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zBF,wBAA6BpE,EAAAA,GAC3BC,cAAgB,CACdoE,eAAgB1C,MAChBgC,QAAS/D,QAGXM,OAAAA,GACEmD,EAAElD,KAAKsB,SAASmC,QAAQzD,KAAK0D,cAC/B,CAEAI,UAAAA,GACEZ,EAAElD,KAAKsB,SAASmC,QAAQ,UAC1B,CAEAC,WAAAA,GACE,IAAIS,EAAiB,CACnBC,KAAMpE,KAAKqE,oBACXC,gBAAiB,CAAC,KAClBN,MAAO,WAET,OAAOvE,OAAOsE,OAAOI,EAAgBnE,KAAKiE,aAC5C,E,yDCjBF,MAAMM,EAAcC,EAAAA,GAAYC,QAC1BC,EAAUC,EAAAA,KAChBJ,EAAYK,MAAKC,EAAAA,EAAAA,IAAuBH,G","sources":["webpack://app/./app/javascript/controllers/ sync _controller\\.js$","webpack://app/./app/javascript/controllers/conditional_form_fields_controller.js","webpack://app/./app/javascript/controllers/orders/form_frame_communication_controller.js","webpack://app/./app/javascript/controllers/selects/simple_select2_controller.js","webpack://app/./app/javascript/controllers/selects/simple_select2_tags_controller.js","webpack://app/./app/javascript/controllers/index.js"],"sourcesContent":["var map = {\n\t\"./conditional_form_fields_controller.js\": 315,\n\t\"./orders/form_frame_communication_controller.js\": 831,\n\t\"./selects/simple_select2_controller.js\": 787,\n\t\"./selects/simple_select2_tags_controller.js\": 633,\n\t\"controllers/conditional_form_fields_controller.js\": 315,\n\t\"controllers/orders/form_frame_communication_controller.js\": 831,\n\t\"controllers/selects/simple_select2_controller.js\": 787,\n\t\"controllers/selects/simple_select2_tags_controller.js\": 633\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 = 124;","import { Controller } from \"stimulus\"\n\nexport default class extends Controller {\n static targets = [ \"conditionalFieldset\" ]\n\n connect(){\n this.refresh()\n }\n\n refresh(e){\n for (const fieldset of this.conditionalFieldsetTargets) {\n this.processFieldset(fieldset)\n }\n }\n\n processFieldset(fieldset){\n fieldset.disabled = !this.conditionsPassed(fieldset)\n }\n\n conditionsPassed(fieldset){\n const conditions = JSON.parse(fieldset.dataset.conditions)\n\n return (conditions.filter(condition => this.conditionPassed(condition)).length > 0)\n }\n\n conditionPassed({ field, type, values }){\n return values.includes(this.getCurrentFieldValue(field))\n }\n\n getCurrentFieldValue(field){\n return Object.fromEntries(new FormData(this.element))[field]\n }\n}\n","import { Controller } from \"stimulus\"\n\nexport default class extends Controller {\n static values = {\n allowedUrls: Array\n }\n\n handleMessage(event) {\n if (this.originIsInvalid(event)) {\n console.warn(\"Invalid origin for postMessage\")\n return\n }\n\n let promise = this.takeAction(event.data)\n\n if (promise != null){\n promise.done((response) => {\n event.source.postMessage({\n action: `${event.data.action} response`,\n response: response\n }, event.origin)\n }).fail(() => {\n event.source.postMessage({\n action: `${event.data.action} response`,\n response: {\n result: 'Failed', message: \"Something went wrong.\", errors: []\n }\n }, event.origin)\n })\n }\n }\n\n takeAction(message) {\n switch (message.action) {\n case 'create order':\n return window.OrderAPI.create(message.orderData)\n case 'orders app frame position':\n return this.framePosition()\n case 'orders app height':\n this.updateFrameHeight(message.height)\n return null\n }\n }\n\n updateFrameHeight(height) {\n if (height != null) {\n $(this.element).css('height', height)\n }\n }\n\n framePosition() {\n let deferred = $.Deferred()\n\n deferred.resolve(this.element.getBoundingClientRect())\n\n return deferred.promise()\n }\n\n originIsInvalid(event) {\n return !this.allowedUrlsValue.includes(event.origin)\n }\n}\n","import { Controller } from \"stimulus\"\n\nexport default class extends Controller {\n static values = {\n options: Object,\n }\n\n connect() {\n $(this.element).select2(this.fullOptions())\n\n // Fire a custom event on change, for compatibility with the conditional-form-fields\n // controller, as Stimulus does not detect the normal change event from Select2\n $(this.element).on('change', () => {\n let event = new Event('select2-change')\n this.element.dispatchEvent(event)\n })\n }\n\n disconnect() {\n $(this.element).select2('destroy')\n }\n\n fullOptions() {\n let defaultOptions = {\n width: 'resolve'\n }\n return Object.assign(defaultOptions, this.optionsValue)\n }\n}\n","import { Controller } from \"stimulus\"\n\nexport default class extends Controller {\n static values = {\n predefinedTags: Array,\n options: Object,\n }\n\n connect() {\n $(this.element).select2(this.fullOptions())\n }\n\n disconnect() {\n $(this.element).select2('destroy')\n }\n\n fullOptions() {\n let defaultOptions = {\n tags: this.predefinedTagsValue,\n tokenSeparators: [','],\n width: 'resolve'\n }\n return Object.assign(defaultOptions, this.optionsValue)\n }\n}\n","// Load all the controllers within this directory and all subdirectories. \n// Controller files must be named *_controller.js.\n\nimport { Application } from \"stimulus\"\nimport { definitionsFromContext } from \"stimulus/webpack-helpers\"\n\nconst application = Application.start()\nconst context = require.context(\"controllers\", true, /_controller\\.js$/)\napplication.load(definitionsFromContext(context))\n"],"names":["map","webpackContext","req","id","webpackContextResolve","__webpack_require__","o","e","Error","code","keys","Object","resolve","module","exports","Controller","static","connect","this","refresh","fieldset","conditionalFieldsetTargets","processFieldset","disabled","conditionsPassed","JSON","parse","dataset","conditions","filter","condition","conditionPassed","length","field","type","values","includes","getCurrentFieldValue","fromEntries","FormData","element","allowedUrls","Array","handleMessage","event","originIsInvalid","console","warn","promise","takeAction","data","done","response","source","postMessage","action","origin","fail","result","message","errors","window","OrderAPI","create","orderData","framePosition","updateFrameHeight","height","$","css","deferred","Deferred","getBoundingClientRect","allowedUrlsValue","options","select2","fullOptions","on","Event","dispatchEvent","disconnect","assign","width","optionsValue","predefinedTags","defaultOptions","tags","predefinedTagsValue","tokenSeparators","application","Application","start","context","require","load","definitionsFromContext"],"sourceRoot":""}