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AAKkB,KAC7C,CAEA0B,mBAAAA,GACE5C,KAAKkB,KAAK6C,OAASrE,EAAAA,EAASyE,QAC5BnE,KAAKqB,OAAOpB,SAASgE,KAAK,UAAWjE,KAAKkB,MAC1ClB,KAAKqB,OAAOpB,SAASgE,KAAK,WAAYjE,KAAKkB,KAC7C,E,2ECrHF,MAAMkD,EAAcC,EAAAA,GAAY7C,QAC1B8C,EAAUC,EAAAA,KAChBH,EAAYI,MAAKC,EAAAA,EAAAA,IAAuBH,IAGxCF,EAAYM,SAAS,YAAaC,EAAAA,GCOlCC,EAAAA,I","sources":["webpack://app/./app/javascript/controllers/ sync _controller\\.js$","webpack://app/./app/javascript/helpers/index.js","webpack://app/./app/javascript/controllers/dropzone_controller.js","webpack://app/./app/javascript/controllers/index.js","webpack://app/./app/javascript/application.js"],"sourcesContent":["var map = {\n\t\"./dropzone_controller.js\": 364,\n\t\"controllers/dropzone_controller.js\": 364\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;","export function getMetaValue(name) {\n const element = findElement(document.head, `meta[name=\"${name}\"]`)\n if (element) {\n return element.getAttribute(\"content\")\n }\n}\n\nexport function findElement(root, selector) {\n if (typeof root == \"string\") {\n selector = root\n root = document\n }\n return root.querySelector(selector)\n}\n\nexport function removeElement(el) {\n if (el && el.parentNode) {\n el.parentNode.removeChild(el);\n }\n}\n\nexport function insertAfter(el, referenceNode) {\n return referenceNode.parentNode.insertBefore(el, referenceNode.nextSibling);\n}","import { Controller } from \"@hotwired/stimulus\"\nimport { DirectUpload } from \"@rails/activestorage\"\nimport Dropzone from \"dropzone\"\nimport { getMetaValue, findElement, removeElement, insertAfter } from \"helpers\"\n\nDropzone.autoDiscover = false\n\nexport default class extends Controller {\n static targets = [\"input\"]\n\n connect() {\n this.dropZone = createDropZone(this)\n this.hideFileInput()\n this.bindEvents()\n }\n\n // Private\n hideFileInput() {\n this.inputTarget.disabled = true\n this.inputTarget.style.display = \"none\"\n }\n\n bindEvents() {\n this.dropZone.on(\"addedfile\", (file) => {\n setTimeout(() => { file.accepted && createDirectUploadController(this, file).start() }, 500)\n })\n\n this.dropZone.on(\"removedfile\", (file) => {\n file.controller && removeElement(file.controller.hiddenInput)\n })\n\n this.dropZone.on(\"canceled\", (file) => {\n file.controller && file.controller.xhr.abort()\n })\n\n this.dropZone.on(\"processing\", (file) => {\n this.submitButton.disabled = true\n })\n\n this.dropZone.on(\"queuecomplete\", (file) => {\n this.submitButton.disabled = false\n })\n }\n\n get headers() { return { \"X-CSRF-Token\": getMetaValue(\"csrf-token\") } }\n\n get url() { return this.inputTarget.getAttribute(\"data-direct-upload-url\") }\n\n get maxFiles() { return this.data.get(\"maxFiles\") || 1 }\n\n get maxFileSize() { return this.data.get(\"maxFileSize\") || 256 }\n\n get acceptedFiles() { return this.data.get(\"acceptedFiles\") }\n\n get addRemoveLinks() { return this.data.get(\"addRemoveLinks\") || true }\n\n get form() { return this.element.closest(\"form\") }\n\n get submitButton() { return findElement(this.form, \"input[type=submit], button[type=submit]\") }\n\n}\n\nclass DirectUploadController {\n constructor(source, file) {\n this.directUpload = createDirectUpload(file, source.url, this)\n this.source = source\n this.file = file\n }\n\n start() {\n this.file.controller = this\n this.hiddenInput = this.createHiddenInput()\n this.directUpload.create((error, attributes) => {\n if (error) {\n removeElement(this.hiddenInput)\n this.emitDropzoneError(error)\n } else {\n this.hiddenInput.value = attributes.signed_id\n this.emitDropzoneSuccess()\n }\n })\n }\n\n // Private\n createHiddenInput() {\n const input = document.createElement(\"input\")\n input.type = \"hidden\"\n input.name = this.source.inputTarget.name\n insertAfter(input, this.source.inputTarget)\n return input\n }\n\n directUploadWillStoreFileWithXHR(xhr) {\n this.bindProgressEvent(xhr)\n this.emitDropzoneUploading()\n }\n\n bindProgressEvent(xhr) {\n this.xhr = xhr\n this.xhr.upload.addEventListener(\"progress\", event => this.uploadRequestDidProgress(event))\n }\n\n uploadRequestDidProgress(event) {\n const element = this.source.element\n const progress = event.loaded / event.total * 100\n findElement(this.file.previewTemplate, \".dz-upload\").style.width = `${progress}%`\n }\n\n emitDropzoneUploading() {\n this.file.status = Dropzone.UPLOADING\n this.source.dropZone.emit(\"processing\", this.file)\n }\n\n emitDropzoneError(error) {\n this.file.status = Dropzone.ERROR\n this.source.dropZone.emit(\"error\", this.file, error)\n this.source.dropZone.emit(\"complete\", this.file)\n }\n\n emitDropzoneSuccess() {\n this.file.status = Dropzone.SUCCESS\n this.source.dropZone.emit(\"success\", this.file)\n this.source.dropZone.emit(\"complete\", this.file)\n }\n}\n\n// Top level...\nfunction createDirectUploadController(source, file) {\n return new DirectUploadController(source, file)\n}\n\nfunction createDirectUpload(file, url, controller) {\n return new DirectUpload(file, url, controller)\n}\n\nfunction createDropZone(controller) {\n return new Dropzone(controller.element, {\n url: controller.url,\n headers: controller.headers,\n maxFiles: controller.maxFiles,\n maxFilesize: controller.maxFileSize,\n acceptedFiles: controller.acceptedFiles,\n addRemoveLinks: controller.addRemoveLinks,\n thumbnailMethod: 'contain',\n autoQueue: false\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 \"@hotwired/stimulus\"\nimport { definitionsFromContext } from \"@hotwired/stimulus-webpack-helpers\"\n\nconst application = Application.start()\nconst context = require.context(\"controllers\", true, /_controller\\.js$/)\napplication.load(definitionsFromContext(context))\n\nimport Clipboard from \"@stimulus-components/clipboard\"\napplication.register(\"clipboard\", Clipboard)\n","/* eslint no-console:0 */\n// This file is automatically compiled by Webpack, along with any other files\n// present in this directory. You're encouraged to place your actual application logic in\n// a relevant structure within app/javascript and only use these pack files to reference\n// that code so it'll be compiled.\n//\n// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate\n// layout file, like app/views/layouts/application.html.erb\n\n\n// Uncomment to copy all static images under ../images to the output folder and reference\n// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)\n// or the `imagePath` JavaScript helper below.\n//\n// const images = require.context('../images', true)\n// const imagePath = (name) => images(name, true)\n\nimport * as ActiveStorage from \"@rails/activestorage\"\nActiveStorage.start()\n\nimport \"stylesheets/application\" \nimport \"controllers\"\n"],"names":["map","webpackContext","req","id","webpackContextResolve","__webpack_require__","o","e","Error","code","keys","Object","resolve","module","exports","getMetaValue","name","element","findElement","document","head","getAttribute","root","selector","querySelector","removeElement","el","parentNode","removeChild","Dropzone","autoDiscover","Controller","static","connect","controller","this","dropZone","url","headers","maxFiles","maxFilesize","maxFileSize","acceptedFiles","addRemoveLinks","thumbnailMethod","autoQueue","hideFileInput","bindEvents","inputTarget","disabled","style","display","on","file","setTimeout","accepted","source","DirectUploadController","createDirectUploadController","start","hiddenInput","xhr","abort","submitButton","data","get","form","closest","constructor","directUpload","DirectUpload","createDirectUpload","createHiddenInput","create","error","attributes","emitDropzoneError","value","signed_id","emitDropzoneSuccess","input","createElement","referenceNode","type","insertBefore","nextSibling","directUploadWillStoreFileWithXHR","bindProgressEvent","emitDropzoneUploading","upload","addEventListener","event","uploadRequestDidProgress","progress","loaded","total","previewTemplate","width","status","UPLOADING","emit","ERROR","SUCCESS","application","Application","context","require","load","definitionsFromContext","register","Clipboard","ActiveStorage"],"sourceRoot":""}