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SAChCpB,EAAavD,KAAKR,QAAQgE,QAAQD,WAExCE,MAAO,GAAEF,KAAcoB,IAAY,CACjCjB,OAAQ,SACRE,QAAS,CACP,eAAgB7E,SACb6B,cAAc,4BACbiD,aAAa,cAGlBC,MAAMtC,GACDA,EAASuC,GACJvC,EAASwC,OAETxC,EAASyC,SAGnBH,MAAM5E,IACgB,YAAjBA,GAAMgF,OACRlE,KAAK8C,qBAAqBlC,cAAe,iBAAgB+D,OAAc5D,SAEvEuB,MAAMpD,EACR,GAEJ,EACH,EA5GQgD,QAAU,CACf,aACA,WACA,iBACA,aACA,UACA,e","sources":["webpack://app/./app/javascript/channels/ sync _channel\\.js$","webpack://app/./app/javascript/controllers/ sync _controller\\.js$","webpack://app/./app/javascript/controllers/index.js","webpack://app/./app/javascript/application.js","webpack://app/./app/javascript/channels/index.js","webpack://app/./app/javascript/controllers/hello_controller.js","webpack://app/./app/javascript/controllers/modal_controller.js","webpack://app/./app/javascript/controllers/upload_controller.js"],"sourcesContent":["function webpackEmptyContext(req) {\n\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\te.code = 'MODULE_NOT_FOUND';\n\tthrow e;\n}\nwebpackEmptyContext.keys = function() { return []; };\nwebpackEmptyContext.resolve = webpackEmptyContext;\nwebpackEmptyContext.id = 463;\nmodule.exports = webpackEmptyContext;","var map = {\n\t\"./hello_controller.js\": 913,\n\t\"./modal_controller.js\": 205,\n\t\"./upload_controller.js\": 31,\n\t\"controllers/hello_controller.js\": 913,\n\t\"controllers/modal_controller.js\": 205,\n\t\"controllers/upload_controller.js\": 31\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 = 74;","// 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","import Rails from \"@rails/ujs\"\nimport \"@hotwired/turbo-rails\"\nimport { Turbo } from \"@hotwired/turbo-rails\"\n// import * as ActiveStorage from \"@rails/activestorage\"\nimport $ from 'jquery';\nimport \"channels\"\nimport \"controllers\"\n\n// If set `Turbo.session.drive` to false, all form submit becomes regular form submit, not turbo frame. \n// - ie `render turbo_frame.replace(...)` does not work. It will render this response as the whole page.\n// \n// Turbo.session.drive = false;\nRails.start()\nglobal.jQuery = $;\nglobal.$ = $;\n\n// Inject a header into turbolinks requests so the above\n// nonce generation code works\ndocument.addEventListener('turbolinks:request-start', function(event) {\n const xhr = event.data.xhr;\n // console.log(\">>>>\");\n // console.log( $('meta[name=\\'csp-nonce\\']').prop('content'));\n xhr.setRequestHeader('X-Turbolinks-Nonce', $('meta[name=\\'csp-nonce\\']').prop('content'));\n});\n\n// Because nonces can only be accessed via their IDL attribute\n// after the page loads (for security reasons),\n// they need to be read via JS and added back as\n// normal attributes in the DOM before the page is cached\n// otherwise on cache restoration visits, the nonces won’t be there!\ndocument.addEventListener('turbolinks:before-cache', function() {\n $('script[nonce]').each(function(index, element) {\n $(element).attr('nonce', element.nonce);\n });\n});\n\n$('.dropdown-toggle').dropdown()\n","// Load all the channels within this directory and all subdirectories.\n// Channel files must be named *_channel.js.\n\nconst channels = require.context('.', true, /_channel\\.js$/)\nchannels.keys().forEach(channels)\n","import { Controller } from \"stimulus\"\n\nexport default class extends Controller {\n connect() {\n this.element.textContent = \"Hello World!\"\n }\n}\n","import { Controller } from \"stimulus\"\nimport { Modal } from \"bootstrap\"\nimport Rails from '@rails/ujs';\n\nexport default class extends Controller {\n static targets = [\"size\", \"url\", \"localContent\"]\n\n connect() {\n console.log(\"stimulus modal load\")\n this.mainModal = document.getElementById('modal')\n this.modal = new Modal(this.mainModal)\n\t\t\twindow.mainModal = this.modal\n\t\t\t$(this.element).on('hide.bs.modal', (event) => {\n\t\t\t\tthis.closeCallback()\n\t\t\t})\n }\n\n async toggle(){\n this.mainModal.querySelector('.modal-content').innerHTML = \"\"\n this.mainModal.querySelector('.modal-dialog').classList\n .remove(\"animated\", \"shake\", \"modal-lg\", \"modal-xl\", \"modal-sm\")\n\n await this.load(this.data.get(\"url\"))\n this.modal.show()\n }\n\n async toggleLocal(){\n this.mainModal.querySelector('.modal-content').innerHTML = \"\"\n this.mainModal.querySelector('.modal-dialog').classList\n .remove(\"animated\", \"shake\", \"modal-lg\", \"modal-xl\", \"modal-sm\")\n const content = document.getElementById(this.data.get(\"localContent\"))\n this.mainModal.querySelector('.modal-content').innerHTML = content.innerHTML\n this.modal.show()\n }\n\n load(path) {\n Rails.ajax({\n type: 'GET',\n url: path,\n dataType: 'script', // remote -> true\n success: (response) => this._success(response),\n complete: (response) => this._complete(),\n error: (response) => this._errors()\n });\n // fetch(path)\n // .then((r) => r.text())\n // .then((html) => {\n // this.mainModal.querySelector('.modal-content').innerHTML = html\n // });\n }\n\n _success(response) {\n this.mainModal.querySelector('.modal-dialog').classList\n .add(`modal-${this.data.get('size')}`)\n // this.modal.hide()\n\n // let [data, status, xhr] = response.detail;\n // console.log(xhr.response)\n // this.mainModal.querySelector('.modal-content').innerHTML = response\n }\n\n _complete() {\n }\n\n _error() {\n }\n\n\t\tcloseCallback() {\n\t\t\tconsole.log('close modal')\n\t\t\tconsole.log(this.data.get('callback'))\n }\n\n onPostSuccess(){\n // reload\n // this.mainModal.querySelector('.modal-content').innerHTML = \"\"\n // this.mainModal.querySelector('.modal-dialog').classList\n // .remove(\"animated\", \"shake\", \"modal-lg\", \"modal-xl\", \"modal-sm\")\n // this.modal.hide()\n // $('.modal-backdrop').remove()\n }\n\n onPostError(){\n }\n\n}\n","import { Controller } from \"stimulus\";\n\nexport default class extends Controller {\n static targets = [\n \"filesInput\",\n \"fileItem\",\n \"filesContainer\",\n \"uploadPath\",\n \"message\",\n \"submitButton\"\n ];\n\n initialize() {\n this.uploading = false;\n }\n \n uploadFile(event) {\n if (this.uploading) {\n alert('Please wait for upload to finish.');\n return;\n }\n\n this.messageTarget.textContent = \"\";\n const filesInput = this.filesInputTarget;\n let files = Array.from(filesInput.files);\n \n if (files.length === 0) {\n return;\n }\n \n if ((files.length + this.filesContainerTarget.children.length) > 10) {\n alert('Please do not upload more than 10 files.')\n return;\n }\n\n // should change state to prevent further upload until current one completes. \n this.uploading = true;\n this.messageTarget.textContent = \"Uploading....\";\n this.submitButtonTarget.disabled = true;\n\n let formData = new FormData();\n\n files.forEach((file) => {\n formData.append(\"attachments[]\", file);\n });\n\n // Reset after 1 minute\n setTimeout(() => {\n this.messageTarget.textContent = \"\";\n this.submitButtonTarget.disabled = false;\n this.uploading = false;\n }, 50000);\n\n const uploadPath = this.element.dataset.uploadPath;\n fetch(uploadPath, {\n method: \"POST\",\n body: formData,\n headers: { \n \"X-CSRF-Token\": document.querySelector('meta[name=\"csrf-token\"]')?.getAttribute(\"content\")\n },\n })\n .then((response) => {\n this.messageTarget.textContent = \"\";\n this.submitButtonTarget.disabled = false;\n\n if (response.ok) {\n return response.json();\n } else {\n return response.text();\n }\n })\n .then((data) => {\n if (data?.result === \"success\") {\n var range = document.createRange();\n this.filesContainerTarget.appendChild(range.createContextualFragment(data.html));\n filesInput.value = \"\";\n this.uploading = false;\n } else {\n alert(data);\n }\n });\n }\n\n removeFile(event) {\n event.preventDefault();\n const signedId = event.target.dataset.signedId;\n const uploadPath = this.element.dataset.uploadPath;\n \n fetch(`${uploadPath}/${signedId}`, {\n method: \"DELETE\",\n headers: {\n \"X-CSRF-Token\": document\n .querySelector('meta[name=\"csrf-token\"]')\n ?.getAttribute(\"content\"),\n },\n })\n .then((response) => {\n if (response.ok) {\n return response.json();\n } else {\n return response.text();\n }\n })\n .then((data) => {\n if (data?.result === \"success\") {\n this.filesContainerTarget.querySelector(`[data-row-id='${signedId}'`)?.remove();\n } else {\n alert(data);\n }\n });\n }\n}"],"names":["webpackEmptyContext","req","e","Error","code","keys","resolve","id","module","exports","map","webpackContext","webpackContextResolve","__webpack_require__","o","Object","application","Application","context","require","load","definitionsFromContext","Rails","global","jQuery","$","document","addEventListener","event","data","xhr","setRequestHeader","prop","each","index","element","attr","nonce","dropdown","channels","forEach","Controller","connect","this","textContent","console","log","mainModal","getElementById","modal","Modal","window","on","closeCallback","async","querySelector","innerHTML","classList","remove","get","show","content","path","type","url","dataType","success","response","_success","complete","_complete","error","_errors","add","_error","onPostSuccess","onPostError","targets","initialize","uploading","uploadFile","alert","messageTarget","filesInput","filesInputTarget","files","Array","from","length","filesContainerTarget","children","submitButtonTarget","disabled","formData","FormData","file","append","setTimeout","uploadPath","dataset","fetch","method","body","headers","getAttribute","then","ok","json","text","result","range","createRange","appendChild","createContextualFragment","html","value","removeFile","preventDefault","signedId","target"],"sourceRoot":""}