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AOC,OACf,CCrBAT,EAAoBc,EAAI,SAASN,GAChC,IAAIO,EAASP,GAAUA,EAAOQ,WAC7B,WAAa,OAAOR,EAAgB,OAAG,EACvC,WAAa,OAAOA,CAAQ,EAE7B,OADAR,EAAoBiB,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CACR,ECNAf,EAAoBiB,EAAI,SAASR,EAASU,GACzC,IAAI,IAAIC,KAAOD,EACXnB,EAAoBC,EAAEkB,EAAYC,KAASpB,EAAoBC,EAAEQ,EAASW,IAC5Ed,OAAOe,eAAeZ,EAASW,EAAK,CAAEE,YAAY,EAAMC,IAAKJ,EAAWC,IAG3E,ECPApB,EAAoBC,EAAI,SAASuB,EAAKC,GAAQ,OAAOnB,OAAOoB,UAAUC,eAAeC,KAAKJ,EAAKC,EAAO,ECAtGzB,EAAoB6B,EAAI,kB,mDCKxBC,EAAAA,M","sources":["webpack://app/../usr/local/bundle/bundler/gems/decidim-budget_category_voting-e059d392d646/app/packs/src/decidim/budgets/projects.js","webpack://app/../usr/local/bundle/gems/decidim-budgets-0.27.4/app/packs/src/decidim/budgets/exit_handler.js","webpack://app/../usr/local/bundle/gems/decidim-budgets-0.27.4/app/packs/src/decidim/budgets/progressFixed.js","webpack://app/../usr/local/bundle/gems/decidim-budgets-0.27.4/app/packs/images/ sync ^\\.\\/.*$","webpack://app/webpack/bootstrap","webpack://app/webpack/runtime/compat get default export","webpack://app/webpack/runtime/define property getters","webpack://app/webpack/runtime/hasOwnProperty shorthand","webpack://app/webpack/runtime/publicPath","webpack://app/../usr/local/bundle/gems/decidim-budgets-0.27.4/app/packs/entrypoints/decidim_budgets.js"],"sourcesContent":["$(() => {\n const $projects = $(\"#projects, #project\");\n const $budgetSummaryTotal = $(\".budget-summary__total\");\n const $budgetExceedModal = $(\"#budget-excess\");\n const $budgetSummary = $(\".budget-summary__progressbox\");\n const $voteButton = $(\".budget-vote-button\");\n const totalAllocation = parseInt($budgetSummaryTotal.attr(\"data-total-allocation\"), 10);\n\n const cancelEvent = (event) => {\n $(event.currentTarget).removeClass(\"loading-spinner\");\n event.stopPropagation();\n event.preventDefault();\n };\n\n $voteButton.on(\"click\", \"span\", () => {\n $(\".budget-list__action\").click();\n });\n\n $projects.on(\"click\", \".budget-list__action\", (event) => {\n const currentAllocation = parseInt($budgetSummary.attr(\"data-current-allocation\"), 10);\n const $currentTarget = $(event.currentTarget);\n const projectAllocation = parseInt($currentTarget.attr(\"data-allocation\"), 10);\n\n if (!$currentTarget.attr(\"data-open\")) {\n $currentTarget.addClass(\"loading-spinner\");\n }\n\n $targetCategory = null;\n const $targetCategoryId = $currentTarget.parents(\".budget-list__data\").first().data(\"categoryId\");\n if ($targetCategoryId !== undefined) {\n $targetCategory = $(`.vote_by_category[data-category-id=${$targetCategoryId}]`).first();\n }\n\n let quotaExceeded = ((currentAllocation + projectAllocation) > totalAllocation);\n let categoryQuotaExceeded = false;\n\n if ($targetCategory && $targetCategory.length > 0) {\n const currentCategoryAllocation = parseInt($targetCategory.attr(\"data-current-allocation\"), 10);\n const totalCategoryAllocation = parseInt($targetCategory.attr(\"data-allocation\"), 10);\n categoryQuotaExceeded = ((currentCategoryAllocation + projectAllocation) > totalCategoryAllocation || quotaExceeded);\n }\n\n if ($currentTarget.attr(\"disabled\")) {\n console.log(\"Disabled\");\n cancelEvent(event);\n } else if (($currentTarget.attr(\"data-add\") === \"true\") && categoryQuotaExceeded === true) {\n console.log(\"categoryQuotaExceeded\");\n $(`#budget-excess-${$targetCategoryId}`).foundation(\"toggle\");\n cancelEvent(event);\n } else if (($currentTarget.attr(\"data-add\") === \"true\") && quotaExceeded === true) {\n console.log(\"mainQuotaExceeded\");\n $budgetExceedModal.foundation(\"toggle\");\n cancelEvent(event);\n }\n });\n});","const currentAllocationZero = () => {\n const $budgetSummary = $(\".budget-summary__progressbox\");\n return parseInt($budgetSummary.attr(\"data-current-allocation\"), 10) === 0;\n}\n\nconst isSafeUrl = (exitUrl) => {\n if (!exitUrl) {\n return false\n }\n\n const safeUrls = [\n $(\".budget-summary\").attr(\"data-safe-url\").split(\"?\")[0],\n `${location.pathname}#`,\n `${location.href}#`,\n \"#\"\n ];\n\n let safe = false;\n safeUrls.forEach((url) => {\n if (exitUrl.startsWith(url)) {\n safe = true\n }\n });\n\n return safe;\n}\n\nconst allowExitFrom = ($el) => {\n if (currentAllocationZero()) {\n return true\n } else if ($el.attr(\"target\") === \"_blank\") {\n return true;\n } else if ($el.parents(\"#loginModal\").length > 0) {\n return true;\n } else if ($el.parents(\"#authorizationModal\").length > 0) {\n return true;\n } else if ($el.attr(\"id\") === \"exit-notification-link\") {\n return true;\n } else if ($el.parents(\".voting-wrapper\").length > 0) {\n return true;\n } else if (isSafeUrl($el.attr(\"href\"))) {\n return true\n }\n\n return false;\n}\n\n$(() => {\n const $exitNotification = $(\"#exit-notification\");\n const $exitLink = $(\"#exit-notification-link\");\n const defaultExitUrl = $exitLink.attr(\"href\");\n const defaultExitLinkText = $exitLink.text();\n let exitLinkText = defaultExitLinkText;\n\n if ($exitNotification.length < 1) {\n // Do not apply when not inside the voting pipeline\n return;\n }\n\n const openExitNotification = (url, method = null) => {\n if (method && method !== \"get\") {\n $exitLink.attr(\"data-method\", method);\n } else {\n $exitLink.removeAttr(\"data-method\");\n }\n\n $exitLink.attr(\"href\", url);\n $exitLink.html(exitLinkText);\n $exitNotification.foundation(\"open\");\n };\n\n $(document).on(\"click\", \"a\", (event) => {\n exitLinkText = defaultExitLinkText;\n\n const $link = $(event.currentTarget);\n if (!allowExitFrom($link)) {\n event.preventDefault();\n openExitNotification($link.attr(\"href\"), $link.data(\"method\"));\n }\n });\n // Custom handling for the header sign out so that it won't trigger the\n // logout form submit and so that it changes the exit link text. This does\n // not trigger the document link click listener because it has the\n // data-method attribute to trigger a form submit event.\n $(\".header a.sign-out-link\").on(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n\n const $link = $(event.currentTarget);\n exitLinkText = $link.text();\n openExitNotification($link.attr(\"href\"), $link.data(\"method\"));\n });\n // Custom handling for the exit link which needs to change the exit link\n // text to the default text as this is not handled by the document click\n // listener.\n $(\"a[data-open='exit-notification']\").on(\"click\", () => {\n exitLinkText = defaultExitLinkText;\n openExitNotification(defaultExitUrl);\n });\n});\n","$(() => {\n const checkProgressPosition = () => {\n let progressFix = document.querySelector(\"[data-progressbox-fixed]\"),\n progressRef = document.querySelector(\"[data-progress-reference]\"),\n progressVisibleClass = \"is-progressbox-visible\";\n\n if (!progressRef) {\n return;\n }\n\n let progressPosition = progressRef.getBoundingClientRect().bottom;\n if (progressPosition > 0) {\n progressFix.classList.remove(progressVisibleClass);\n } else {\n progressFix.classList.add(progressVisibleClass);\n }\n }\n\n window.addEventListener(\"scroll\", checkProgressPosition);\n\n window.DecidimBudgets = window.DecidimBudgets || {};\n window.DecidimBudgets.checkProgressPosition = checkProgressPosition;\n});\n","var map = {\n\t\"./decidim/budgets/decidim_budgets.svg\": 77978\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 = 62449;","// 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","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(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 = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","__webpack_require__.p = \"/decidim-packs/\";","import \"src/decidim/budgets/projects\"\nimport \"src/decidim/budgets/progressFixed\"\nimport \"src/decidim/budgets/exit_handler\"\n\n// Images\nrequire.context(\"../images\", true)\n"],"names":["$","$projects","$budgetSummaryTotal","$budgetExceedModal","$budgetSummary","$voteButton","totalAllocation","parseInt","attr","cancelEvent","event","currentTarget","removeClass","stopPropagation","preventDefault","on","click","currentAllocation","$currentTarget","projectAllocation","addClass","$targetCategory","$targetCategoryId","parents","first","data","undefined","quotaExceeded","categoryQuotaExceeded","length","console","log","foundation","allowExitFrom","$el","exitUrl","safeUrls","split","location","pathname","href","safe","forEach","url","startsWith","isSafeUrl","$exitNotification","$exitLink","defaultExitUrl","defaultExitLinkText","text","exitLinkText","openExitNotification","method","removeAttr","html","document","$link","checkProgressPosition","progressFix","querySelector","progressRef","progressVisibleClass","getBoundingClientRect","bottom","classList","remove","add","window","addEventListener","DecidimBudgets","map","webpackContext","req","id","webpackContextResolve","__webpack_require__","o","e","Error","code","keys","Object","resolve","module","exports","__webpack_module_cache__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","a","definition","key","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","p","require"],"sourceRoot":""}