{"version":3,"file":"set_password.js","mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;ACAA;AACA,IAAI,KAA4D;AAChE,IAAI,CACuG;AAC3G,CAAC,sBAAsB;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,EAAE;AACrD,mDAAmD,EAAE;AACrD,gDAAgD,EAAE;AAClD,gDAAgD,EAAE;AAClD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gCAAgC,KAAK,IAAI;AACzC;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yCAAyC,yBAAyB,6BAA6B,IAAI,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,gCAAgC,GAAG;;AAE1K;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB;AAChB;AACA,SAAS,eAAe;AACxB,oBAAoB;AACpB;AACA,SAAS,4BAA4B;AACrC,iBAAiB;AACjB;AACA,WAAW;AACX,kBAAkB;AAClB;AACA,SAAS,eAAe;AACxB,mBAAmB;AACnB;AACA,WAAW;AACX,qBAAqB;AACrB;AACA,WAAW;AACX,qBAAqB;AACrB;AACA,WAAW;AACX,eAAe;AACf;AACA,WAAW;AACX,eAAe;AACf;AACA,WAAW;AACX,mBAAmB;AACnB,oEAAoE;AACpE,WAAW;;AAEX;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,kDAAkD;AAClD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,sBAAsB;AACtB;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA,iBAAiB;;AAEjB,0CAA0C;AAC1C,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;;AAEA,4BAA4B,WAAW;AACvC;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,gCAAgC,wBAAwB;AACxD;AACA;AACA,+CAA+C,0CAA0C;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,4BAA4B,qBAAqB;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uFAAuF,GAAG,yBAAyB,GAAG;AACtH;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,kDAAkD;AAClG;AACA;AACA,iBAAiB;AACjB,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B,gBAAgB;AAC5C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,mFAAmF,GAAG,yBAAyB,GAAG;AAClH;AACA;AACA;AACA;AACA;AACA,kBAAkB,kDAAkD;AACpE;;AAEA;;AAEA,CAAC;;;;;;;UC9YD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNA,CAA0B;AACQ;AAClC;AACA;AACA;AACA,qBAAqB,mDAAQ;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA,UAAU;AACV;AACA;AACA,KAAK;AACL,CAAC,E","sources":["webpack://ais/./src/scss/app.scss?8b6f","webpack://ais/./node_modules/pristinejs/dist/pristine.js","webpack://ais/webpack/bootstrap","webpack://ais/webpack/runtime/compat get default export","webpack://ais/webpack/runtime/define property getters","webpack://ais/webpack/runtime/hasOwnProperty shorthand","webpack://ais/webpack/runtime/make namespace object","webpack://ais/./src/set_password.js"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport {};","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Pristine = factory());\n}(this, (function () { 'use strict';\n\n var lang = {\n required: \"This field is required\",\n email: \"This field requires a valid e-mail address\",\n number: \"This field requires a number\",\n integer: \"This field requires an integer value\",\n url: \"This field requires a valid website URL\",\n tel: \"This field requires a valid telephone number\",\n maxlength: \"This fields length must be < ${1}\",\n minlength: \"This fields length must be > ${1}\",\n min: \"Minimum value for this field is ${1}\",\n max: \"Maximum value for this field is ${1}\",\n pattern: \"Please match the requested format\"\n };\n\n function findAncestor(el, cls) {\n while ((el = el.parentElement) && !el.classList.contains(cls)) {}\n return el;\n }\n\n function tmpl(o) {\n var _arguments = arguments;\n\n return this.replace(/\\${([^{}]*)}/g, function (a, b) {\n return _arguments[b];\n });\n }\n\n function groupedElemCount(input) {\n return input.pristine.self.form.querySelectorAll('input[name=\"' + input.getAttribute('name') + '\"]:checked').length;\n }\n\n function mergeConfig(obj1, obj2) {\n for (var attr in obj2) {\n if (!(attr in obj1)) {\n obj1[attr] = obj2[attr];\n }\n }\n return obj1;\n }\n\n function isFunction(obj) {\n return !!(obj && obj.constructor && obj.call && obj.apply);\n }\n\n var defaultConfig = {\n classTo: 'form-group',\n errorClass: 'has-danger',\n successClass: 'has-success',\n errorTextParent: 'form-group',\n errorTextTag: 'div',\n errorTextClass: 'text-help'\n };\n\n var PRISTINE_ERROR = 'pristine-error';\n var SELECTOR = \"input:not([type^=hidden]):not([type^=submit]), select, textarea\";\n var ALLOWED_ATTRIBUTES = [\"required\", \"min\", \"max\", 'minlength', 'maxlength', 'pattern'];\n var EMAIL_REGEX = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n\n var validators = {};\n\n var _ = function _(name, validator) {\n validator.name = name;\n if (!validator.msg) validator.msg = lang[name];\n if (validator.priority === undefined) validator.priority = 1;\n validators[name] = validator;\n };\n\n _('text', { fn: function fn(val) {\n return true;\n }, priority: 0 });\n _('required', { fn: function fn(val) {\n return this.type === 'radio' || this.type === 'checkbox' ? groupedElemCount(this) : val !== undefined && val !== '';\n }, priority: 99, halt: true });\n _('email', { fn: function fn(val) {\n return !val || EMAIL_REGEX.test(val);\n } });\n _('number', { fn: function fn(val) {\n return !val || !isNaN(parseFloat(val));\n }, priority: 2 });\n _('integer', { fn: function fn(val) {\n return !val || /^\\d+$/.test(val);\n } });\n _('minlength', { fn: function fn(val, length) {\n return !val || val.length >= parseInt(length);\n } });\n _('maxlength', { fn: function fn(val, length) {\n return !val || val.length <= parseInt(length);\n } });\n _('min', { fn: function fn(val, limit) {\n return !val || (this.type === 'checkbox' ? groupedElemCount(this) >= parseInt(limit) : parseFloat(val) >= parseFloat(limit));\n } });\n _('max', { fn: function fn(val, limit) {\n return !val || (this.type === 'checkbox' ? groupedElemCount(this) <= parseInt(limit) : parseFloat(val) <= parseFloat(limit));\n } });\n _('pattern', { fn: function fn(val, pattern) {\n var m = pattern.match(new RegExp('^/(.*?)/([gimy]*)$'));return !val || new RegExp(m[1], m[2]).test(val);\n } });\n\n function Pristine(form, config, live) {\n\n var self = this;\n\n init(form, config, live);\n\n function init(form, config, live) {\n\n form.setAttribute(\"novalidate\", \"true\");\n\n self.form = form;\n self.config = mergeConfig(config || {}, defaultConfig);\n self.live = !(live === false);\n self.fields = Array.from(form.querySelectorAll(SELECTOR)).map(function (input) {\n\n var fns = [];\n var params = {};\n var messages = {};\n\n [].forEach.call(input.attributes, function (attr) {\n if (/^data-pristine-/.test(attr.name)) {\n var name = attr.name.substr(14);\n if (name.endsWith('-message')) {\n messages[name.slice(0, name.length - 8)] = attr.value;\n return;\n }\n if (name === 'type') name = attr.value;\n _addValidatorToField(fns, params, name, attr.value);\n } else if (~ALLOWED_ATTRIBUTES.indexOf(attr.name)) {\n _addValidatorToField(fns, params, attr.name, attr.value);\n } else if (attr.name === 'type') {\n _addValidatorToField(fns, params, attr.value);\n }\n });\n\n fns.sort(function (a, b) {\n return b.priority - a.priority;\n });\n\n self.live && input.addEventListener(!~['radio', 'checkbox'].indexOf(input.getAttribute('type')) ? 'input' : 'change', function (e) {\n self.validate(e.target);\n }.bind(self));\n\n return input.pristine = { input: input, validators: fns, params: params, messages: messages, self: self };\n }.bind(self));\n }\n\n function _addValidatorToField(fns, params, name, value) {\n var validator = validators[name];\n if (validator) {\n fns.push(validator);\n if (value) {\n var valueParams = value.split(',');\n valueParams.unshift(null); // placeholder for input's value\n params[name] = valueParams;\n }\n }\n }\n\n /***\n * Checks whether the form/input elements are valid\n * @param input => input element(s) or a jquery selector, null for full form validation\n * @param silent => do not show error messages, just return true/false\n * @returns {boolean} return true when valid false otherwise\n */\n self.validate = function (input, silent) {\n silent = input && silent === true || input === true;\n var fields = self.fields;\n if (input !== true && input !== false) {\n if (input instanceof HTMLElement) {\n fields = [input.pristine];\n } else if (input instanceof NodeList || input instanceof (window.$ || Array) || input instanceof Array) {\n fields = Array.from(input).map(function (el) {\n return el.pristine;\n });\n }\n }\n\n var valid = true;\n\n for (var i = 0; fields[i]; i++) {\n var field = fields[i];\n if (_validateField(field)) {\n !silent && _showSuccess(field);\n } else {\n valid = false;\n !silent && _showError(field);\n }\n }\n return valid;\n };\n\n /***\n * Get errors of a specific field or the whole form\n * @param input\n * @returns {Array|*}\n */\n self.getErrors = function (input) {\n if (!input) {\n var erroneousFields = [];\n for (var i = 0; i < self.fields.length; i++) {\n var field = self.fields[i];\n if (field.errors.length) {\n erroneousFields.push({ input: field.input, errors: field.errors });\n }\n }\n return erroneousFields;\n }\n if (input.tagName && input.tagName.toLowerCase() === \"select\") {\n return input.pristine.errors;\n }\n return input.length ? input[0].pristine.errors : input.pristine.errors;\n };\n\n /***\n * Validates a single field, all validator functions are called and error messages are generated\n * when a validator fails\n * @param field\n * @returns {boolean}\n * @private\n */\n function _validateField(field) {\n var errors = [];\n var valid = true;\n for (var i = 0; field.validators[i]; i++) {\n var validator = field.validators[i];\n var params = field.params[validator.name] ? field.params[validator.name] : [];\n params[0] = field.input.value;\n if (!validator.fn.apply(field.input, params)) {\n valid = false;\n\n if (isFunction(validator.msg)) {\n errors.push(validator.msg(field.input.value, params));\n } else {\n var error = field.messages[validator.name] || validator.msg;\n errors.push(tmpl.apply(error, params));\n }\n\n if (validator.halt === true) {\n break;\n }\n }\n }\n field.errors = errors;\n return valid;\n }\n\n /***\n *\n * @param elem => The dom element where the validator is applied to\n * @param fn => validator function\n * @param msg => message to show when validation fails. Supports templating. ${0} for the input's value, ${1} and\n * so on are for the attribute values\n * @param priority => priority of the validator function, higher valued function gets called first.\n * @param halt => whether validation should stop for this field after current validation function\n */\n self.addValidator = function (elem, fn, msg, priority, halt) {\n if (elem instanceof HTMLElement) {\n elem.pristine.validators.push({ fn: fn, msg: msg, priority: priority, halt: halt });\n elem.pristine.validators.sort(function (a, b) {\n return b.priority - a.priority;\n });\n } else {\n console.warn(\"The parameter elem must be a dom element\");\n }\n };\n\n /***\n * An utility function that returns a 2-element array, first one is the element where error/success class is\n * applied. 2nd one is the element where error message is displayed. 2nd element is created if doesn't exist and cached.\n * @param field\n * @returns {*}\n * @private\n */\n function _getErrorElements(field) {\n if (field.errorElements) {\n return field.errorElements;\n }\n var errorClassElement = findAncestor(field.input, self.config.classTo);\n var errorTextParent = null,\n errorTextElement = null;\n if (self.config.classTo === self.config.errorTextParent) {\n errorTextParent = errorClassElement;\n } else {\n errorTextParent = errorClassElement.querySelector('.' + self.config.errorTextParent);\n }\n if (errorTextParent) {\n errorTextElement = errorTextParent.querySelector('.' + PRISTINE_ERROR);\n if (!errorTextElement) {\n errorTextElement = document.createElement(self.config.errorTextTag);\n errorTextElement.className = PRISTINE_ERROR + ' ' + self.config.errorTextClass;\n errorTextParent.appendChild(errorTextElement);\n errorTextElement.pristineDisplay = errorTextElement.style.display;\n }\n }\n return field.errorElements = [errorClassElement, errorTextElement];\n }\n\n function _showError(field) {\n var errorElements = _getErrorElements(field);\n var errorClassElement = errorElements[0],\n errorTextElement = errorElements[1];\n\n if (errorClassElement) {\n errorClassElement.classList.remove(self.config.successClass);\n errorClassElement.classList.add(self.config.errorClass);\n }\n if (errorTextElement) {\n errorTextElement.innerHTML = field.errors.join('
');\n errorTextElement.style.display = errorTextElement.pristineDisplay || '';\n }\n }\n\n /***\n * Adds error to a specific field\n * @param input\n * @param error\n */\n self.addError = function (input, error) {\n input = input.length ? input[0] : input;\n input.pristine.errors.push(error);\n _showError(input.pristine);\n };\n\n function _removeError(field) {\n var errorElements = _getErrorElements(field);\n var errorClassElement = errorElements[0],\n errorTextElement = errorElements[1];\n if (errorClassElement) {\n // IE > 9 doesn't support multiple class removal\n errorClassElement.classList.remove(self.config.errorClass);\n errorClassElement.classList.remove(self.config.successClass);\n }\n if (errorTextElement) {\n errorTextElement.innerHTML = '';\n errorTextElement.style.display = 'none';\n }\n return errorElements;\n }\n\n function _showSuccess(field) {\n var errorClassElement = _removeError(field)[0];\n errorClassElement && errorClassElement.classList.add(self.config.successClass);\n }\n\n /***\n * Resets the errors\n */\n self.reset = function () {\n for (var i = 0; self.fields[i]; i++) {\n self.fields[i].errorElements = null;\n }\n Array.from(self.form.querySelectorAll('.' + PRISTINE_ERROR)).map(function (elem) {\n elem.parentNode.removeChild(elem);\n });\n Array.from(self.form.querySelectorAll('.' + self.config.classTo)).map(function (elem) {\n elem.classList.remove(self.config.successClass);\n elem.classList.remove(self.config.errorClass);\n });\n };\n\n /***\n * Resets the errors and deletes all pristine fields\n */\n self.destroy = function () {\n self.reset();\n self.fields.forEach(function (field) {\n delete field.input.pristine;\n });\n self.fields = [];\n };\n\n self.setGlobalConfig = function (config) {\n defaultConfig = config;\n };\n\n return self;\n }\n\n /***\n *\n * @param name => Name of the global validator\n * @param fn => validator function\n * @param msg => message to show when validation fails. Supports templating. ${0} for the input's value, ${1} and\n * so on are for the attribute values\n * @param priority => priority of the validator function, higher valued function gets called first.\n * @param halt => whether validation should stop for this field after current validation function\n */\n Pristine.addValidator = function (name, fn, msg, priority, halt) {\n _(name, { fn: fn, msg: msg, priority: priority, halt: halt });\n };\n\n return Pristine;\n\n})));\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import './scss/app.scss';\r\nimport Pristine from 'pristinejs';\r\n\r\nconst form = document.getElementById('set_password_form');\r\nconst formBtn = form.querySelector('button[type=\"submit\"]');\r\nconst pristine = new Pristine(form);\r\n\r\nconst pw = document.getElementById('pw');\r\nconst confirm = document.getElementById('pw_repeat');\r\n\r\nif (pw)\r\n{\r\n pw.value = \"\";\r\n}\r\n\r\nconfirm?.addEventListener('change', function (e) {\r\n pw.dispatchEvent(new Event('change'));\r\n});\r\n\r\nconst pwDontMathMsg = document.getElementById('passwords_dont_match');\r\n\r\npristine.addValidator(pw, function (val) {\r\n\r\n if (val === confirm.value) {\r\n pwDontMathMsg.textContent = '';\r\n return true;\r\n }\r\n pwDontMathMsg.textContent = 'Пароли не совпадают';\r\n return false;\r\n}, \"\", 1, true);\r\n\r\n\r\n['change', 'input'].map(event => {\r\n form.addEventListener(event, e => {\r\n const isFormValid = pristine.validate({}, true);\r\n if (isFormValid) {\r\n formBtn.removeAttribute('disabled');\r\n } else {\r\n formBtn.setAttribute('disabled', true);\r\n }\r\n });\r\n});"],"names":[],"sourceRoot":""}