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,SAASC,EAAeC,EAAK,CAC5B,IAAIC,EAAKC,EAAsBF,CAAG,EAClC,OAAOG,EAAoBF,CAAE,CAC9B,CACA,SAASC,EAAsBF,EAAK,CACnC,GAAG,CAACG,EAAoB,EAAEL,EAAKE,CAAG,EAAG,CACpC,IAAI,EAAI,IAAI,MAAM,uBAAyBA,EAAM,GAAG,EACpD,QAAE,KAAO,mBACH,CACP,CACA,OAAOF,EAAIE,CAAG,CACf,CACAD,EAAe,KAAO,UAA8B,CACnD,OAAO,OAAO,KAAKD,CAAG,CACvB,EACAC,EAAe,QAAUG,EACzBE,EAAO,QAAUL,EACjBA,EAAe,GAAK,K,mPCtBhBM,EAA2B,CAAC,EAGhC,SAASF,EAAoBG,EAAU,CAEtC,IAAIC,EAAeF,EAAyBC,CAAQ,EACpD,GAAIC,IAAiB,OACpB,OAAOA,EAAa,QAGrB,IAAIH,EAASC,EAAyBC,CAAQ,EAAI,CAGjD,QAAS,CAAC,CACX,EAGA,OAAAE,EAAoBF,CAAQ,EAAEF,EAAQA,EAAO,QAASD,CAAmB,EAGlEC,EAAO,OACf,E,WCtBAD,EAAoB,EAAI,SAASM,EAAKC,EAAM,CAAE,OAAO,OAAO,UAAU,eAAe,KAAKD,EAAKC,CAAI,CAAG,C,gBCAtGP,EAAoB,EAAI,iB,2ECIxB,Q","sources":["webpack://decidim-populate-lot2/./vendor/bundle/ruby/3.3.0/bundler/gems/decidim-ad397c2e05db/decidim-initiatives/app/packs/src/decidim/initiatives/check_code.js","webpack://decidim-populate-lot2/./vendor/bundle/ruby/3.3.0/bundler/gems/decidim-ad397c2e05db/decidim-initiatives/app/packs/src/decidim/initiatives/initiative_creation_wizard.js","webpack://decidim-populate-lot2/./vendor/bundle/ruby/3.3.0/bundler/gems/decidim-ad397c2e05db/decidim-initiatives/app/packs/src/decidim/initiatives/scoped_type.js","webpack://decidim-populate-lot2/./vendor/bundle/ruby/3.3.0/bundler/gems/decidim-ad397c2e05db/decidim-initiatives/app/packs/images/ sync ^\\.\\/.*$","webpack://decidim-populate-lot2/webpack/bootstrap","webpack://decidim-populate-lot2/webpack/runtime/hasOwnProperty shorthand","webpack://decidim-populate-lot2/webpack/runtime/publicPath","webpack://decidim-populate-lot2/./vendor/bundle/ruby/3.3.0/bundler/gems/decidim-ad397c2e05db/decidim-initiatives/app/packs/entrypoints/decidim_initiatives.js"],"sourcesContent":["\"use strict\";\nconst focusDigit = (digit) => {\n const length = digit.value.length;\n digit.focus();\n setTimeout(() => digit.setSelectionRange(length, length), 0);\n};\nconst validateCode = (path, code) => {\n var _a;\n return fetch(path, {\n method: \"PUT\",\n cache: \"no-cache\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-CSRF-Token\": (_a = document.querySelector(\"meta[name=csrf-token]\")) == null ? void 0 : _a.content\n },\n body: JSON.stringify({ confirmation: { \"verification_code\": code } })\n }).then((response) => response.json()).then((json) => {\n return json.sms_code === \"OK\";\n });\n};\nconst updateSubmit = (enable, includeAnnouncement) => {\n const correctAnnouncement = document.querySelector(\".code-correct-announcement\");\n const incorrectAnnouncement = document.querySelector(\".code-incorrect-announcement\");\n const submitButton = document.querySelector(\"[data-submit-verification-code]\");\n const resendCodeMessage = document.querySelector(\"[data-resend-code]\");\n if (enable) {\n if (includeAnnouncement) {\n correctAnnouncement.classList.remove(\"hidden\");\n resendCodeMessage.classList.add(\"hidden\");\n } else {\n correctAnnouncement.classList.add(\"hidden\");\n resendCodeMessage.classList.remove(\"hidden\");\n }\n incorrectAnnouncement.classList.add(\"hidden\");\n submitButton.classList.remove(\"hidden\");\n submitButton.disabled = false;\n } else {\n if (includeAnnouncement) {\n incorrectAnnouncement.classList.remove(\"hidden\");\n resendCodeMessage.classList.add(\"hidden\");\n } else {\n incorrectAnnouncement.classList.add(\"hidden\");\n resendCodeMessage.classList.remove(\"hidden\");\n }\n correctAnnouncement.classList.add(\"hidden\");\n submitButton.classList.add(\"hidden\");\n submitButton.disabled = true;\n }\n};\nconst updateValue = (codeInput, event, digitsInputs) => {\n const checkCodePath = codeInput.dataset.checkCodePath;\n const index = Number(event.target.dataset.verificationCode);\n const prevDigit = digitsInputs[index - 1];\n const nextDigit = digitsInputs[index + 1];\n let digits = codeInput.value.split(\"\");\n const newDigit = event.target.value || \"-\";\n if (newDigit.length > 0) {\n const position = event.target.dataset.verificationCode;\n digits[position] = newDigit;\n const newCode = digits.join(\"\");\n if (codeInput.value !== newCode) {\n codeInput.value = newCode;\n if (/^\\d{6}$/.test(newCode)) {\n validateCode(checkCodePath, newCode).then((validCode) => updateSubmit(validCode, true));\n } else {\n updateSubmit(false, false);\n }\n }\n if (prevDigit && newDigit === \"-\") {\n focusDigit(prevDigit);\n } else if (nextDigit && newDigit !== \"-\") {\n focusDigit(nextDigit);\n }\n }\n};\nconst updatePosition = (codeInput, event, digitsInputs) => {\n const index = Number(event.target.dataset.verificationCode);\n const nextDigit = (() => {\n if (event.key === \"ArrowLeft\" || [\"Delete\", \"Backspace\"].includes(event.key) && event.target.value === \"\") {\n return digitsInputs[index - 1];\n } else if (event.key === \"ArrowRight\" || /^\\d$/.test(event.key) && event.target.value.length > 0) {\n return digitsInputs[index + 1];\n }\n return false;\n })();\n if (nextDigit) {\n focusDigit(nextDigit);\n }\n return true;\n};\nconst initializeCodeVerificator = (codeElement) => {\n const codeInput = codeElement.querySelector(\"[data-check-code-path]\");\n const digitsInputs = codeElement.querySelectorAll(\"[data-verification-code]\");\n digitsInputs.forEach((digitInput) => {\n digitInput.addEventListener(\"input\", (event) => updateValue(codeInput, event, digitsInputs));\n digitInput.addEventListener(\"keydown\", (event) => updatePosition(codeInput, event, digitsInputs));\n });\n codeInput.value = \"------\";\n};\n$(() => {\n const codeElement = document.querySelector(\"[data-check-code]\");\n if (codeElement) {\n initializeCodeVerificator(codeElement);\n }\n});\n","\"use strict\";\n$(() => {\n const selectInitiativeType = document.getElementById(\"select-initiative-type\");\n if (selectInitiativeType) {\n const submitButton = selectInitiativeType.querySelector('button[type=\"submit\"]');\n const radioButtons = selectInitiativeType.querySelectorAll('input[type=\"radio\"][name=\"initiative[type_id]\"]');\n submitButton.disabled = true;\n for (const radioButton of radioButtons) {\n radioButton.addEventListener(\"click\", () => {\n submitButton.disabled = false;\n });\n }\n }\n});\n","\"use strict\";\nconst controlSelector = function(source, prefix, currentValueKey) {\n if (source.length) {\n let currentValue = source.data(currentValueKey), searchUrl = source.data(`${prefix}-search-url`), targetElement = $(`#${source.data(`${prefix}-selector`)}`);\n if (targetElement.length) {\n let refresh = function() {\n $.ajax({\n url: searchUrl,\n cache: false,\n dataType: \"html\",\n data: {\n type_id: source.val(),\n selected: currentValue\n },\n success: function(data) {\n targetElement.html(data);\n }\n });\n };\n source.change(refresh);\n refresh();\n }\n }\n};\n$(() => {\n let typeSelector = $(\"[data-scope-selector]\");\n controlSelector(typeSelector, \"scope\", \"scope-id\");\n controlSelector(typeSelector, \"signature-types\", \"signature-type\");\n});\n","var map = {\n\t\"./decidim/gamification/badges/decidim_gamification_badges_initiatives.svg\": 39060,\n\t\"./decidim/initiatives/decidim_initiatives.svg\": 61296\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 86471;","// 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](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","__webpack_require__.p = \"/decidim-packs/\";","\"use strict\";\nimport \"src/decidim/initiatives/application\";\nimport \"src/decidim/initiatives/scoped_type\";\nimport \"src/decidim/initiatives/initiative_creation_wizard\";\nrequire.context(\"../images\", true);\nimport \"stylesheets/initiatives.scss\";\n"],"names":["focusDigit","digit","length","validateCode","path","code","_a","response","json","updateSubmit","enable","includeAnnouncement","correctAnnouncement","incorrectAnnouncement","submitButton","resendCodeMessage","updateValue","codeInput","event","digitsInputs","checkCodePath","index","prevDigit","nextDigit","digits","newDigit","position","newCode","validCode","updatePosition","initializeCodeVerificator","codeElement","digitInput","selectInitiativeType","radioButtons","radioButton","controlSelector","source","prefix","currentValueKey","currentValue","searchUrl","targetElement","refresh","data","typeSelector","map","webpackContext","req","id","webpackContextResolve","__webpack_require__","module","__webpack_module_cache__","moduleId","cachedModule","__webpack_modules__","obj","prop"],"sourceRoot":""}