{"version":3,"sources":["assets/js/shop.js"],"names":["$","window","document","String","prototype","getDecimals","undefined","match","this","Math","num","length","body","on","$qty","closest","find","currentVal","parseFloat","val","max","attr","min","step","is","toFixed","jQuery"],"mappings":"cAGC,SAAWA,EAAGC,EAAQC,GAGdC,OAAOC,UAAUC,cAHxBF,OAAaF,UAAQC,YAAUI,WAC7B,IAKYC,GAAS,GALrBC,MAK+BD,MAAM,oCAHhCJ,OAAOC,EAGSK,KAAKC,IAAN,GAAWH,EAAM,GAAAA,EAAA,GAAAI,OAAA,IAAAJ,EAD7B,IAAAA,EAAA,GAAA,IADaF,IAITL,EAAAE,EAAOU,MAAPC,GAAA,QAAA,sCAAA,WACH,IAAAC,EAAAd,EAAAQ,MAAAO,QAAA,aAAAC,KAAA,QAMDC,EAAaC,WAAWJ,EAAKK,OAL7BC,EAAYA,WAAQb,EAAAc,KAAWd,QANnCe,EAAAJ,WAAAJ,EAAAO,KAAA,QAQHE,EAAAT,EAAAO,KAAA,QAEWJ,GAAG,KAAQF,GAAnB,QAAWE,IAAXA,EAAA,GACc,KAAVA,GAAwBH,QAAXI,IAAWE,EAD5B,IAEUF,KAAHI,GAAc,QAAAR,IAADQ,EAFpB,GAGUJ,QAAHK,GAAwB,KAALF,QAjBjC,IAcOE,GAAA,QAAAL,WAAAK,KAAAA,EAAA,GAOKN,EAAAA,MAADO,GAAeP,oBACPG,GAAqBA,GAAfA,EACNN,EAARK,IAAiBC,GAQbN,EAAKK,KAAKF,EAAaC,WAAWK,IAAOE,QAAQF,EAAKlB,gBAFtDiB,GAAAL,GAAAK,EACGR,EAAAK,IAAAG,GACoBJ,EAAbD,GACbH,EAAAK,KAAAF,EAAAC,WAAAK,IAAAE,QAAAF,EAAAlB,gBAKGS,EAAKK,QAAKF,YArCzB,CA8CES,OAAQzB,OAAQC","file":"shop.min.js","sourcesContent":["/**\n * Shop\n */\n;(function ($, window, document, undefined) {\n 'use strict';\n\n if (!String.prototype.getDecimals) {\n String.prototype.getDecimals = function () {\n var num = this,\n match = ('' + num).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n if (!match) {\n return 0;\n }\n return Math.max(0, (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0));\n }\n }\n $(document.body).on('click', '.qty_button.plus, .qty_button.minus', function () {\n var $qty = $(this).closest('.quantity').find('.qty'),\n currentVal = parseFloat($qty.val()),\n max = parseFloat($qty.attr('max')),\n min = parseFloat($qty.attr('min')),\n step = $qty.attr('step');\n\n // Format values\n if (!currentVal || currentVal === '' || currentVal === 'NaN') currentVal = 0;\n if (max === '' || max === 'NaN') max = '';\n if (min === '' || min === 'NaN') min = 0;\n if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') step = 1;\n\n // Change the value\n if ($(this).is('.qty_button.plus')) {\n if (max && (currentVal >= max)) {\n $qty.val(max);\n } else {\n $qty.val((currentVal + parseFloat(step)).toFixed(step.getDecimals()));\n }\n } else {\n if (min && (currentVal <= min)) {\n $qty.val(min);\n } else if (currentVal > 0) {\n $qty.val((currentVal - parseFloat(step)).toFixed(step.getDecimals()));\n }\n }\n\n // Trigger change event\n $qty.trigger('change');\n });\n\n\n})(jQuery, window, document);\n"]}