{"version":3,"sources":["webpack:///scripts/plugin--input-qty--3859fad43c062bbaf09f.js","webpack:///./client/src/core/components/forms/input-qty/input-qty.js"],"names":["webpackJsonpHairCare","D:\\a\\1\\s\\node_modules\\babel-loader\\lib\\index.js??ref--12-0!D:\\a\\1\\s\\node_modules\\eslint-loader\\index.js??ref--12-1!D:\\a\\1\\s\\client\\src\\core\\components\\forms\\input-qty\\input-qty.js","module","exports","__webpack_require__","_classCallCheck","instance","Constructor","TypeError","getJSONValue","stringValue","JSON","parse","error","Object","defineProperty","value","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","key","protoProps","staticProps","prototype","_debug2","obj","__esModule","default","_debug","log","InputQty","element","options","this","watch","addEventListener","triggerIncrement","increment","bind","triggerDecrement","decrement","max","defaultValue","triggerInput","min","dispatchEvent","InputEvent","DEFAULTS"],"mappings":"AAAAA,sBAAsB,sBAEhBC,6MACA,SAAUC,EAAQC,EAASC,GAEjC,YAeA,SAASC,GAAgBC,EAAUC,GAAe,KAAMD,YAAoBC,IAAgB,KAAM,IAAIC,WAAU,qCChBhH,QAASC,GAAaC,GACrB,IACC,MAAOC,MAAKC,MAAMF,GACjB,MAAOG,GACR,MAAOH,IDATI,OAAOC,eAAeZ,EAAS,cAC9Ba,OAAO,GAGR,IAAIC,GAAe,WAAc,QAASC,GAAiBC,EAAQC,GAAS,IAAK,GAAIC,GAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,GAAIE,GAAaH,EAAMC,EAAIE,GAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,SAAWF,KAAYA,EAAWG,UAAW,GAAMZ,OAAOC,eAAeI,EAAQI,EAAWI,IAAKJ,IAAiB,MAAO,UAAUhB,EAAaqB,EAAYC,GAAiJ,MAA9HD,IAAYV,EAAiBX,EAAYuB,UAAWF,GAAiBC,GAAaX,EAAiBX,EAAasB,GAAqBtB,MCXhiB,yLDeIwB,EAEJ,SAAgCC,GAAO,MAAOA,IA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,WClBPwB,KAAKF,QAAQc,cAAc,GAAIC,YAAW,cDuBpChB,ICnBRA,GAASiB,UACRX,iBAAkB,YAClBG,iBAAkB,aD0BnB3C,EAAQ+B,QCtBOG","file":"scripts/plugin--input-qty--3859fad43c062bbaf09f.js","sourcesContent":["webpackJsonpHairCare([\"plugin--input-qty\"],{\n\n/***/ \"D:\\\\a\\\\1\\\\s\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js??ref--12-0!D:\\\\a\\\\1\\\\s\\\\node_modules\\\\eslint-loader\\\\index.js??ref--12-1!D:\\\\a\\\\1\\\\s\\\\client\\\\src\\\\core\\\\components\\\\forms\\\\input-qty\\\\input-qty.js\":\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _debug = __webpack_require__(\"D:\\\\a\\\\1\\\\s\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js??ref--12-0!D:\\\\a\\\\1\\\\s\\\\node_modules\\\\eslint-loader\\\\index.js??ref--12-1!D:\\\\a\\\\1\\\\s\\\\node_modules\\\\debug\\\\src\\\\browser.js\");\n\nvar _debug2 = _interopRequireDefault(_debug);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar log = (0, _debug2.default)(\"input-qty\");\n\nfunction getJSONValue(stringValue) {\n\ttry {\n\t\treturn JSON.parse(stringValue);\n\t} catch (error) {\n\t\treturn stringValue;\n\t}\n}\n\nvar InputQty = function () {\n\tfunction InputQty(element, options) {\n\t\t_classCallCheck(this, InputQty);\n\n\t\tthis.element = element;\n\t\tthis.options = options;\n\n\t\tlog(this);\n\t\tthis.watch();\n\t}\n\n\t_createClass(InputQty, [{\n\t\tkey: \"watch\",\n\t\tvalue: function watch() {\n\t\t\tthis.element.addEventListener(this.options.triggerIncrement, this.increment.bind(this));\n\t\t\tthis.element.addEventListener(this.options.triggerDecrement, this.decrement.bind(this));\n\t\t}\n\t}, {\n\t\tkey: \"increment\",\n\t\tvalue: function increment() {\n\t\t\tlog('increment');\n\t\t\tvar value = getJSONValue(this.element.value);\n\t\t\tvar max = getJSONValue(this.element.max);\n\n\t\t\t// Invalid value - reapply the default\n\t\t\tif (typeof value === 'string') {\n\t\t\t\tthis.element.value = this.element.defaultValue;\n\t\t\t\tthis.triggerInput();\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (typeof max === 'number') {\n\n\t\t\t\tif (value > max) {\n\t\t\t\t\tthis.element.value = max;\n\t\t\t\t\tthis.triggerInput();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Dont exceed the max value\n\t\t\t\tif (value === max) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.element.value = value + 1;\n\t\t\tthis.triggerInput();\n\t\t}\n\t}, {\n\t\tkey: \"decrement\",\n\t\tvalue: function decrement() {\n\t\t\tlog('decrement');\n\t\t\tvar value = getJSONValue(this.element.value);\n\t\t\tvar min = getJSONValue(this.element.min);\n\n\t\t\tif (typeof value === 'string') {\n\t\t\t\tthis.element.value = this.element.defaultValue;\n\t\t\t\tthis.triggerInput();\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (typeof min === 'number') {\n\t\t\t\tif (value < min) {\n\t\t\t\t\tthis.element.value = min;\n\t\t\t\t\tthis.triggerInput();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Dont go below the min value\n\t\t\t\tif (value === min) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.element.value = value - 1;\n\t\t\tthis.triggerInput();\n\t\t}\n\t}, {\n\t\tkey: \"triggerInput\",\n\t\tvalue: function triggerInput() {\n\t\t\tthis.element.dispatchEvent(new InputEvent('input'));\n\t\t}\n\t}]);\n\n\treturn InputQty;\n}();\n\nInputQty.DEFAULTS = {\n\ttriggerIncrement: 'increment',\n\ttriggerDecrement: 'decrement'\n\n};\n\nexports.default = InputQty;\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// scripts/plugin--input-qty--3859fad43c062bbaf09f.js","\r\nimport debug from \"debug\";\r\nconst log = debug(\"input-qty\");\r\n\r\nfunction getJSONValue(stringValue) {\r\n\ttry {\r\n\t\treturn JSON.parse(stringValue);\r\n\t} catch (error) {\r\n\t\treturn stringValue;\r\n\t}\r\n}\r\n\r\nclass InputQty {\r\n\tconstructor(element, options) {\r\n\t\tthis.element = element;\r\n\t\tthis.options = options;\r\n\r\n\r\n\t\tlog(this);\r\n\t\tthis.watch();\r\n\t}\r\n\r\n\twatch() {\r\n\t\tthis.element.addEventListener(\r\n\t\t\tthis.options.triggerIncrement,\r\n\t\t\tthis.increment.bind(this)\r\n\t\t);\r\n\t\tthis.element.addEventListener(\r\n\t\t\tthis.options.triggerDecrement,\r\n\t\t\tthis.decrement.bind(this)\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tincrement() {\r\n\t\tlog('increment');\r\n\t\tconst value = getJSONValue(this.element.value);\r\n\t\tconst max = getJSONValue(this.element.max);\r\n\r\n\t\t// Invalid value - reapply the default\r\n\t\tif (typeof value === 'string') {\r\n\t\t\tthis.element.value = this.element.defaultValue;\r\n\t\t\tthis.triggerInput();\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif (typeof max === 'number') {\r\n\r\n\t\t\tif (value > max) {\r\n\t\t\t\tthis.element.value = max;\r\n\t\t\t\tthis.triggerInput();\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\t// Dont exceed the max value\r\n\t\t\tif (value === max) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.element.value = value + 1;\r\n\t\tthis.triggerInput();\r\n\t}\r\n\r\n\tdecrement() {\r\n\t\tlog('decrement');\r\n\t\tconst value = getJSONValue(this.element.value);\r\n\t\tconst min = getJSONValue(this.element.min);\r\n\r\n\t\tif (typeof value === 'string') {\r\n\t\t\tthis.element.value = this.element.defaultValue;\r\n\t\t\tthis.triggerInput();\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif (typeof min === 'number') {\r\n\t\t\tif (value < min) {\r\n\t\t\t\tthis.element.value = min;\r\n\t\t\t\tthis.triggerInput();\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\t// Dont go below the min value\r\n\t\t\tif (value === min) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.element.value = value - 1;\r\n\t\tthis.triggerInput();\r\n\t}\r\n\r\n\ttriggerInput() {\r\n\t\tthis.element.dispatchEvent(new InputEvent('input'));\r\n\t}\r\n}\r\n\r\nInputQty.DEFAULTS = {\r\n\ttriggerIncrement: 'increment',\r\n\ttriggerDecrement: 'decrement',\r\n\r\n};\r\n\r\nexport default InputQty;\r\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/core/components/forms/input-qty/input-qty.js"],"sourceRoot":""}