{"version":3,"file":"file_drop_controller-BFKqZiNU.js","names":[],"sources":["../../../app/javascript/entrypoints/site_controllers/file_drop_controller.js"],"sourcesContent":["import { Controller } from \"@hotwired/stimulus\"\n\n// Drop zone for the optional specifications PDF: shows the chosen file and accepts a drop.\nexport default class extends Controller {\n static targets = [\"zone\", \"input\", \"name\"]\n\n over(event) {\n event.preventDefault()\n this.zoneTarget.classList.add(\"over\")\n }\n\n leave() {\n this.zoneTarget.classList.remove(\"over\")\n }\n\n drop(event) {\n event.preventDefault()\n this.leave()\n if (!event.dataTransfer.files.length) return\n this.inputTarget.files = event.dataTransfer.files\n this.show()\n }\n\n show() {\n const file = this.inputTarget.files[0]\n this.nameTarget.textContent = file\n ? `${file.name} ยท ${(file.size / 1024 / 1024).toFixed(1)} ${this.nameTarget.dataset.unit}`\n : this.nameTarget.dataset.empty\n }\n}\n"],"mappings":"4GAGA,EAAA,cAA6B,CAAW,CACtC,OAAO,QAAU,CAAC,OAAQ,QAAS,OAAO,CAE1C,KAAK,EAAO,CACV,EAAM,gBAAgB,CACtB,KAAK,WAAW,UAAU,IAAI,OAAO,CAGvC,OAAQ,CACN,KAAK,WAAW,UAAU,OAAO,OAAO,CAG1C,KAAK,EAAO,CACV,EAAM,gBAAgB,CACtB,KAAK,OAAO,CACP,EAAM,aAAa,MAAM,SAC9B,KAAK,YAAY,MAAQ,EAAM,aAAa,MAC5C,KAAK,MAAM,EAGb,MAAO,CACL,IAAM,EAAO,KAAK,YAAY,MAAM,GACpC,KAAK,WAAW,YAAc,EAC1B,GAAG,EAAK,KAAK,MAAM,EAAK,KAAO,KAAO,MAAM,QAAQ,EAAE,CAAC,GAAG,KAAK,WAAW,QAAQ,OAClF,KAAK,WAAW,QAAQ"}