@georapbox/files-dropzone-element 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- Object.defineProperty({},"FilesDropzone",{get:function(){return m},set:void 0,enumerable:!0,configurable:!0});let e=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["jxl","image/jxl"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]),t=[".DS_Store","Thumbs.db"],o=t=>{let{name:o}=t;if(o&&-1!==o.lastIndexOf(".")&&!t.type){let i=(o.split(".").pop()||"").toLowerCase(),r=e.get(i);r&&Object.defineProperty(t,"type",{value:r,writable:!1,configurable:!1,enumerable:!0})}return t},i=(e,t)=>{let i=o(e);if("string"!=typeof i.path){let{webkitRelativePath:o}=e;Object.defineProperty(i,"path",{value:"string"==typeof t?t:o||e.name,writable:!1,configurable:!1,enumerable:!0})}return i},r=async e=>await new Promise((t,o)=>{e.readEntries(t,o)}),a=async e=>{let t=[],o=await r(e);for(;o.length>0;)t.push(...o),o=await r(e);return t},n=e=>new Promise((t,o)=>{e.file(o=>t(i(o,e.fullPath)),o)}),s=async e=>{let o=[],i=[];for(let t of e){if("file"!==t.kind)continue;let e=t.getAsEntry?t.getAsEntry():t.webkitGetAsEntry();i.push(e)}for(;i.length>0;){let e=i.shift();if(e){if(e.isFile){let i=await n(e);-1===t.indexOf(i.name)&&o.push(i)}else e.isDirectory&&i.push(...await a(e.createReader()))}}return o},d=async e=>{let o=[];for(let r of e)-1===t.indexOf(r.name)&&o.push(i(r));return o},l=async e=>e.dataTransfer?e.dataTransfer.items?await s(e.dataTransfer.items):await d(e.dataTransfer.files):await d(e.target.files),p="files-dropzone",c="TOO_MANY_FILES",h=document.createElement("template"),u=`
1
+ Object.defineProperty({},"FilesDropzone",{get:function(){return m},set:void 0,enumerable:!0,configurable:!0});let e=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["jxl","image/jxl"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["markdown","text/markdown"],["md","text/markdown"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]),t=[".DS_Store","Thumbs.db"],o=t=>{let{name:o}=t;if(o&&-1!==o.lastIndexOf(".")&&!t.type){let i=(o.split(".").pop()||"").toLowerCase(),r=e.get(i);r&&Object.defineProperty(t,"type",{value:r,writable:!1,configurable:!1,enumerable:!0})}return t},i=(e,t)=>{let i=o(e);if("string"!=typeof i.path){let{webkitRelativePath:o}=e;Object.defineProperty(i,"path",{value:"string"==typeof t?t:o||e.name,writable:!1,configurable:!1,enumerable:!0})}return i},r=async e=>await new Promise((t,o)=>{e.readEntries(t,o)}),a=async e=>{let t=[],o=await r(e);for(;o.length>0;)t.push(...o),o=await r(e);return t},n=e=>new Promise((t,o)=>{e.file(o=>t(i(o,e.fullPath)),o)}),s=async e=>{let o=[],i=[];for(let t of e){if("file"!==t.kind)continue;let e=t.getAsEntry?t.getAsEntry():t.webkitGetAsEntry();i.push(e)}for(;i.length>0;){let e=i.shift();if(e){if(e.isFile){let i=await n(e);-1===t.indexOf(i.name)&&o.push(i)}else e.isDirectory&&i.push(...await a(e.createReader()))}}return o},d=async e=>{let o=[];for(let r of e)-1===t.indexOf(r.name)&&o.push(i(r));return o},l=async e=>e.dataTransfer?e.dataTransfer.items?await s(e.dataTransfer.items):await d(e.dataTransfer.files):await d(e.target.files),p="files-dropzone",c="TOO_MANY_FILES",h=document.createElement("template"),u=`
2
2
  *,
3
3
  *::before,
4
4
  *::after {
@@ -1 +1 @@
1
- {"mappings":"A,O,c,C,C,E,gB,C,I,W,O,C,E,I,K,E,W,C,E,a,C,C,GIKA,IAAM,EAAoB,IAAI,IAAI,CAEhC,CAAC,MAAO,YAAY,CACpB,CAAC,MAAO,wBAAwB,CAChC,CAAC,MAAO,wBAAwB,CAChC,CAAC,OAAQ,aAAa,CACtB,CAAC,MAAO,k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CAAC,aAAA,CAAc,IAAI,YAAY,CAAC,EAAE,EAAe,cAAc,CAAC,CAAE,CACpE,QAAS,CAAA,EACT,SAAU,CAAA,EACV,OAAQ,CACN,cAAA,CACF,CACF,IAGE,EAAc,MAAA,CAAS,GACzB,IAAI,CAAC,aAAA,CAAc,IAAI,YAAY,CAAC,EAAE,EAAe,cAAc,CAAC,CAAE,CACpE,QAAS,CAAA,EACT,SAAU,CAAA,EACV,OAAQ,CACN,cAAA,CACF,CACF,IAGE,IAAI,CAAC,CAAC,CAAS,EACjB,CAAA,IAAI,CAAC,CAAC,CAAS,CAAC,KAAA,CAAQ,IAAI,CAAC,CAAC,CAAS,CAAC,YAD1C,AAAA,CAGF,CAKA,gBAAiB,CACX,IAAI,CAAC,QAAA,EAIT,IAAI,CAAC,CAAC,CAAS,EAAE,OACnB,CAWA,CAAC,CAAe,CAAC,CAAI,EAInB,GAAI,OAAO,SAAA,CAAU,cAAA,CAAe,IAAA,CAFnB,IAAI,CAE8B,GAAO,CACxD,IAAM,EAAQ,AAHC,IAAI,AAGG,CAAC,EAAK,AAC5B,QAAO,AAJQ,IAAI,AAIJ,CAAC,EAAK,CACrB,AALe,IAAI,AAKX,CAAC,EAAK,CAAG,CACnB,CACF,CAWA,OAAO,oBAAoB,EAAc,CAAc,CAAE,CACjC,aAAlB,OAAO,QAA2B,OAAO,cAAA,CAAe,GAAA,CAAI,IAC9D,OAAO,cAAA,CAAe,MAAA,CAAO,EAAa,EAE9C,CACF,CD1sBA,AAAA,EAAc,mBAAd,U,K,a","sources":["<anon>","src/files-dropzone-defined.js","src/files-dropzone.js","src/utils/is-valid-file.js","src/utils/files-selector.js"],"sourcesContent":["function $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $862aa3736b0514bc$exports = {};\n\n$parcel$export($862aa3736b0514bc$exports, \"FilesDropzone\", function () { return $862aa3736b0514bc$export$6ccd1735166caad9; });\n// @ts-check\n/**\n * Represents a value that may be of type T, or null.\n *\n * @template T\n * @typedef {T | null} Nullable\n */ // @ts-check\n/**\n * Checks if a file is valid based on the accepted file type specifiers.\n *\n * @param {File} file - The File object to validate.\n * @param {string} [acceptedTypeSpecifiers=''] - The accepted file type specifiers.\n * @returns {boolean} - True if the file is valid, false otherwise.\n */ function $38f222170fd4d21a$export$7c47054fed488f80(file, acceptedTypeSpecifiers = \"\") {\n if (!acceptedTypeSpecifiers) return true;\n const acceptedMimeTypesList = [\n ...new Set(acceptedTypeSpecifiers.split(\",\").map((v)=>v.trim()).filter(Boolean))\n ];\n const fileMimeType = file.type;\n const baseMimeType = fileMimeType.replace(/\\/.*$/, \"\");\n for (const validType of acceptedMimeTypesList){\n if (validType.charAt(0) === \".\") {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) return true;\n } else if (/\\/\\*$/.test(validType)) {\n // Check for mime type that looks like \"image/*\" or similar.\n if (baseMimeType === validType.replace(/\\/.*$/, \"\")) return true;\n } else {\n if (fileMimeType === validType) return true;\n }\n }\n return false;\n}\n\n\n// @ts-check\n/**\n * A map of common file extensions and their associated MIME types.\n */ const $f31161edf38949e9$var$COMMON_MIME_TYPES = new Map([\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\n [\n \"aac\",\n \"audio/aac\"\n ],\n [\n \"abw\",\n \"application/x-abiword\"\n ],\n [\n \"arc\",\n \"application/x-freearc\"\n ],\n [\n \"avif\",\n \"image/avif\"\n ],\n [\n \"avi\",\n \"video/x-msvideo\"\n ],\n [\n \"azw\",\n \"application/vnd.amazon.ebook\"\n ],\n [\n \"bin\",\n \"application/octet-stream\"\n ],\n [\n \"bmp\",\n \"image/bmp\"\n ],\n [\n \"bz\",\n \"application/x-bzip\"\n ],\n [\n \"bz2\",\n \"application/x-bzip2\"\n ],\n [\n \"cda\",\n \"application/x-cdf\"\n ],\n [\n \"csh\",\n \"application/x-csh\"\n ],\n [\n \"css\",\n \"text/css\"\n ],\n [\n \"csv\",\n \"text/csv\"\n ],\n [\n \"doc\",\n \"application/msword\"\n ],\n [\n \"docx\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"\n ],\n [\n \"eot\",\n \"application/vnd.ms-fontobject\"\n ],\n [\n \"epub\",\n \"application/epub+zip\"\n ],\n [\n \"gz\",\n \"application/gzip\"\n ],\n [\n \"gif\",\n \"image/gif\"\n ],\n [\n \"heic\",\n \"image/heic\"\n ],\n [\n \"heif\",\n \"image/heif\"\n ],\n [\n \"htm\",\n \"text/html\"\n ],\n [\n \"html\",\n \"text/html\"\n ],\n [\n \"ico\",\n \"image/vnd.microsoft.icon\"\n ],\n [\n \"ics\",\n \"text/calendar\"\n ],\n [\n \"jar\",\n \"application/java-archive\"\n ],\n [\n \"jpeg\",\n \"image/jpeg\"\n ],\n [\n \"jpg\",\n \"image/jpeg\"\n ],\n [\n \"jxl\",\n \"image/jxl\"\n ],\n [\n \"js\",\n \"text/javascript\"\n ],\n [\n \"json\",\n \"application/json\"\n ],\n [\n \"jsonld\",\n \"application/ld+json\"\n ],\n [\n \"mid\",\n \"audio/midi\"\n ],\n [\n \"midi\",\n \"audio/midi\"\n ],\n [\n \"mjs\",\n \"text/javascript\"\n ],\n [\n \"mp3\",\n \"audio/mpeg\"\n ],\n [\n \"mp4\",\n \"video/mp4\"\n ],\n [\n \"mpeg\",\n \"video/mpeg\"\n ],\n [\n \"mpkg\",\n \"application/vnd.apple.installer+xml\"\n ],\n [\n \"odp\",\n \"application/vnd.oasis.opendocument.presentation\"\n ],\n [\n \"ods\",\n \"application/vnd.oasis.opendocument.spreadsheet\"\n ],\n [\n \"odt\",\n \"application/vnd.oasis.opendocument.text\"\n ],\n [\n \"oga\",\n \"audio/ogg\"\n ],\n [\n \"ogv\",\n \"video/ogg\"\n ],\n [\n \"ogx\",\n \"application/ogg\"\n ],\n [\n \"opus\",\n \"audio/opus\"\n ],\n [\n \"otf\",\n \"font/otf\"\n ],\n [\n \"png\",\n \"image/png\"\n ],\n [\n \"pdf\",\n \"application/pdf\"\n ],\n [\n \"php\",\n \"application/x-httpd-php\"\n ],\n [\n \"ppt\",\n \"application/vnd.ms-powerpoint\"\n ],\n [\n \"pptx\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\"\n ],\n [\n \"rar\",\n \"application/vnd.rar\"\n ],\n [\n \"rtf\",\n \"application/rtf\"\n ],\n [\n \"sh\",\n \"application/x-sh\"\n ],\n [\n \"svg\",\n \"image/svg+xml\"\n ],\n [\n \"swf\",\n \"application/x-shockwave-flash\"\n ],\n [\n \"tar\",\n \"application/x-tar\"\n ],\n [\n \"tif\",\n \"image/tiff\"\n ],\n [\n \"tiff\",\n \"image/tiff\"\n ],\n [\n \"ts\",\n \"video/mp2t\"\n ],\n [\n \"ttf\",\n \"font/ttf\"\n ],\n [\n \"txt\",\n \"text/plain\"\n ],\n [\n \"vsd\",\n \"application/vnd.visio\"\n ],\n [\n \"wav\",\n \"audio/wav\"\n ],\n [\n \"weba\",\n \"audio/webm\"\n ],\n [\n \"webm\",\n \"video/webm\"\n ],\n [\n \"webp\",\n \"image/webp\"\n ],\n [\n \"woff\",\n \"font/woff\"\n ],\n [\n \"woff2\",\n \"font/woff2\"\n ],\n [\n \"xhtml\",\n \"application/xhtml+xml\"\n ],\n [\n \"xls\",\n \"application/vnd.ms-excel\"\n ],\n [\n \"xlsx\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"\n ],\n [\n \"xml\",\n \"application/xml\"\n ],\n [\n \"xul\",\n \"application/vnd.mozilla.xul+xml\"\n ],\n [\n \"zip\",\n \"application/zip\"\n ],\n [\n \"7z\",\n \"application/x-7z-compressed\"\n ],\n // Others\n [\n \"mkv\",\n \"video/x-matroska\"\n ],\n [\n \"mov\",\n \"video/quicktime\"\n ],\n [\n \"msg\",\n \"application/vnd.ms-outlook\"\n ]\n]);\nconst $f31161edf38949e9$var$FILES_TO_IGNORE = [\n // Thumbnail cache files for macOS and Windows\n \".DS_Store\",\n \"Thumbs.db\" // Windows\n];\n/**\n * Adds a `type` property to the file object if it doesn't have one and the file has an extension.\n * This is needed because Firefox doesn't add a type property to files dragged from the desktop.\n * @bug https://bugzilla.mozilla.org/show_bug.cgi?id=1424689\n *\n * @param {File} file - The file object to add the type property to.\n * @returns {File} - The file object with the type property added.\n */ const $f31161edf38949e9$var$toFileWithMimeType = (file)=>{\n const { name: name } = file;\n const hasExtension = name && name.lastIndexOf(\".\") !== -1;\n if (hasExtension && !file.type) {\n const extension = (name.split(\".\").pop() || \"\").toLowerCase();\n const type = $f31161edf38949e9$var$COMMON_MIME_TYPES.get(extension);\n if (type) Object.defineProperty(file, \"type\", {\n value: type,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n return file;\n};\n/**\n * Adds a `path` property to the file object if it doesn't have one.\n * If `path` is not provided, the `webkitRelativePath` property of the file will be used\n * or the file's name if `webkitRelativePath` is not available.\n *\n * @param {File} file - The file object to add the path property to.\n * @param {string} [path] - The path to set on the file object.\n * @returns {File} - The file object with the path property added.\n */ const $f31161edf38949e9$var$toFileWithPath = (file, path)=>{\n const fileWithMimeType = $f31161edf38949e9$var$toFileWithMimeType(file);\n // @ts-ignore\n if (typeof fileWithMimeType.path !== \"string\") {\n const { webkitRelativePath: webkitRelativePath } = file;\n Object.defineProperty(fileWithMimeType, \"path\", {\n value: typeof path === \"string\" ? path : webkitRelativePath || file.name,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n return fileWithMimeType;\n};\n/**\n * Wrap `FileSystemDirectoryReader.readEntries` in a promise to make working with read entries easier.\n * https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */ const $f31161edf38949e9$var$readEntriesPromise = async (directoryReader)=>{\n return await new Promise((resolve, reject)=>{\n directoryReader.readEntries(resolve, reject);\n });\n};\n/**\n * Read all entries in a directory or sub-directory\n * by calling `readEntries` until it returns an empty array.\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */ const $f31161edf38949e9$var$readAllDirectoryEntries = async (directoryReader)=>{\n const entries = [];\n let readEntries = await $f31161edf38949e9$var$readEntriesPromise(directoryReader);\n while(readEntries.length > 0){\n entries.push(...readEntries);\n readEntries = await $f31161edf38949e9$var$readEntriesPromise(directoryReader);\n }\n return entries;\n};\n/**\n * Get a `File` object from a `FileSystemFileEntry` object.\n *\n * @param {FileSystemFileEntry} fileEntry - The file entry to get a `File` object from.\n * @returns {Promise<File>} - A promise that resolves with a `File` object.\n */ const $f31161edf38949e9$var$getFileFromFileEntry = (fileEntry)=>{\n return new Promise((resolve, reject)=>{\n fileEntry.file((file)=>resolve($f31161edf38949e9$var$toFileWithPath(file, fileEntry.fullPath)), reject);\n });\n};\n/**\n * Get an array of `File` objects from a `DataTransferItemList` object.\n *\n * @param {DataTransferItemList} dataTransferItemList - The item list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */ const $f31161edf38949e9$var$getFilesFromDataTransferItemList = async (dataTransferItemList)=>{\n const files = [];\n // Chromium browsers read only 100 files at a time as per the spec, so we need to use\n // BFS (Breadth-first search) to traverse the entire directory/file structure.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#javascript_content\n const queue = [];\n for (const item of dataTransferItemList){\n if (item.kind !== \"file\") continue;\n // https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry\n // This function is implemented as `webkitGetAsEntry()` in non-WebKit browsers\n // including Firefox at this time but it may be renamed to `getAsEntry()` in the future.\n // @ts-ignore\n const entry = item.getAsEntry ? item.getAsEntry() : item.webkitGetAsEntry();\n queue.push(entry);\n }\n while(queue.length > 0){\n const entry = queue.shift();\n if (!entry) continue;\n else if (entry.isFile) {\n const file = await $f31161edf38949e9$var$getFileFromFileEntry(entry);\n if ($f31161edf38949e9$var$FILES_TO_IGNORE.indexOf(file.name) === -1) files.push(file);\n } else if (entry.isDirectory) queue.push(...await $f31161edf38949e9$var$readAllDirectoryEntries(entry.createReader()));\n }\n return files;\n};\n/**\n * Get an array of `File` objects from a `FileList` object.\n *\n * @param {FileList} fileList - The file list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */ const $f31161edf38949e9$var$getFilesFromFileList = async (fileList)=>{\n const files = [];\n for (const file of fileList)if ($f31161edf38949e9$var$FILES_TO_IGNORE.indexOf(file.name) === -1) files.push($f31161edf38949e9$var$toFileWithPath(file));\n return files;\n};\nconst $f31161edf38949e9$export$6d52664cd15c442 = async (evt)=>{\n if (evt.dataTransfer) return evt.dataTransfer.items ? await $f31161edf38949e9$var$getFilesFromDataTransferItemList(evt.dataTransfer.items) : await $f31161edf38949e9$var$getFilesFromFileList(evt.dataTransfer.files);\n return await $f31161edf38949e9$var$getFilesFromFileList(evt.target.files);\n};\n\n\nconst $862aa3736b0514bc$var$COMPONENT_NAME = \"files-dropzone\";\nconst $862aa3736b0514bc$var$TOO_MANY_FILES = \"TOO_MANY_FILES\";\nconst $862aa3736b0514bc$var$FILE_TOO_LARGE = \"FILE_TOO_LARGE\";\nconst $862aa3736b0514bc$var$FILE_TOO_SMALL = \"FILE_TOO_SMALL\";\nconst $862aa3736b0514bc$var$INVALID_MIME_TYPE = \"INVALID_MIME_TYPE\";\nconst $862aa3736b0514bc$var$template = document.createElement(\"template\");\nconst $862aa3736b0514bc$var$styles = /* css */ `\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #6c757d;\n --dropzone-border-color-dragover: #0d6efd;\n --dropzone-border-color-hover: var(--dropzone-border-color-dragover);\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-background-color-hover: var(--dropzone-background-color-dragover);\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n --dropzone-body-color-hover: var(--dropzone-body-color-dragover);\n --dropzone-focus-shadow-rgb: 49,132,253;\n --dropzone-focus-box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);\n --transition-duration: 0.2s; /* for backwards compatibility */\n --dropzone-transition-duration: var(--transition-duration);\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border var(--dropzone-transition-duration) ease-in-out, background-color var(--dropzone-transition-duration) ease-in-out, color var(--dropzone-transition-duration) ease-in-out, box-shadow var(--dropzone-transition-duration) ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone:focus-visible {\n outline: none;\n box-shadow: var(--dropzone-focus-box-shadow);\n }\n\n @media (hover: hover) {\n :host(:not([no-style]):not([disabled])) .dropzone:not(.dropzone--dragover):hover {\n border-color: var(--dropzone-border-color-hover);\n background-color: var(--dropzone-background-color-hover);\n color: var(--dropzone-body-color-hover);\n }\n }\n`;\n$862aa3736b0514bc$var$template.innerHTML = /* html */ `\n <style>\n ${$862aa3736b0514bc$var$styles}\n </style>\n\n <input type=\"file\" id=\"fileInput\" hidden>\n\n <div part=\"dropzone\" class=\"dropzone\" id=\"dropzoneEl\" tabindex=\"0\" role=\"presentation\">\n <slot>Drag 'n' drop files here, or click to select files</slot>\n </div>\n`;\n/**\n * @summary A custom element that allows users to drag and drop files into it.\n * @documentation https://github.com/georapbox/files-dropzone-element\n *\n * @tagname files-dropzone - This is the default tag name, unless overridden by the `defineCustomElement` method.\n *\n * @property {string} accept - A comma-separated list of unique file type specifiers describing file types to allow.\n * @property {boolean} disabled - Determines whether the dropzone is disabled.\n * @property {number} maxFiles - The maximum number of files allowed to be dropped.\n * @property {number} maxSize - The maximum file size allowed in bytes.\n * @property {number} minSize - The minimum file size allowed in bytes.\n * @property {boolean} multiple - Allows multiple files to be dropped.\n * @property {boolean} noClick - Prevents the file dialog from opening when the dropzone is clicked.\n * @property {boolean} noDrag - Prevents the dropzone from reacting to drag events.\n * @property {boolean} noKeyboard - Prevents the dropzone from reacting to keyboard events.\n * @property {boolean} autoFocus - Automatically focuses the dropzone when it's connected to the DOM.\n * @property {boolean} noStyle - Prevents the dropzone from applying any styling.\n *\n * @attribute {string} accept - Reflects the accept property.\n * @attribute {boolean} disabled - Reflects the disabled property.\n * @attribute {number} max-files - Reflects the maxFiles property.\n * @attribute {number} max-size - Reflects the maxSize property.\n * @attribute {number} min-size - Reflects the minSize property.\n * @attribute {boolean} multiple - Reflects the multiple property.\n * @attribute {boolean} no-click - Reflects the noClick property.\n * @attribute {boolean} no-drag - Reflects the noDrag property.\n * @attribute {boolean} no-keyboard - Reflects the noKeyboard property.\n * @attribute {boolean} auto-focus - Reflects the autoFocus property.\n * @attribute {boolean} no-style - Reflects the noStyle property.\n *\n * @slot - The default slot content of the dropzone.\n *\n * @csspart dropzone - The dropzone element.\n * @csspart dropzone--dragover - The state of the dropzone when dragging over it.\n *\n * @cssproperty --dropzone-border-width - The border width of the dropzone.\n * @cssproperty --dropzone-border-style - The border style of the dropzone.\n * @cssproperty --dropzone-border-radius - The border radius of the dropzone.\n * @cssproperty --dropzone-border-color - The border color of the dropzone.\n * @cssproperty --dropzone-border-color-dragover - The border color of the dropzone when dragging over it.\n * @cssproperty --dropzone-border-color-hover - The border color of the dropzone when hovering over it.\n * @cssproperty --dropzone-background-color - The background color of the dropzone.\n * @cssproperty --dropzone-background-color-dragover - The background color of the dropzone when dragging over it.\n * @cssproperty --dropzone-background-color-hover - The background color of the dropzone when hovering over it.\n * @cssproperty --dropzone-body-color - The text color of the dropzone.\n * @cssproperty --dropzone-body-color-dragover - The text color of the dropzone when dragging over it.\n * @cssproperty --dropzone-body-color-hover - The text color of the dropzone when hovering over it.\n * @cssproperty --dropzone-focus-shadow-rgb - The RGB value of the dropzone's focus shadow.\n * @cssproperty --dropzone-focus-box-shadow - The box shadow of the dropzone when focused.\n * @cssproperty --dropzone-transition-duration - The transition's duration for the dropzone area.\n *\n * @event files-dropzone-drop - Fired when files are dropped.\n * @event files-dropzone-drop-accepted - Fired when files dropped files are accepted.\n * @event files-dropzone-drop-rejected - Fired when files dropped files are rejected.\n * @event files-dropzone-dragenter - Fired when files are dragged into the dropzone.\n * @event files-dropzone-dragover - Fired when files are dragged over the dropzone.\n * @event files-dropzone-dragleave - Fired when files are dragged out of the dropzone.\n * @event files-dropzone-error - Fired when there is any error in the process of reading dropped files or directories.\n *\n * @method defineCustomElement - Static method. Defines a custom element with the given name.\n * @method openFileDialog - Instance method. Opens the file dialog programmatically.\n */ class $862aa3736b0514bc$export$6ccd1735166caad9 extends HTMLElement {\n /** @type {Nullable<HTMLInputElement>} */ #fileInput = null;\n /** @type {Nullable<HTMLElement>} */ #dropzoneEl = null;\n constructor(){\n super();\n if (!this.shadowRoot) {\n const shadowRoot = this.attachShadow({\n mode: \"open\"\n });\n shadowRoot.appendChild($862aa3736b0514bc$var$template.content.cloneNode(true));\n }\n if (this.shadowRoot) {\n this.#fileInput = /** @type {Nullable<HTMLInputElement>} */ this.shadowRoot.getElementById(\"fileInput\");\n this.#dropzoneEl = this.shadowRoot.getElementById(\"dropzoneEl\");\n }\n }\n static get observedAttributes() {\n return [\n \"accept\",\n \"disabled\",\n \"multiple\",\n \"no-keyboard\"\n ];\n }\n /**\n * Lifecycle method that is called when attributes are changed, added, removed, or replaced.\n *\n * @param {string} name - The name of the attribute.\n * @param {string} oldValue - The old value of the attribute.\n * @param {string} newValue - The new value of the attribute.\n */ attributeChangedCallback(name, oldValue, newValue) {\n if (name === \"accept\" && oldValue !== newValue && this.#fileInput) this.#fileInput.accept = this.accept;\n if (name === \"disabled\" && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.disabled = this.disabled;\n if (this.disabled) this.#dropzoneEl?.removeAttribute(\"tabindex\");\n else this.#dropzoneEl?.setAttribute(\"tabindex\", \"0\");\n }\n if (name === \"multiple\" && oldValue !== newValue && this.#fileInput) this.#fileInput.multiple = this.multiple;\n if (name === \"no-keyboard\" && oldValue !== newValue && this.#dropzoneEl) {\n if (this.noKeyboard) this.#dropzoneEl.removeAttribute(\"tabindex\");\n else this.#dropzoneEl.setAttribute(\"tabindex\", \"0\");\n }\n }\n /**\n * Lifecycle method that is called when the element is added to the DOM.\n */ connectedCallback() {\n this.#upgradeProperty(\"accept\");\n this.#upgradeProperty(\"disabled\");\n this.#upgradeProperty(\"maxFiles\");\n this.#upgradeProperty(\"maxSize\");\n this.#upgradeProperty(\"minSize\");\n this.#upgradeProperty(\"multiple\");\n this.#upgradeProperty(\"noClick\");\n this.#upgradeProperty(\"noDrag\");\n this.#upgradeProperty(\"noKeyboard\");\n this.#upgradeProperty(\"autoFocus\");\n this.#upgradeProperty(\"noStyle\");\n this.#fileInput?.addEventListener(\"change\", this.#handleFileInputChange);\n this.#dropzoneEl?.addEventListener(\"dragenter\", this.#handleDragEnter);\n this.#dropzoneEl?.addEventListener(\"dragover\", this.#handleDragOver);\n this.#dropzoneEl?.addEventListener(\"dragleave\", this.#handleDragLeave);\n this.#dropzoneEl?.addEventListener(\"drop\", this.#handleDrop);\n this.#dropzoneEl?.addEventListener(\"click\", this.#handleClick);\n this.#dropzoneEl?.addEventListener(\"keyup\", this.#handleKeyUp);\n this.autoFocus && this.#dropzoneEl?.focus();\n }\n /**\n * Lifecycle method that is called when the element is removed from the DOM.\n */ disconnectedCallback() {\n this.#fileInput?.removeEventListener(\"change\", this.#handleFileInputChange);\n this.#dropzoneEl?.removeEventListener(\"dragenter\", this.#handleDragEnter);\n this.#dropzoneEl?.removeEventListener(\"dragover\", this.#handleDragOver);\n this.#dropzoneEl?.removeEventListener(\"dragleave\", this.#handleDragLeave);\n this.#dropzoneEl?.removeEventListener(\"drop\", this.#handleDrop);\n this.#dropzoneEl?.removeEventListener(\"click\", this.#handleClick);\n this.#dropzoneEl?.removeEventListener(\"keyup\", this.#handleKeyUp);\n }\n /**\n * @type {string} - A comma-separated list of unique file type specifiers describing file types to allow.\n * @attribute accept - Reflects the accept property.\n */ get accept() {\n return this.getAttribute(\"accept\") || \"\";\n }\n set accept(value) {\n this.setAttribute(\"accept\", value != null ? value.toString() : value);\n }\n /**\n * @type {boolean} - Determines whether the dropzone is disabled.\n * @default false\n * @attribute disabled - Reflects the disabled property.\n */ get disabled() {\n return this.hasAttribute(\"disabled\");\n }\n set disabled(value) {\n this.toggleAttribute(\"disabled\", !!value);\n }\n /**\n * @type {number} - The maximum number of files allowed to be dropped.\n * @default Infinity\n * @attribute max-files - Reflects the maxFiles property.\n */ get maxFiles() {\n const num = Number(this.getAttribute(\"max-files\")) || 0;\n if (num <= 0) return Infinity;\n return Math.floor(Math.abs(num));\n }\n set maxFiles(value) {\n this.setAttribute(\"max-files\", value != null ? value.toString() : value);\n }\n /**\n * @type {number} - The maximum file size allowed in bytes.\n * @default Infinity\n * @attribute max-size - Reflects the maxSize property.\n */ get maxSize() {\n const value = this.getAttribute(\"max-size\");\n if (value === null) return Infinity;\n const num = Number(value);\n return Number.isNaN(num) ? Infinity : num;\n }\n set maxSize(value) {\n this.setAttribute(\"max-size\", value != null ? value.toString() : value);\n }\n /**\n * @type {number} - The minimum file size allowed in bytes.\n * @default 0\n * @attribute min-size - Reflects the minSize property.\n */ get minSize() {\n const value = this.getAttribute(\"min-size\");\n if (value === null) return 0;\n const num = Number(value);\n return Number.isNaN(num) ? 0 : num;\n }\n set minSize(value) {\n this.setAttribute(\"min-size\", value != null ? value.toString() : value);\n }\n /**\n * @type {boolean} - Allows multiple files to be dropped.\n * @default false\n * @attribute multiple - Reflects the multiple property.\n */ get multiple() {\n return this.hasAttribute(\"multiple\");\n }\n set multiple(value) {\n this.toggleAttribute(\"multiple\", !!value);\n }\n /**\n * @type {boolean} - Prevents the file dialog from opening when the dropzone is clicked.\n * @default false\n * @attribute no-click - Reflects the noClick property.\n */ get noClick() {\n return this.hasAttribute(\"no-click\");\n }\n set noClick(value) {\n this.toggleAttribute(\"no-click\", !!value);\n }\n /**\n * @type {boolean} - Prevents the dropzone from reacting to drag events.\n * @default false\n * @attribute no-drag - Reflects the noDrag property.\n */ get noDrag() {\n return this.hasAttribute(\"no-drag\");\n }\n set noDrag(value) {\n this.toggleAttribute(\"no-drag\", !!value);\n }\n /**\n * @type {boolean} - Prevents the dropzone from reacting to keyboard events.\n * @default false\n * @attribute no-keyboard - Reflects the noKeyboard property.\n */ get noKeyboard() {\n return this.hasAttribute(\"no-keyboard\");\n }\n set noKeyboard(value) {\n this.toggleAttribute(\"no-keyboard\", !!value);\n }\n /**\n * @type {boolean} - Automatically focuses the dropzone when it's connected to the DOM.\n * @default false\n * @attribute auto-focus - Reflects the autoFocus property.\n */ get autoFocus() {\n return this.hasAttribute(\"auto-focus\");\n }\n set autoFocus(value) {\n this.toggleAttribute(\"auto-focus\", !!value);\n }\n /**\n * @type {boolean} - Prevents the dropzone from applying any styling.\n * @default false\n * @attribute no-style - Reflects the noStyle property.\n */ get noStyle() {\n return this.hasAttribute(\"no-style\");\n }\n set noStyle(value) {\n this.toggleAttribute(\"no-style\", !!value);\n }\n /**\n * Handles the change event of the file input.\n *\n * @param {*} evt - The event object.\n */ #handleFileInputChange = async (evt)=>{\n try {\n this.#handleFilesSelect(await (0, $f31161edf38949e9$export$6d52664cd15c442)(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: {\n error: error\n }\n }));\n }\n };\n /**\n * Handles the dragenter event of the dropzone.\n */ #handleDragEnter = ()=>{\n if (this.disabled || this.noDrag) return;\n this.dispatchEvent(new Event(`${$862aa3736b0514bc$var$COMPONENT_NAME}-dragenter`, {\n bubbles: true,\n composed: true\n }));\n };\n /**\n * Handles the dragover event of the dropzone.\n *\n * @param {*} evt - The event object.\n */ #handleDragOver = (evt)=>{\n evt.preventDefault();\n if (this.disabled || this.noDrag) {\n evt.dataTransfer.dropEffect = \"none\";\n return;\n }\n evt.dataTransfer.dropEffect = \"copy\";\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.add(\"dropzone--dragover\");\n this.#dropzoneEl.part.add(\"dropzone--dragover\");\n }\n this.dispatchEvent(new Event(`${$862aa3736b0514bc$var$COMPONENT_NAME}-dragover`, {\n bubbles: true,\n composed: true\n }));\n };\n /**\n * Handles the dragleave event of the dropzone.\n */ #handleDragLeave = ()=>{\n if (this.disabled || this.noDrag) return;\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove(\"dropzone--dragover\");\n this.#dropzoneEl.part.remove(\"dropzone--dragover\");\n }\n this.dispatchEvent(new Event(`${$862aa3736b0514bc$var$COMPONENT_NAME}-dragleave`, {\n bubbles: true,\n composed: true\n }));\n };\n /**\n * Handles the drop event of the dropzone.\n *\n * @param {*} evt - The event object.\n */ #handleDrop = async (evt)=>{\n if (this.disabled || this.noDrag) return;\n evt.preventDefault();\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove(\"dropzone--dragover\");\n this.#dropzoneEl.part.remove(\"dropzone--dragover\");\n }\n try {\n this.#handleFilesSelect(await (0, $f31161edf38949e9$export$6d52664cd15c442)(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: {\n error: error\n }\n }));\n }\n };\n /**\n * Handles the click event of the dropzone.\n */ #handleClick = ()=>{\n if (this.disabled || this.noClick) return;\n this.#fileInput?.click();\n };\n /**\n * Handles the keyup event of the dropzone.\n *\n * @param {*} evt - The event object.\n */ #handleKeyUp = (evt)=>{\n if (this.disabled || this.noKeyboard) return;\n if (evt.key === \" \" || evt.key === \"Enter\") this.#fileInput?.click();\n };\n /**\n * Handles the selection of files.\n *\n * @param {File[]} files - The files to handle.\n */ #handleFilesSelect(files) {\n if (!Array.isArray(files) || !files.length) return;\n const acceptedFiles = [];\n const rejectedFiles = [];\n const filesLength = files.length;\n // If the component is not in multiple mode, reject all files.\n if (!this.multiple && filesLength > 1) for (const file of files)rejectedFiles.push({\n file: file,\n errors: [\n {\n code: $862aa3736b0514bc$var$TOO_MANY_FILES,\n message: `Too many files selected. Only 1 file is allowed.`\n }\n ]\n });\n else if (this.multiple && filesLength > this.maxFiles) // If the component is in multiple mode, but the number of files exceeds\n // the maxFiles attribute, reject all files.\n for (const file of files)rejectedFiles.push({\n file: file,\n errors: [\n {\n code: $862aa3736b0514bc$var$TOO_MANY_FILES,\n message: `Too many files selected. Only ${this.maxFiles} ${this.maxFiles > 1 ? \"files are\" : \"file is\"} allowed.`\n }\n ]\n });\n else // Validate each file. If it's valid, add it to the accepted files array,\n // otherwise add it to the rejected files array.\n for (const file of files){\n const fileHasValidType = (0, $38f222170fd4d21a$export$7c47054fed488f80)(file, this.accept);\n const fileExceedsMaxSize = file.size > this.maxSize;\n const fileIsSmallerThanMinSize = file.size < this.minSize;\n if (fileHasValidType && !fileExceedsMaxSize && !fileIsSmallerThanMinSize) acceptedFiles.push(file);\n else {\n const errors = [];\n if (!fileHasValidType) errors.push({\n code: $862aa3736b0514bc$var$INVALID_MIME_TYPE,\n message: `File type \"${file.type}\" is not accepted.`\n });\n if (fileExceedsMaxSize) errors.push({\n code: $862aa3736b0514bc$var$FILE_TOO_LARGE,\n message: `File size ${file.size} exceeds the maximum size of ${this.maxSize}.`\n });\n if (fileIsSmallerThanMinSize) errors.push({\n code: $862aa3736b0514bc$var$FILE_TOO_SMALL,\n message: `File size ${file.size} is smaller than the minimum size of ${this.minSize}.`\n });\n rejectedFiles.push({\n file: file,\n errors: errors\n });\n }\n }\n this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-drop`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles: acceptedFiles,\n rejectedFiles: rejectedFiles\n }\n }));\n if (acceptedFiles.length > 0) this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-drop-accepted`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles: acceptedFiles\n }\n }));\n if (rejectedFiles.length > 0) this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-drop-rejected`, {\n bubbles: true,\n composed: true,\n detail: {\n rejectedFiles: rejectedFiles\n }\n }));\n if (this.#fileInput) this.#fileInput.value = this.#fileInput.defaultValue;\n }\n /**\n * Opens the file dialog programmatically.\n */ openFileDialog() {\n if (this.disabled) return;\n this.#fileInput?.click();\n }\n /**\n * This is to safe guard against cases where, for instance, a framework may have added the element to the page and set a\n * value on one of its properties, but lazy loaded its definition. Without this guard, the upgraded element would miss that\n * property and the instance property would prevent the class property setter from ever being called.\n *\n * https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n *\n * @param {'accept' | 'disabled' | 'maxFiles' | 'maxSize' | 'minSize' | 'multiple' | 'noClick' | 'noDrag' | 'noKeyboard' | 'autoFocus' | 'noStyle'} prop - The property name to upgrade.\n */ #upgradeProperty(prop) {\n /** @type {any} */ const instance = this;\n if (Object.prototype.hasOwnProperty.call(instance, prop)) {\n const value = instance[prop];\n delete instance[prop];\n instance[prop] = value;\n }\n }\n /**\n * Defines a custom element with the given name.\n * The name must contain a dash (-).\n *\n * @param {string} [elementName='files-dropzone'] - The name of the custom element.\n * @example\n *\n * FilesDropzone.defineCustomElement('my-dropzone');\n */ static defineCustomElement(elementName = $862aa3736b0514bc$var$COMPONENT_NAME) {\n if (typeof window !== \"undefined\" && !window.customElements.get(elementName)) window.customElements.define(elementName, $862aa3736b0514bc$export$6ccd1735166caad9);\n }\n}\n\n\n(0, $862aa3736b0514bc$export$6ccd1735166caad9).defineCustomElement();\n\n\nexport {$862aa3736b0514bc$export$6ccd1735166caad9 as FilesDropzone};\n//# sourceMappingURL=files-dropzone-defined.js.map\n","import { FilesDropzone } from './files-dropzone.js';\n\nFilesDropzone.defineCustomElement();\n\nexport { FilesDropzone };\n","// @ts-check\n\n/**\n * Represents a value that may be of type T, or null.\n *\n * @template T\n * @typedef {T | null} Nullable\n */\n\nimport { isValidFile } from './utils/is-valid-file.js';\nimport { getFilesFromEvent } from './utils/files-selector.js';\n\nconst COMPONENT_NAME = 'files-dropzone';\nconst TOO_MANY_FILES = 'TOO_MANY_FILES';\nconst FILE_TOO_LARGE = 'FILE_TOO_LARGE';\nconst FILE_TOO_SMALL = 'FILE_TOO_SMALL';\nconst INVALID_MIME_TYPE = 'INVALID_MIME_TYPE';\nconst template = document.createElement('template');\n\nconst styles = /* css */`\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #6c757d;\n --dropzone-border-color-dragover: #0d6efd;\n --dropzone-border-color-hover: var(--dropzone-border-color-dragover);\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-background-color-hover: var(--dropzone-background-color-dragover);\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n --dropzone-body-color-hover: var(--dropzone-body-color-dragover);\n --dropzone-focus-shadow-rgb: 49,132,253;\n --dropzone-focus-box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);\n --transition-duration: 0.2s; /* for backwards compatibility */\n --dropzone-transition-duration: var(--transition-duration);\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border var(--dropzone-transition-duration) ease-in-out, background-color var(--dropzone-transition-duration) ease-in-out, color var(--dropzone-transition-duration) ease-in-out, box-shadow var(--dropzone-transition-duration) ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone:focus-visible {\n outline: none;\n box-shadow: var(--dropzone-focus-box-shadow);\n }\n\n @media (hover: hover) {\n :host(:not([no-style]):not([disabled])) .dropzone:not(.dropzone--dragover):hover {\n border-color: var(--dropzone-border-color-hover);\n background-color: var(--dropzone-background-color-hover);\n color: var(--dropzone-body-color-hover);\n }\n }\n`;\n\ntemplate.innerHTML = /* html */`\n <style>\n ${styles}\n </style>\n\n <input type=\"file\" id=\"fileInput\" hidden>\n\n <div part=\"dropzone\" class=\"dropzone\" id=\"dropzoneEl\" tabindex=\"0\" role=\"presentation\">\n <slot>Drag 'n' drop files here, or click to select files</slot>\n </div>\n`;\n\n/**\n * @summary A custom element that allows users to drag and drop files into it.\n * @documentation https://github.com/georapbox/files-dropzone-element\n *\n * @tagname files-dropzone - This is the default tag name, unless overridden by the `defineCustomElement` method.\n *\n * @property {string} accept - A comma-separated list of unique file type specifiers describing file types to allow.\n * @property {boolean} disabled - Determines whether the dropzone is disabled.\n * @property {number} maxFiles - The maximum number of files allowed to be dropped.\n * @property {number} maxSize - The maximum file size allowed in bytes.\n * @property {number} minSize - The minimum file size allowed in bytes.\n * @property {boolean} multiple - Allows multiple files to be dropped.\n * @property {boolean} noClick - Prevents the file dialog from opening when the dropzone is clicked.\n * @property {boolean} noDrag - Prevents the dropzone from reacting to drag events.\n * @property {boolean} noKeyboard - Prevents the dropzone from reacting to keyboard events.\n * @property {boolean} autoFocus - Automatically focuses the dropzone when it's connected to the DOM.\n * @property {boolean} noStyle - Prevents the dropzone from applying any styling.\n *\n * @attribute {string} accept - Reflects the accept property.\n * @attribute {boolean} disabled - Reflects the disabled property.\n * @attribute {number} max-files - Reflects the maxFiles property.\n * @attribute {number} max-size - Reflects the maxSize property.\n * @attribute {number} min-size - Reflects the minSize property.\n * @attribute {boolean} multiple - Reflects the multiple property.\n * @attribute {boolean} no-click - Reflects the noClick property.\n * @attribute {boolean} no-drag - Reflects the noDrag property.\n * @attribute {boolean} no-keyboard - Reflects the noKeyboard property.\n * @attribute {boolean} auto-focus - Reflects the autoFocus property.\n * @attribute {boolean} no-style - Reflects the noStyle property.\n *\n * @slot - The default slot content of the dropzone.\n *\n * @csspart dropzone - The dropzone element.\n * @csspart dropzone--dragover - The state of the dropzone when dragging over it.\n *\n * @cssproperty --dropzone-border-width - The border width of the dropzone.\n * @cssproperty --dropzone-border-style - The border style of the dropzone.\n * @cssproperty --dropzone-border-radius - The border radius of the dropzone.\n * @cssproperty --dropzone-border-color - The border color of the dropzone.\n * @cssproperty --dropzone-border-color-dragover - The border color of the dropzone when dragging over it.\n * @cssproperty --dropzone-border-color-hover - The border color of the dropzone when hovering over it.\n * @cssproperty --dropzone-background-color - The background color of the dropzone.\n * @cssproperty --dropzone-background-color-dragover - The background color of the dropzone when dragging over it.\n * @cssproperty --dropzone-background-color-hover - The background color of the dropzone when hovering over it.\n * @cssproperty --dropzone-body-color - The text color of the dropzone.\n * @cssproperty --dropzone-body-color-dragover - The text color of the dropzone when dragging over it.\n * @cssproperty --dropzone-body-color-hover - The text color of the dropzone when hovering over it.\n * @cssproperty --dropzone-focus-shadow-rgb - The RGB value of the dropzone's focus shadow.\n * @cssproperty --dropzone-focus-box-shadow - The box shadow of the dropzone when focused.\n * @cssproperty --dropzone-transition-duration - The transition's duration for the dropzone area.\n *\n * @event files-dropzone-drop - Fired when files are dropped.\n * @event files-dropzone-drop-accepted - Fired when files dropped files are accepted.\n * @event files-dropzone-drop-rejected - Fired when files dropped files are rejected.\n * @event files-dropzone-dragenter - Fired when files are dragged into the dropzone.\n * @event files-dropzone-dragover - Fired when files are dragged over the dropzone.\n * @event files-dropzone-dragleave - Fired when files are dragged out of the dropzone.\n * @event files-dropzone-error - Fired when there is any error in the process of reading dropped files or directories.\n *\n * @method defineCustomElement - Static method. Defines a custom element with the given name.\n * @method openFileDialog - Instance method. Opens the file dialog programmatically.\n */\nclass FilesDropzone extends HTMLElement {\n /** @type {Nullable<HTMLInputElement>} */\n #fileInput = null;\n\n /** @type {Nullable<HTMLElement>} */\n #dropzoneEl = null;\n\n constructor() {\n super();\n\n if (!this.shadowRoot) {\n const shadowRoot = this.attachShadow({ mode: 'open' });\n shadowRoot.appendChild(template.content.cloneNode(true));\n }\n\n if (this.shadowRoot) {\n this.#fileInput = /** @type {Nullable<HTMLInputElement>} */(this.shadowRoot.getElementById('fileInput'));\n this.#dropzoneEl = this.shadowRoot.getElementById('dropzoneEl');\n }\n }\n\n static get observedAttributes() {\n return ['accept', 'disabled', 'multiple', 'no-keyboard'];\n }\n\n /**\n * Lifecycle method that is called when attributes are changed, added, removed, or replaced.\n *\n * @param {string} name - The name of the attribute.\n * @param {string} oldValue - The old value of the attribute.\n * @param {string} newValue - The new value of the attribute.\n */\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'accept' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.accept = this.accept;\n }\n\n if (name === 'disabled' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.disabled = this.disabled;\n\n if (this.disabled) {\n this.#dropzoneEl?.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl?.setAttribute('tabindex', '0');\n }\n }\n\n if (name === 'multiple' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.multiple = this.multiple;\n }\n\n if (name === 'no-keyboard' && oldValue !== newValue && this.#dropzoneEl) {\n if (this.noKeyboard) {\n this.#dropzoneEl.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl.setAttribute('tabindex', '0');\n }\n }\n }\n\n /**\n * Lifecycle method that is called when the element is added to the DOM.\n */\n connectedCallback() {\n this.#upgradeProperty('accept');\n this.#upgradeProperty('disabled');\n this.#upgradeProperty('maxFiles');\n this.#upgradeProperty('maxSize');\n this.#upgradeProperty('minSize');\n this.#upgradeProperty('multiple');\n this.#upgradeProperty('noClick');\n this.#upgradeProperty('noDrag');\n this.#upgradeProperty('noKeyboard');\n this.#upgradeProperty('autoFocus');\n this.#upgradeProperty('noStyle');\n\n this.#fileInput?.addEventListener('change', this.#handleFileInputChange);\n this.#dropzoneEl?.addEventListener('dragenter', this.#handleDragEnter);\n this.#dropzoneEl?.addEventListener('dragover', this.#handleDragOver);\n this.#dropzoneEl?.addEventListener('dragleave', this.#handleDragLeave);\n this.#dropzoneEl?.addEventListener('drop', this.#handleDrop);\n this.#dropzoneEl?.addEventListener('click', this.#handleClick);\n this.#dropzoneEl?.addEventListener('keyup', this.#handleKeyUp);\n\n this.autoFocus && this.#dropzoneEl?.focus();\n }\n\n /**\n * Lifecycle method that is called when the element is removed from the DOM.\n */\n disconnectedCallback() {\n this.#fileInput?.removeEventListener('change', this.#handleFileInputChange);\n this.#dropzoneEl?.removeEventListener('dragenter', this.#handleDragEnter);\n this.#dropzoneEl?.removeEventListener('dragover', this.#handleDragOver);\n this.#dropzoneEl?.removeEventListener('dragleave', this.#handleDragLeave);\n this.#dropzoneEl?.removeEventListener('drop', this.#handleDrop);\n this.#dropzoneEl?.removeEventListener('click', this.#handleClick);\n this.#dropzoneEl?.removeEventListener('keyup', this.#handleKeyUp);\n }\n\n /**\n * @type {string} - A comma-separated list of unique file type specifiers describing file types to allow.\n * @attribute accept - Reflects the accept property.\n */\n get accept() {\n return this.getAttribute('accept') || '';\n }\n\n set accept(value) {\n this.setAttribute('accept', value != null ? value.toString() : value);\n }\n\n /**\n * @type {boolean} - Determines whether the dropzone is disabled.\n * @default false\n * @attribute disabled - Reflects the disabled property.\n */\n get disabled() {\n return this.hasAttribute('disabled');\n }\n\n set disabled(value) {\n this.toggleAttribute('disabled', !!value);\n }\n\n /**\n * @type {number} - The maximum number of files allowed to be dropped.\n * @default Infinity\n * @attribute max-files - Reflects the maxFiles property.\n */\n get maxFiles() {\n const num = Number(this.getAttribute('max-files')) || 0;\n\n if (num <= 0) {\n return Infinity;\n }\n\n return Math.floor(Math.abs(num));\n }\n\n set maxFiles(value) {\n this.setAttribute('max-files', value != null ? value.toString() : value);\n }\n\n /**\n * @type {number} - The maximum file size allowed in bytes.\n * @default Infinity\n * @attribute max-size - Reflects the maxSize property.\n */\n get maxSize() {\n const value = this.getAttribute('max-size');\n\n if (value === null) {\n return Infinity;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? Infinity : num;\n }\n\n set maxSize(value) {\n this.setAttribute('max-size', value != null ? value.toString() : value);\n }\n\n /**\n * @type {number} - The minimum file size allowed in bytes.\n * @default 0\n * @attribute min-size - Reflects the minSize property.\n */\n get minSize() {\n const value = this.getAttribute('min-size');\n\n if (value === null) {\n return 0;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? 0 : num;\n }\n\n set minSize(value) {\n this.setAttribute('min-size', value != null ? value.toString() : value);\n }\n\n /**\n * @type {boolean} - Allows multiple files to be dropped.\n * @default false\n * @attribute multiple - Reflects the multiple property.\n */\n get multiple() {\n return this.hasAttribute('multiple');\n }\n\n set multiple(value) {\n this.toggleAttribute('multiple', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the file dialog from opening when the dropzone is clicked.\n * @default false\n * @attribute no-click - Reflects the noClick property.\n */\n get noClick() {\n return this.hasAttribute('no-click');\n }\n\n set noClick(value) {\n this.toggleAttribute('no-click', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the dropzone from reacting to drag events.\n * @default false\n * @attribute no-drag - Reflects the noDrag property.\n */\n get noDrag() {\n return this.hasAttribute('no-drag');\n }\n\n set noDrag(value) {\n this.toggleAttribute('no-drag', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the dropzone from reacting to keyboard events.\n * @default false\n * @attribute no-keyboard - Reflects the noKeyboard property.\n */\n get noKeyboard() {\n return this.hasAttribute('no-keyboard');\n }\n\n set noKeyboard(value) {\n this.toggleAttribute('no-keyboard', !!value);\n }\n\n /**\n * @type {boolean} - Automatically focuses the dropzone when it's connected to the DOM.\n * @default false\n * @attribute auto-focus - Reflects the autoFocus property.\n */\n get autoFocus() {\n return this.hasAttribute('auto-focus');\n }\n\n set autoFocus(value) {\n this.toggleAttribute('auto-focus', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the dropzone from applying any styling.\n * @default false\n * @attribute no-style - Reflects the noStyle property.\n */\n get noStyle() {\n return this.hasAttribute('no-style');\n }\n\n set noStyle(value) {\n this.toggleAttribute('no-style', !!value);\n }\n\n /**\n * Handles the change event of the file input.\n *\n * @param {*} evt - The event object.\n */\n #handleFileInputChange = async evt => {\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n /**\n * Handles the dragenter event of the dropzone.\n */\n #handleDragEnter = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragenter`, {\n bubbles: true,\n composed: true\n }));\n };\n\n /**\n * Handles the dragover event of the dropzone.\n *\n * @param {*} evt - The event object.\n */\n #handleDragOver = evt => {\n evt.preventDefault();\n\n if (this.disabled || this.noDrag) {\n evt.dataTransfer.dropEffect = 'none';\n return;\n }\n\n evt.dataTransfer.dropEffect = 'copy';\n\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.add('dropzone--dragover');\n this.#dropzoneEl.part.add('dropzone--dragover');\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragover`, {\n bubbles: true,\n composed: true\n }));\n };\n\n /**\n * Handles the dragleave event of the dropzone.\n */\n #handleDragLeave = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragleave`, {\n bubbles: true,\n composed: true\n }));\n };\n\n /**\n * Handles the drop event of the dropzone.\n *\n * @param {*} evt - The event object.\n */\n #handleDrop = async evt => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n evt.preventDefault();\n\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n }\n\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n /**\n * Handles the click event of the dropzone.\n */\n #handleClick = () => {\n if (this.disabled || this.noClick) {\n return;\n }\n\n this.#fileInput?.click();\n };\n\n /**\n * Handles the keyup event of the dropzone.\n *\n * @param {*} evt - The event object.\n */\n #handleKeyUp = evt => {\n if (this.disabled || this.noKeyboard) {\n return;\n }\n\n if (evt.key === ' ' || evt.key === 'Enter') {\n this.#fileInput?.click();\n }\n };\n\n /**\n * Handles the selection of files.\n *\n * @param {File[]} files - The files to handle.\n */\n #handleFilesSelect(files) {\n if (!Array.isArray(files) || !files.length) {\n return;\n }\n\n const acceptedFiles = [];\n const rejectedFiles = [];\n const filesLength = files.length;\n\n // If the component is not in multiple mode, reject all files.\n if (!this.multiple && filesLength > 1) {\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only 1 file is allowed.`\n }]\n });\n }\n } else if (this.multiple && filesLength > this.maxFiles) {\n // If the component is in multiple mode, but the number of files exceeds\n // the maxFiles attribute, reject all files.\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only ${this.maxFiles} ${this.maxFiles > 1 ? 'files are' : 'file is'} allowed.`\n }]\n });\n }\n } else {\n // Validate each file. If it's valid, add it to the accepted files array,\n // otherwise add it to the rejected files array.\n for (const file of files) {\n const fileHasValidType = isValidFile(file, this.accept);\n const fileExceedsMaxSize = file.size > this.maxSize;\n const fileIsSmallerThanMinSize = file.size < this.minSize;\n\n if (fileHasValidType && !fileExceedsMaxSize && !fileIsSmallerThanMinSize) {\n acceptedFiles.push(file);\n } else {\n const errors = [];\n\n if (!fileHasValidType) {\n errors.push({\n code: INVALID_MIME_TYPE,\n message: `File type \"${file.type}\" is not accepted.`\n });\n }\n\n if (fileExceedsMaxSize) {\n errors.push({\n code: FILE_TOO_LARGE,\n message: `File size ${file.size} exceeds the maximum size of ${this.maxSize}.`\n });\n }\n\n if (fileIsSmallerThanMinSize) {\n errors.push({\n code: FILE_TOO_SMALL,\n message: `File size ${file.size} is smaller than the minimum size of ${this.minSize}.`\n });\n }\n\n rejectedFiles.push({ file, errors });\n }\n }\n }\n\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles,\n rejectedFiles\n }\n }));\n\n if (acceptedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-accepted`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles\n }\n }));\n }\n\n if (rejectedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-rejected`, {\n bubbles: true,\n composed: true,\n detail: {\n rejectedFiles\n }\n }));\n }\n\n if (this.#fileInput) {\n this.#fileInput.value = this.#fileInput.defaultValue;\n }\n }\n\n /**\n * Opens the file dialog programmatically.\n */\n openFileDialog() {\n if (this.disabled) {\n return;\n }\n\n this.#fileInput?.click();\n }\n\n /**\n * This is to safe guard against cases where, for instance, a framework may have added the element to the page and set a\n * value on one of its properties, but lazy loaded its definition. Without this guard, the upgraded element would miss that\n * property and the instance property would prevent the class property setter from ever being called.\n *\n * https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n *\n * @param {'accept' | 'disabled' | 'maxFiles' | 'maxSize' | 'minSize' | 'multiple' | 'noClick' | 'noDrag' | 'noKeyboard' | 'autoFocus' | 'noStyle'} prop - The property name to upgrade.\n */\n #upgradeProperty(prop) {\n /** @type {any} */\n const instance = this;\n\n if (Object.prototype.hasOwnProperty.call(instance, prop)) {\n const value = instance[prop];\n delete instance[prop];\n instance[prop] = value;\n }\n }\n\n /**\n * Defines a custom element with the given name.\n * The name must contain a dash (-).\n *\n * @param {string} [elementName='files-dropzone'] - The name of the custom element.\n * @example\n *\n * FilesDropzone.defineCustomElement('my-dropzone');\n */\n static defineCustomElement(elementName = COMPONENT_NAME) {\n if (typeof window !== 'undefined' && !window.customElements.get(elementName)) {\n window.customElements.define(elementName, FilesDropzone);\n }\n }\n}\n\nexport { FilesDropzone };\n","// @ts-check\n\n/**\n * Checks if a file is valid based on the accepted file type specifiers.\n *\n * @param {File} file - The File object to validate.\n * @param {string} [acceptedTypeSpecifiers=''] - The accepted file type specifiers.\n * @returns {boolean} - True if the file is valid, false otherwise.\n */\nexport function isValidFile(file, acceptedTypeSpecifiers = '') {\n if (!acceptedTypeSpecifiers) {\n return true;\n }\n\n const acceptedMimeTypesList = [\n ...new Set(acceptedTypeSpecifiers.split(',').map(v => v.trim()).filter(Boolean))\n ];\n\n const fileMimeType = file.type;\n const baseMimeType = fileMimeType.replace(/\\/.*$/, '');\n\n for (const validType of acceptedMimeTypesList) {\n if (validType.charAt(0) === '.') {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {\n return true;\n }\n } else if (/\\/\\*$/.test(validType)) {\n // Check for mime type that looks like \"image/*\" or similar.\n if (baseMimeType === validType.replace(/\\/.*$/, '')) {\n return true;\n }\n } else {\n if (fileMimeType === validType) {\n return true;\n }\n }\n }\n\n return false;\n}\n","// @ts-check\n\n/**\n * A map of common file extensions and their associated MIME types.\n */\nconst COMMON_MIME_TYPES = new Map([\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\n ['aac', 'audio/aac'],\n ['abw', 'application/x-abiword'],\n ['arc', 'application/x-freearc'],\n ['avif', 'image/avif'],\n ['avi', 'video/x-msvideo'],\n ['azw', 'application/vnd.amazon.ebook'],\n ['bin', 'application/octet-stream'],\n ['bmp', 'image/bmp'],\n ['bz', 'application/x-bzip'],\n ['bz2', 'application/x-bzip2'],\n ['cda', 'application/x-cdf'],\n ['csh', 'application/x-csh'],\n ['css', 'text/css'],\n ['csv', 'text/csv'],\n ['doc', 'application/msword'],\n ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n ['eot', 'application/vnd.ms-fontobject'],\n ['epub', 'application/epub+zip'],\n ['gz', 'application/gzip'],\n ['gif', 'image/gif'],\n ['heic', 'image/heic'],\n ['heif', 'image/heif'],\n ['htm', 'text/html'],\n ['html', 'text/html'],\n ['ico', 'image/vnd.microsoft.icon'],\n ['ics', 'text/calendar'],\n ['jar', 'application/java-archive'],\n ['jpeg', 'image/jpeg'],\n ['jpg', 'image/jpeg'],\n ['jxl', 'image/jxl'],\n ['js', 'text/javascript'],\n ['json', 'application/json'],\n ['jsonld', 'application/ld+json'],\n ['mid', 'audio/midi'],\n ['midi', 'audio/midi'],\n ['mjs', 'text/javascript'],\n ['mp3', 'audio/mpeg'],\n ['mp4', 'video/mp4'],\n ['mpeg', 'video/mpeg'],\n ['mpkg', 'application/vnd.apple.installer+xml'],\n ['odp', 'application/vnd.oasis.opendocument.presentation'],\n ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],\n ['odt', 'application/vnd.oasis.opendocument.text'],\n ['oga', 'audio/ogg'],\n ['ogv', 'video/ogg'],\n ['ogx', 'application/ogg'],\n ['opus', 'audio/opus'],\n ['otf', 'font/otf'],\n ['png', 'image/png'],\n ['pdf', 'application/pdf'],\n ['php', 'application/x-httpd-php'],\n ['ppt', 'application/vnd.ms-powerpoint'],\n ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],\n ['rar', 'application/vnd.rar'],\n ['rtf', 'application/rtf'],\n ['sh', 'application/x-sh'],\n ['svg', 'image/svg+xml'],\n ['swf', 'application/x-shockwave-flash'],\n ['tar', 'application/x-tar'],\n ['tif', 'image/tiff'],\n ['tiff', 'image/tiff'],\n ['ts', 'video/mp2t'],\n ['ttf', 'font/ttf'],\n ['txt', 'text/plain'],\n ['vsd', 'application/vnd.visio'],\n ['wav', 'audio/wav'],\n ['weba', 'audio/webm'],\n ['webm', 'video/webm'],\n ['webp', 'image/webp'],\n ['woff', 'font/woff'],\n ['woff2', 'font/woff2'],\n ['xhtml', 'application/xhtml+xml'],\n ['xls', 'application/vnd.ms-excel'],\n ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n ['xml', 'application/xml'],\n ['xul', 'application/vnd.mozilla.xul+xml'],\n ['zip', 'application/zip'],\n ['7z', 'application/x-7z-compressed'],\n\n // Others\n ['mkv', 'video/x-matroska'],\n ['mov', 'video/quicktime'],\n ['msg', 'application/vnd.ms-outlook']\n]);\n\nconst FILES_TO_IGNORE = [\n // Thumbnail cache files for macOS and Windows\n '.DS_Store', // macOs\n 'Thumbs.db' // Windows\n];\n\n/**\n * Adds a `type` property to the file object if it doesn't have one and the file has an extension.\n * This is needed because Firefox doesn't add a type property to files dragged from the desktop.\n * @bug https://bugzilla.mozilla.org/show_bug.cgi?id=1424689\n *\n * @param {File} file - The file object to add the type property to.\n * @returns {File} - The file object with the type property added.\n */\nconst toFileWithMimeType = file => {\n const { name } = file;\n const hasExtension = name && name.lastIndexOf('.') !== -1;\n\n if (hasExtension && !file.type) {\n const extension = (name.split('.').pop() || '').toLowerCase();\n const type = COMMON_MIME_TYPES.get(extension);\n\n if (type) {\n Object.defineProperty(file, 'type', {\n value: type,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n }\n\n return file;\n};\n\n/**\n * Adds a `path` property to the file object if it doesn't have one.\n * If `path` is not provided, the `webkitRelativePath` property of the file will be used\n * or the file's name if `webkitRelativePath` is not available.\n *\n * @param {File} file - The file object to add the path property to.\n * @param {string} [path] - The path to set on the file object.\n * @returns {File} - The file object with the path property added.\n */\nconst toFileWithPath = (file, path) => {\n const fileWithMimeType = toFileWithMimeType(file);\n\n // @ts-ignore\n if (typeof fileWithMimeType.path !== 'string') {\n const { webkitRelativePath } = file;\n\n Object.defineProperty(fileWithMimeType, 'path', {\n value: typeof path === 'string' ? path : webkitRelativePath || file.name,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n\n return fileWithMimeType;\n};\n\n/**\n * Wrap `FileSystemDirectoryReader.readEntries` in a promise to make working with read entries easier.\n * https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */\nconst readEntriesPromise = async directoryReader => {\n return await new Promise((resolve, reject) => {\n directoryReader.readEntries(resolve, reject);\n });\n};\n\n/**\n * Read all entries in a directory or sub-directory\n * by calling `readEntries` until it returns an empty array.\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */\nconst readAllDirectoryEntries = async directoryReader => {\n const entries = [];\n let readEntries = await readEntriesPromise(directoryReader);\n\n while (readEntries.length > 0) {\n entries.push(...readEntries);\n readEntries = await readEntriesPromise(directoryReader);\n }\n\n return entries;\n};\n\n/**\n * Get a `File` object from a `FileSystemFileEntry` object.\n *\n * @param {FileSystemFileEntry} fileEntry - The file entry to get a `File` object from.\n * @returns {Promise<File>} - A promise that resolves with a `File` object.\n */\nconst getFileFromFileEntry = fileEntry => {\n return new Promise((resolve, reject) => {\n fileEntry.file(file => resolve(toFileWithPath(file, fileEntry.fullPath)), reject);\n });\n};\n\n/**\n * Get an array of `File` objects from a `DataTransferItemList` object.\n *\n * @param {DataTransferItemList} dataTransferItemList - The item list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromDataTransferItemList = async dataTransferItemList => {\n const files = [];\n\n // Chromium browsers read only 100 files at a time as per the spec, so we need to use\n // BFS (Breadth-first search) to traverse the entire directory/file structure.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#javascript_content\n const queue = [];\n\n for (const item of dataTransferItemList) {\n if (item.kind !== 'file') {\n // Ignore non-file items, such as links.\n continue;\n }\n\n // https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry\n // This function is implemented as `webkitGetAsEntry()` in non-WebKit browsers\n // including Firefox at this time but it may be renamed to `getAsEntry()` in the future.\n // @ts-ignore\n const entry = item.getAsEntry ? item.getAsEntry() : item.webkitGetAsEntry();\n\n queue.push(entry);\n }\n\n while (queue.length > 0) {\n const entry = queue.shift();\n\n if (!entry) {\n continue;\n } else if (entry.isFile) {\n const file = await getFileFromFileEntry(entry);\n\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(file);\n }\n } else if (entry.isDirectory) {\n queue.push(...await readAllDirectoryEntries(entry.createReader()));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from a `FileList` object.\n *\n * @param {FileList} fileList - The file list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromFileList = async fileList => {\n const files = [];\n\n for (const file of fileList) {\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(toFileWithPath(file));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from an event.\n * This function supports both `drop` and `change` events.\n *\n * @param {*} evt - The event to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */\nexport const getFilesFromEvent = async evt => {\n if (evt.dataTransfer) {\n return evt.dataTransfer.items\n ? await getFilesFromDataTransferItemList(evt.dataTransfer.items)\n : await getFilesFromFileList(evt.dataTransfer.files);\n }\n\n return await getFilesFromFileList(evt.target.files);\n};\n"],"names":["Object","defineProperty","get","$862aa3736b0514bc$export$6ccd1735166caad9","set","s","enumerable","configurable","$f31161edf38949e9$var$COMMON_MIME_TYPES","Map","$f31161edf38949e9$var$FILES_TO_IGNORE","$f31161edf38949e9$var$toFileWithMimeType","file","name","hasExtension","lastIndexOf","type","extension","split","pop","toLowerCase","value","writable","$f31161edf38949e9$var$toFileWithPath","path","fileWithMimeType","webkitRelativePath","$f31161edf38949e9$var$readEntriesPromise","directoryReader","Promise","resolve","reject","readEntries","$f31161edf38949e9$var$readAllDirectoryEntries","entries","length","push","$f31161edf38949e9$var$getFileFromFileEntry","fileEntry","fullPath","$f31161edf38949e9$var$getFilesFromDataTransferItemList","dataTransferItemList","files","queue","item","kind","entry","getAsEntry","webkitGetAsEntry","shift","isFile","indexOf","isDirectory","createReader","$f31161edf38949e9$var$getFilesFromFileList","fileList","$f31161edf38949e9$export$6d52664cd15c442","evt","dataTransfer","items","target","$862aa3736b0514bc$var$COMPONENT_NAME","$862aa3736b0514bc$var$TOO_MANY_FILES","$862aa3736b0514bc$var$template","document","createElement","$862aa3736b0514bc$var$styles","innerHTML","HTMLElement","fileInput","dropzoneEl","constructor","shadowRoot","attachShadow","mode","appendChild","content","cloneNode","getElementById","observedAttributes","attributeChangedCallback","oldValue","newValue","accept","disabled","removeAttribute","setAttribute","multiple","noKeyboard","connectedCallback","upgradeProperty","addEventListener","handleFileInputChange","handleDragEnter","handleDragOver","handleDragLeave","handleDrop","handleClick","handleKeyUp","autoFocus","focus","disconnectedCallback","removeEventListener","getAttribute","toString","hasAttribute","toggleAttribute","maxFiles","num","Number","Infinity","Math","floor","abs","maxSize","isNaN","minSize","noClick","noDrag","noStyle","handleFilesSelect","error","dispatchEvent","CustomEvent","bubbles","composed","detail","Event","preventDefault","dropEffect","classList","add","part","remove","click","key","Array","isArray","acceptedFiles","rejectedFiles","filesLength","errors","code","message","fileHasValidType","acceptedTypeSpecifiers","acceptedMimeTypesList","Set","map","v","trim","filter","Boolean","fileMimeType","baseMimeType","replace","validType","charAt","test","fileExceedsMaxSize","size","fileIsSmallerThanMinSize","defaultValue","openFileDialog","prop","prototype","hasOwnProperty","call","instance","defineCustomElement","elementName","window","customElements","define","FilesDropzone"],"version":3,"file":"files-dropzone-defined.js.map"}
1
+ {"mappings":"A,O,c,C,C,E,gB,C,I,W,O,C,E,I,K,E,W,C,E,a,C,C,GIKA,IAAM,EAAoB,IAAI,IAAI,CAEhC,CAAC,MAAO,YAAY,CACpB,CAAC,MAAO,wBAAwB,CAChC,CAAC,MAAO,wBAAwB,CAChC,CAAC,OAAQ,aAAa,CACtB,CAAC,MAAO,kBAAkB,CAC1B,CAAC,MAAO,+BAA+B,CACvC,CAAC,MAAO,2BAA2B,CACnC,CAAC,MAAO,YAAY,CACpB,CAAC,KAAM,qBAAqB,CAC5B,CAAC,MAAO,sBAAsB,CAC9B,CAAC,MAAO,oBAAoB,CAC5B,CAAC,MAAO,oBAAoB,CAC5B,CAAC,MAAO,WAAW,CACnB,CAAC,MAAO,WAAW,CACnB,CAAC,MAAO,qBAAqB,CAC7B,CAAC,OAAQ,0EAA0E,CACnF,CAAC,MAAO,gCAAgC,CACxC,CAAC,OAAQ,uBAAuB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CACF,IAGE,IAAI,CAAC,CAAC,CAAS,EACjB,CAAA,IAAI,CAAC,CAAC,CAAS,CAAC,KAAA,CAAQ,IAAI,CAAC,CAAC,CAAS,CAAC,YAD1C,AAAA,CAGF,CAKA,gBAAiB,CACX,IAAI,CAAC,QAAA,EAIT,IAAI,CAAC,CAAC,CAAS,EAAE,OACnB,CAWA,CAAC,CAAe,CAAC,CAAI,EAInB,GAAI,OAAO,SAAA,CAAU,cAAA,CAAe,IAAA,CAFnB,IAAI,CAE8B,GAAO,CACxD,IAAM,EAAQ,AAHC,IAAI,AAGG,CAAC,EAAK,AAC5B,QAAO,AAJQ,IAAI,AAIJ,CAAC,EAAK,CACrB,AALe,IAAI,AAKX,CAAC,EAAK,CAAG,CACnB,CACF,CAWA,OAAO,oBAAoB,EAAc,CAAc,CAAE,CACjC,aAAlB,OAAO,QAA2B,OAAO,cAAA,CAAe,GAAA,CAAI,IAC9D,OAAO,cAAA,CAAe,MAAA,CAAO,EAAa,EAE9C,CACF,CD1sBA,AAAA,EAAc,mBAAd,U,K,a","sources":["<anon>","src/files-dropzone-defined.js","src/files-dropzone.js","src/utils/is-valid-file.js","src/utils/files-selector.js"],"sourcesContent":["function $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $862aa3736b0514bc$exports = {};\n\n$parcel$export($862aa3736b0514bc$exports, \"FilesDropzone\", function () { return $862aa3736b0514bc$export$6ccd1735166caad9; });\n// @ts-check\n/**\n * Represents a value that may be of type T, or null.\n *\n * @template T\n * @typedef {T | null} Nullable\n */ // @ts-check\n/**\n * Checks if a file is valid based on the accepted file type specifiers.\n *\n * @param {File} file - The File object to validate.\n * @param {string} [acceptedTypeSpecifiers=''] - The accepted file type specifiers.\n * @returns {boolean} - True if the file is valid, false otherwise.\n */ function $38f222170fd4d21a$export$7c47054fed488f80(file, acceptedTypeSpecifiers = \"\") {\n if (!acceptedTypeSpecifiers) return true;\n const acceptedMimeTypesList = [\n ...new Set(acceptedTypeSpecifiers.split(\",\").map((v)=>v.trim()).filter(Boolean))\n ];\n const fileMimeType = file.type;\n const baseMimeType = fileMimeType.replace(/\\/.*$/, \"\");\n for (const validType of acceptedMimeTypesList){\n if (validType.charAt(0) === \".\") {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) return true;\n } else if (/\\/\\*$/.test(validType)) {\n // Check for mime type that looks like \"image/*\" or similar.\n if (baseMimeType === validType.replace(/\\/.*$/, \"\")) return true;\n } else {\n if (fileMimeType === validType) return true;\n }\n }\n return false;\n}\n\n\n// @ts-check\n/**\n * A map of common file extensions and their associated MIME types.\n */ const $f31161edf38949e9$var$COMMON_MIME_TYPES = new Map([\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\n [\n \"aac\",\n \"audio/aac\"\n ],\n [\n \"abw\",\n \"application/x-abiword\"\n ],\n [\n \"arc\",\n \"application/x-freearc\"\n ],\n [\n \"avif\",\n \"image/avif\"\n ],\n [\n \"avi\",\n \"video/x-msvideo\"\n ],\n [\n \"azw\",\n \"application/vnd.amazon.ebook\"\n ],\n [\n \"bin\",\n \"application/octet-stream\"\n ],\n [\n \"bmp\",\n \"image/bmp\"\n ],\n [\n \"bz\",\n \"application/x-bzip\"\n ],\n [\n \"bz2\",\n \"application/x-bzip2\"\n ],\n [\n \"cda\",\n \"application/x-cdf\"\n ],\n [\n \"csh\",\n \"application/x-csh\"\n ],\n [\n \"css\",\n \"text/css\"\n ],\n [\n \"csv\",\n \"text/csv\"\n ],\n [\n \"doc\",\n \"application/msword\"\n ],\n [\n \"docx\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"\n ],\n [\n \"eot\",\n \"application/vnd.ms-fontobject\"\n ],\n [\n \"epub\",\n \"application/epub+zip\"\n ],\n [\n \"gz\",\n \"application/gzip\"\n ],\n [\n \"gif\",\n \"image/gif\"\n ],\n [\n \"heic\",\n \"image/heic\"\n ],\n [\n \"heif\",\n \"image/heif\"\n ],\n [\n \"htm\",\n \"text/html\"\n ],\n [\n \"html\",\n \"text/html\"\n ],\n [\n \"ico\",\n \"image/vnd.microsoft.icon\"\n ],\n [\n \"ics\",\n \"text/calendar\"\n ],\n [\n \"jar\",\n \"application/java-archive\"\n ],\n [\n \"jpeg\",\n \"image/jpeg\"\n ],\n [\n \"jpg\",\n \"image/jpeg\"\n ],\n [\n \"jxl\",\n \"image/jxl\"\n ],\n [\n \"js\",\n \"text/javascript\"\n ],\n [\n \"json\",\n \"application/json\"\n ],\n [\n \"jsonld\",\n \"application/ld+json\"\n ],\n [\n \"markdown\",\n \"text/markdown\"\n ],\n [\n \"md\",\n \"text/markdown\"\n ],\n [\n \"mid\",\n \"audio/midi\"\n ],\n [\n \"midi\",\n \"audio/midi\"\n ],\n [\n \"mjs\",\n \"text/javascript\"\n ],\n [\n \"mp3\",\n \"audio/mpeg\"\n ],\n [\n \"mp4\",\n \"video/mp4\"\n ],\n [\n \"mpeg\",\n \"video/mpeg\"\n ],\n [\n \"mpkg\",\n \"application/vnd.apple.installer+xml\"\n ],\n [\n \"odp\",\n \"application/vnd.oasis.opendocument.presentation\"\n ],\n [\n \"ods\",\n \"application/vnd.oasis.opendocument.spreadsheet\"\n ],\n [\n \"odt\",\n \"application/vnd.oasis.opendocument.text\"\n ],\n [\n \"oga\",\n \"audio/ogg\"\n ],\n [\n \"ogv\",\n \"video/ogg\"\n ],\n [\n \"ogx\",\n \"application/ogg\"\n ],\n [\n \"opus\",\n \"audio/opus\"\n ],\n [\n \"otf\",\n \"font/otf\"\n ],\n [\n \"png\",\n \"image/png\"\n ],\n [\n \"pdf\",\n \"application/pdf\"\n ],\n [\n \"php\",\n \"application/x-httpd-php\"\n ],\n [\n \"ppt\",\n \"application/vnd.ms-powerpoint\"\n ],\n [\n \"pptx\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\"\n ],\n [\n \"rar\",\n \"application/vnd.rar\"\n ],\n [\n \"rtf\",\n \"application/rtf\"\n ],\n [\n \"sh\",\n \"application/x-sh\"\n ],\n [\n \"svg\",\n \"image/svg+xml\"\n ],\n [\n \"swf\",\n \"application/x-shockwave-flash\"\n ],\n [\n \"tar\",\n \"application/x-tar\"\n ],\n [\n \"tif\",\n \"image/tiff\"\n ],\n [\n \"tiff\",\n \"image/tiff\"\n ],\n [\n \"ts\",\n \"video/mp2t\"\n ],\n [\n \"ttf\",\n \"font/ttf\"\n ],\n [\n \"txt\",\n \"text/plain\"\n ],\n [\n \"vsd\",\n \"application/vnd.visio\"\n ],\n [\n \"wav\",\n \"audio/wav\"\n ],\n [\n \"weba\",\n \"audio/webm\"\n ],\n [\n \"webm\",\n \"video/webm\"\n ],\n [\n \"webp\",\n \"image/webp\"\n ],\n [\n \"woff\",\n \"font/woff\"\n ],\n [\n \"woff2\",\n \"font/woff2\"\n ],\n [\n \"xhtml\",\n \"application/xhtml+xml\"\n ],\n [\n \"xls\",\n \"application/vnd.ms-excel\"\n ],\n [\n \"xlsx\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"\n ],\n [\n \"xml\",\n \"application/xml\"\n ],\n [\n \"xul\",\n \"application/vnd.mozilla.xul+xml\"\n ],\n [\n \"zip\",\n \"application/zip\"\n ],\n [\n \"7z\",\n \"application/x-7z-compressed\"\n ],\n // Others\n [\n \"mkv\",\n \"video/x-matroska\"\n ],\n [\n \"mov\",\n \"video/quicktime\"\n ],\n [\n \"msg\",\n \"application/vnd.ms-outlook\"\n ]\n]);\nconst $f31161edf38949e9$var$FILES_TO_IGNORE = [\n // Thumbnail cache files for macOS and Windows\n \".DS_Store\",\n \"Thumbs.db\" // Windows\n];\n/**\n * Adds a `type` property to the file object if it doesn't have one and the file has an extension.\n * This is needed because Firefox doesn't add a type property to files dragged from the desktop.\n * @bug https://bugzilla.mozilla.org/show_bug.cgi?id=1424689\n *\n * @param {File} file - The file object to add the type property to.\n * @returns {File} - The file object with the type property added.\n */ const $f31161edf38949e9$var$toFileWithMimeType = (file)=>{\n const { name: name } = file;\n const hasExtension = name && name.lastIndexOf(\".\") !== -1;\n if (hasExtension && !file.type) {\n const extension = (name.split(\".\").pop() || \"\").toLowerCase();\n const type = $f31161edf38949e9$var$COMMON_MIME_TYPES.get(extension);\n if (type) Object.defineProperty(file, \"type\", {\n value: type,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n return file;\n};\n/**\n * Adds a `path` property to the file object if it doesn't have one.\n * If `path` is not provided, the `webkitRelativePath` property of the file will be used\n * or the file's name if `webkitRelativePath` is not available.\n *\n * @param {File} file - The file object to add the path property to.\n * @param {string} [path] - The path to set on the file object.\n * @returns {File} - The file object with the path property added.\n */ const $f31161edf38949e9$var$toFileWithPath = (file, path)=>{\n const fileWithMimeType = $f31161edf38949e9$var$toFileWithMimeType(file);\n // @ts-ignore\n if (typeof fileWithMimeType.path !== \"string\") {\n const { webkitRelativePath: webkitRelativePath } = file;\n Object.defineProperty(fileWithMimeType, \"path\", {\n value: typeof path === \"string\" ? path : webkitRelativePath || file.name,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n return fileWithMimeType;\n};\n/**\n * Wrap `FileSystemDirectoryReader.readEntries` in a promise to make working with read entries easier.\n * https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */ const $f31161edf38949e9$var$readEntriesPromise = async (directoryReader)=>{\n return await new Promise((resolve, reject)=>{\n directoryReader.readEntries(resolve, reject);\n });\n};\n/**\n * Read all entries in a directory or sub-directory\n * by calling `readEntries` until it returns an empty array.\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */ const $f31161edf38949e9$var$readAllDirectoryEntries = async (directoryReader)=>{\n const entries = [];\n let readEntries = await $f31161edf38949e9$var$readEntriesPromise(directoryReader);\n while(readEntries.length > 0){\n entries.push(...readEntries);\n readEntries = await $f31161edf38949e9$var$readEntriesPromise(directoryReader);\n }\n return entries;\n};\n/**\n * Get a `File` object from a `FileSystemFileEntry` object.\n *\n * @param {FileSystemFileEntry} fileEntry - The file entry to get a `File` object from.\n * @returns {Promise<File>} - A promise that resolves with a `File` object.\n */ const $f31161edf38949e9$var$getFileFromFileEntry = (fileEntry)=>{\n return new Promise((resolve, reject)=>{\n fileEntry.file((file)=>resolve($f31161edf38949e9$var$toFileWithPath(file, fileEntry.fullPath)), reject);\n });\n};\n/**\n * Get an array of `File` objects from a `DataTransferItemList` object.\n *\n * @param {DataTransferItemList} dataTransferItemList - The item list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */ const $f31161edf38949e9$var$getFilesFromDataTransferItemList = async (dataTransferItemList)=>{\n const files = [];\n // Chromium browsers read only 100 files at a time as per the spec, so we need to use\n // BFS (Breadth-first search) to traverse the entire directory/file structure.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#javascript_content\n const queue = [];\n for (const item of dataTransferItemList){\n if (item.kind !== \"file\") continue;\n // https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry\n // This function is implemented as `webkitGetAsEntry()` in non-WebKit browsers\n // including Firefox at this time but it may be renamed to `getAsEntry()` in the future.\n // @ts-ignore\n const entry = item.getAsEntry ? item.getAsEntry() : item.webkitGetAsEntry();\n queue.push(entry);\n }\n while(queue.length > 0){\n const entry = queue.shift();\n if (!entry) continue;\n else if (entry.isFile) {\n const file = await $f31161edf38949e9$var$getFileFromFileEntry(entry);\n if ($f31161edf38949e9$var$FILES_TO_IGNORE.indexOf(file.name) === -1) files.push(file);\n } else if (entry.isDirectory) queue.push(...await $f31161edf38949e9$var$readAllDirectoryEntries(entry.createReader()));\n }\n return files;\n};\n/**\n * Get an array of `File` objects from a `FileList` object.\n *\n * @param {FileList} fileList - The file list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */ const $f31161edf38949e9$var$getFilesFromFileList = async (fileList)=>{\n const files = [];\n for (const file of fileList)if ($f31161edf38949e9$var$FILES_TO_IGNORE.indexOf(file.name) === -1) files.push($f31161edf38949e9$var$toFileWithPath(file));\n return files;\n};\nconst $f31161edf38949e9$export$6d52664cd15c442 = async (evt)=>{\n if (evt.dataTransfer) return evt.dataTransfer.items ? await $f31161edf38949e9$var$getFilesFromDataTransferItemList(evt.dataTransfer.items) : await $f31161edf38949e9$var$getFilesFromFileList(evt.dataTransfer.files);\n return await $f31161edf38949e9$var$getFilesFromFileList(evt.target.files);\n};\n\n\nconst $862aa3736b0514bc$var$COMPONENT_NAME = \"files-dropzone\";\nconst $862aa3736b0514bc$var$TOO_MANY_FILES = \"TOO_MANY_FILES\";\nconst $862aa3736b0514bc$var$FILE_TOO_LARGE = \"FILE_TOO_LARGE\";\nconst $862aa3736b0514bc$var$FILE_TOO_SMALL = \"FILE_TOO_SMALL\";\nconst $862aa3736b0514bc$var$INVALID_MIME_TYPE = \"INVALID_MIME_TYPE\";\nconst $862aa3736b0514bc$var$template = document.createElement(\"template\");\nconst $862aa3736b0514bc$var$styles = /* css */ `\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #6c757d;\n --dropzone-border-color-dragover: #0d6efd;\n --dropzone-border-color-hover: var(--dropzone-border-color-dragover);\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-background-color-hover: var(--dropzone-background-color-dragover);\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n --dropzone-body-color-hover: var(--dropzone-body-color-dragover);\n --dropzone-focus-shadow-rgb: 49,132,253;\n --dropzone-focus-box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);\n --transition-duration: 0.2s; /* for backwards compatibility */\n --dropzone-transition-duration: var(--transition-duration);\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border var(--dropzone-transition-duration) ease-in-out, background-color var(--dropzone-transition-duration) ease-in-out, color var(--dropzone-transition-duration) ease-in-out, box-shadow var(--dropzone-transition-duration) ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone:focus-visible {\n outline: none;\n box-shadow: var(--dropzone-focus-box-shadow);\n }\n\n @media (hover: hover) {\n :host(:not([no-style]):not([disabled])) .dropzone:not(.dropzone--dragover):hover {\n border-color: var(--dropzone-border-color-hover);\n background-color: var(--dropzone-background-color-hover);\n color: var(--dropzone-body-color-hover);\n }\n }\n`;\n$862aa3736b0514bc$var$template.innerHTML = /* html */ `\n <style>\n ${$862aa3736b0514bc$var$styles}\n </style>\n\n <input type=\"file\" id=\"fileInput\" hidden>\n\n <div part=\"dropzone\" class=\"dropzone\" id=\"dropzoneEl\" tabindex=\"0\" role=\"presentation\">\n <slot>Drag 'n' drop files here, or click to select files</slot>\n </div>\n`;\n/**\n * @summary A custom element that allows users to drag and drop files into it.\n * @documentation https://github.com/georapbox/files-dropzone-element\n *\n * @tagname files-dropzone - This is the default tag name, unless overridden by the `defineCustomElement` method.\n *\n * @property {string} accept - A comma-separated list of unique file type specifiers describing file types to allow.\n * @property {boolean} disabled - Determines whether the dropzone is disabled.\n * @property {number} maxFiles - The maximum number of files allowed to be dropped.\n * @property {number} maxSize - The maximum file size allowed in bytes.\n * @property {number} minSize - The minimum file size allowed in bytes.\n * @property {boolean} multiple - Allows multiple files to be dropped.\n * @property {boolean} noClick - Prevents the file dialog from opening when the dropzone is clicked.\n * @property {boolean} noDrag - Prevents the dropzone from reacting to drag events.\n * @property {boolean} noKeyboard - Prevents the dropzone from reacting to keyboard events.\n * @property {boolean} autoFocus - Automatically focuses the dropzone when it's connected to the DOM.\n * @property {boolean} noStyle - Prevents the dropzone from applying any styling.\n *\n * @attribute {string} accept - Reflects the accept property.\n * @attribute {boolean} disabled - Reflects the disabled property.\n * @attribute {number} max-files - Reflects the maxFiles property.\n * @attribute {number} max-size - Reflects the maxSize property.\n * @attribute {number} min-size - Reflects the minSize property.\n * @attribute {boolean} multiple - Reflects the multiple property.\n * @attribute {boolean} no-click - Reflects the noClick property.\n * @attribute {boolean} no-drag - Reflects the noDrag property.\n * @attribute {boolean} no-keyboard - Reflects the noKeyboard property.\n * @attribute {boolean} auto-focus - Reflects the autoFocus property.\n * @attribute {boolean} no-style - Reflects the noStyle property.\n *\n * @slot - The default slot content of the dropzone.\n *\n * @csspart dropzone - The dropzone element.\n * @csspart dropzone--dragover - The state of the dropzone when dragging over it.\n *\n * @cssproperty --dropzone-border-width - The border width of the dropzone.\n * @cssproperty --dropzone-border-style - The border style of the dropzone.\n * @cssproperty --dropzone-border-radius - The border radius of the dropzone.\n * @cssproperty --dropzone-border-color - The border color of the dropzone.\n * @cssproperty --dropzone-border-color-dragover - The border color of the dropzone when dragging over it.\n * @cssproperty --dropzone-border-color-hover - The border color of the dropzone when hovering over it.\n * @cssproperty --dropzone-background-color - The background color of the dropzone.\n * @cssproperty --dropzone-background-color-dragover - The background color of the dropzone when dragging over it.\n * @cssproperty --dropzone-background-color-hover - The background color of the dropzone when hovering over it.\n * @cssproperty --dropzone-body-color - The text color of the dropzone.\n * @cssproperty --dropzone-body-color-dragover - The text color of the dropzone when dragging over it.\n * @cssproperty --dropzone-body-color-hover - The text color of the dropzone when hovering over it.\n * @cssproperty --dropzone-focus-shadow-rgb - The RGB value of the dropzone's focus shadow.\n * @cssproperty --dropzone-focus-box-shadow - The box shadow of the dropzone when focused.\n * @cssproperty --dropzone-transition-duration - The transition's duration for the dropzone area.\n *\n * @event files-dropzone-drop - Fired when files are dropped.\n * @event files-dropzone-drop-accepted - Fired when files dropped files are accepted.\n * @event files-dropzone-drop-rejected - Fired when files dropped files are rejected.\n * @event files-dropzone-dragenter - Fired when files are dragged into the dropzone.\n * @event files-dropzone-dragover - Fired when files are dragged over the dropzone.\n * @event files-dropzone-dragleave - Fired when files are dragged out of the dropzone.\n * @event files-dropzone-error - Fired when there is any error in the process of reading dropped files or directories.\n *\n * @method defineCustomElement - Static method. Defines a custom element with the given name.\n * @method openFileDialog - Instance method. Opens the file dialog programmatically.\n */ class $862aa3736b0514bc$export$6ccd1735166caad9 extends HTMLElement {\n /** @type {Nullable<HTMLInputElement>} */ #fileInput = null;\n /** @type {Nullable<HTMLElement>} */ #dropzoneEl = null;\n constructor(){\n super();\n if (!this.shadowRoot) {\n const shadowRoot = this.attachShadow({\n mode: \"open\"\n });\n shadowRoot.appendChild($862aa3736b0514bc$var$template.content.cloneNode(true));\n }\n if (this.shadowRoot) {\n this.#fileInput = /** @type {Nullable<HTMLInputElement>} */ this.shadowRoot.getElementById(\"fileInput\");\n this.#dropzoneEl = this.shadowRoot.getElementById(\"dropzoneEl\");\n }\n }\n static get observedAttributes() {\n return [\n \"accept\",\n \"disabled\",\n \"multiple\",\n \"no-keyboard\"\n ];\n }\n /**\n * Lifecycle method that is called when attributes are changed, added, removed, or replaced.\n *\n * @param {string} name - The name of the attribute.\n * @param {string} oldValue - The old value of the attribute.\n * @param {string} newValue - The new value of the attribute.\n */ attributeChangedCallback(name, oldValue, newValue) {\n if (name === \"accept\" && oldValue !== newValue && this.#fileInput) this.#fileInput.accept = this.accept;\n if (name === \"disabled\" && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.disabled = this.disabled;\n if (this.disabled) this.#dropzoneEl?.removeAttribute(\"tabindex\");\n else this.#dropzoneEl?.setAttribute(\"tabindex\", \"0\");\n }\n if (name === \"multiple\" && oldValue !== newValue && this.#fileInput) this.#fileInput.multiple = this.multiple;\n if (name === \"no-keyboard\" && oldValue !== newValue && this.#dropzoneEl) {\n if (this.noKeyboard) this.#dropzoneEl.removeAttribute(\"tabindex\");\n else this.#dropzoneEl.setAttribute(\"tabindex\", \"0\");\n }\n }\n /**\n * Lifecycle method that is called when the element is added to the DOM.\n */ connectedCallback() {\n this.#upgradeProperty(\"accept\");\n this.#upgradeProperty(\"disabled\");\n this.#upgradeProperty(\"maxFiles\");\n this.#upgradeProperty(\"maxSize\");\n this.#upgradeProperty(\"minSize\");\n this.#upgradeProperty(\"multiple\");\n this.#upgradeProperty(\"noClick\");\n this.#upgradeProperty(\"noDrag\");\n this.#upgradeProperty(\"noKeyboard\");\n this.#upgradeProperty(\"autoFocus\");\n this.#upgradeProperty(\"noStyle\");\n this.#fileInput?.addEventListener(\"change\", this.#handleFileInputChange);\n this.#dropzoneEl?.addEventListener(\"dragenter\", this.#handleDragEnter);\n this.#dropzoneEl?.addEventListener(\"dragover\", this.#handleDragOver);\n this.#dropzoneEl?.addEventListener(\"dragleave\", this.#handleDragLeave);\n this.#dropzoneEl?.addEventListener(\"drop\", this.#handleDrop);\n this.#dropzoneEl?.addEventListener(\"click\", this.#handleClick);\n this.#dropzoneEl?.addEventListener(\"keyup\", this.#handleKeyUp);\n this.autoFocus && this.#dropzoneEl?.focus();\n }\n /**\n * Lifecycle method that is called when the element is removed from the DOM.\n */ disconnectedCallback() {\n this.#fileInput?.removeEventListener(\"change\", this.#handleFileInputChange);\n this.#dropzoneEl?.removeEventListener(\"dragenter\", this.#handleDragEnter);\n this.#dropzoneEl?.removeEventListener(\"dragover\", this.#handleDragOver);\n this.#dropzoneEl?.removeEventListener(\"dragleave\", this.#handleDragLeave);\n this.#dropzoneEl?.removeEventListener(\"drop\", this.#handleDrop);\n this.#dropzoneEl?.removeEventListener(\"click\", this.#handleClick);\n this.#dropzoneEl?.removeEventListener(\"keyup\", this.#handleKeyUp);\n }\n /**\n * @type {string} - A comma-separated list of unique file type specifiers describing file types to allow.\n * @attribute accept - Reflects the accept property.\n */ get accept() {\n return this.getAttribute(\"accept\") || \"\";\n }\n set accept(value) {\n this.setAttribute(\"accept\", value != null ? value.toString() : value);\n }\n /**\n * @type {boolean} - Determines whether the dropzone is disabled.\n * @default false\n * @attribute disabled - Reflects the disabled property.\n */ get disabled() {\n return this.hasAttribute(\"disabled\");\n }\n set disabled(value) {\n this.toggleAttribute(\"disabled\", !!value);\n }\n /**\n * @type {number} - The maximum number of files allowed to be dropped.\n * @default Infinity\n * @attribute max-files - Reflects the maxFiles property.\n */ get maxFiles() {\n const num = Number(this.getAttribute(\"max-files\")) || 0;\n if (num <= 0) return Infinity;\n return Math.floor(Math.abs(num));\n }\n set maxFiles(value) {\n this.setAttribute(\"max-files\", value != null ? value.toString() : value);\n }\n /**\n * @type {number} - The maximum file size allowed in bytes.\n * @default Infinity\n * @attribute max-size - Reflects the maxSize property.\n */ get maxSize() {\n const value = this.getAttribute(\"max-size\");\n if (value === null) return Infinity;\n const num = Number(value);\n return Number.isNaN(num) ? Infinity : num;\n }\n set maxSize(value) {\n this.setAttribute(\"max-size\", value != null ? value.toString() : value);\n }\n /**\n * @type {number} - The minimum file size allowed in bytes.\n * @default 0\n * @attribute min-size - Reflects the minSize property.\n */ get minSize() {\n const value = this.getAttribute(\"min-size\");\n if (value === null) return 0;\n const num = Number(value);\n return Number.isNaN(num) ? 0 : num;\n }\n set minSize(value) {\n this.setAttribute(\"min-size\", value != null ? value.toString() : value);\n }\n /**\n * @type {boolean} - Allows multiple files to be dropped.\n * @default false\n * @attribute multiple - Reflects the multiple property.\n */ get multiple() {\n return this.hasAttribute(\"multiple\");\n }\n set multiple(value) {\n this.toggleAttribute(\"multiple\", !!value);\n }\n /**\n * @type {boolean} - Prevents the file dialog from opening when the dropzone is clicked.\n * @default false\n * @attribute no-click - Reflects the noClick property.\n */ get noClick() {\n return this.hasAttribute(\"no-click\");\n }\n set noClick(value) {\n this.toggleAttribute(\"no-click\", !!value);\n }\n /**\n * @type {boolean} - Prevents the dropzone from reacting to drag events.\n * @default false\n * @attribute no-drag - Reflects the noDrag property.\n */ get noDrag() {\n return this.hasAttribute(\"no-drag\");\n }\n set noDrag(value) {\n this.toggleAttribute(\"no-drag\", !!value);\n }\n /**\n * @type {boolean} - Prevents the dropzone from reacting to keyboard events.\n * @default false\n * @attribute no-keyboard - Reflects the noKeyboard property.\n */ get noKeyboard() {\n return this.hasAttribute(\"no-keyboard\");\n }\n set noKeyboard(value) {\n this.toggleAttribute(\"no-keyboard\", !!value);\n }\n /**\n * @type {boolean} - Automatically focuses the dropzone when it's connected to the DOM.\n * @default false\n * @attribute auto-focus - Reflects the autoFocus property.\n */ get autoFocus() {\n return this.hasAttribute(\"auto-focus\");\n }\n set autoFocus(value) {\n this.toggleAttribute(\"auto-focus\", !!value);\n }\n /**\n * @type {boolean} - Prevents the dropzone from applying any styling.\n * @default false\n * @attribute no-style - Reflects the noStyle property.\n */ get noStyle() {\n return this.hasAttribute(\"no-style\");\n }\n set noStyle(value) {\n this.toggleAttribute(\"no-style\", !!value);\n }\n /**\n * Handles the change event of the file input.\n *\n * @param {*} evt - The event object.\n */ #handleFileInputChange = async (evt)=>{\n try {\n this.#handleFilesSelect(await (0, $f31161edf38949e9$export$6d52664cd15c442)(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: {\n error: error\n }\n }));\n }\n };\n /**\n * Handles the dragenter event of the dropzone.\n */ #handleDragEnter = ()=>{\n if (this.disabled || this.noDrag) return;\n this.dispatchEvent(new Event(`${$862aa3736b0514bc$var$COMPONENT_NAME}-dragenter`, {\n bubbles: true,\n composed: true\n }));\n };\n /**\n * Handles the dragover event of the dropzone.\n *\n * @param {*} evt - The event object.\n */ #handleDragOver = (evt)=>{\n evt.preventDefault();\n if (this.disabled || this.noDrag) {\n evt.dataTransfer.dropEffect = \"none\";\n return;\n }\n evt.dataTransfer.dropEffect = \"copy\";\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.add(\"dropzone--dragover\");\n this.#dropzoneEl.part.add(\"dropzone--dragover\");\n }\n this.dispatchEvent(new Event(`${$862aa3736b0514bc$var$COMPONENT_NAME}-dragover`, {\n bubbles: true,\n composed: true\n }));\n };\n /**\n * Handles the dragleave event of the dropzone.\n */ #handleDragLeave = ()=>{\n if (this.disabled || this.noDrag) return;\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove(\"dropzone--dragover\");\n this.#dropzoneEl.part.remove(\"dropzone--dragover\");\n }\n this.dispatchEvent(new Event(`${$862aa3736b0514bc$var$COMPONENT_NAME}-dragleave`, {\n bubbles: true,\n composed: true\n }));\n };\n /**\n * Handles the drop event of the dropzone.\n *\n * @param {*} evt - The event object.\n */ #handleDrop = async (evt)=>{\n if (this.disabled || this.noDrag) return;\n evt.preventDefault();\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove(\"dropzone--dragover\");\n this.#dropzoneEl.part.remove(\"dropzone--dragover\");\n }\n try {\n this.#handleFilesSelect(await (0, $f31161edf38949e9$export$6d52664cd15c442)(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: {\n error: error\n }\n }));\n }\n };\n /**\n * Handles the click event of the dropzone.\n */ #handleClick = ()=>{\n if (this.disabled || this.noClick) return;\n this.#fileInput?.click();\n };\n /**\n * Handles the keyup event of the dropzone.\n *\n * @param {*} evt - The event object.\n */ #handleKeyUp = (evt)=>{\n if (this.disabled || this.noKeyboard) return;\n if (evt.key === \" \" || evt.key === \"Enter\") this.#fileInput?.click();\n };\n /**\n * Handles the selection of files.\n *\n * @param {File[]} files - The files to handle.\n */ #handleFilesSelect(files) {\n if (!Array.isArray(files) || !files.length) return;\n const acceptedFiles = [];\n const rejectedFiles = [];\n const filesLength = files.length;\n // If the component is not in multiple mode, reject all files.\n if (!this.multiple && filesLength > 1) for (const file of files)rejectedFiles.push({\n file: file,\n errors: [\n {\n code: $862aa3736b0514bc$var$TOO_MANY_FILES,\n message: `Too many files selected. Only 1 file is allowed.`\n }\n ]\n });\n else if (this.multiple && filesLength > this.maxFiles) // If the component is in multiple mode, but the number of files exceeds\n // the maxFiles attribute, reject all files.\n for (const file of files)rejectedFiles.push({\n file: file,\n errors: [\n {\n code: $862aa3736b0514bc$var$TOO_MANY_FILES,\n message: `Too many files selected. Only ${this.maxFiles} ${this.maxFiles > 1 ? \"files are\" : \"file is\"} allowed.`\n }\n ]\n });\n else // Validate each file. If it's valid, add it to the accepted files array,\n // otherwise add it to the rejected files array.\n for (const file of files){\n const fileHasValidType = (0, $38f222170fd4d21a$export$7c47054fed488f80)(file, this.accept);\n const fileExceedsMaxSize = file.size > this.maxSize;\n const fileIsSmallerThanMinSize = file.size < this.minSize;\n if (fileHasValidType && !fileExceedsMaxSize && !fileIsSmallerThanMinSize) acceptedFiles.push(file);\n else {\n const errors = [];\n if (!fileHasValidType) errors.push({\n code: $862aa3736b0514bc$var$INVALID_MIME_TYPE,\n message: `File type \"${file.type}\" is not accepted.`\n });\n if (fileExceedsMaxSize) errors.push({\n code: $862aa3736b0514bc$var$FILE_TOO_LARGE,\n message: `File size ${file.size} exceeds the maximum size of ${this.maxSize}.`\n });\n if (fileIsSmallerThanMinSize) errors.push({\n code: $862aa3736b0514bc$var$FILE_TOO_SMALL,\n message: `File size ${file.size} is smaller than the minimum size of ${this.minSize}.`\n });\n rejectedFiles.push({\n file: file,\n errors: errors\n });\n }\n }\n this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-drop`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles: acceptedFiles,\n rejectedFiles: rejectedFiles\n }\n }));\n if (acceptedFiles.length > 0) this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-drop-accepted`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles: acceptedFiles\n }\n }));\n if (rejectedFiles.length > 0) this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-drop-rejected`, {\n bubbles: true,\n composed: true,\n detail: {\n rejectedFiles: rejectedFiles\n }\n }));\n if (this.#fileInput) this.#fileInput.value = this.#fileInput.defaultValue;\n }\n /**\n * Opens the file dialog programmatically.\n */ openFileDialog() {\n if (this.disabled) return;\n this.#fileInput?.click();\n }\n /**\n * This is to safe guard against cases where, for instance, a framework may have added the element to the page and set a\n * value on one of its properties, but lazy loaded its definition. Without this guard, the upgraded element would miss that\n * property and the instance property would prevent the class property setter from ever being called.\n *\n * https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n *\n * @param {'accept' | 'disabled' | 'maxFiles' | 'maxSize' | 'minSize' | 'multiple' | 'noClick' | 'noDrag' | 'noKeyboard' | 'autoFocus' | 'noStyle'} prop - The property name to upgrade.\n */ #upgradeProperty(prop) {\n /** @type {any} */ const instance = this;\n if (Object.prototype.hasOwnProperty.call(instance, prop)) {\n const value = instance[prop];\n delete instance[prop];\n instance[prop] = value;\n }\n }\n /**\n * Defines a custom element with the given name.\n * The name must contain a dash (-).\n *\n * @param {string} [elementName='files-dropzone'] - The name of the custom element.\n * @example\n *\n * FilesDropzone.defineCustomElement('my-dropzone');\n */ static defineCustomElement(elementName = $862aa3736b0514bc$var$COMPONENT_NAME) {\n if (typeof window !== \"undefined\" && !window.customElements.get(elementName)) window.customElements.define(elementName, $862aa3736b0514bc$export$6ccd1735166caad9);\n }\n}\n\n\n(0, $862aa3736b0514bc$export$6ccd1735166caad9).defineCustomElement();\n\n\nexport {$862aa3736b0514bc$export$6ccd1735166caad9 as FilesDropzone};\n//# sourceMappingURL=files-dropzone-defined.js.map\n","import { FilesDropzone } from './files-dropzone.js';\n\nFilesDropzone.defineCustomElement();\n\nexport { FilesDropzone };\n","// @ts-check\n\n/**\n * Represents a value that may be of type T, or null.\n *\n * @template T\n * @typedef {T | null} Nullable\n */\n\nimport { isValidFile } from './utils/is-valid-file.js';\nimport { getFilesFromEvent } from './utils/files-selector.js';\n\nconst COMPONENT_NAME = 'files-dropzone';\nconst TOO_MANY_FILES = 'TOO_MANY_FILES';\nconst FILE_TOO_LARGE = 'FILE_TOO_LARGE';\nconst FILE_TOO_SMALL = 'FILE_TOO_SMALL';\nconst INVALID_MIME_TYPE = 'INVALID_MIME_TYPE';\nconst template = document.createElement('template');\n\nconst styles = /* css */`\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #6c757d;\n --dropzone-border-color-dragover: #0d6efd;\n --dropzone-border-color-hover: var(--dropzone-border-color-dragover);\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-background-color-hover: var(--dropzone-background-color-dragover);\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n --dropzone-body-color-hover: var(--dropzone-body-color-dragover);\n --dropzone-focus-shadow-rgb: 49,132,253;\n --dropzone-focus-box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);\n --transition-duration: 0.2s; /* for backwards compatibility */\n --dropzone-transition-duration: var(--transition-duration);\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border var(--dropzone-transition-duration) ease-in-out, background-color var(--dropzone-transition-duration) ease-in-out, color var(--dropzone-transition-duration) ease-in-out, box-shadow var(--dropzone-transition-duration) ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone:focus-visible {\n outline: none;\n box-shadow: var(--dropzone-focus-box-shadow);\n }\n\n @media (hover: hover) {\n :host(:not([no-style]):not([disabled])) .dropzone:not(.dropzone--dragover):hover {\n border-color: var(--dropzone-border-color-hover);\n background-color: var(--dropzone-background-color-hover);\n color: var(--dropzone-body-color-hover);\n }\n }\n`;\n\ntemplate.innerHTML = /* html */`\n <style>\n ${styles}\n </style>\n\n <input type=\"file\" id=\"fileInput\" hidden>\n\n <div part=\"dropzone\" class=\"dropzone\" id=\"dropzoneEl\" tabindex=\"0\" role=\"presentation\">\n <slot>Drag 'n' drop files here, or click to select files</slot>\n </div>\n`;\n\n/**\n * @summary A custom element that allows users to drag and drop files into it.\n * @documentation https://github.com/georapbox/files-dropzone-element\n *\n * @tagname files-dropzone - This is the default tag name, unless overridden by the `defineCustomElement` method.\n *\n * @property {string} accept - A comma-separated list of unique file type specifiers describing file types to allow.\n * @property {boolean} disabled - Determines whether the dropzone is disabled.\n * @property {number} maxFiles - The maximum number of files allowed to be dropped.\n * @property {number} maxSize - The maximum file size allowed in bytes.\n * @property {number} minSize - The minimum file size allowed in bytes.\n * @property {boolean} multiple - Allows multiple files to be dropped.\n * @property {boolean} noClick - Prevents the file dialog from opening when the dropzone is clicked.\n * @property {boolean} noDrag - Prevents the dropzone from reacting to drag events.\n * @property {boolean} noKeyboard - Prevents the dropzone from reacting to keyboard events.\n * @property {boolean} autoFocus - Automatically focuses the dropzone when it's connected to the DOM.\n * @property {boolean} noStyle - Prevents the dropzone from applying any styling.\n *\n * @attribute {string} accept - Reflects the accept property.\n * @attribute {boolean} disabled - Reflects the disabled property.\n * @attribute {number} max-files - Reflects the maxFiles property.\n * @attribute {number} max-size - Reflects the maxSize property.\n * @attribute {number} min-size - Reflects the minSize property.\n * @attribute {boolean} multiple - Reflects the multiple property.\n * @attribute {boolean} no-click - Reflects the noClick property.\n * @attribute {boolean} no-drag - Reflects the noDrag property.\n * @attribute {boolean} no-keyboard - Reflects the noKeyboard property.\n * @attribute {boolean} auto-focus - Reflects the autoFocus property.\n * @attribute {boolean} no-style - Reflects the noStyle property.\n *\n * @slot - The default slot content of the dropzone.\n *\n * @csspart dropzone - The dropzone element.\n * @csspart dropzone--dragover - The state of the dropzone when dragging over it.\n *\n * @cssproperty --dropzone-border-width - The border width of the dropzone.\n * @cssproperty --dropzone-border-style - The border style of the dropzone.\n * @cssproperty --dropzone-border-radius - The border radius of the dropzone.\n * @cssproperty --dropzone-border-color - The border color of the dropzone.\n * @cssproperty --dropzone-border-color-dragover - The border color of the dropzone when dragging over it.\n * @cssproperty --dropzone-border-color-hover - The border color of the dropzone when hovering over it.\n * @cssproperty --dropzone-background-color - The background color of the dropzone.\n * @cssproperty --dropzone-background-color-dragover - The background color of the dropzone when dragging over it.\n * @cssproperty --dropzone-background-color-hover - The background color of the dropzone when hovering over it.\n * @cssproperty --dropzone-body-color - The text color of the dropzone.\n * @cssproperty --dropzone-body-color-dragover - The text color of the dropzone when dragging over it.\n * @cssproperty --dropzone-body-color-hover - The text color of the dropzone when hovering over it.\n * @cssproperty --dropzone-focus-shadow-rgb - The RGB value of the dropzone's focus shadow.\n * @cssproperty --dropzone-focus-box-shadow - The box shadow of the dropzone when focused.\n * @cssproperty --dropzone-transition-duration - The transition's duration for the dropzone area.\n *\n * @event files-dropzone-drop - Fired when files are dropped.\n * @event files-dropzone-drop-accepted - Fired when files dropped files are accepted.\n * @event files-dropzone-drop-rejected - Fired when files dropped files are rejected.\n * @event files-dropzone-dragenter - Fired when files are dragged into the dropzone.\n * @event files-dropzone-dragover - Fired when files are dragged over the dropzone.\n * @event files-dropzone-dragleave - Fired when files are dragged out of the dropzone.\n * @event files-dropzone-error - Fired when there is any error in the process of reading dropped files or directories.\n *\n * @method defineCustomElement - Static method. Defines a custom element with the given name.\n * @method openFileDialog - Instance method. Opens the file dialog programmatically.\n */\nclass FilesDropzone extends HTMLElement {\n /** @type {Nullable<HTMLInputElement>} */\n #fileInput = null;\n\n /** @type {Nullable<HTMLElement>} */\n #dropzoneEl = null;\n\n constructor() {\n super();\n\n if (!this.shadowRoot) {\n const shadowRoot = this.attachShadow({ mode: 'open' });\n shadowRoot.appendChild(template.content.cloneNode(true));\n }\n\n if (this.shadowRoot) {\n this.#fileInput = /** @type {Nullable<HTMLInputElement>} */(this.shadowRoot.getElementById('fileInput'));\n this.#dropzoneEl = this.shadowRoot.getElementById('dropzoneEl');\n }\n }\n\n static get observedAttributes() {\n return ['accept', 'disabled', 'multiple', 'no-keyboard'];\n }\n\n /**\n * Lifecycle method that is called when attributes are changed, added, removed, or replaced.\n *\n * @param {string} name - The name of the attribute.\n * @param {string} oldValue - The old value of the attribute.\n * @param {string} newValue - The new value of the attribute.\n */\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'accept' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.accept = this.accept;\n }\n\n if (name === 'disabled' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.disabled = this.disabled;\n\n if (this.disabled) {\n this.#dropzoneEl?.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl?.setAttribute('tabindex', '0');\n }\n }\n\n if (name === 'multiple' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.multiple = this.multiple;\n }\n\n if (name === 'no-keyboard' && oldValue !== newValue && this.#dropzoneEl) {\n if (this.noKeyboard) {\n this.#dropzoneEl.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl.setAttribute('tabindex', '0');\n }\n }\n }\n\n /**\n * Lifecycle method that is called when the element is added to the DOM.\n */\n connectedCallback() {\n this.#upgradeProperty('accept');\n this.#upgradeProperty('disabled');\n this.#upgradeProperty('maxFiles');\n this.#upgradeProperty('maxSize');\n this.#upgradeProperty('minSize');\n this.#upgradeProperty('multiple');\n this.#upgradeProperty('noClick');\n this.#upgradeProperty('noDrag');\n this.#upgradeProperty('noKeyboard');\n this.#upgradeProperty('autoFocus');\n this.#upgradeProperty('noStyle');\n\n this.#fileInput?.addEventListener('change', this.#handleFileInputChange);\n this.#dropzoneEl?.addEventListener('dragenter', this.#handleDragEnter);\n this.#dropzoneEl?.addEventListener('dragover', this.#handleDragOver);\n this.#dropzoneEl?.addEventListener('dragleave', this.#handleDragLeave);\n this.#dropzoneEl?.addEventListener('drop', this.#handleDrop);\n this.#dropzoneEl?.addEventListener('click', this.#handleClick);\n this.#dropzoneEl?.addEventListener('keyup', this.#handleKeyUp);\n\n this.autoFocus && this.#dropzoneEl?.focus();\n }\n\n /**\n * Lifecycle method that is called when the element is removed from the DOM.\n */\n disconnectedCallback() {\n this.#fileInput?.removeEventListener('change', this.#handleFileInputChange);\n this.#dropzoneEl?.removeEventListener('dragenter', this.#handleDragEnter);\n this.#dropzoneEl?.removeEventListener('dragover', this.#handleDragOver);\n this.#dropzoneEl?.removeEventListener('dragleave', this.#handleDragLeave);\n this.#dropzoneEl?.removeEventListener('drop', this.#handleDrop);\n this.#dropzoneEl?.removeEventListener('click', this.#handleClick);\n this.#dropzoneEl?.removeEventListener('keyup', this.#handleKeyUp);\n }\n\n /**\n * @type {string} - A comma-separated list of unique file type specifiers describing file types to allow.\n * @attribute accept - Reflects the accept property.\n */\n get accept() {\n return this.getAttribute('accept') || '';\n }\n\n set accept(value) {\n this.setAttribute('accept', value != null ? value.toString() : value);\n }\n\n /**\n * @type {boolean} - Determines whether the dropzone is disabled.\n * @default false\n * @attribute disabled - Reflects the disabled property.\n */\n get disabled() {\n return this.hasAttribute('disabled');\n }\n\n set disabled(value) {\n this.toggleAttribute('disabled', !!value);\n }\n\n /**\n * @type {number} - The maximum number of files allowed to be dropped.\n * @default Infinity\n * @attribute max-files - Reflects the maxFiles property.\n */\n get maxFiles() {\n const num = Number(this.getAttribute('max-files')) || 0;\n\n if (num <= 0) {\n return Infinity;\n }\n\n return Math.floor(Math.abs(num));\n }\n\n set maxFiles(value) {\n this.setAttribute('max-files', value != null ? value.toString() : value);\n }\n\n /**\n * @type {number} - The maximum file size allowed in bytes.\n * @default Infinity\n * @attribute max-size - Reflects the maxSize property.\n */\n get maxSize() {\n const value = this.getAttribute('max-size');\n\n if (value === null) {\n return Infinity;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? Infinity : num;\n }\n\n set maxSize(value) {\n this.setAttribute('max-size', value != null ? value.toString() : value);\n }\n\n /**\n * @type {number} - The minimum file size allowed in bytes.\n * @default 0\n * @attribute min-size - Reflects the minSize property.\n */\n get minSize() {\n const value = this.getAttribute('min-size');\n\n if (value === null) {\n return 0;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? 0 : num;\n }\n\n set minSize(value) {\n this.setAttribute('min-size', value != null ? value.toString() : value);\n }\n\n /**\n * @type {boolean} - Allows multiple files to be dropped.\n * @default false\n * @attribute multiple - Reflects the multiple property.\n */\n get multiple() {\n return this.hasAttribute('multiple');\n }\n\n set multiple(value) {\n this.toggleAttribute('multiple', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the file dialog from opening when the dropzone is clicked.\n * @default false\n * @attribute no-click - Reflects the noClick property.\n */\n get noClick() {\n return this.hasAttribute('no-click');\n }\n\n set noClick(value) {\n this.toggleAttribute('no-click', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the dropzone from reacting to drag events.\n * @default false\n * @attribute no-drag - Reflects the noDrag property.\n */\n get noDrag() {\n return this.hasAttribute('no-drag');\n }\n\n set noDrag(value) {\n this.toggleAttribute('no-drag', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the dropzone from reacting to keyboard events.\n * @default false\n * @attribute no-keyboard - Reflects the noKeyboard property.\n */\n get noKeyboard() {\n return this.hasAttribute('no-keyboard');\n }\n\n set noKeyboard(value) {\n this.toggleAttribute('no-keyboard', !!value);\n }\n\n /**\n * @type {boolean} - Automatically focuses the dropzone when it's connected to the DOM.\n * @default false\n * @attribute auto-focus - Reflects the autoFocus property.\n */\n get autoFocus() {\n return this.hasAttribute('auto-focus');\n }\n\n set autoFocus(value) {\n this.toggleAttribute('auto-focus', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the dropzone from applying any styling.\n * @default false\n * @attribute no-style - Reflects the noStyle property.\n */\n get noStyle() {\n return this.hasAttribute('no-style');\n }\n\n set noStyle(value) {\n this.toggleAttribute('no-style', !!value);\n }\n\n /**\n * Handles the change event of the file input.\n *\n * @param {*} evt - The event object.\n */\n #handleFileInputChange = async evt => {\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n /**\n * Handles the dragenter event of the dropzone.\n */\n #handleDragEnter = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragenter`, {\n bubbles: true,\n composed: true\n }));\n };\n\n /**\n * Handles the dragover event of the dropzone.\n *\n * @param {*} evt - The event object.\n */\n #handleDragOver = evt => {\n evt.preventDefault();\n\n if (this.disabled || this.noDrag) {\n evt.dataTransfer.dropEffect = 'none';\n return;\n }\n\n evt.dataTransfer.dropEffect = 'copy';\n\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.add('dropzone--dragover');\n this.#dropzoneEl.part.add('dropzone--dragover');\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragover`, {\n bubbles: true,\n composed: true\n }));\n };\n\n /**\n * Handles the dragleave event of the dropzone.\n */\n #handleDragLeave = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragleave`, {\n bubbles: true,\n composed: true\n }));\n };\n\n /**\n * Handles the drop event of the dropzone.\n *\n * @param {*} evt - The event object.\n */\n #handleDrop = async evt => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n evt.preventDefault();\n\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n }\n\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n /**\n * Handles the click event of the dropzone.\n */\n #handleClick = () => {\n if (this.disabled || this.noClick) {\n return;\n }\n\n this.#fileInput?.click();\n };\n\n /**\n * Handles the keyup event of the dropzone.\n *\n * @param {*} evt - The event object.\n */\n #handleKeyUp = evt => {\n if (this.disabled || this.noKeyboard) {\n return;\n }\n\n if (evt.key === ' ' || evt.key === 'Enter') {\n this.#fileInput?.click();\n }\n };\n\n /**\n * Handles the selection of files.\n *\n * @param {File[]} files - The files to handle.\n */\n #handleFilesSelect(files) {\n if (!Array.isArray(files) || !files.length) {\n return;\n }\n\n const acceptedFiles = [];\n const rejectedFiles = [];\n const filesLength = files.length;\n\n // If the component is not in multiple mode, reject all files.\n if (!this.multiple && filesLength > 1) {\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only 1 file is allowed.`\n }]\n });\n }\n } else if (this.multiple && filesLength > this.maxFiles) {\n // If the component is in multiple mode, but the number of files exceeds\n // the maxFiles attribute, reject all files.\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only ${this.maxFiles} ${this.maxFiles > 1 ? 'files are' : 'file is'} allowed.`\n }]\n });\n }\n } else {\n // Validate each file. If it's valid, add it to the accepted files array,\n // otherwise add it to the rejected files array.\n for (const file of files) {\n const fileHasValidType = isValidFile(file, this.accept);\n const fileExceedsMaxSize = file.size > this.maxSize;\n const fileIsSmallerThanMinSize = file.size < this.minSize;\n\n if (fileHasValidType && !fileExceedsMaxSize && !fileIsSmallerThanMinSize) {\n acceptedFiles.push(file);\n } else {\n const errors = [];\n\n if (!fileHasValidType) {\n errors.push({\n code: INVALID_MIME_TYPE,\n message: `File type \"${file.type}\" is not accepted.`\n });\n }\n\n if (fileExceedsMaxSize) {\n errors.push({\n code: FILE_TOO_LARGE,\n message: `File size ${file.size} exceeds the maximum size of ${this.maxSize}.`\n });\n }\n\n if (fileIsSmallerThanMinSize) {\n errors.push({\n code: FILE_TOO_SMALL,\n message: `File size ${file.size} is smaller than the minimum size of ${this.minSize}.`\n });\n }\n\n rejectedFiles.push({ file, errors });\n }\n }\n }\n\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles,\n rejectedFiles\n }\n }));\n\n if (acceptedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-accepted`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles\n }\n }));\n }\n\n if (rejectedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-rejected`, {\n bubbles: true,\n composed: true,\n detail: {\n rejectedFiles\n }\n }));\n }\n\n if (this.#fileInput) {\n this.#fileInput.value = this.#fileInput.defaultValue;\n }\n }\n\n /**\n * Opens the file dialog programmatically.\n */\n openFileDialog() {\n if (this.disabled) {\n return;\n }\n\n this.#fileInput?.click();\n }\n\n /**\n * This is to safe guard against cases where, for instance, a framework may have added the element to the page and set a\n * value on one of its properties, but lazy loaded its definition. Without this guard, the upgraded element would miss that\n * property and the instance property would prevent the class property setter from ever being called.\n *\n * https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n *\n * @param {'accept' | 'disabled' | 'maxFiles' | 'maxSize' | 'minSize' | 'multiple' | 'noClick' | 'noDrag' | 'noKeyboard' | 'autoFocus' | 'noStyle'} prop - The property name to upgrade.\n */\n #upgradeProperty(prop) {\n /** @type {any} */\n const instance = this;\n\n if (Object.prototype.hasOwnProperty.call(instance, prop)) {\n const value = instance[prop];\n delete instance[prop];\n instance[prop] = value;\n }\n }\n\n /**\n * Defines a custom element with the given name.\n * The name must contain a dash (-).\n *\n * @param {string} [elementName='files-dropzone'] - The name of the custom element.\n * @example\n *\n * FilesDropzone.defineCustomElement('my-dropzone');\n */\n static defineCustomElement(elementName = COMPONENT_NAME) {\n if (typeof window !== 'undefined' && !window.customElements.get(elementName)) {\n window.customElements.define(elementName, FilesDropzone);\n }\n }\n}\n\nexport { FilesDropzone };\n","// @ts-check\n\n/**\n * Checks if a file is valid based on the accepted file type specifiers.\n *\n * @param {File} file - The File object to validate.\n * @param {string} [acceptedTypeSpecifiers=''] - The accepted file type specifiers.\n * @returns {boolean} - True if the file is valid, false otherwise.\n */\nexport function isValidFile(file, acceptedTypeSpecifiers = '') {\n if (!acceptedTypeSpecifiers) {\n return true;\n }\n\n const acceptedMimeTypesList = [\n ...new Set(acceptedTypeSpecifiers.split(',').map(v => v.trim()).filter(Boolean))\n ];\n\n const fileMimeType = file.type;\n const baseMimeType = fileMimeType.replace(/\\/.*$/, '');\n\n for (const validType of acceptedMimeTypesList) {\n if (validType.charAt(0) === '.') {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {\n return true;\n }\n } else if (/\\/\\*$/.test(validType)) {\n // Check for mime type that looks like \"image/*\" or similar.\n if (baseMimeType === validType.replace(/\\/.*$/, '')) {\n return true;\n }\n } else {\n if (fileMimeType === validType) {\n return true;\n }\n }\n }\n\n return false;\n}\n","// @ts-check\n\n/**\n * A map of common file extensions and their associated MIME types.\n */\nconst COMMON_MIME_TYPES = new Map([\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\n ['aac', 'audio/aac'],\n ['abw', 'application/x-abiword'],\n ['arc', 'application/x-freearc'],\n ['avif', 'image/avif'],\n ['avi', 'video/x-msvideo'],\n ['azw', 'application/vnd.amazon.ebook'],\n ['bin', 'application/octet-stream'],\n ['bmp', 'image/bmp'],\n ['bz', 'application/x-bzip'],\n ['bz2', 'application/x-bzip2'],\n ['cda', 'application/x-cdf'],\n ['csh', 'application/x-csh'],\n ['css', 'text/css'],\n ['csv', 'text/csv'],\n ['doc', 'application/msword'],\n ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n ['eot', 'application/vnd.ms-fontobject'],\n ['epub', 'application/epub+zip'],\n ['gz', 'application/gzip'],\n ['gif', 'image/gif'],\n ['heic', 'image/heic'],\n ['heif', 'image/heif'],\n ['htm', 'text/html'],\n ['html', 'text/html'],\n ['ico', 'image/vnd.microsoft.icon'],\n ['ics', 'text/calendar'],\n ['jar', 'application/java-archive'],\n ['jpeg', 'image/jpeg'],\n ['jpg', 'image/jpeg'],\n ['jxl', 'image/jxl'],\n ['js', 'text/javascript'],\n ['json', 'application/json'],\n ['jsonld', 'application/ld+json'],\n ['markdown', 'text/markdown'],\n ['md', 'text/markdown'],\n ['mid', 'audio/midi'],\n ['midi', 'audio/midi'],\n ['mjs', 'text/javascript'],\n ['mp3', 'audio/mpeg'],\n ['mp4', 'video/mp4'],\n ['mpeg', 'video/mpeg'],\n ['mpkg', 'application/vnd.apple.installer+xml'],\n ['odp', 'application/vnd.oasis.opendocument.presentation'],\n ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],\n ['odt', 'application/vnd.oasis.opendocument.text'],\n ['oga', 'audio/ogg'],\n ['ogv', 'video/ogg'],\n ['ogx', 'application/ogg'],\n ['opus', 'audio/opus'],\n ['otf', 'font/otf'],\n ['png', 'image/png'],\n ['pdf', 'application/pdf'],\n ['php', 'application/x-httpd-php'],\n ['ppt', 'application/vnd.ms-powerpoint'],\n ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],\n ['rar', 'application/vnd.rar'],\n ['rtf', 'application/rtf'],\n ['sh', 'application/x-sh'],\n ['svg', 'image/svg+xml'],\n ['swf', 'application/x-shockwave-flash'],\n ['tar', 'application/x-tar'],\n ['tif', 'image/tiff'],\n ['tiff', 'image/tiff'],\n ['ts', 'video/mp2t'],\n ['ttf', 'font/ttf'],\n ['txt', 'text/plain'],\n ['vsd', 'application/vnd.visio'],\n ['wav', 'audio/wav'],\n ['weba', 'audio/webm'],\n ['webm', 'video/webm'],\n ['webp', 'image/webp'],\n ['woff', 'font/woff'],\n ['woff2', 'font/woff2'],\n ['xhtml', 'application/xhtml+xml'],\n ['xls', 'application/vnd.ms-excel'],\n ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n ['xml', 'application/xml'],\n ['xul', 'application/vnd.mozilla.xul+xml'],\n ['zip', 'application/zip'],\n ['7z', 'application/x-7z-compressed'],\n\n // Others\n ['mkv', 'video/x-matroska'],\n ['mov', 'video/quicktime'],\n ['msg', 'application/vnd.ms-outlook']\n]);\n\nconst FILES_TO_IGNORE = [\n // Thumbnail cache files for macOS and Windows\n '.DS_Store', // macOs\n 'Thumbs.db' // Windows\n];\n\n/**\n * Adds a `type` property to the file object if it doesn't have one and the file has an extension.\n * This is needed because Firefox doesn't add a type property to files dragged from the desktop.\n * @bug https://bugzilla.mozilla.org/show_bug.cgi?id=1424689\n *\n * @param {File} file - The file object to add the type property to.\n * @returns {File} - The file object with the type property added.\n */\nconst toFileWithMimeType = file => {\n const { name } = file;\n const hasExtension = name && name.lastIndexOf('.') !== -1;\n\n if (hasExtension && !file.type) {\n const extension = (name.split('.').pop() || '').toLowerCase();\n const type = COMMON_MIME_TYPES.get(extension);\n\n if (type) {\n Object.defineProperty(file, 'type', {\n value: type,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n }\n\n return file;\n};\n\n/**\n * Adds a `path` property to the file object if it doesn't have one.\n * If `path` is not provided, the `webkitRelativePath` property of the file will be used\n * or the file's name if `webkitRelativePath` is not available.\n *\n * @param {File} file - The file object to add the path property to.\n * @param {string} [path] - The path to set on the file object.\n * @returns {File} - The file object with the path property added.\n */\nconst toFileWithPath = (file, path) => {\n const fileWithMimeType = toFileWithMimeType(file);\n\n // @ts-ignore\n if (typeof fileWithMimeType.path !== 'string') {\n const { webkitRelativePath } = file;\n\n Object.defineProperty(fileWithMimeType, 'path', {\n value: typeof path === 'string' ? path : webkitRelativePath || file.name,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n\n return fileWithMimeType;\n};\n\n/**\n * Wrap `FileSystemDirectoryReader.readEntries` in a promise to make working with read entries easier.\n * https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */\nconst readEntriesPromise = async directoryReader => {\n return await new Promise((resolve, reject) => {\n directoryReader.readEntries(resolve, reject);\n });\n};\n\n/**\n * Read all entries in a directory or sub-directory\n * by calling `readEntries` until it returns an empty array.\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */\nconst readAllDirectoryEntries = async directoryReader => {\n const entries = [];\n let readEntries = await readEntriesPromise(directoryReader);\n\n while (readEntries.length > 0) {\n entries.push(...readEntries);\n readEntries = await readEntriesPromise(directoryReader);\n }\n\n return entries;\n};\n\n/**\n * Get a `File` object from a `FileSystemFileEntry` object.\n *\n * @param {FileSystemFileEntry} fileEntry - The file entry to get a `File` object from.\n * @returns {Promise<File>} - A promise that resolves with a `File` object.\n */\nconst getFileFromFileEntry = fileEntry => {\n return new Promise((resolve, reject) => {\n fileEntry.file(file => resolve(toFileWithPath(file, fileEntry.fullPath)), reject);\n });\n};\n\n/**\n * Get an array of `File` objects from a `DataTransferItemList` object.\n *\n * @param {DataTransferItemList} dataTransferItemList - The item list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromDataTransferItemList = async dataTransferItemList => {\n const files = [];\n\n // Chromium browsers read only 100 files at a time as per the spec, so we need to use\n // BFS (Breadth-first search) to traverse the entire directory/file structure.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#javascript_content\n const queue = [];\n\n for (const item of dataTransferItemList) {\n if (item.kind !== 'file') {\n // Ignore non-file items, such as links.\n continue;\n }\n\n // https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry\n // This function is implemented as `webkitGetAsEntry()` in non-WebKit browsers\n // including Firefox at this time but it may be renamed to `getAsEntry()` in the future.\n // @ts-ignore\n const entry = item.getAsEntry ? item.getAsEntry() : item.webkitGetAsEntry();\n\n queue.push(entry);\n }\n\n while (queue.length > 0) {\n const entry = queue.shift();\n\n if (!entry) {\n continue;\n } else if (entry.isFile) {\n const file = await getFileFromFileEntry(entry);\n\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(file);\n }\n } else if (entry.isDirectory) {\n queue.push(...await readAllDirectoryEntries(entry.createReader()));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from a `FileList` object.\n *\n * @param {FileList} fileList - The file list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromFileList = async fileList => {\n const files = [];\n\n for (const file of fileList) {\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(toFileWithPath(file));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from an event.\n * This function supports both `drop` and `change` events.\n *\n * @param {*} evt - The event to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */\nexport const getFilesFromEvent = async evt => {\n if (evt.dataTransfer) {\n return evt.dataTransfer.items\n ? await getFilesFromDataTransferItemList(evt.dataTransfer.items)\n : await getFilesFromFileList(evt.dataTransfer.files);\n }\n\n return await getFilesFromFileList(evt.target.files);\n};\n"],"names":["Object","defineProperty","get","$862aa3736b0514bc$export$6ccd1735166caad9","set","s","enumerable","configurable","$f31161edf38949e9$var$COMMON_MIME_TYPES","Map","$f31161edf38949e9$var$FILES_TO_IGNORE","$f31161edf38949e9$var$toFileWithMimeType","file","name","hasExtension","lastIndexOf","type","extension","split","pop","toLowerCase","value","writable","$f31161edf38949e9$var$toFileWithPath","path","fileWithMimeType","webkitRelativePath","$f31161edf38949e9$var$readEntriesPromise","directoryReader","Promise","resolve","reject","readEntries","$f31161edf38949e9$var$readAllDirectoryEntries","entries","length","push","$f31161edf38949e9$var$getFileFromFileEntry","fileEntry","fullPath","$f31161edf38949e9$var$getFilesFromDataTransferItemList","dataTransferItemList","files","queue","item","kind","entry","getAsEntry","webkitGetAsEntry","shift","isFile","indexOf","isDirectory","createReader","$f31161edf38949e9$var$getFilesFromFileList","fileList","$f31161edf38949e9$export$6d52664cd15c442","evt","dataTransfer","items","target","$862aa3736b0514bc$var$COMPONENT_NAME","$862aa3736b0514bc$var$TOO_MANY_FILES","$862aa3736b0514bc$var$template","document","createElement","$862aa3736b0514bc$var$styles","innerHTML","HTMLElement","fileInput","dropzoneEl","constructor","shadowRoot","attachShadow","mode","appendChild","content","cloneNode","getElementById","observedAttributes","attributeChangedCallback","oldValue","newValue","accept","disabled","removeAttribute","setAttribute","multiple","noKeyboard","connectedCallback","upgradeProperty","addEventListener","handleFileInputChange","handleDragEnter","handleDragOver","handleDragLeave","handleDrop","handleClick","handleKeyUp","autoFocus","focus","disconnectedCallback","removeEventListener","getAttribute","toString","hasAttribute","toggleAttribute","maxFiles","num","Number","Infinity","Math","floor","abs","maxSize","isNaN","minSize","noClick","noDrag","noStyle","handleFilesSelect","error","dispatchEvent","CustomEvent","bubbles","composed","detail","Event","preventDefault","dropEffect","classList","add","part","remove","click","key","Array","isArray","acceptedFiles","rejectedFiles","filesLength","errors","code","message","fileHasValidType","acceptedTypeSpecifiers","acceptedMimeTypesList","Set","map","v","trim","filter","Boolean","fileMimeType","baseMimeType","replace","validType","charAt","test","fileExceedsMaxSize","size","fileIsSmallerThanMinSize","defaultValue","openFileDialog","prop","prototype","hasOwnProperty","call","instance","defineCustomElement","elementName","window","customElements","define","FilesDropzone"],"version":3,"file":"files-dropzone-defined.js.map"}
@@ -1,4 +1,4 @@
1
- let e=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["jxl","image/jxl"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]),t=[".DS_Store","Thumbs.db"],o=t=>{let{name:o}=t;if(o&&-1!==o.lastIndexOf(".")&&!t.type){let i=(o.split(".").pop()||"").toLowerCase(),r=e.get(i);r&&Object.defineProperty(t,"type",{value:r,writable:!1,configurable:!1,enumerable:!0})}return t},i=(e,t)=>{let i=o(e);if("string"!=typeof i.path){let{webkitRelativePath:o}=e;Object.defineProperty(i,"path",{value:"string"==typeof t?t:o||e.name,writable:!1,configurable:!1,enumerable:!0})}return i},r=async e=>await new Promise((t,o)=>{e.readEntries(t,o)}),a=async e=>{let t=[],o=await r(e);for(;o.length>0;)t.push(...o),o=await r(e);return t},n=e=>new Promise((t,o)=>{e.file(o=>t(i(o,e.fullPath)),o)}),s=async e=>{let o=[],i=[];for(let t of e){if("file"!==t.kind)continue;let e=t.getAsEntry?t.getAsEntry():t.webkitGetAsEntry();i.push(e)}for(;i.length>0;){let e=i.shift();if(e){if(e.isFile){let i=await n(e);-1===t.indexOf(i.name)&&o.push(i)}else e.isDirectory&&i.push(...await a(e.createReader()))}}return o},d=async e=>{let o=[];for(let r of e)-1===t.indexOf(r.name)&&o.push(i(r));return o},l=async e=>e.dataTransfer?e.dataTransfer.items?await s(e.dataTransfer.items):await d(e.dataTransfer.files):await d(e.target.files),p="files-dropzone",c="TOO_MANY_FILES",h=document.createElement("template"),u=`
1
+ let e=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["jxl","image/jxl"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["markdown","text/markdown"],["md","text/markdown"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]),t=[".DS_Store","Thumbs.db"],o=t=>{let{name:o}=t;if(o&&-1!==o.lastIndexOf(".")&&!t.type){let i=(o.split(".").pop()||"").toLowerCase(),r=e.get(i);r&&Object.defineProperty(t,"type",{value:r,writable:!1,configurable:!1,enumerable:!0})}return t},i=(e,t)=>{let i=o(e);if("string"!=typeof i.path){let{webkitRelativePath:o}=e;Object.defineProperty(i,"path",{value:"string"==typeof t?t:o||e.name,writable:!1,configurable:!1,enumerable:!0})}return i},r=async e=>await new Promise((t,o)=>{e.readEntries(t,o)}),a=async e=>{let t=[],o=await r(e);for(;o.length>0;)t.push(...o),o=await r(e);return t},n=e=>new Promise((t,o)=>{e.file(o=>t(i(o,e.fullPath)),o)}),s=async e=>{let o=[],i=[];for(let t of e){if("file"!==t.kind)continue;let e=t.getAsEntry?t.getAsEntry():t.webkitGetAsEntry();i.push(e)}for(;i.length>0;){let e=i.shift();if(e){if(e.isFile){let i=await n(e);-1===t.indexOf(i.name)&&o.push(i)}else e.isDirectory&&i.push(...await a(e.createReader()))}}return o},d=async e=>{let o=[];for(let r of e)-1===t.indexOf(r.name)&&o.push(i(r));return o},l=async e=>e.dataTransfer?e.dataTransfer.items?await s(e.dataTransfer.items):await d(e.dataTransfer.files):await d(e.target.files),p="files-dropzone",c="TOO_MANY_FILES",h=document.createElement("template"),u=`
2
2
  *,
3
3
  *::before,
4
4
  *::after {
@@ -1 +1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,CAAc,IAAI,YAAY,CAAC,EAAE,EAAe,KAAK,CAAC,CAAE,CAC3D,QAAS,CAAA,EACT,SAAU,CAAA,EACV,OAAQ,CACN,cAAA,EACA,cAAA,CACF,CACF,IAEI,EAAc,MAAA,CAAS,GACzB,IAAI,CAAC,aAAA,CAAc,IAAI,YAAY,CAAC,EAAE,EAAe,cAAc,CAAC,CAAE,CACpE,QAAS,CAAA,EACT,SAAU,CAAA,EACV,OAAQ,CACN,cAAA,CACF,CACF,IAGE,EAAc,MAAA,CAAS,GACzB,IAAI,CAAC,aAAA,CAAc,IAAI,YAAY,CAAC,EAAE,EAAe,cAAc,CAAC,CAAE,CACpE,QAAS,CAAA,EACT,SAAU,CAAA,EACV,OAAQ,CACN,cAAA,CACF,CACF,IAGE,IAAI,CAAC,CAAC,CAAS,EACjB,CAAA,IAAI,CAAC,CAAC,CAAS,CAAC,KAAA,CAAQ,IAAI,CAAC,CAAC,CAAS,CAAC,YAD1C,AAAA,CAGF,CAKA,gBAAiB,CACX,IAAI,CAAC,QAAA,EAIT,IAAI,CAAC,CAAC,CAAS,EAAE,OACnB,CAWA,CAAC,CAAe,CAAC,CAAI,EAInB,GAAI,OAAO,SAAA,CAAU,cAAA,CAAe,IAAA,CAFnB,IAAI,CAE8B,GAAO,CACxD,IAAM,EAAQ,AAHC,IAAI,AAGG,CAAC,EAAK,AAC5B,QAAO,AAJQ,IAAI,AAIJ,CAAC,EAAK,CACrB,AALe,IAAI,AAKX,CAAC,EAAK,CAAG,CACnB,CACF,CAWA,OAAO,oBAAoB,EAAc,CAAc,CAAE,CACjC,aAAlB,OAAO,QAA2B,OAAO,cAAA,CAAe,GAAA,CAAI,IAC9D,OAAO,cAAA,CAAe,MAAA,CAAO,EAAa,EAE9C,CACF,Q,K,a","sources":["<anon>","src/files-dropzone.js","src/utils/is-valid-file.js","src/utils/files-selector.js"],"sourcesContent":["// @ts-check\n/**\n * Represents a value that may be of type T, or null.\n *\n * @template T\n * @typedef {T | null} Nullable\n */ // @ts-check\n/**\n * Checks if a file is valid based on the accepted file type specifiers.\n *\n * @param {File} file - The File object to validate.\n * @param {string} [acceptedTypeSpecifiers=''] - The accepted file type specifiers.\n * @returns {boolean} - True if the file is valid, false otherwise.\n */ function $38f222170fd4d21a$export$7c47054fed488f80(file, acceptedTypeSpecifiers = \"\") {\n if (!acceptedTypeSpecifiers) return true;\n const acceptedMimeTypesList = [\n ...new Set(acceptedTypeSpecifiers.split(\",\").map((v)=>v.trim()).filter(Boolean))\n ];\n const fileMimeType = file.type;\n const baseMimeType = fileMimeType.replace(/\\/.*$/, \"\");\n for (const validType of acceptedMimeTypesList){\n if (validType.charAt(0) === \".\") {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) return true;\n } else if (/\\/\\*$/.test(validType)) {\n // Check for mime type that looks like \"image/*\" or similar.\n if (baseMimeType === validType.replace(/\\/.*$/, \"\")) return true;\n } else {\n if (fileMimeType === validType) return true;\n }\n }\n return false;\n}\n\n\n// @ts-check\n/**\n * A map of common file extensions and their associated MIME types.\n */ const $f31161edf38949e9$var$COMMON_MIME_TYPES = new Map([\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\n [\n \"aac\",\n \"audio/aac\"\n ],\n [\n \"abw\",\n \"application/x-abiword\"\n ],\n [\n \"arc\",\n \"application/x-freearc\"\n ],\n [\n \"avif\",\n \"image/avif\"\n ],\n [\n \"avi\",\n \"video/x-msvideo\"\n ],\n [\n \"azw\",\n \"application/vnd.amazon.ebook\"\n ],\n [\n \"bin\",\n \"application/octet-stream\"\n ],\n [\n \"bmp\",\n \"image/bmp\"\n ],\n [\n \"bz\",\n \"application/x-bzip\"\n ],\n [\n \"bz2\",\n \"application/x-bzip2\"\n ],\n [\n \"cda\",\n \"application/x-cdf\"\n ],\n [\n \"csh\",\n \"application/x-csh\"\n ],\n [\n \"css\",\n \"text/css\"\n ],\n [\n \"csv\",\n \"text/csv\"\n ],\n [\n \"doc\",\n \"application/msword\"\n ],\n [\n \"docx\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"\n ],\n [\n \"eot\",\n \"application/vnd.ms-fontobject\"\n ],\n [\n \"epub\",\n \"application/epub+zip\"\n ],\n [\n \"gz\",\n \"application/gzip\"\n ],\n [\n \"gif\",\n \"image/gif\"\n ],\n [\n \"heic\",\n \"image/heic\"\n ],\n [\n \"heif\",\n \"image/heif\"\n ],\n [\n \"htm\",\n \"text/html\"\n ],\n [\n \"html\",\n \"text/html\"\n ],\n [\n \"ico\",\n \"image/vnd.microsoft.icon\"\n ],\n [\n \"ics\",\n \"text/calendar\"\n ],\n [\n \"jar\",\n \"application/java-archive\"\n ],\n [\n \"jpeg\",\n \"image/jpeg\"\n ],\n [\n \"jpg\",\n \"image/jpeg\"\n ],\n [\n \"jxl\",\n \"image/jxl\"\n ],\n [\n \"js\",\n \"text/javascript\"\n ],\n [\n \"json\",\n \"application/json\"\n ],\n [\n \"jsonld\",\n \"application/ld+json\"\n ],\n [\n \"mid\",\n \"audio/midi\"\n ],\n [\n \"midi\",\n \"audio/midi\"\n ],\n [\n \"mjs\",\n \"text/javascript\"\n ],\n [\n \"mp3\",\n \"audio/mpeg\"\n ],\n [\n \"mp4\",\n \"video/mp4\"\n ],\n [\n \"mpeg\",\n \"video/mpeg\"\n ],\n [\n \"mpkg\",\n \"application/vnd.apple.installer+xml\"\n ],\n [\n \"odp\",\n \"application/vnd.oasis.opendocument.presentation\"\n ],\n [\n \"ods\",\n \"application/vnd.oasis.opendocument.spreadsheet\"\n ],\n [\n \"odt\",\n \"application/vnd.oasis.opendocument.text\"\n ],\n [\n \"oga\",\n \"audio/ogg\"\n ],\n [\n \"ogv\",\n \"video/ogg\"\n ],\n [\n \"ogx\",\n \"application/ogg\"\n ],\n [\n \"opus\",\n \"audio/opus\"\n ],\n [\n \"otf\",\n \"font/otf\"\n ],\n [\n \"png\",\n \"image/png\"\n ],\n [\n \"pdf\",\n \"application/pdf\"\n ],\n [\n \"php\",\n \"application/x-httpd-php\"\n ],\n [\n \"ppt\",\n \"application/vnd.ms-powerpoint\"\n ],\n [\n \"pptx\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\"\n ],\n [\n \"rar\",\n \"application/vnd.rar\"\n ],\n [\n \"rtf\",\n \"application/rtf\"\n ],\n [\n \"sh\",\n \"application/x-sh\"\n ],\n [\n \"svg\",\n \"image/svg+xml\"\n ],\n [\n \"swf\",\n \"application/x-shockwave-flash\"\n ],\n [\n \"tar\",\n \"application/x-tar\"\n ],\n [\n \"tif\",\n \"image/tiff\"\n ],\n [\n \"tiff\",\n \"image/tiff\"\n ],\n [\n \"ts\",\n \"video/mp2t\"\n ],\n [\n \"ttf\",\n \"font/ttf\"\n ],\n [\n \"txt\",\n \"text/plain\"\n ],\n [\n \"vsd\",\n \"application/vnd.visio\"\n ],\n [\n \"wav\",\n \"audio/wav\"\n ],\n [\n \"weba\",\n \"audio/webm\"\n ],\n [\n \"webm\",\n \"video/webm\"\n ],\n [\n \"webp\",\n \"image/webp\"\n ],\n [\n \"woff\",\n \"font/woff\"\n ],\n [\n \"woff2\",\n \"font/woff2\"\n ],\n [\n \"xhtml\",\n \"application/xhtml+xml\"\n ],\n [\n \"xls\",\n \"application/vnd.ms-excel\"\n ],\n [\n \"xlsx\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"\n ],\n [\n \"xml\",\n \"application/xml\"\n ],\n [\n \"xul\",\n \"application/vnd.mozilla.xul+xml\"\n ],\n [\n \"zip\",\n \"application/zip\"\n ],\n [\n \"7z\",\n \"application/x-7z-compressed\"\n ],\n // Others\n [\n \"mkv\",\n \"video/x-matroska\"\n ],\n [\n \"mov\",\n \"video/quicktime\"\n ],\n [\n \"msg\",\n \"application/vnd.ms-outlook\"\n ]\n]);\nconst $f31161edf38949e9$var$FILES_TO_IGNORE = [\n // Thumbnail cache files for macOS and Windows\n \".DS_Store\",\n \"Thumbs.db\" // Windows\n];\n/**\n * Adds a `type` property to the file object if it doesn't have one and the file has an extension.\n * This is needed because Firefox doesn't add a type property to files dragged from the desktop.\n * @bug https://bugzilla.mozilla.org/show_bug.cgi?id=1424689\n *\n * @param {File} file - The file object to add the type property to.\n * @returns {File} - The file object with the type property added.\n */ const $f31161edf38949e9$var$toFileWithMimeType = (file)=>{\n const { name: name } = file;\n const hasExtension = name && name.lastIndexOf(\".\") !== -1;\n if (hasExtension && !file.type) {\n const extension = (name.split(\".\").pop() || \"\").toLowerCase();\n const type = $f31161edf38949e9$var$COMMON_MIME_TYPES.get(extension);\n if (type) Object.defineProperty(file, \"type\", {\n value: type,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n return file;\n};\n/**\n * Adds a `path` property to the file object if it doesn't have one.\n * If `path` is not provided, the `webkitRelativePath` property of the file will be used\n * or the file's name if `webkitRelativePath` is not available.\n *\n * @param {File} file - The file object to add the path property to.\n * @param {string} [path] - The path to set on the file object.\n * @returns {File} - The file object with the path property added.\n */ const $f31161edf38949e9$var$toFileWithPath = (file, path)=>{\n const fileWithMimeType = $f31161edf38949e9$var$toFileWithMimeType(file);\n // @ts-ignore\n if (typeof fileWithMimeType.path !== \"string\") {\n const { webkitRelativePath: webkitRelativePath } = file;\n Object.defineProperty(fileWithMimeType, \"path\", {\n value: typeof path === \"string\" ? path : webkitRelativePath || file.name,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n return fileWithMimeType;\n};\n/**\n * Wrap `FileSystemDirectoryReader.readEntries` in a promise to make working with read entries easier.\n * https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */ const $f31161edf38949e9$var$readEntriesPromise = async (directoryReader)=>{\n return await new Promise((resolve, reject)=>{\n directoryReader.readEntries(resolve, reject);\n });\n};\n/**\n * Read all entries in a directory or sub-directory\n * by calling `readEntries` until it returns an empty array.\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */ const $f31161edf38949e9$var$readAllDirectoryEntries = async (directoryReader)=>{\n const entries = [];\n let readEntries = await $f31161edf38949e9$var$readEntriesPromise(directoryReader);\n while(readEntries.length > 0){\n entries.push(...readEntries);\n readEntries = await $f31161edf38949e9$var$readEntriesPromise(directoryReader);\n }\n return entries;\n};\n/**\n * Get a `File` object from a `FileSystemFileEntry` object.\n *\n * @param {FileSystemFileEntry} fileEntry - The file entry to get a `File` object from.\n * @returns {Promise<File>} - A promise that resolves with a `File` object.\n */ const $f31161edf38949e9$var$getFileFromFileEntry = (fileEntry)=>{\n return new Promise((resolve, reject)=>{\n fileEntry.file((file)=>resolve($f31161edf38949e9$var$toFileWithPath(file, fileEntry.fullPath)), reject);\n });\n};\n/**\n * Get an array of `File` objects from a `DataTransferItemList` object.\n *\n * @param {DataTransferItemList} dataTransferItemList - The item list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */ const $f31161edf38949e9$var$getFilesFromDataTransferItemList = async (dataTransferItemList)=>{\n const files = [];\n // Chromium browsers read only 100 files at a time as per the spec, so we need to use\n // BFS (Breadth-first search) to traverse the entire directory/file structure.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#javascript_content\n const queue = [];\n for (const item of dataTransferItemList){\n if (item.kind !== \"file\") continue;\n // https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry\n // This function is implemented as `webkitGetAsEntry()` in non-WebKit browsers\n // including Firefox at this time but it may be renamed to `getAsEntry()` in the future.\n // @ts-ignore\n const entry = item.getAsEntry ? item.getAsEntry() : item.webkitGetAsEntry();\n queue.push(entry);\n }\n while(queue.length > 0){\n const entry = queue.shift();\n if (!entry) continue;\n else if (entry.isFile) {\n const file = await $f31161edf38949e9$var$getFileFromFileEntry(entry);\n if ($f31161edf38949e9$var$FILES_TO_IGNORE.indexOf(file.name) === -1) files.push(file);\n } else if (entry.isDirectory) queue.push(...await $f31161edf38949e9$var$readAllDirectoryEntries(entry.createReader()));\n }\n return files;\n};\n/**\n * Get an array of `File` objects from a `FileList` object.\n *\n * @param {FileList} fileList - The file list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */ const $f31161edf38949e9$var$getFilesFromFileList = async (fileList)=>{\n const files = [];\n for (const file of fileList)if ($f31161edf38949e9$var$FILES_TO_IGNORE.indexOf(file.name) === -1) files.push($f31161edf38949e9$var$toFileWithPath(file));\n return files;\n};\nconst $f31161edf38949e9$export$6d52664cd15c442 = async (evt)=>{\n if (evt.dataTransfer) return evt.dataTransfer.items ? await $f31161edf38949e9$var$getFilesFromDataTransferItemList(evt.dataTransfer.items) : await $f31161edf38949e9$var$getFilesFromFileList(evt.dataTransfer.files);\n return await $f31161edf38949e9$var$getFilesFromFileList(evt.target.files);\n};\n\n\nconst $862aa3736b0514bc$var$COMPONENT_NAME = \"files-dropzone\";\nconst $862aa3736b0514bc$var$TOO_MANY_FILES = \"TOO_MANY_FILES\";\nconst $862aa3736b0514bc$var$FILE_TOO_LARGE = \"FILE_TOO_LARGE\";\nconst $862aa3736b0514bc$var$FILE_TOO_SMALL = \"FILE_TOO_SMALL\";\nconst $862aa3736b0514bc$var$INVALID_MIME_TYPE = \"INVALID_MIME_TYPE\";\nconst $862aa3736b0514bc$var$template = document.createElement(\"template\");\nconst $862aa3736b0514bc$var$styles = /* css */ `\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #6c757d;\n --dropzone-border-color-dragover: #0d6efd;\n --dropzone-border-color-hover: var(--dropzone-border-color-dragover);\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-background-color-hover: var(--dropzone-background-color-dragover);\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n --dropzone-body-color-hover: var(--dropzone-body-color-dragover);\n --dropzone-focus-shadow-rgb: 49,132,253;\n --dropzone-focus-box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);\n --transition-duration: 0.2s; /* for backwards compatibility */\n --dropzone-transition-duration: var(--transition-duration);\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border var(--dropzone-transition-duration) ease-in-out, background-color var(--dropzone-transition-duration) ease-in-out, color var(--dropzone-transition-duration) ease-in-out, box-shadow var(--dropzone-transition-duration) ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone:focus-visible {\n outline: none;\n box-shadow: var(--dropzone-focus-box-shadow);\n }\n\n @media (hover: hover) {\n :host(:not([no-style]):not([disabled])) .dropzone:not(.dropzone--dragover):hover {\n border-color: var(--dropzone-border-color-hover);\n background-color: var(--dropzone-background-color-hover);\n color: var(--dropzone-body-color-hover);\n }\n }\n`;\n$862aa3736b0514bc$var$template.innerHTML = /* html */ `\n <style>\n ${$862aa3736b0514bc$var$styles}\n </style>\n\n <input type=\"file\" id=\"fileInput\" hidden>\n\n <div part=\"dropzone\" class=\"dropzone\" id=\"dropzoneEl\" tabindex=\"0\" role=\"presentation\">\n <slot>Drag 'n' drop files here, or click to select files</slot>\n </div>\n`;\n/**\n * @summary A custom element that allows users to drag and drop files into it.\n * @documentation https://github.com/georapbox/files-dropzone-element\n *\n * @tagname files-dropzone - This is the default tag name, unless overridden by the `defineCustomElement` method.\n *\n * @property {string} accept - A comma-separated list of unique file type specifiers describing file types to allow.\n * @property {boolean} disabled - Determines whether the dropzone is disabled.\n * @property {number} maxFiles - The maximum number of files allowed to be dropped.\n * @property {number} maxSize - The maximum file size allowed in bytes.\n * @property {number} minSize - The minimum file size allowed in bytes.\n * @property {boolean} multiple - Allows multiple files to be dropped.\n * @property {boolean} noClick - Prevents the file dialog from opening when the dropzone is clicked.\n * @property {boolean} noDrag - Prevents the dropzone from reacting to drag events.\n * @property {boolean} noKeyboard - Prevents the dropzone from reacting to keyboard events.\n * @property {boolean} autoFocus - Automatically focuses the dropzone when it's connected to the DOM.\n * @property {boolean} noStyle - Prevents the dropzone from applying any styling.\n *\n * @attribute {string} accept - Reflects the accept property.\n * @attribute {boolean} disabled - Reflects the disabled property.\n * @attribute {number} max-files - Reflects the maxFiles property.\n * @attribute {number} max-size - Reflects the maxSize property.\n * @attribute {number} min-size - Reflects the minSize property.\n * @attribute {boolean} multiple - Reflects the multiple property.\n * @attribute {boolean} no-click - Reflects the noClick property.\n * @attribute {boolean} no-drag - Reflects the noDrag property.\n * @attribute {boolean} no-keyboard - Reflects the noKeyboard property.\n * @attribute {boolean} auto-focus - Reflects the autoFocus property.\n * @attribute {boolean} no-style - Reflects the noStyle property.\n *\n * @slot - The default slot content of the dropzone.\n *\n * @csspart dropzone - The dropzone element.\n * @csspart dropzone--dragover - The state of the dropzone when dragging over it.\n *\n * @cssproperty --dropzone-border-width - The border width of the dropzone.\n * @cssproperty --dropzone-border-style - The border style of the dropzone.\n * @cssproperty --dropzone-border-radius - The border radius of the dropzone.\n * @cssproperty --dropzone-border-color - The border color of the dropzone.\n * @cssproperty --dropzone-border-color-dragover - The border color of the dropzone when dragging over it.\n * @cssproperty --dropzone-border-color-hover - The border color of the dropzone when hovering over it.\n * @cssproperty --dropzone-background-color - The background color of the dropzone.\n * @cssproperty --dropzone-background-color-dragover - The background color of the dropzone when dragging over it.\n * @cssproperty --dropzone-background-color-hover - The background color of the dropzone when hovering over it.\n * @cssproperty --dropzone-body-color - The text color of the dropzone.\n * @cssproperty --dropzone-body-color-dragover - The text color of the dropzone when dragging over it.\n * @cssproperty --dropzone-body-color-hover - The text color of the dropzone when hovering over it.\n * @cssproperty --dropzone-focus-shadow-rgb - The RGB value of the dropzone's focus shadow.\n * @cssproperty --dropzone-focus-box-shadow - The box shadow of the dropzone when focused.\n * @cssproperty --dropzone-transition-duration - The transition's duration for the dropzone area.\n *\n * @event files-dropzone-drop - Fired when files are dropped.\n * @event files-dropzone-drop-accepted - Fired when files dropped files are accepted.\n * @event files-dropzone-drop-rejected - Fired when files dropped files are rejected.\n * @event files-dropzone-dragenter - Fired when files are dragged into the dropzone.\n * @event files-dropzone-dragover - Fired when files are dragged over the dropzone.\n * @event files-dropzone-dragleave - Fired when files are dragged out of the dropzone.\n * @event files-dropzone-error - Fired when there is any error in the process of reading dropped files or directories.\n *\n * @method defineCustomElement - Static method. Defines a custom element with the given name.\n * @method openFileDialog - Instance method. Opens the file dialog programmatically.\n */ class $862aa3736b0514bc$export$6ccd1735166caad9 extends HTMLElement {\n /** @type {Nullable<HTMLInputElement>} */ #fileInput = null;\n /** @type {Nullable<HTMLElement>} */ #dropzoneEl = null;\n constructor(){\n super();\n if (!this.shadowRoot) {\n const shadowRoot = this.attachShadow({\n mode: \"open\"\n });\n shadowRoot.appendChild($862aa3736b0514bc$var$template.content.cloneNode(true));\n }\n if (this.shadowRoot) {\n this.#fileInput = /** @type {Nullable<HTMLInputElement>} */ this.shadowRoot.getElementById(\"fileInput\");\n this.#dropzoneEl = this.shadowRoot.getElementById(\"dropzoneEl\");\n }\n }\n static get observedAttributes() {\n return [\n \"accept\",\n \"disabled\",\n \"multiple\",\n \"no-keyboard\"\n ];\n }\n /**\n * Lifecycle method that is called when attributes are changed, added, removed, or replaced.\n *\n * @param {string} name - The name of the attribute.\n * @param {string} oldValue - The old value of the attribute.\n * @param {string} newValue - The new value of the attribute.\n */ attributeChangedCallback(name, oldValue, newValue) {\n if (name === \"accept\" && oldValue !== newValue && this.#fileInput) this.#fileInput.accept = this.accept;\n if (name === \"disabled\" && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.disabled = this.disabled;\n if (this.disabled) this.#dropzoneEl?.removeAttribute(\"tabindex\");\n else this.#dropzoneEl?.setAttribute(\"tabindex\", \"0\");\n }\n if (name === \"multiple\" && oldValue !== newValue && this.#fileInput) this.#fileInput.multiple = this.multiple;\n if (name === \"no-keyboard\" && oldValue !== newValue && this.#dropzoneEl) {\n if (this.noKeyboard) this.#dropzoneEl.removeAttribute(\"tabindex\");\n else this.#dropzoneEl.setAttribute(\"tabindex\", \"0\");\n }\n }\n /**\n * Lifecycle method that is called when the element is added to the DOM.\n */ connectedCallback() {\n this.#upgradeProperty(\"accept\");\n this.#upgradeProperty(\"disabled\");\n this.#upgradeProperty(\"maxFiles\");\n this.#upgradeProperty(\"maxSize\");\n this.#upgradeProperty(\"minSize\");\n this.#upgradeProperty(\"multiple\");\n this.#upgradeProperty(\"noClick\");\n this.#upgradeProperty(\"noDrag\");\n this.#upgradeProperty(\"noKeyboard\");\n this.#upgradeProperty(\"autoFocus\");\n this.#upgradeProperty(\"noStyle\");\n this.#fileInput?.addEventListener(\"change\", this.#handleFileInputChange);\n this.#dropzoneEl?.addEventListener(\"dragenter\", this.#handleDragEnter);\n this.#dropzoneEl?.addEventListener(\"dragover\", this.#handleDragOver);\n this.#dropzoneEl?.addEventListener(\"dragleave\", this.#handleDragLeave);\n this.#dropzoneEl?.addEventListener(\"drop\", this.#handleDrop);\n this.#dropzoneEl?.addEventListener(\"click\", this.#handleClick);\n this.#dropzoneEl?.addEventListener(\"keyup\", this.#handleKeyUp);\n this.autoFocus && this.#dropzoneEl?.focus();\n }\n /**\n * Lifecycle method that is called when the element is removed from the DOM.\n */ disconnectedCallback() {\n this.#fileInput?.removeEventListener(\"change\", this.#handleFileInputChange);\n this.#dropzoneEl?.removeEventListener(\"dragenter\", this.#handleDragEnter);\n this.#dropzoneEl?.removeEventListener(\"dragover\", this.#handleDragOver);\n this.#dropzoneEl?.removeEventListener(\"dragleave\", this.#handleDragLeave);\n this.#dropzoneEl?.removeEventListener(\"drop\", this.#handleDrop);\n this.#dropzoneEl?.removeEventListener(\"click\", this.#handleClick);\n this.#dropzoneEl?.removeEventListener(\"keyup\", this.#handleKeyUp);\n }\n /**\n * @type {string} - A comma-separated list of unique file type specifiers describing file types to allow.\n * @attribute accept - Reflects the accept property.\n */ get accept() {\n return this.getAttribute(\"accept\") || \"\";\n }\n set accept(value) {\n this.setAttribute(\"accept\", value != null ? value.toString() : value);\n }\n /**\n * @type {boolean} - Determines whether the dropzone is disabled.\n * @default false\n * @attribute disabled - Reflects the disabled property.\n */ get disabled() {\n return this.hasAttribute(\"disabled\");\n }\n set disabled(value) {\n this.toggleAttribute(\"disabled\", !!value);\n }\n /**\n * @type {number} - The maximum number of files allowed to be dropped.\n * @default Infinity\n * @attribute max-files - Reflects the maxFiles property.\n */ get maxFiles() {\n const num = Number(this.getAttribute(\"max-files\")) || 0;\n if (num <= 0) return Infinity;\n return Math.floor(Math.abs(num));\n }\n set maxFiles(value) {\n this.setAttribute(\"max-files\", value != null ? value.toString() : value);\n }\n /**\n * @type {number} - The maximum file size allowed in bytes.\n * @default Infinity\n * @attribute max-size - Reflects the maxSize property.\n */ get maxSize() {\n const value = this.getAttribute(\"max-size\");\n if (value === null) return Infinity;\n const num = Number(value);\n return Number.isNaN(num) ? Infinity : num;\n }\n set maxSize(value) {\n this.setAttribute(\"max-size\", value != null ? value.toString() : value);\n }\n /**\n * @type {number} - The minimum file size allowed in bytes.\n * @default 0\n * @attribute min-size - Reflects the minSize property.\n */ get minSize() {\n const value = this.getAttribute(\"min-size\");\n if (value === null) return 0;\n const num = Number(value);\n return Number.isNaN(num) ? 0 : num;\n }\n set minSize(value) {\n this.setAttribute(\"min-size\", value != null ? value.toString() : value);\n }\n /**\n * @type {boolean} - Allows multiple files to be dropped.\n * @default false\n * @attribute multiple - Reflects the multiple property.\n */ get multiple() {\n return this.hasAttribute(\"multiple\");\n }\n set multiple(value) {\n this.toggleAttribute(\"multiple\", !!value);\n }\n /**\n * @type {boolean} - Prevents the file dialog from opening when the dropzone is clicked.\n * @default false\n * @attribute no-click - Reflects the noClick property.\n */ get noClick() {\n return this.hasAttribute(\"no-click\");\n }\n set noClick(value) {\n this.toggleAttribute(\"no-click\", !!value);\n }\n /**\n * @type {boolean} - Prevents the dropzone from reacting to drag events.\n * @default false\n * @attribute no-drag - Reflects the noDrag property.\n */ get noDrag() {\n return this.hasAttribute(\"no-drag\");\n }\n set noDrag(value) {\n this.toggleAttribute(\"no-drag\", !!value);\n }\n /**\n * @type {boolean} - Prevents the dropzone from reacting to keyboard events.\n * @default false\n * @attribute no-keyboard - Reflects the noKeyboard property.\n */ get noKeyboard() {\n return this.hasAttribute(\"no-keyboard\");\n }\n set noKeyboard(value) {\n this.toggleAttribute(\"no-keyboard\", !!value);\n }\n /**\n * @type {boolean} - Automatically focuses the dropzone when it's connected to the DOM.\n * @default false\n * @attribute auto-focus - Reflects the autoFocus property.\n */ get autoFocus() {\n return this.hasAttribute(\"auto-focus\");\n }\n set autoFocus(value) {\n this.toggleAttribute(\"auto-focus\", !!value);\n }\n /**\n * @type {boolean} - Prevents the dropzone from applying any styling.\n * @default false\n * @attribute no-style - Reflects the noStyle property.\n */ get noStyle() {\n return this.hasAttribute(\"no-style\");\n }\n set noStyle(value) {\n this.toggleAttribute(\"no-style\", !!value);\n }\n /**\n * Handles the change event of the file input.\n *\n * @param {*} evt - The event object.\n */ #handleFileInputChange = async (evt)=>{\n try {\n this.#handleFilesSelect(await (0, $f31161edf38949e9$export$6d52664cd15c442)(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: {\n error: error\n }\n }));\n }\n };\n /**\n * Handles the dragenter event of the dropzone.\n */ #handleDragEnter = ()=>{\n if (this.disabled || this.noDrag) return;\n this.dispatchEvent(new Event(`${$862aa3736b0514bc$var$COMPONENT_NAME}-dragenter`, {\n bubbles: true,\n composed: true\n }));\n };\n /**\n * Handles the dragover event of the dropzone.\n *\n * @param {*} evt - The event object.\n */ #handleDragOver = (evt)=>{\n evt.preventDefault();\n if (this.disabled || this.noDrag) {\n evt.dataTransfer.dropEffect = \"none\";\n return;\n }\n evt.dataTransfer.dropEffect = \"copy\";\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.add(\"dropzone--dragover\");\n this.#dropzoneEl.part.add(\"dropzone--dragover\");\n }\n this.dispatchEvent(new Event(`${$862aa3736b0514bc$var$COMPONENT_NAME}-dragover`, {\n bubbles: true,\n composed: true\n }));\n };\n /**\n * Handles the dragleave event of the dropzone.\n */ #handleDragLeave = ()=>{\n if (this.disabled || this.noDrag) return;\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove(\"dropzone--dragover\");\n this.#dropzoneEl.part.remove(\"dropzone--dragover\");\n }\n this.dispatchEvent(new Event(`${$862aa3736b0514bc$var$COMPONENT_NAME}-dragleave`, {\n bubbles: true,\n composed: true\n }));\n };\n /**\n * Handles the drop event of the dropzone.\n *\n * @param {*} evt - The event object.\n */ #handleDrop = async (evt)=>{\n if (this.disabled || this.noDrag) return;\n evt.preventDefault();\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove(\"dropzone--dragover\");\n this.#dropzoneEl.part.remove(\"dropzone--dragover\");\n }\n try {\n this.#handleFilesSelect(await (0, $f31161edf38949e9$export$6d52664cd15c442)(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: {\n error: error\n }\n }));\n }\n };\n /**\n * Handles the click event of the dropzone.\n */ #handleClick = ()=>{\n if (this.disabled || this.noClick) return;\n this.#fileInput?.click();\n };\n /**\n * Handles the keyup event of the dropzone.\n *\n * @param {*} evt - The event object.\n */ #handleKeyUp = (evt)=>{\n if (this.disabled || this.noKeyboard) return;\n if (evt.key === \" \" || evt.key === \"Enter\") this.#fileInput?.click();\n };\n /**\n * Handles the selection of files.\n *\n * @param {File[]} files - The files to handle.\n */ #handleFilesSelect(files) {\n if (!Array.isArray(files) || !files.length) return;\n const acceptedFiles = [];\n const rejectedFiles = [];\n const filesLength = files.length;\n // If the component is not in multiple mode, reject all files.\n if (!this.multiple && filesLength > 1) for (const file of files)rejectedFiles.push({\n file: file,\n errors: [\n {\n code: $862aa3736b0514bc$var$TOO_MANY_FILES,\n message: `Too many files selected. Only 1 file is allowed.`\n }\n ]\n });\n else if (this.multiple && filesLength > this.maxFiles) // If the component is in multiple mode, but the number of files exceeds\n // the maxFiles attribute, reject all files.\n for (const file of files)rejectedFiles.push({\n file: file,\n errors: [\n {\n code: $862aa3736b0514bc$var$TOO_MANY_FILES,\n message: `Too many files selected. Only ${this.maxFiles} ${this.maxFiles > 1 ? \"files are\" : \"file is\"} allowed.`\n }\n ]\n });\n else // Validate each file. If it's valid, add it to the accepted files array,\n // otherwise add it to the rejected files array.\n for (const file of files){\n const fileHasValidType = (0, $38f222170fd4d21a$export$7c47054fed488f80)(file, this.accept);\n const fileExceedsMaxSize = file.size > this.maxSize;\n const fileIsSmallerThanMinSize = file.size < this.minSize;\n if (fileHasValidType && !fileExceedsMaxSize && !fileIsSmallerThanMinSize) acceptedFiles.push(file);\n else {\n const errors = [];\n if (!fileHasValidType) errors.push({\n code: $862aa3736b0514bc$var$INVALID_MIME_TYPE,\n message: `File type \"${file.type}\" is not accepted.`\n });\n if (fileExceedsMaxSize) errors.push({\n code: $862aa3736b0514bc$var$FILE_TOO_LARGE,\n message: `File size ${file.size} exceeds the maximum size of ${this.maxSize}.`\n });\n if (fileIsSmallerThanMinSize) errors.push({\n code: $862aa3736b0514bc$var$FILE_TOO_SMALL,\n message: `File size ${file.size} is smaller than the minimum size of ${this.minSize}.`\n });\n rejectedFiles.push({\n file: file,\n errors: errors\n });\n }\n }\n this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-drop`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles: acceptedFiles,\n rejectedFiles: rejectedFiles\n }\n }));\n if (acceptedFiles.length > 0) this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-drop-accepted`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles: acceptedFiles\n }\n }));\n if (rejectedFiles.length > 0) this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-drop-rejected`, {\n bubbles: true,\n composed: true,\n detail: {\n rejectedFiles: rejectedFiles\n }\n }));\n if (this.#fileInput) this.#fileInput.value = this.#fileInput.defaultValue;\n }\n /**\n * Opens the file dialog programmatically.\n */ openFileDialog() {\n if (this.disabled) return;\n this.#fileInput?.click();\n }\n /**\n * This is to safe guard against cases where, for instance, a framework may have added the element to the page and set a\n * value on one of its properties, but lazy loaded its definition. Without this guard, the upgraded element would miss that\n * property and the instance property would prevent the class property setter from ever being called.\n *\n * https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n *\n * @param {'accept' | 'disabled' | 'maxFiles' | 'maxSize' | 'minSize' | 'multiple' | 'noClick' | 'noDrag' | 'noKeyboard' | 'autoFocus' | 'noStyle'} prop - The property name to upgrade.\n */ #upgradeProperty(prop) {\n /** @type {any} */ const instance = this;\n if (Object.prototype.hasOwnProperty.call(instance, prop)) {\n const value = instance[prop];\n delete instance[prop];\n instance[prop] = value;\n }\n }\n /**\n * Defines a custom element with the given name.\n * The name must contain a dash (-).\n *\n * @param {string} [elementName='files-dropzone'] - The name of the custom element.\n * @example\n *\n * FilesDropzone.defineCustomElement('my-dropzone');\n */ static defineCustomElement(elementName = $862aa3736b0514bc$var$COMPONENT_NAME) {\n if (typeof window !== \"undefined\" && !window.customElements.get(elementName)) window.customElements.define(elementName, $862aa3736b0514bc$export$6ccd1735166caad9);\n }\n}\n\n\nexport {$862aa3736b0514bc$export$6ccd1735166caad9 as FilesDropzone};\n//# sourceMappingURL=files-dropzone.js.map\n","// @ts-check\n\n/**\n * Represents a value that may be of type T, or null.\n *\n * @template T\n * @typedef {T | null} Nullable\n */\n\nimport { isValidFile } from './utils/is-valid-file.js';\nimport { getFilesFromEvent } from './utils/files-selector.js';\n\nconst COMPONENT_NAME = 'files-dropzone';\nconst TOO_MANY_FILES = 'TOO_MANY_FILES';\nconst FILE_TOO_LARGE = 'FILE_TOO_LARGE';\nconst FILE_TOO_SMALL = 'FILE_TOO_SMALL';\nconst INVALID_MIME_TYPE = 'INVALID_MIME_TYPE';\nconst template = document.createElement('template');\n\nconst styles = /* css */`\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #6c757d;\n --dropzone-border-color-dragover: #0d6efd;\n --dropzone-border-color-hover: var(--dropzone-border-color-dragover);\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-background-color-hover: var(--dropzone-background-color-dragover);\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n --dropzone-body-color-hover: var(--dropzone-body-color-dragover);\n --dropzone-focus-shadow-rgb: 49,132,253;\n --dropzone-focus-box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);\n --transition-duration: 0.2s; /* for backwards compatibility */\n --dropzone-transition-duration: var(--transition-duration);\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border var(--dropzone-transition-duration) ease-in-out, background-color var(--dropzone-transition-duration) ease-in-out, color var(--dropzone-transition-duration) ease-in-out, box-shadow var(--dropzone-transition-duration) ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone:focus-visible {\n outline: none;\n box-shadow: var(--dropzone-focus-box-shadow);\n }\n\n @media (hover: hover) {\n :host(:not([no-style]):not([disabled])) .dropzone:not(.dropzone--dragover):hover {\n border-color: var(--dropzone-border-color-hover);\n background-color: var(--dropzone-background-color-hover);\n color: var(--dropzone-body-color-hover);\n }\n }\n`;\n\ntemplate.innerHTML = /* html */`\n <style>\n ${styles}\n </style>\n\n <input type=\"file\" id=\"fileInput\" hidden>\n\n <div part=\"dropzone\" class=\"dropzone\" id=\"dropzoneEl\" tabindex=\"0\" role=\"presentation\">\n <slot>Drag 'n' drop files here, or click to select files</slot>\n </div>\n`;\n\n/**\n * @summary A custom element that allows users to drag and drop files into it.\n * @documentation https://github.com/georapbox/files-dropzone-element\n *\n * @tagname files-dropzone - This is the default tag name, unless overridden by the `defineCustomElement` method.\n *\n * @property {string} accept - A comma-separated list of unique file type specifiers describing file types to allow.\n * @property {boolean} disabled - Determines whether the dropzone is disabled.\n * @property {number} maxFiles - The maximum number of files allowed to be dropped.\n * @property {number} maxSize - The maximum file size allowed in bytes.\n * @property {number} minSize - The minimum file size allowed in bytes.\n * @property {boolean} multiple - Allows multiple files to be dropped.\n * @property {boolean} noClick - Prevents the file dialog from opening when the dropzone is clicked.\n * @property {boolean} noDrag - Prevents the dropzone from reacting to drag events.\n * @property {boolean} noKeyboard - Prevents the dropzone from reacting to keyboard events.\n * @property {boolean} autoFocus - Automatically focuses the dropzone when it's connected to the DOM.\n * @property {boolean} noStyle - Prevents the dropzone from applying any styling.\n *\n * @attribute {string} accept - Reflects the accept property.\n * @attribute {boolean} disabled - Reflects the disabled property.\n * @attribute {number} max-files - Reflects the maxFiles property.\n * @attribute {number} max-size - Reflects the maxSize property.\n * @attribute {number} min-size - Reflects the minSize property.\n * @attribute {boolean} multiple - Reflects the multiple property.\n * @attribute {boolean} no-click - Reflects the noClick property.\n * @attribute {boolean} no-drag - Reflects the noDrag property.\n * @attribute {boolean} no-keyboard - Reflects the noKeyboard property.\n * @attribute {boolean} auto-focus - Reflects the autoFocus property.\n * @attribute {boolean} no-style - Reflects the noStyle property.\n *\n * @slot - The default slot content of the dropzone.\n *\n * @csspart dropzone - The dropzone element.\n * @csspart dropzone--dragover - The state of the dropzone when dragging over it.\n *\n * @cssproperty --dropzone-border-width - The border width of the dropzone.\n * @cssproperty --dropzone-border-style - The border style of the dropzone.\n * @cssproperty --dropzone-border-radius - The border radius of the dropzone.\n * @cssproperty --dropzone-border-color - The border color of the dropzone.\n * @cssproperty --dropzone-border-color-dragover - The border color of the dropzone when dragging over it.\n * @cssproperty --dropzone-border-color-hover - The border color of the dropzone when hovering over it.\n * @cssproperty --dropzone-background-color - The background color of the dropzone.\n * @cssproperty --dropzone-background-color-dragover - The background color of the dropzone when dragging over it.\n * @cssproperty --dropzone-background-color-hover - The background color of the dropzone when hovering over it.\n * @cssproperty --dropzone-body-color - The text color of the dropzone.\n * @cssproperty --dropzone-body-color-dragover - The text color of the dropzone when dragging over it.\n * @cssproperty --dropzone-body-color-hover - The text color of the dropzone when hovering over it.\n * @cssproperty --dropzone-focus-shadow-rgb - The RGB value of the dropzone's focus shadow.\n * @cssproperty --dropzone-focus-box-shadow - The box shadow of the dropzone when focused.\n * @cssproperty --dropzone-transition-duration - The transition's duration for the dropzone area.\n *\n * @event files-dropzone-drop - Fired when files are dropped.\n * @event files-dropzone-drop-accepted - Fired when files dropped files are accepted.\n * @event files-dropzone-drop-rejected - Fired when files dropped files are rejected.\n * @event files-dropzone-dragenter - Fired when files are dragged into the dropzone.\n * @event files-dropzone-dragover - Fired when files are dragged over the dropzone.\n * @event files-dropzone-dragleave - Fired when files are dragged out of the dropzone.\n * @event files-dropzone-error - Fired when there is any error in the process of reading dropped files or directories.\n *\n * @method defineCustomElement - Static method. Defines a custom element with the given name.\n * @method openFileDialog - Instance method. Opens the file dialog programmatically.\n */\nclass FilesDropzone extends HTMLElement {\n /** @type {Nullable<HTMLInputElement>} */\n #fileInput = null;\n\n /** @type {Nullable<HTMLElement>} */\n #dropzoneEl = null;\n\n constructor() {\n super();\n\n if (!this.shadowRoot) {\n const shadowRoot = this.attachShadow({ mode: 'open' });\n shadowRoot.appendChild(template.content.cloneNode(true));\n }\n\n if (this.shadowRoot) {\n this.#fileInput = /** @type {Nullable<HTMLInputElement>} */(this.shadowRoot.getElementById('fileInput'));\n this.#dropzoneEl = this.shadowRoot.getElementById('dropzoneEl');\n }\n }\n\n static get observedAttributes() {\n return ['accept', 'disabled', 'multiple', 'no-keyboard'];\n }\n\n /**\n * Lifecycle method that is called when attributes are changed, added, removed, or replaced.\n *\n * @param {string} name - The name of the attribute.\n * @param {string} oldValue - The old value of the attribute.\n * @param {string} newValue - The new value of the attribute.\n */\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'accept' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.accept = this.accept;\n }\n\n if (name === 'disabled' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.disabled = this.disabled;\n\n if (this.disabled) {\n this.#dropzoneEl?.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl?.setAttribute('tabindex', '0');\n }\n }\n\n if (name === 'multiple' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.multiple = this.multiple;\n }\n\n if (name === 'no-keyboard' && oldValue !== newValue && this.#dropzoneEl) {\n if (this.noKeyboard) {\n this.#dropzoneEl.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl.setAttribute('tabindex', '0');\n }\n }\n }\n\n /**\n * Lifecycle method that is called when the element is added to the DOM.\n */\n connectedCallback() {\n this.#upgradeProperty('accept');\n this.#upgradeProperty('disabled');\n this.#upgradeProperty('maxFiles');\n this.#upgradeProperty('maxSize');\n this.#upgradeProperty('minSize');\n this.#upgradeProperty('multiple');\n this.#upgradeProperty('noClick');\n this.#upgradeProperty('noDrag');\n this.#upgradeProperty('noKeyboard');\n this.#upgradeProperty('autoFocus');\n this.#upgradeProperty('noStyle');\n\n this.#fileInput?.addEventListener('change', this.#handleFileInputChange);\n this.#dropzoneEl?.addEventListener('dragenter', this.#handleDragEnter);\n this.#dropzoneEl?.addEventListener('dragover', this.#handleDragOver);\n this.#dropzoneEl?.addEventListener('dragleave', this.#handleDragLeave);\n this.#dropzoneEl?.addEventListener('drop', this.#handleDrop);\n this.#dropzoneEl?.addEventListener('click', this.#handleClick);\n this.#dropzoneEl?.addEventListener('keyup', this.#handleKeyUp);\n\n this.autoFocus && this.#dropzoneEl?.focus();\n }\n\n /**\n * Lifecycle method that is called when the element is removed from the DOM.\n */\n disconnectedCallback() {\n this.#fileInput?.removeEventListener('change', this.#handleFileInputChange);\n this.#dropzoneEl?.removeEventListener('dragenter', this.#handleDragEnter);\n this.#dropzoneEl?.removeEventListener('dragover', this.#handleDragOver);\n this.#dropzoneEl?.removeEventListener('dragleave', this.#handleDragLeave);\n this.#dropzoneEl?.removeEventListener('drop', this.#handleDrop);\n this.#dropzoneEl?.removeEventListener('click', this.#handleClick);\n this.#dropzoneEl?.removeEventListener('keyup', this.#handleKeyUp);\n }\n\n /**\n * @type {string} - A comma-separated list of unique file type specifiers describing file types to allow.\n * @attribute accept - Reflects the accept property.\n */\n get accept() {\n return this.getAttribute('accept') || '';\n }\n\n set accept(value) {\n this.setAttribute('accept', value != null ? value.toString() : value);\n }\n\n /**\n * @type {boolean} - Determines whether the dropzone is disabled.\n * @default false\n * @attribute disabled - Reflects the disabled property.\n */\n get disabled() {\n return this.hasAttribute('disabled');\n }\n\n set disabled(value) {\n this.toggleAttribute('disabled', !!value);\n }\n\n /**\n * @type {number} - The maximum number of files allowed to be dropped.\n * @default Infinity\n * @attribute max-files - Reflects the maxFiles property.\n */\n get maxFiles() {\n const num = Number(this.getAttribute('max-files')) || 0;\n\n if (num <= 0) {\n return Infinity;\n }\n\n return Math.floor(Math.abs(num));\n }\n\n set maxFiles(value) {\n this.setAttribute('max-files', value != null ? value.toString() : value);\n }\n\n /**\n * @type {number} - The maximum file size allowed in bytes.\n * @default Infinity\n * @attribute max-size - Reflects the maxSize property.\n */\n get maxSize() {\n const value = this.getAttribute('max-size');\n\n if (value === null) {\n return Infinity;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? Infinity : num;\n }\n\n set maxSize(value) {\n this.setAttribute('max-size', value != null ? value.toString() : value);\n }\n\n /**\n * @type {number} - The minimum file size allowed in bytes.\n * @default 0\n * @attribute min-size - Reflects the minSize property.\n */\n get minSize() {\n const value = this.getAttribute('min-size');\n\n if (value === null) {\n return 0;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? 0 : num;\n }\n\n set minSize(value) {\n this.setAttribute('min-size', value != null ? value.toString() : value);\n }\n\n /**\n * @type {boolean} - Allows multiple files to be dropped.\n * @default false\n * @attribute multiple - Reflects the multiple property.\n */\n get multiple() {\n return this.hasAttribute('multiple');\n }\n\n set multiple(value) {\n this.toggleAttribute('multiple', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the file dialog from opening when the dropzone is clicked.\n * @default false\n * @attribute no-click - Reflects the noClick property.\n */\n get noClick() {\n return this.hasAttribute('no-click');\n }\n\n set noClick(value) {\n this.toggleAttribute('no-click', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the dropzone from reacting to drag events.\n * @default false\n * @attribute no-drag - Reflects the noDrag property.\n */\n get noDrag() {\n return this.hasAttribute('no-drag');\n }\n\n set noDrag(value) {\n this.toggleAttribute('no-drag', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the dropzone from reacting to keyboard events.\n * @default false\n * @attribute no-keyboard - Reflects the noKeyboard property.\n */\n get noKeyboard() {\n return this.hasAttribute('no-keyboard');\n }\n\n set noKeyboard(value) {\n this.toggleAttribute('no-keyboard', !!value);\n }\n\n /**\n * @type {boolean} - Automatically focuses the dropzone when it's connected to the DOM.\n * @default false\n * @attribute auto-focus - Reflects the autoFocus property.\n */\n get autoFocus() {\n return this.hasAttribute('auto-focus');\n }\n\n set autoFocus(value) {\n this.toggleAttribute('auto-focus', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the dropzone from applying any styling.\n * @default false\n * @attribute no-style - Reflects the noStyle property.\n */\n get noStyle() {\n return this.hasAttribute('no-style');\n }\n\n set noStyle(value) {\n this.toggleAttribute('no-style', !!value);\n }\n\n /**\n * Handles the change event of the file input.\n *\n * @param {*} evt - The event object.\n */\n #handleFileInputChange = async evt => {\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n /**\n * Handles the dragenter event of the dropzone.\n */\n #handleDragEnter = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragenter`, {\n bubbles: true,\n composed: true\n }));\n };\n\n /**\n * Handles the dragover event of the dropzone.\n *\n * @param {*} evt - The event object.\n */\n #handleDragOver = evt => {\n evt.preventDefault();\n\n if (this.disabled || this.noDrag) {\n evt.dataTransfer.dropEffect = 'none';\n return;\n }\n\n evt.dataTransfer.dropEffect = 'copy';\n\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.add('dropzone--dragover');\n this.#dropzoneEl.part.add('dropzone--dragover');\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragover`, {\n bubbles: true,\n composed: true\n }));\n };\n\n /**\n * Handles the dragleave event of the dropzone.\n */\n #handleDragLeave = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragleave`, {\n bubbles: true,\n composed: true\n }));\n };\n\n /**\n * Handles the drop event of the dropzone.\n *\n * @param {*} evt - The event object.\n */\n #handleDrop = async evt => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n evt.preventDefault();\n\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n }\n\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n /**\n * Handles the click event of the dropzone.\n */\n #handleClick = () => {\n if (this.disabled || this.noClick) {\n return;\n }\n\n this.#fileInput?.click();\n };\n\n /**\n * Handles the keyup event of the dropzone.\n *\n * @param {*} evt - The event object.\n */\n #handleKeyUp = evt => {\n if (this.disabled || this.noKeyboard) {\n return;\n }\n\n if (evt.key === ' ' || evt.key === 'Enter') {\n this.#fileInput?.click();\n }\n };\n\n /**\n * Handles the selection of files.\n *\n * @param {File[]} files - The files to handle.\n */\n #handleFilesSelect(files) {\n if (!Array.isArray(files) || !files.length) {\n return;\n }\n\n const acceptedFiles = [];\n const rejectedFiles = [];\n const filesLength = files.length;\n\n // If the component is not in multiple mode, reject all files.\n if (!this.multiple && filesLength > 1) {\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only 1 file is allowed.`\n }]\n });\n }\n } else if (this.multiple && filesLength > this.maxFiles) {\n // If the component is in multiple mode, but the number of files exceeds\n // the maxFiles attribute, reject all files.\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only ${this.maxFiles} ${this.maxFiles > 1 ? 'files are' : 'file is'} allowed.`\n }]\n });\n }\n } else {\n // Validate each file. If it's valid, add it to the accepted files array,\n // otherwise add it to the rejected files array.\n for (const file of files) {\n const fileHasValidType = isValidFile(file, this.accept);\n const fileExceedsMaxSize = file.size > this.maxSize;\n const fileIsSmallerThanMinSize = file.size < this.minSize;\n\n if (fileHasValidType && !fileExceedsMaxSize && !fileIsSmallerThanMinSize) {\n acceptedFiles.push(file);\n } else {\n const errors = [];\n\n if (!fileHasValidType) {\n errors.push({\n code: INVALID_MIME_TYPE,\n message: `File type \"${file.type}\" is not accepted.`\n });\n }\n\n if (fileExceedsMaxSize) {\n errors.push({\n code: FILE_TOO_LARGE,\n message: `File size ${file.size} exceeds the maximum size of ${this.maxSize}.`\n });\n }\n\n if (fileIsSmallerThanMinSize) {\n errors.push({\n code: FILE_TOO_SMALL,\n message: `File size ${file.size} is smaller than the minimum size of ${this.minSize}.`\n });\n }\n\n rejectedFiles.push({ file, errors });\n }\n }\n }\n\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles,\n rejectedFiles\n }\n }));\n\n if (acceptedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-accepted`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles\n }\n }));\n }\n\n if (rejectedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-rejected`, {\n bubbles: true,\n composed: true,\n detail: {\n rejectedFiles\n }\n }));\n }\n\n if (this.#fileInput) {\n this.#fileInput.value = this.#fileInput.defaultValue;\n }\n }\n\n /**\n * Opens the file dialog programmatically.\n */\n openFileDialog() {\n if (this.disabled) {\n return;\n }\n\n this.#fileInput?.click();\n }\n\n /**\n * This is to safe guard against cases where, for instance, a framework may have added the element to the page and set a\n * value on one of its properties, but lazy loaded its definition. Without this guard, the upgraded element would miss that\n * property and the instance property would prevent the class property setter from ever being called.\n *\n * https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n *\n * @param {'accept' | 'disabled' | 'maxFiles' | 'maxSize' | 'minSize' | 'multiple' | 'noClick' | 'noDrag' | 'noKeyboard' | 'autoFocus' | 'noStyle'} prop - The property name to upgrade.\n */\n #upgradeProperty(prop) {\n /** @type {any} */\n const instance = this;\n\n if (Object.prototype.hasOwnProperty.call(instance, prop)) {\n const value = instance[prop];\n delete instance[prop];\n instance[prop] = value;\n }\n }\n\n /**\n * Defines a custom element with the given name.\n * The name must contain a dash (-).\n *\n * @param {string} [elementName='files-dropzone'] - The name of the custom element.\n * @example\n *\n * FilesDropzone.defineCustomElement('my-dropzone');\n */\n static defineCustomElement(elementName = COMPONENT_NAME) {\n if (typeof window !== 'undefined' && !window.customElements.get(elementName)) {\n window.customElements.define(elementName, FilesDropzone);\n }\n }\n}\n\nexport { FilesDropzone };\n","// @ts-check\n\n/**\n * Checks if a file is valid based on the accepted file type specifiers.\n *\n * @param {File} file - The File object to validate.\n * @param {string} [acceptedTypeSpecifiers=''] - The accepted file type specifiers.\n * @returns {boolean} - True if the file is valid, false otherwise.\n */\nexport function isValidFile(file, acceptedTypeSpecifiers = '') {\n if (!acceptedTypeSpecifiers) {\n return true;\n }\n\n const acceptedMimeTypesList = [\n ...new Set(acceptedTypeSpecifiers.split(',').map(v => v.trim()).filter(Boolean))\n ];\n\n const fileMimeType = file.type;\n const baseMimeType = fileMimeType.replace(/\\/.*$/, '');\n\n for (const validType of acceptedMimeTypesList) {\n if (validType.charAt(0) === '.') {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {\n return true;\n }\n } else if (/\\/\\*$/.test(validType)) {\n // Check for mime type that looks like \"image/*\" or similar.\n if (baseMimeType === validType.replace(/\\/.*$/, '')) {\n return true;\n }\n } else {\n if (fileMimeType === validType) {\n return true;\n }\n }\n }\n\n return false;\n}\n","// @ts-check\n\n/**\n * A map of common file extensions and their associated MIME types.\n */\nconst COMMON_MIME_TYPES = new Map([\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\n ['aac', 'audio/aac'],\n ['abw', 'application/x-abiword'],\n ['arc', 'application/x-freearc'],\n ['avif', 'image/avif'],\n ['avi', 'video/x-msvideo'],\n ['azw', 'application/vnd.amazon.ebook'],\n ['bin', 'application/octet-stream'],\n ['bmp', 'image/bmp'],\n ['bz', 'application/x-bzip'],\n ['bz2', 'application/x-bzip2'],\n ['cda', 'application/x-cdf'],\n ['csh', 'application/x-csh'],\n ['css', 'text/css'],\n ['csv', 'text/csv'],\n ['doc', 'application/msword'],\n ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n ['eot', 'application/vnd.ms-fontobject'],\n ['epub', 'application/epub+zip'],\n ['gz', 'application/gzip'],\n ['gif', 'image/gif'],\n ['heic', 'image/heic'],\n ['heif', 'image/heif'],\n ['htm', 'text/html'],\n ['html', 'text/html'],\n ['ico', 'image/vnd.microsoft.icon'],\n ['ics', 'text/calendar'],\n ['jar', 'application/java-archive'],\n ['jpeg', 'image/jpeg'],\n ['jpg', 'image/jpeg'],\n ['jxl', 'image/jxl'],\n ['js', 'text/javascript'],\n ['json', 'application/json'],\n ['jsonld', 'application/ld+json'],\n ['mid', 'audio/midi'],\n ['midi', 'audio/midi'],\n ['mjs', 'text/javascript'],\n ['mp3', 'audio/mpeg'],\n ['mp4', 'video/mp4'],\n ['mpeg', 'video/mpeg'],\n ['mpkg', 'application/vnd.apple.installer+xml'],\n ['odp', 'application/vnd.oasis.opendocument.presentation'],\n ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],\n ['odt', 'application/vnd.oasis.opendocument.text'],\n ['oga', 'audio/ogg'],\n ['ogv', 'video/ogg'],\n ['ogx', 'application/ogg'],\n ['opus', 'audio/opus'],\n ['otf', 'font/otf'],\n ['png', 'image/png'],\n ['pdf', 'application/pdf'],\n ['php', 'application/x-httpd-php'],\n ['ppt', 'application/vnd.ms-powerpoint'],\n ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],\n ['rar', 'application/vnd.rar'],\n ['rtf', 'application/rtf'],\n ['sh', 'application/x-sh'],\n ['svg', 'image/svg+xml'],\n ['swf', 'application/x-shockwave-flash'],\n ['tar', 'application/x-tar'],\n ['tif', 'image/tiff'],\n ['tiff', 'image/tiff'],\n ['ts', 'video/mp2t'],\n ['ttf', 'font/ttf'],\n ['txt', 'text/plain'],\n ['vsd', 'application/vnd.visio'],\n ['wav', 'audio/wav'],\n ['weba', 'audio/webm'],\n ['webm', 'video/webm'],\n ['webp', 'image/webp'],\n ['woff', 'font/woff'],\n ['woff2', 'font/woff2'],\n ['xhtml', 'application/xhtml+xml'],\n ['xls', 'application/vnd.ms-excel'],\n ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n ['xml', 'application/xml'],\n ['xul', 'application/vnd.mozilla.xul+xml'],\n ['zip', 'application/zip'],\n ['7z', 'application/x-7z-compressed'],\n\n // Others\n ['mkv', 'video/x-matroska'],\n ['mov', 'video/quicktime'],\n ['msg', 'application/vnd.ms-outlook']\n]);\n\nconst FILES_TO_IGNORE = [\n // Thumbnail cache files for macOS and Windows\n '.DS_Store', // macOs\n 'Thumbs.db' // Windows\n];\n\n/**\n * Adds a `type` property to the file object if it doesn't have one and the file has an extension.\n * This is needed because Firefox doesn't add a type property to files dragged from the desktop.\n * @bug https://bugzilla.mozilla.org/show_bug.cgi?id=1424689\n *\n * @param {File} file - The file object to add the type property to.\n * @returns {File} - The file object with the type property added.\n */\nconst toFileWithMimeType = file => {\n const { name } = file;\n const hasExtension = name && name.lastIndexOf('.') !== -1;\n\n if (hasExtension && !file.type) {\n const extension = (name.split('.').pop() || '').toLowerCase();\n const type = COMMON_MIME_TYPES.get(extension);\n\n if (type) {\n Object.defineProperty(file, 'type', {\n value: type,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n }\n\n return file;\n};\n\n/**\n * Adds a `path` property to the file object if it doesn't have one.\n * If `path` is not provided, the `webkitRelativePath` property of the file will be used\n * or the file's name if `webkitRelativePath` is not available.\n *\n * @param {File} file - The file object to add the path property to.\n * @param {string} [path] - The path to set on the file object.\n * @returns {File} - The file object with the path property added.\n */\nconst toFileWithPath = (file, path) => {\n const fileWithMimeType = toFileWithMimeType(file);\n\n // @ts-ignore\n if (typeof fileWithMimeType.path !== 'string') {\n const { webkitRelativePath } = file;\n\n Object.defineProperty(fileWithMimeType, 'path', {\n value: typeof path === 'string' ? path : webkitRelativePath || file.name,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n\n return fileWithMimeType;\n};\n\n/**\n * Wrap `FileSystemDirectoryReader.readEntries` in a promise to make working with read entries easier.\n * https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */\nconst readEntriesPromise = async directoryReader => {\n return await new Promise((resolve, reject) => {\n directoryReader.readEntries(resolve, reject);\n });\n};\n\n/**\n * Read all entries in a directory or sub-directory\n * by calling `readEntries` until it returns an empty array.\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */\nconst readAllDirectoryEntries = async directoryReader => {\n const entries = [];\n let readEntries = await readEntriesPromise(directoryReader);\n\n while (readEntries.length > 0) {\n entries.push(...readEntries);\n readEntries = await readEntriesPromise(directoryReader);\n }\n\n return entries;\n};\n\n/**\n * Get a `File` object from a `FileSystemFileEntry` object.\n *\n * @param {FileSystemFileEntry} fileEntry - The file entry to get a `File` object from.\n * @returns {Promise<File>} - A promise that resolves with a `File` object.\n */\nconst getFileFromFileEntry = fileEntry => {\n return new Promise((resolve, reject) => {\n fileEntry.file(file => resolve(toFileWithPath(file, fileEntry.fullPath)), reject);\n });\n};\n\n/**\n * Get an array of `File` objects from a `DataTransferItemList` object.\n *\n * @param {DataTransferItemList} dataTransferItemList - The item list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromDataTransferItemList = async dataTransferItemList => {\n const files = [];\n\n // Chromium browsers read only 100 files at a time as per the spec, so we need to use\n // BFS (Breadth-first search) to traverse the entire directory/file structure.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#javascript_content\n const queue = [];\n\n for (const item of dataTransferItemList) {\n if (item.kind !== 'file') {\n // Ignore non-file items, such as links.\n continue;\n }\n\n // https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry\n // This function is implemented as `webkitGetAsEntry()` in non-WebKit browsers\n // including Firefox at this time but it may be renamed to `getAsEntry()` in the future.\n // @ts-ignore\n const entry = item.getAsEntry ? item.getAsEntry() : item.webkitGetAsEntry();\n\n queue.push(entry);\n }\n\n while (queue.length > 0) {\n const entry = queue.shift();\n\n if (!entry) {\n continue;\n } else if (entry.isFile) {\n const file = await getFileFromFileEntry(entry);\n\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(file);\n }\n } else if (entry.isDirectory) {\n queue.push(...await readAllDirectoryEntries(entry.createReader()));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from a `FileList` object.\n *\n * @param {FileList} fileList - The file list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromFileList = async fileList => {\n const files = [];\n\n for (const file of fileList) {\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(toFileWithPath(file));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from an event.\n * This function supports both `drop` and `change` events.\n *\n * @param {*} evt - The event to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */\nexport const getFilesFromEvent = async evt => {\n if (evt.dataTransfer) {\n return evt.dataTransfer.items\n ? await getFilesFromDataTransferItemList(evt.dataTransfer.items)\n : await getFilesFromFileList(evt.dataTransfer.files);\n }\n\n return await getFilesFromFileList(evt.target.files);\n};\n"],"names":["$f31161edf38949e9$var$COMMON_MIME_TYPES","Map","$f31161edf38949e9$var$FILES_TO_IGNORE","$f31161edf38949e9$var$toFileWithMimeType","file","name","hasExtension","lastIndexOf","type","extension","split","pop","toLowerCase","get","Object","defineProperty","value","writable","configurable","enumerable","$f31161edf38949e9$var$toFileWithPath","path","fileWithMimeType","webkitRelativePath","$f31161edf38949e9$var$readEntriesPromise","directoryReader","Promise","resolve","reject","readEntries","$f31161edf38949e9$var$readAllDirectoryEntries","entries","length","push","$f31161edf38949e9$var$getFileFromFileEntry","fileEntry","fullPath","$f31161edf38949e9$var$getFilesFromDataTransferItemList","dataTransferItemList","files","queue","item","kind","entry","getAsEntry","webkitGetAsEntry","shift","isFile","indexOf","isDirectory","createReader","$f31161edf38949e9$var$getFilesFromFileList","fileList","$f31161edf38949e9$export$6d52664cd15c442","evt","dataTransfer","items","target","$862aa3736b0514bc$var$COMPONENT_NAME","$862aa3736b0514bc$var$TOO_MANY_FILES","$862aa3736b0514bc$var$template","document","createElement","$862aa3736b0514bc$var$styles","innerHTML","$862aa3736b0514bc$export$6ccd1735166caad9","HTMLElement","fileInput","dropzoneEl","constructor","shadowRoot","attachShadow","mode","appendChild","content","cloneNode","getElementById","observedAttributes","attributeChangedCallback","oldValue","newValue","accept","disabled","removeAttribute","setAttribute","multiple","noKeyboard","connectedCallback","upgradeProperty","addEventListener","handleFileInputChange","handleDragEnter","handleDragOver","handleDragLeave","handleDrop","handleClick","handleKeyUp","autoFocus","focus","disconnectedCallback","removeEventListener","getAttribute","toString","hasAttribute","toggleAttribute","maxFiles","num","Number","Infinity","Math","floor","abs","maxSize","isNaN","minSize","noClick","noDrag","noStyle","handleFilesSelect","error","dispatchEvent","CustomEvent","bubbles","composed","detail","Event","preventDefault","dropEffect","classList","add","part","remove","click","key","Array","isArray","acceptedFiles","rejectedFiles","filesLength","errors","code","message","fileHasValidType","acceptedTypeSpecifiers","acceptedMimeTypesList","Set","map","v","trim","filter","Boolean","fileMimeType","baseMimeType","replace","validType","charAt","test","fileExceedsMaxSize","size","fileIsSmallerThanMinSize","defaultValue","openFileDialog","prop","prototype","hasOwnProperty","call","instance","defineCustomElement","elementName","window","customElements","define","FilesDropzone"],"version":3,"file":"files-dropzone.js.map"}
1
+ {"mappings":"AGKA,IAAM,EAAoB,IAAI,IAAI,CAEhC,CAAC,MAAO,YAAY,CACpB,CAAC,MAAO,wBAAwB,CAChC,CAAC,MAAO,wBAAwB,CAChC,CAAC,OAAQ,aAAa,CACtB,CAAC,MAAO,kBAAkB,CAC1B,CAAC,MAAO,+BAA+B,CACvC,CAAC,MAAO,2BAA2B,CACnC,CAAC,MAAO,YAAY,CACpB,CAAC,KAAM,qBAAqB,CAC5B,CAAC,MAAO,sBAAsB,CAC9B,CAAC,MAAO,oBAAoB,CAC5B,CAAC,MAAO,oBAAoB,CAC5B,CAAC,MAAO,WAAW,CACnB,CAAC,MAAO,WAAW,CACnB,CAAC,MAAO,qBAAqB,CAC7B,CAAC,OAAQ,0EAA0E,CACnF,CAAC,MAAO,gCAAgC,CACxC,CAAC,OAAQ,uBAAuB,CAChC,CAAC,KAAM,mBAAmB,CAC1B,CAAC,MAAO,YAAY,CACpB,CAAC,OAAQ,aAAa,CACtB,CAAC,OAAQ,aAAa,CACtB,CAAC,MAAO,YAAY,CACpB,CAAC,OAAQ,YAAY,CACrB,CAAC,MAAO,2BAA2B,CACnC,CAAC,MAAO,gBAAgB,CACxB,CAAC,MAAO,2BAA2B,CACn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,CAAC,CAAI,EAInB,GAAI,OAAO,SAAA,CAAU,cAAA,CAAe,IAAA,CAFnB,IAAI,CAE8B,GAAO,CACxD,IAAM,EAAQ,AAHC,IAAI,AAGG,CAAC,EAAK,AAC5B,QAAO,AAJQ,IAAI,AAIJ,CAAC,EAAK,CACrB,AALe,IAAI,AAKX,CAAC,EAAK,CAAG,CACnB,CACF,CAWA,OAAO,oBAAoB,EAAc,CAAc,CAAE,CACjC,aAAlB,OAAO,QAA2B,OAAO,cAAA,CAAe,GAAA,CAAI,IAC9D,OAAO,cAAA,CAAe,MAAA,CAAO,EAAa,EAE9C,CACF,Q,K,a","sources":["<anon>","src/files-dropzone.js","src/utils/is-valid-file.js","src/utils/files-selector.js"],"sourcesContent":["// @ts-check\n/**\n * Represents a value that may be of type T, or null.\n *\n * @template T\n * @typedef {T | null} Nullable\n */ // @ts-check\n/**\n * Checks if a file is valid based on the accepted file type specifiers.\n *\n * @param {File} file - The File object to validate.\n * @param {string} [acceptedTypeSpecifiers=''] - The accepted file type specifiers.\n * @returns {boolean} - True if the file is valid, false otherwise.\n */ function $38f222170fd4d21a$export$7c47054fed488f80(file, acceptedTypeSpecifiers = \"\") {\n if (!acceptedTypeSpecifiers) return true;\n const acceptedMimeTypesList = [\n ...new Set(acceptedTypeSpecifiers.split(\",\").map((v)=>v.trim()).filter(Boolean))\n ];\n const fileMimeType = file.type;\n const baseMimeType = fileMimeType.replace(/\\/.*$/, \"\");\n for (const validType of acceptedMimeTypesList){\n if (validType.charAt(0) === \".\") {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) return true;\n } else if (/\\/\\*$/.test(validType)) {\n // Check for mime type that looks like \"image/*\" or similar.\n if (baseMimeType === validType.replace(/\\/.*$/, \"\")) return true;\n } else {\n if (fileMimeType === validType) return true;\n }\n }\n return false;\n}\n\n\n// @ts-check\n/**\n * A map of common file extensions and their associated MIME types.\n */ const $f31161edf38949e9$var$COMMON_MIME_TYPES = new Map([\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\n [\n \"aac\",\n \"audio/aac\"\n ],\n [\n \"abw\",\n \"application/x-abiword\"\n ],\n [\n \"arc\",\n \"application/x-freearc\"\n ],\n [\n \"avif\",\n \"image/avif\"\n ],\n [\n \"avi\",\n \"video/x-msvideo\"\n ],\n [\n \"azw\",\n \"application/vnd.amazon.ebook\"\n ],\n [\n \"bin\",\n \"application/octet-stream\"\n ],\n [\n \"bmp\",\n \"image/bmp\"\n ],\n [\n \"bz\",\n \"application/x-bzip\"\n ],\n [\n \"bz2\",\n \"application/x-bzip2\"\n ],\n [\n \"cda\",\n \"application/x-cdf\"\n ],\n [\n \"csh\",\n \"application/x-csh\"\n ],\n [\n \"css\",\n \"text/css\"\n ],\n [\n \"csv\",\n \"text/csv\"\n ],\n [\n \"doc\",\n \"application/msword\"\n ],\n [\n \"docx\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"\n ],\n [\n \"eot\",\n \"application/vnd.ms-fontobject\"\n ],\n [\n \"epub\",\n \"application/epub+zip\"\n ],\n [\n \"gz\",\n \"application/gzip\"\n ],\n [\n \"gif\",\n \"image/gif\"\n ],\n [\n \"heic\",\n \"image/heic\"\n ],\n [\n \"heif\",\n \"image/heif\"\n ],\n [\n \"htm\",\n \"text/html\"\n ],\n [\n \"html\",\n \"text/html\"\n ],\n [\n \"ico\",\n \"image/vnd.microsoft.icon\"\n ],\n [\n \"ics\",\n \"text/calendar\"\n ],\n [\n \"jar\",\n \"application/java-archive\"\n ],\n [\n \"jpeg\",\n \"image/jpeg\"\n ],\n [\n \"jpg\",\n \"image/jpeg\"\n ],\n [\n \"jxl\",\n \"image/jxl\"\n ],\n [\n \"js\",\n \"text/javascript\"\n ],\n [\n \"json\",\n \"application/json\"\n ],\n [\n \"jsonld\",\n \"application/ld+json\"\n ],\n [\n \"markdown\",\n \"text/markdown\"\n ],\n [\n \"md\",\n \"text/markdown\"\n ],\n [\n \"mid\",\n \"audio/midi\"\n ],\n [\n \"midi\",\n \"audio/midi\"\n ],\n [\n \"mjs\",\n \"text/javascript\"\n ],\n [\n \"mp3\",\n \"audio/mpeg\"\n ],\n [\n \"mp4\",\n \"video/mp4\"\n ],\n [\n \"mpeg\",\n \"video/mpeg\"\n ],\n [\n \"mpkg\",\n \"application/vnd.apple.installer+xml\"\n ],\n [\n \"odp\",\n \"application/vnd.oasis.opendocument.presentation\"\n ],\n [\n \"ods\",\n \"application/vnd.oasis.opendocument.spreadsheet\"\n ],\n [\n \"odt\",\n \"application/vnd.oasis.opendocument.text\"\n ],\n [\n \"oga\",\n \"audio/ogg\"\n ],\n [\n \"ogv\",\n \"video/ogg\"\n ],\n [\n \"ogx\",\n \"application/ogg\"\n ],\n [\n \"opus\",\n \"audio/opus\"\n ],\n [\n \"otf\",\n \"font/otf\"\n ],\n [\n \"png\",\n \"image/png\"\n ],\n [\n \"pdf\",\n \"application/pdf\"\n ],\n [\n \"php\",\n \"application/x-httpd-php\"\n ],\n [\n \"ppt\",\n \"application/vnd.ms-powerpoint\"\n ],\n [\n \"pptx\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\"\n ],\n [\n \"rar\",\n \"application/vnd.rar\"\n ],\n [\n \"rtf\",\n \"application/rtf\"\n ],\n [\n \"sh\",\n \"application/x-sh\"\n ],\n [\n \"svg\",\n \"image/svg+xml\"\n ],\n [\n \"swf\",\n \"application/x-shockwave-flash\"\n ],\n [\n \"tar\",\n \"application/x-tar\"\n ],\n [\n \"tif\",\n \"image/tiff\"\n ],\n [\n \"tiff\",\n \"image/tiff\"\n ],\n [\n \"ts\",\n \"video/mp2t\"\n ],\n [\n \"ttf\",\n \"font/ttf\"\n ],\n [\n \"txt\",\n \"text/plain\"\n ],\n [\n \"vsd\",\n \"application/vnd.visio\"\n ],\n [\n \"wav\",\n \"audio/wav\"\n ],\n [\n \"weba\",\n \"audio/webm\"\n ],\n [\n \"webm\",\n \"video/webm\"\n ],\n [\n \"webp\",\n \"image/webp\"\n ],\n [\n \"woff\",\n \"font/woff\"\n ],\n [\n \"woff2\",\n \"font/woff2\"\n ],\n [\n \"xhtml\",\n \"application/xhtml+xml\"\n ],\n [\n \"xls\",\n \"application/vnd.ms-excel\"\n ],\n [\n \"xlsx\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"\n ],\n [\n \"xml\",\n \"application/xml\"\n ],\n [\n \"xul\",\n \"application/vnd.mozilla.xul+xml\"\n ],\n [\n \"zip\",\n \"application/zip\"\n ],\n [\n \"7z\",\n \"application/x-7z-compressed\"\n ],\n // Others\n [\n \"mkv\",\n \"video/x-matroska\"\n ],\n [\n \"mov\",\n \"video/quicktime\"\n ],\n [\n \"msg\",\n \"application/vnd.ms-outlook\"\n ]\n]);\nconst $f31161edf38949e9$var$FILES_TO_IGNORE = [\n // Thumbnail cache files for macOS and Windows\n \".DS_Store\",\n \"Thumbs.db\" // Windows\n];\n/**\n * Adds a `type` property to the file object if it doesn't have one and the file has an extension.\n * This is needed because Firefox doesn't add a type property to files dragged from the desktop.\n * @bug https://bugzilla.mozilla.org/show_bug.cgi?id=1424689\n *\n * @param {File} file - The file object to add the type property to.\n * @returns {File} - The file object with the type property added.\n */ const $f31161edf38949e9$var$toFileWithMimeType = (file)=>{\n const { name: name } = file;\n const hasExtension = name && name.lastIndexOf(\".\") !== -1;\n if (hasExtension && !file.type) {\n const extension = (name.split(\".\").pop() || \"\").toLowerCase();\n const type = $f31161edf38949e9$var$COMMON_MIME_TYPES.get(extension);\n if (type) Object.defineProperty(file, \"type\", {\n value: type,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n return file;\n};\n/**\n * Adds a `path` property to the file object if it doesn't have one.\n * If `path` is not provided, the `webkitRelativePath` property of the file will be used\n * or the file's name if `webkitRelativePath` is not available.\n *\n * @param {File} file - The file object to add the path property to.\n * @param {string} [path] - The path to set on the file object.\n * @returns {File} - The file object with the path property added.\n */ const $f31161edf38949e9$var$toFileWithPath = (file, path)=>{\n const fileWithMimeType = $f31161edf38949e9$var$toFileWithMimeType(file);\n // @ts-ignore\n if (typeof fileWithMimeType.path !== \"string\") {\n const { webkitRelativePath: webkitRelativePath } = file;\n Object.defineProperty(fileWithMimeType, \"path\", {\n value: typeof path === \"string\" ? path : webkitRelativePath || file.name,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n return fileWithMimeType;\n};\n/**\n * Wrap `FileSystemDirectoryReader.readEntries` in a promise to make working with read entries easier.\n * https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */ const $f31161edf38949e9$var$readEntriesPromise = async (directoryReader)=>{\n return await new Promise((resolve, reject)=>{\n directoryReader.readEntries(resolve, reject);\n });\n};\n/**\n * Read all entries in a directory or sub-directory\n * by calling `readEntries` until it returns an empty array.\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */ const $f31161edf38949e9$var$readAllDirectoryEntries = async (directoryReader)=>{\n const entries = [];\n let readEntries = await $f31161edf38949e9$var$readEntriesPromise(directoryReader);\n while(readEntries.length > 0){\n entries.push(...readEntries);\n readEntries = await $f31161edf38949e9$var$readEntriesPromise(directoryReader);\n }\n return entries;\n};\n/**\n * Get a `File` object from a `FileSystemFileEntry` object.\n *\n * @param {FileSystemFileEntry} fileEntry - The file entry to get a `File` object from.\n * @returns {Promise<File>} - A promise that resolves with a `File` object.\n */ const $f31161edf38949e9$var$getFileFromFileEntry = (fileEntry)=>{\n return new Promise((resolve, reject)=>{\n fileEntry.file((file)=>resolve($f31161edf38949e9$var$toFileWithPath(file, fileEntry.fullPath)), reject);\n });\n};\n/**\n * Get an array of `File` objects from a `DataTransferItemList` object.\n *\n * @param {DataTransferItemList} dataTransferItemList - The item list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */ const $f31161edf38949e9$var$getFilesFromDataTransferItemList = async (dataTransferItemList)=>{\n const files = [];\n // Chromium browsers read only 100 files at a time as per the spec, so we need to use\n // BFS (Breadth-first search) to traverse the entire directory/file structure.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#javascript_content\n const queue = [];\n for (const item of dataTransferItemList){\n if (item.kind !== \"file\") continue;\n // https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry\n // This function is implemented as `webkitGetAsEntry()` in non-WebKit browsers\n // including Firefox at this time but it may be renamed to `getAsEntry()` in the future.\n // @ts-ignore\n const entry = item.getAsEntry ? item.getAsEntry() : item.webkitGetAsEntry();\n queue.push(entry);\n }\n while(queue.length > 0){\n const entry = queue.shift();\n if (!entry) continue;\n else if (entry.isFile) {\n const file = await $f31161edf38949e9$var$getFileFromFileEntry(entry);\n if ($f31161edf38949e9$var$FILES_TO_IGNORE.indexOf(file.name) === -1) files.push(file);\n } else if (entry.isDirectory) queue.push(...await $f31161edf38949e9$var$readAllDirectoryEntries(entry.createReader()));\n }\n return files;\n};\n/**\n * Get an array of `File` objects from a `FileList` object.\n *\n * @param {FileList} fileList - The file list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */ const $f31161edf38949e9$var$getFilesFromFileList = async (fileList)=>{\n const files = [];\n for (const file of fileList)if ($f31161edf38949e9$var$FILES_TO_IGNORE.indexOf(file.name) === -1) files.push($f31161edf38949e9$var$toFileWithPath(file));\n return files;\n};\nconst $f31161edf38949e9$export$6d52664cd15c442 = async (evt)=>{\n if (evt.dataTransfer) return evt.dataTransfer.items ? await $f31161edf38949e9$var$getFilesFromDataTransferItemList(evt.dataTransfer.items) : await $f31161edf38949e9$var$getFilesFromFileList(evt.dataTransfer.files);\n return await $f31161edf38949e9$var$getFilesFromFileList(evt.target.files);\n};\n\n\nconst $862aa3736b0514bc$var$COMPONENT_NAME = \"files-dropzone\";\nconst $862aa3736b0514bc$var$TOO_MANY_FILES = \"TOO_MANY_FILES\";\nconst $862aa3736b0514bc$var$FILE_TOO_LARGE = \"FILE_TOO_LARGE\";\nconst $862aa3736b0514bc$var$FILE_TOO_SMALL = \"FILE_TOO_SMALL\";\nconst $862aa3736b0514bc$var$INVALID_MIME_TYPE = \"INVALID_MIME_TYPE\";\nconst $862aa3736b0514bc$var$template = document.createElement(\"template\");\nconst $862aa3736b0514bc$var$styles = /* css */ `\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #6c757d;\n --dropzone-border-color-dragover: #0d6efd;\n --dropzone-border-color-hover: var(--dropzone-border-color-dragover);\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-background-color-hover: var(--dropzone-background-color-dragover);\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n --dropzone-body-color-hover: var(--dropzone-body-color-dragover);\n --dropzone-focus-shadow-rgb: 49,132,253;\n --dropzone-focus-box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);\n --transition-duration: 0.2s; /* for backwards compatibility */\n --dropzone-transition-duration: var(--transition-duration);\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border var(--dropzone-transition-duration) ease-in-out, background-color var(--dropzone-transition-duration) ease-in-out, color var(--dropzone-transition-duration) ease-in-out, box-shadow var(--dropzone-transition-duration) ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone:focus-visible {\n outline: none;\n box-shadow: var(--dropzone-focus-box-shadow);\n }\n\n @media (hover: hover) {\n :host(:not([no-style]):not([disabled])) .dropzone:not(.dropzone--dragover):hover {\n border-color: var(--dropzone-border-color-hover);\n background-color: var(--dropzone-background-color-hover);\n color: var(--dropzone-body-color-hover);\n }\n }\n`;\n$862aa3736b0514bc$var$template.innerHTML = /* html */ `\n <style>\n ${$862aa3736b0514bc$var$styles}\n </style>\n\n <input type=\"file\" id=\"fileInput\" hidden>\n\n <div part=\"dropzone\" class=\"dropzone\" id=\"dropzoneEl\" tabindex=\"0\" role=\"presentation\">\n <slot>Drag 'n' drop files here, or click to select files</slot>\n </div>\n`;\n/**\n * @summary A custom element that allows users to drag and drop files into it.\n * @documentation https://github.com/georapbox/files-dropzone-element\n *\n * @tagname files-dropzone - This is the default tag name, unless overridden by the `defineCustomElement` method.\n *\n * @property {string} accept - A comma-separated list of unique file type specifiers describing file types to allow.\n * @property {boolean} disabled - Determines whether the dropzone is disabled.\n * @property {number} maxFiles - The maximum number of files allowed to be dropped.\n * @property {number} maxSize - The maximum file size allowed in bytes.\n * @property {number} minSize - The minimum file size allowed in bytes.\n * @property {boolean} multiple - Allows multiple files to be dropped.\n * @property {boolean} noClick - Prevents the file dialog from opening when the dropzone is clicked.\n * @property {boolean} noDrag - Prevents the dropzone from reacting to drag events.\n * @property {boolean} noKeyboard - Prevents the dropzone from reacting to keyboard events.\n * @property {boolean} autoFocus - Automatically focuses the dropzone when it's connected to the DOM.\n * @property {boolean} noStyle - Prevents the dropzone from applying any styling.\n *\n * @attribute {string} accept - Reflects the accept property.\n * @attribute {boolean} disabled - Reflects the disabled property.\n * @attribute {number} max-files - Reflects the maxFiles property.\n * @attribute {number} max-size - Reflects the maxSize property.\n * @attribute {number} min-size - Reflects the minSize property.\n * @attribute {boolean} multiple - Reflects the multiple property.\n * @attribute {boolean} no-click - Reflects the noClick property.\n * @attribute {boolean} no-drag - Reflects the noDrag property.\n * @attribute {boolean} no-keyboard - Reflects the noKeyboard property.\n * @attribute {boolean} auto-focus - Reflects the autoFocus property.\n * @attribute {boolean} no-style - Reflects the noStyle property.\n *\n * @slot - The default slot content of the dropzone.\n *\n * @csspart dropzone - The dropzone element.\n * @csspart dropzone--dragover - The state of the dropzone when dragging over it.\n *\n * @cssproperty --dropzone-border-width - The border width of the dropzone.\n * @cssproperty --dropzone-border-style - The border style of the dropzone.\n * @cssproperty --dropzone-border-radius - The border radius of the dropzone.\n * @cssproperty --dropzone-border-color - The border color of the dropzone.\n * @cssproperty --dropzone-border-color-dragover - The border color of the dropzone when dragging over it.\n * @cssproperty --dropzone-border-color-hover - The border color of the dropzone when hovering over it.\n * @cssproperty --dropzone-background-color - The background color of the dropzone.\n * @cssproperty --dropzone-background-color-dragover - The background color of the dropzone when dragging over it.\n * @cssproperty --dropzone-background-color-hover - The background color of the dropzone when hovering over it.\n * @cssproperty --dropzone-body-color - The text color of the dropzone.\n * @cssproperty --dropzone-body-color-dragover - The text color of the dropzone when dragging over it.\n * @cssproperty --dropzone-body-color-hover - The text color of the dropzone when hovering over it.\n * @cssproperty --dropzone-focus-shadow-rgb - The RGB value of the dropzone's focus shadow.\n * @cssproperty --dropzone-focus-box-shadow - The box shadow of the dropzone when focused.\n * @cssproperty --dropzone-transition-duration - The transition's duration for the dropzone area.\n *\n * @event files-dropzone-drop - Fired when files are dropped.\n * @event files-dropzone-drop-accepted - Fired when files dropped files are accepted.\n * @event files-dropzone-drop-rejected - Fired when files dropped files are rejected.\n * @event files-dropzone-dragenter - Fired when files are dragged into the dropzone.\n * @event files-dropzone-dragover - Fired when files are dragged over the dropzone.\n * @event files-dropzone-dragleave - Fired when files are dragged out of the dropzone.\n * @event files-dropzone-error - Fired when there is any error in the process of reading dropped files or directories.\n *\n * @method defineCustomElement - Static method. Defines a custom element with the given name.\n * @method openFileDialog - Instance method. Opens the file dialog programmatically.\n */ class $862aa3736b0514bc$export$6ccd1735166caad9 extends HTMLElement {\n /** @type {Nullable<HTMLInputElement>} */ #fileInput = null;\n /** @type {Nullable<HTMLElement>} */ #dropzoneEl = null;\n constructor(){\n super();\n if (!this.shadowRoot) {\n const shadowRoot = this.attachShadow({\n mode: \"open\"\n });\n shadowRoot.appendChild($862aa3736b0514bc$var$template.content.cloneNode(true));\n }\n if (this.shadowRoot) {\n this.#fileInput = /** @type {Nullable<HTMLInputElement>} */ this.shadowRoot.getElementById(\"fileInput\");\n this.#dropzoneEl = this.shadowRoot.getElementById(\"dropzoneEl\");\n }\n }\n static get observedAttributes() {\n return [\n \"accept\",\n \"disabled\",\n \"multiple\",\n \"no-keyboard\"\n ];\n }\n /**\n * Lifecycle method that is called when attributes are changed, added, removed, or replaced.\n *\n * @param {string} name - The name of the attribute.\n * @param {string} oldValue - The old value of the attribute.\n * @param {string} newValue - The new value of the attribute.\n */ attributeChangedCallback(name, oldValue, newValue) {\n if (name === \"accept\" && oldValue !== newValue && this.#fileInput) this.#fileInput.accept = this.accept;\n if (name === \"disabled\" && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.disabled = this.disabled;\n if (this.disabled) this.#dropzoneEl?.removeAttribute(\"tabindex\");\n else this.#dropzoneEl?.setAttribute(\"tabindex\", \"0\");\n }\n if (name === \"multiple\" && oldValue !== newValue && this.#fileInput) this.#fileInput.multiple = this.multiple;\n if (name === \"no-keyboard\" && oldValue !== newValue && this.#dropzoneEl) {\n if (this.noKeyboard) this.#dropzoneEl.removeAttribute(\"tabindex\");\n else this.#dropzoneEl.setAttribute(\"tabindex\", \"0\");\n }\n }\n /**\n * Lifecycle method that is called when the element is added to the DOM.\n */ connectedCallback() {\n this.#upgradeProperty(\"accept\");\n this.#upgradeProperty(\"disabled\");\n this.#upgradeProperty(\"maxFiles\");\n this.#upgradeProperty(\"maxSize\");\n this.#upgradeProperty(\"minSize\");\n this.#upgradeProperty(\"multiple\");\n this.#upgradeProperty(\"noClick\");\n this.#upgradeProperty(\"noDrag\");\n this.#upgradeProperty(\"noKeyboard\");\n this.#upgradeProperty(\"autoFocus\");\n this.#upgradeProperty(\"noStyle\");\n this.#fileInput?.addEventListener(\"change\", this.#handleFileInputChange);\n this.#dropzoneEl?.addEventListener(\"dragenter\", this.#handleDragEnter);\n this.#dropzoneEl?.addEventListener(\"dragover\", this.#handleDragOver);\n this.#dropzoneEl?.addEventListener(\"dragleave\", this.#handleDragLeave);\n this.#dropzoneEl?.addEventListener(\"drop\", this.#handleDrop);\n this.#dropzoneEl?.addEventListener(\"click\", this.#handleClick);\n this.#dropzoneEl?.addEventListener(\"keyup\", this.#handleKeyUp);\n this.autoFocus && this.#dropzoneEl?.focus();\n }\n /**\n * Lifecycle method that is called when the element is removed from the DOM.\n */ disconnectedCallback() {\n this.#fileInput?.removeEventListener(\"change\", this.#handleFileInputChange);\n this.#dropzoneEl?.removeEventListener(\"dragenter\", this.#handleDragEnter);\n this.#dropzoneEl?.removeEventListener(\"dragover\", this.#handleDragOver);\n this.#dropzoneEl?.removeEventListener(\"dragleave\", this.#handleDragLeave);\n this.#dropzoneEl?.removeEventListener(\"drop\", this.#handleDrop);\n this.#dropzoneEl?.removeEventListener(\"click\", this.#handleClick);\n this.#dropzoneEl?.removeEventListener(\"keyup\", this.#handleKeyUp);\n }\n /**\n * @type {string} - A comma-separated list of unique file type specifiers describing file types to allow.\n * @attribute accept - Reflects the accept property.\n */ get accept() {\n return this.getAttribute(\"accept\") || \"\";\n }\n set accept(value) {\n this.setAttribute(\"accept\", value != null ? value.toString() : value);\n }\n /**\n * @type {boolean} - Determines whether the dropzone is disabled.\n * @default false\n * @attribute disabled - Reflects the disabled property.\n */ get disabled() {\n return this.hasAttribute(\"disabled\");\n }\n set disabled(value) {\n this.toggleAttribute(\"disabled\", !!value);\n }\n /**\n * @type {number} - The maximum number of files allowed to be dropped.\n * @default Infinity\n * @attribute max-files - Reflects the maxFiles property.\n */ get maxFiles() {\n const num = Number(this.getAttribute(\"max-files\")) || 0;\n if (num <= 0) return Infinity;\n return Math.floor(Math.abs(num));\n }\n set maxFiles(value) {\n this.setAttribute(\"max-files\", value != null ? value.toString() : value);\n }\n /**\n * @type {number} - The maximum file size allowed in bytes.\n * @default Infinity\n * @attribute max-size - Reflects the maxSize property.\n */ get maxSize() {\n const value = this.getAttribute(\"max-size\");\n if (value === null) return Infinity;\n const num = Number(value);\n return Number.isNaN(num) ? Infinity : num;\n }\n set maxSize(value) {\n this.setAttribute(\"max-size\", value != null ? value.toString() : value);\n }\n /**\n * @type {number} - The minimum file size allowed in bytes.\n * @default 0\n * @attribute min-size - Reflects the minSize property.\n */ get minSize() {\n const value = this.getAttribute(\"min-size\");\n if (value === null) return 0;\n const num = Number(value);\n return Number.isNaN(num) ? 0 : num;\n }\n set minSize(value) {\n this.setAttribute(\"min-size\", value != null ? value.toString() : value);\n }\n /**\n * @type {boolean} - Allows multiple files to be dropped.\n * @default false\n * @attribute multiple - Reflects the multiple property.\n */ get multiple() {\n return this.hasAttribute(\"multiple\");\n }\n set multiple(value) {\n this.toggleAttribute(\"multiple\", !!value);\n }\n /**\n * @type {boolean} - Prevents the file dialog from opening when the dropzone is clicked.\n * @default false\n * @attribute no-click - Reflects the noClick property.\n */ get noClick() {\n return this.hasAttribute(\"no-click\");\n }\n set noClick(value) {\n this.toggleAttribute(\"no-click\", !!value);\n }\n /**\n * @type {boolean} - Prevents the dropzone from reacting to drag events.\n * @default false\n * @attribute no-drag - Reflects the noDrag property.\n */ get noDrag() {\n return this.hasAttribute(\"no-drag\");\n }\n set noDrag(value) {\n this.toggleAttribute(\"no-drag\", !!value);\n }\n /**\n * @type {boolean} - Prevents the dropzone from reacting to keyboard events.\n * @default false\n * @attribute no-keyboard - Reflects the noKeyboard property.\n */ get noKeyboard() {\n return this.hasAttribute(\"no-keyboard\");\n }\n set noKeyboard(value) {\n this.toggleAttribute(\"no-keyboard\", !!value);\n }\n /**\n * @type {boolean} - Automatically focuses the dropzone when it's connected to the DOM.\n * @default false\n * @attribute auto-focus - Reflects the autoFocus property.\n */ get autoFocus() {\n return this.hasAttribute(\"auto-focus\");\n }\n set autoFocus(value) {\n this.toggleAttribute(\"auto-focus\", !!value);\n }\n /**\n * @type {boolean} - Prevents the dropzone from applying any styling.\n * @default false\n * @attribute no-style - Reflects the noStyle property.\n */ get noStyle() {\n return this.hasAttribute(\"no-style\");\n }\n set noStyle(value) {\n this.toggleAttribute(\"no-style\", !!value);\n }\n /**\n * Handles the change event of the file input.\n *\n * @param {*} evt - The event object.\n */ #handleFileInputChange = async (evt)=>{\n try {\n this.#handleFilesSelect(await (0, $f31161edf38949e9$export$6d52664cd15c442)(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: {\n error: error\n }\n }));\n }\n };\n /**\n * Handles the dragenter event of the dropzone.\n */ #handleDragEnter = ()=>{\n if (this.disabled || this.noDrag) return;\n this.dispatchEvent(new Event(`${$862aa3736b0514bc$var$COMPONENT_NAME}-dragenter`, {\n bubbles: true,\n composed: true\n }));\n };\n /**\n * Handles the dragover event of the dropzone.\n *\n * @param {*} evt - The event object.\n */ #handleDragOver = (evt)=>{\n evt.preventDefault();\n if (this.disabled || this.noDrag) {\n evt.dataTransfer.dropEffect = \"none\";\n return;\n }\n evt.dataTransfer.dropEffect = \"copy\";\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.add(\"dropzone--dragover\");\n this.#dropzoneEl.part.add(\"dropzone--dragover\");\n }\n this.dispatchEvent(new Event(`${$862aa3736b0514bc$var$COMPONENT_NAME}-dragover`, {\n bubbles: true,\n composed: true\n }));\n };\n /**\n * Handles the dragleave event of the dropzone.\n */ #handleDragLeave = ()=>{\n if (this.disabled || this.noDrag) return;\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove(\"dropzone--dragover\");\n this.#dropzoneEl.part.remove(\"dropzone--dragover\");\n }\n this.dispatchEvent(new Event(`${$862aa3736b0514bc$var$COMPONENT_NAME}-dragleave`, {\n bubbles: true,\n composed: true\n }));\n };\n /**\n * Handles the drop event of the dropzone.\n *\n * @param {*} evt - The event object.\n */ #handleDrop = async (evt)=>{\n if (this.disabled || this.noDrag) return;\n evt.preventDefault();\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove(\"dropzone--dragover\");\n this.#dropzoneEl.part.remove(\"dropzone--dragover\");\n }\n try {\n this.#handleFilesSelect(await (0, $f31161edf38949e9$export$6d52664cd15c442)(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: {\n error: error\n }\n }));\n }\n };\n /**\n * Handles the click event of the dropzone.\n */ #handleClick = ()=>{\n if (this.disabled || this.noClick) return;\n this.#fileInput?.click();\n };\n /**\n * Handles the keyup event of the dropzone.\n *\n * @param {*} evt - The event object.\n */ #handleKeyUp = (evt)=>{\n if (this.disabled || this.noKeyboard) return;\n if (evt.key === \" \" || evt.key === \"Enter\") this.#fileInput?.click();\n };\n /**\n * Handles the selection of files.\n *\n * @param {File[]} files - The files to handle.\n */ #handleFilesSelect(files) {\n if (!Array.isArray(files) || !files.length) return;\n const acceptedFiles = [];\n const rejectedFiles = [];\n const filesLength = files.length;\n // If the component is not in multiple mode, reject all files.\n if (!this.multiple && filesLength > 1) for (const file of files)rejectedFiles.push({\n file: file,\n errors: [\n {\n code: $862aa3736b0514bc$var$TOO_MANY_FILES,\n message: `Too many files selected. Only 1 file is allowed.`\n }\n ]\n });\n else if (this.multiple && filesLength > this.maxFiles) // If the component is in multiple mode, but the number of files exceeds\n // the maxFiles attribute, reject all files.\n for (const file of files)rejectedFiles.push({\n file: file,\n errors: [\n {\n code: $862aa3736b0514bc$var$TOO_MANY_FILES,\n message: `Too many files selected. Only ${this.maxFiles} ${this.maxFiles > 1 ? \"files are\" : \"file is\"} allowed.`\n }\n ]\n });\n else // Validate each file. If it's valid, add it to the accepted files array,\n // otherwise add it to the rejected files array.\n for (const file of files){\n const fileHasValidType = (0, $38f222170fd4d21a$export$7c47054fed488f80)(file, this.accept);\n const fileExceedsMaxSize = file.size > this.maxSize;\n const fileIsSmallerThanMinSize = file.size < this.minSize;\n if (fileHasValidType && !fileExceedsMaxSize && !fileIsSmallerThanMinSize) acceptedFiles.push(file);\n else {\n const errors = [];\n if (!fileHasValidType) errors.push({\n code: $862aa3736b0514bc$var$INVALID_MIME_TYPE,\n message: `File type \"${file.type}\" is not accepted.`\n });\n if (fileExceedsMaxSize) errors.push({\n code: $862aa3736b0514bc$var$FILE_TOO_LARGE,\n message: `File size ${file.size} exceeds the maximum size of ${this.maxSize}.`\n });\n if (fileIsSmallerThanMinSize) errors.push({\n code: $862aa3736b0514bc$var$FILE_TOO_SMALL,\n message: `File size ${file.size} is smaller than the minimum size of ${this.minSize}.`\n });\n rejectedFiles.push({\n file: file,\n errors: errors\n });\n }\n }\n this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-drop`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles: acceptedFiles,\n rejectedFiles: rejectedFiles\n }\n }));\n if (acceptedFiles.length > 0) this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-drop-accepted`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles: acceptedFiles\n }\n }));\n if (rejectedFiles.length > 0) this.dispatchEvent(new CustomEvent(`${$862aa3736b0514bc$var$COMPONENT_NAME}-drop-rejected`, {\n bubbles: true,\n composed: true,\n detail: {\n rejectedFiles: rejectedFiles\n }\n }));\n if (this.#fileInput) this.#fileInput.value = this.#fileInput.defaultValue;\n }\n /**\n * Opens the file dialog programmatically.\n */ openFileDialog() {\n if (this.disabled) return;\n this.#fileInput?.click();\n }\n /**\n * This is to safe guard against cases where, for instance, a framework may have added the element to the page and set a\n * value on one of its properties, but lazy loaded its definition. Without this guard, the upgraded element would miss that\n * property and the instance property would prevent the class property setter from ever being called.\n *\n * https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n *\n * @param {'accept' | 'disabled' | 'maxFiles' | 'maxSize' | 'minSize' | 'multiple' | 'noClick' | 'noDrag' | 'noKeyboard' | 'autoFocus' | 'noStyle'} prop - The property name to upgrade.\n */ #upgradeProperty(prop) {\n /** @type {any} */ const instance = this;\n if (Object.prototype.hasOwnProperty.call(instance, prop)) {\n const value = instance[prop];\n delete instance[prop];\n instance[prop] = value;\n }\n }\n /**\n * Defines a custom element with the given name.\n * The name must contain a dash (-).\n *\n * @param {string} [elementName='files-dropzone'] - The name of the custom element.\n * @example\n *\n * FilesDropzone.defineCustomElement('my-dropzone');\n */ static defineCustomElement(elementName = $862aa3736b0514bc$var$COMPONENT_NAME) {\n if (typeof window !== \"undefined\" && !window.customElements.get(elementName)) window.customElements.define(elementName, $862aa3736b0514bc$export$6ccd1735166caad9);\n }\n}\n\n\nexport {$862aa3736b0514bc$export$6ccd1735166caad9 as FilesDropzone};\n//# sourceMappingURL=files-dropzone.js.map\n","// @ts-check\n\n/**\n * Represents a value that may be of type T, or null.\n *\n * @template T\n * @typedef {T | null} Nullable\n */\n\nimport { isValidFile } from './utils/is-valid-file.js';\nimport { getFilesFromEvent } from './utils/files-selector.js';\n\nconst COMPONENT_NAME = 'files-dropzone';\nconst TOO_MANY_FILES = 'TOO_MANY_FILES';\nconst FILE_TOO_LARGE = 'FILE_TOO_LARGE';\nconst FILE_TOO_SMALL = 'FILE_TOO_SMALL';\nconst INVALID_MIME_TYPE = 'INVALID_MIME_TYPE';\nconst template = document.createElement('template');\n\nconst styles = /* css */`\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #6c757d;\n --dropzone-border-color-dragover: #0d6efd;\n --dropzone-border-color-hover: var(--dropzone-border-color-dragover);\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-background-color-hover: var(--dropzone-background-color-dragover);\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n --dropzone-body-color-hover: var(--dropzone-body-color-dragover);\n --dropzone-focus-shadow-rgb: 49,132,253;\n --dropzone-focus-box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);\n --transition-duration: 0.2s; /* for backwards compatibility */\n --dropzone-transition-duration: var(--transition-duration);\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border var(--dropzone-transition-duration) ease-in-out, background-color var(--dropzone-transition-duration) ease-in-out, color var(--dropzone-transition-duration) ease-in-out, box-shadow var(--dropzone-transition-duration) ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone:focus-visible {\n outline: none;\n box-shadow: var(--dropzone-focus-box-shadow);\n }\n\n @media (hover: hover) {\n :host(:not([no-style]):not([disabled])) .dropzone:not(.dropzone--dragover):hover {\n border-color: var(--dropzone-border-color-hover);\n background-color: var(--dropzone-background-color-hover);\n color: var(--dropzone-body-color-hover);\n }\n }\n`;\n\ntemplate.innerHTML = /* html */`\n <style>\n ${styles}\n </style>\n\n <input type=\"file\" id=\"fileInput\" hidden>\n\n <div part=\"dropzone\" class=\"dropzone\" id=\"dropzoneEl\" tabindex=\"0\" role=\"presentation\">\n <slot>Drag 'n' drop files here, or click to select files</slot>\n </div>\n`;\n\n/**\n * @summary A custom element that allows users to drag and drop files into it.\n * @documentation https://github.com/georapbox/files-dropzone-element\n *\n * @tagname files-dropzone - This is the default tag name, unless overridden by the `defineCustomElement` method.\n *\n * @property {string} accept - A comma-separated list of unique file type specifiers describing file types to allow.\n * @property {boolean} disabled - Determines whether the dropzone is disabled.\n * @property {number} maxFiles - The maximum number of files allowed to be dropped.\n * @property {number} maxSize - The maximum file size allowed in bytes.\n * @property {number} minSize - The minimum file size allowed in bytes.\n * @property {boolean} multiple - Allows multiple files to be dropped.\n * @property {boolean} noClick - Prevents the file dialog from opening when the dropzone is clicked.\n * @property {boolean} noDrag - Prevents the dropzone from reacting to drag events.\n * @property {boolean} noKeyboard - Prevents the dropzone from reacting to keyboard events.\n * @property {boolean} autoFocus - Automatically focuses the dropzone when it's connected to the DOM.\n * @property {boolean} noStyle - Prevents the dropzone from applying any styling.\n *\n * @attribute {string} accept - Reflects the accept property.\n * @attribute {boolean} disabled - Reflects the disabled property.\n * @attribute {number} max-files - Reflects the maxFiles property.\n * @attribute {number} max-size - Reflects the maxSize property.\n * @attribute {number} min-size - Reflects the minSize property.\n * @attribute {boolean} multiple - Reflects the multiple property.\n * @attribute {boolean} no-click - Reflects the noClick property.\n * @attribute {boolean} no-drag - Reflects the noDrag property.\n * @attribute {boolean} no-keyboard - Reflects the noKeyboard property.\n * @attribute {boolean} auto-focus - Reflects the autoFocus property.\n * @attribute {boolean} no-style - Reflects the noStyle property.\n *\n * @slot - The default slot content of the dropzone.\n *\n * @csspart dropzone - The dropzone element.\n * @csspart dropzone--dragover - The state of the dropzone when dragging over it.\n *\n * @cssproperty --dropzone-border-width - The border width of the dropzone.\n * @cssproperty --dropzone-border-style - The border style of the dropzone.\n * @cssproperty --dropzone-border-radius - The border radius of the dropzone.\n * @cssproperty --dropzone-border-color - The border color of the dropzone.\n * @cssproperty --dropzone-border-color-dragover - The border color of the dropzone when dragging over it.\n * @cssproperty --dropzone-border-color-hover - The border color of the dropzone when hovering over it.\n * @cssproperty --dropzone-background-color - The background color of the dropzone.\n * @cssproperty --dropzone-background-color-dragover - The background color of the dropzone when dragging over it.\n * @cssproperty --dropzone-background-color-hover - The background color of the dropzone when hovering over it.\n * @cssproperty --dropzone-body-color - The text color of the dropzone.\n * @cssproperty --dropzone-body-color-dragover - The text color of the dropzone when dragging over it.\n * @cssproperty --dropzone-body-color-hover - The text color of the dropzone when hovering over it.\n * @cssproperty --dropzone-focus-shadow-rgb - The RGB value of the dropzone's focus shadow.\n * @cssproperty --dropzone-focus-box-shadow - The box shadow of the dropzone when focused.\n * @cssproperty --dropzone-transition-duration - The transition's duration for the dropzone area.\n *\n * @event files-dropzone-drop - Fired when files are dropped.\n * @event files-dropzone-drop-accepted - Fired when files dropped files are accepted.\n * @event files-dropzone-drop-rejected - Fired when files dropped files are rejected.\n * @event files-dropzone-dragenter - Fired when files are dragged into the dropzone.\n * @event files-dropzone-dragover - Fired when files are dragged over the dropzone.\n * @event files-dropzone-dragleave - Fired when files are dragged out of the dropzone.\n * @event files-dropzone-error - Fired when there is any error in the process of reading dropped files or directories.\n *\n * @method defineCustomElement - Static method. Defines a custom element with the given name.\n * @method openFileDialog - Instance method. Opens the file dialog programmatically.\n */\nclass FilesDropzone extends HTMLElement {\n /** @type {Nullable<HTMLInputElement>} */\n #fileInput = null;\n\n /** @type {Nullable<HTMLElement>} */\n #dropzoneEl = null;\n\n constructor() {\n super();\n\n if (!this.shadowRoot) {\n const shadowRoot = this.attachShadow({ mode: 'open' });\n shadowRoot.appendChild(template.content.cloneNode(true));\n }\n\n if (this.shadowRoot) {\n this.#fileInput = /** @type {Nullable<HTMLInputElement>} */(this.shadowRoot.getElementById('fileInput'));\n this.#dropzoneEl = this.shadowRoot.getElementById('dropzoneEl');\n }\n }\n\n static get observedAttributes() {\n return ['accept', 'disabled', 'multiple', 'no-keyboard'];\n }\n\n /**\n * Lifecycle method that is called when attributes are changed, added, removed, or replaced.\n *\n * @param {string} name - The name of the attribute.\n * @param {string} oldValue - The old value of the attribute.\n * @param {string} newValue - The new value of the attribute.\n */\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'accept' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.accept = this.accept;\n }\n\n if (name === 'disabled' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.disabled = this.disabled;\n\n if (this.disabled) {\n this.#dropzoneEl?.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl?.setAttribute('tabindex', '0');\n }\n }\n\n if (name === 'multiple' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.multiple = this.multiple;\n }\n\n if (name === 'no-keyboard' && oldValue !== newValue && this.#dropzoneEl) {\n if (this.noKeyboard) {\n this.#dropzoneEl.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl.setAttribute('tabindex', '0');\n }\n }\n }\n\n /**\n * Lifecycle method that is called when the element is added to the DOM.\n */\n connectedCallback() {\n this.#upgradeProperty('accept');\n this.#upgradeProperty('disabled');\n this.#upgradeProperty('maxFiles');\n this.#upgradeProperty('maxSize');\n this.#upgradeProperty('minSize');\n this.#upgradeProperty('multiple');\n this.#upgradeProperty('noClick');\n this.#upgradeProperty('noDrag');\n this.#upgradeProperty('noKeyboard');\n this.#upgradeProperty('autoFocus');\n this.#upgradeProperty('noStyle');\n\n this.#fileInput?.addEventListener('change', this.#handleFileInputChange);\n this.#dropzoneEl?.addEventListener('dragenter', this.#handleDragEnter);\n this.#dropzoneEl?.addEventListener('dragover', this.#handleDragOver);\n this.#dropzoneEl?.addEventListener('dragleave', this.#handleDragLeave);\n this.#dropzoneEl?.addEventListener('drop', this.#handleDrop);\n this.#dropzoneEl?.addEventListener('click', this.#handleClick);\n this.#dropzoneEl?.addEventListener('keyup', this.#handleKeyUp);\n\n this.autoFocus && this.#dropzoneEl?.focus();\n }\n\n /**\n * Lifecycle method that is called when the element is removed from the DOM.\n */\n disconnectedCallback() {\n this.#fileInput?.removeEventListener('change', this.#handleFileInputChange);\n this.#dropzoneEl?.removeEventListener('dragenter', this.#handleDragEnter);\n this.#dropzoneEl?.removeEventListener('dragover', this.#handleDragOver);\n this.#dropzoneEl?.removeEventListener('dragleave', this.#handleDragLeave);\n this.#dropzoneEl?.removeEventListener('drop', this.#handleDrop);\n this.#dropzoneEl?.removeEventListener('click', this.#handleClick);\n this.#dropzoneEl?.removeEventListener('keyup', this.#handleKeyUp);\n }\n\n /**\n * @type {string} - A comma-separated list of unique file type specifiers describing file types to allow.\n * @attribute accept - Reflects the accept property.\n */\n get accept() {\n return this.getAttribute('accept') || '';\n }\n\n set accept(value) {\n this.setAttribute('accept', value != null ? value.toString() : value);\n }\n\n /**\n * @type {boolean} - Determines whether the dropzone is disabled.\n * @default false\n * @attribute disabled - Reflects the disabled property.\n */\n get disabled() {\n return this.hasAttribute('disabled');\n }\n\n set disabled(value) {\n this.toggleAttribute('disabled', !!value);\n }\n\n /**\n * @type {number} - The maximum number of files allowed to be dropped.\n * @default Infinity\n * @attribute max-files - Reflects the maxFiles property.\n */\n get maxFiles() {\n const num = Number(this.getAttribute('max-files')) || 0;\n\n if (num <= 0) {\n return Infinity;\n }\n\n return Math.floor(Math.abs(num));\n }\n\n set maxFiles(value) {\n this.setAttribute('max-files', value != null ? value.toString() : value);\n }\n\n /**\n * @type {number} - The maximum file size allowed in bytes.\n * @default Infinity\n * @attribute max-size - Reflects the maxSize property.\n */\n get maxSize() {\n const value = this.getAttribute('max-size');\n\n if (value === null) {\n return Infinity;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? Infinity : num;\n }\n\n set maxSize(value) {\n this.setAttribute('max-size', value != null ? value.toString() : value);\n }\n\n /**\n * @type {number} - The minimum file size allowed in bytes.\n * @default 0\n * @attribute min-size - Reflects the minSize property.\n */\n get minSize() {\n const value = this.getAttribute('min-size');\n\n if (value === null) {\n return 0;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? 0 : num;\n }\n\n set minSize(value) {\n this.setAttribute('min-size', value != null ? value.toString() : value);\n }\n\n /**\n * @type {boolean} - Allows multiple files to be dropped.\n * @default false\n * @attribute multiple - Reflects the multiple property.\n */\n get multiple() {\n return this.hasAttribute('multiple');\n }\n\n set multiple(value) {\n this.toggleAttribute('multiple', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the file dialog from opening when the dropzone is clicked.\n * @default false\n * @attribute no-click - Reflects the noClick property.\n */\n get noClick() {\n return this.hasAttribute('no-click');\n }\n\n set noClick(value) {\n this.toggleAttribute('no-click', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the dropzone from reacting to drag events.\n * @default false\n * @attribute no-drag - Reflects the noDrag property.\n */\n get noDrag() {\n return this.hasAttribute('no-drag');\n }\n\n set noDrag(value) {\n this.toggleAttribute('no-drag', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the dropzone from reacting to keyboard events.\n * @default false\n * @attribute no-keyboard - Reflects the noKeyboard property.\n */\n get noKeyboard() {\n return this.hasAttribute('no-keyboard');\n }\n\n set noKeyboard(value) {\n this.toggleAttribute('no-keyboard', !!value);\n }\n\n /**\n * @type {boolean} - Automatically focuses the dropzone when it's connected to the DOM.\n * @default false\n * @attribute auto-focus - Reflects the autoFocus property.\n */\n get autoFocus() {\n return this.hasAttribute('auto-focus');\n }\n\n set autoFocus(value) {\n this.toggleAttribute('auto-focus', !!value);\n }\n\n /**\n * @type {boolean} - Prevents the dropzone from applying any styling.\n * @default false\n * @attribute no-style - Reflects the noStyle property.\n */\n get noStyle() {\n return this.hasAttribute('no-style');\n }\n\n set noStyle(value) {\n this.toggleAttribute('no-style', !!value);\n }\n\n /**\n * Handles the change event of the file input.\n *\n * @param {*} evt - The event object.\n */\n #handleFileInputChange = async evt => {\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n /**\n * Handles the dragenter event of the dropzone.\n */\n #handleDragEnter = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragenter`, {\n bubbles: true,\n composed: true\n }));\n };\n\n /**\n * Handles the dragover event of the dropzone.\n *\n * @param {*} evt - The event object.\n */\n #handleDragOver = evt => {\n evt.preventDefault();\n\n if (this.disabled || this.noDrag) {\n evt.dataTransfer.dropEffect = 'none';\n return;\n }\n\n evt.dataTransfer.dropEffect = 'copy';\n\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.add('dropzone--dragover');\n this.#dropzoneEl.part.add('dropzone--dragover');\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragover`, {\n bubbles: true,\n composed: true\n }));\n };\n\n /**\n * Handles the dragleave event of the dropzone.\n */\n #handleDragLeave = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragleave`, {\n bubbles: true,\n composed: true\n }));\n };\n\n /**\n * Handles the drop event of the dropzone.\n *\n * @param {*} evt - The event object.\n */\n #handleDrop = async evt => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n evt.preventDefault();\n\n if (this.#dropzoneEl) {\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n }\n\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n /**\n * Handles the click event of the dropzone.\n */\n #handleClick = () => {\n if (this.disabled || this.noClick) {\n return;\n }\n\n this.#fileInput?.click();\n };\n\n /**\n * Handles the keyup event of the dropzone.\n *\n * @param {*} evt - The event object.\n */\n #handleKeyUp = evt => {\n if (this.disabled || this.noKeyboard) {\n return;\n }\n\n if (evt.key === ' ' || evt.key === 'Enter') {\n this.#fileInput?.click();\n }\n };\n\n /**\n * Handles the selection of files.\n *\n * @param {File[]} files - The files to handle.\n */\n #handleFilesSelect(files) {\n if (!Array.isArray(files) || !files.length) {\n return;\n }\n\n const acceptedFiles = [];\n const rejectedFiles = [];\n const filesLength = files.length;\n\n // If the component is not in multiple mode, reject all files.\n if (!this.multiple && filesLength > 1) {\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only 1 file is allowed.`\n }]\n });\n }\n } else if (this.multiple && filesLength > this.maxFiles) {\n // If the component is in multiple mode, but the number of files exceeds\n // the maxFiles attribute, reject all files.\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only ${this.maxFiles} ${this.maxFiles > 1 ? 'files are' : 'file is'} allowed.`\n }]\n });\n }\n } else {\n // Validate each file. If it's valid, add it to the accepted files array,\n // otherwise add it to the rejected files array.\n for (const file of files) {\n const fileHasValidType = isValidFile(file, this.accept);\n const fileExceedsMaxSize = file.size > this.maxSize;\n const fileIsSmallerThanMinSize = file.size < this.minSize;\n\n if (fileHasValidType && !fileExceedsMaxSize && !fileIsSmallerThanMinSize) {\n acceptedFiles.push(file);\n } else {\n const errors = [];\n\n if (!fileHasValidType) {\n errors.push({\n code: INVALID_MIME_TYPE,\n message: `File type \"${file.type}\" is not accepted.`\n });\n }\n\n if (fileExceedsMaxSize) {\n errors.push({\n code: FILE_TOO_LARGE,\n message: `File size ${file.size} exceeds the maximum size of ${this.maxSize}.`\n });\n }\n\n if (fileIsSmallerThanMinSize) {\n errors.push({\n code: FILE_TOO_SMALL,\n message: `File size ${file.size} is smaller than the minimum size of ${this.minSize}.`\n });\n }\n\n rejectedFiles.push({ file, errors });\n }\n }\n }\n\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles,\n rejectedFiles\n }\n }));\n\n if (acceptedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-accepted`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles\n }\n }));\n }\n\n if (rejectedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-rejected`, {\n bubbles: true,\n composed: true,\n detail: {\n rejectedFiles\n }\n }));\n }\n\n if (this.#fileInput) {\n this.#fileInput.value = this.#fileInput.defaultValue;\n }\n }\n\n /**\n * Opens the file dialog programmatically.\n */\n openFileDialog() {\n if (this.disabled) {\n return;\n }\n\n this.#fileInput?.click();\n }\n\n /**\n * This is to safe guard against cases where, for instance, a framework may have added the element to the page and set a\n * value on one of its properties, but lazy loaded its definition. Without this guard, the upgraded element would miss that\n * property and the instance property would prevent the class property setter from ever being called.\n *\n * https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n *\n * @param {'accept' | 'disabled' | 'maxFiles' | 'maxSize' | 'minSize' | 'multiple' | 'noClick' | 'noDrag' | 'noKeyboard' | 'autoFocus' | 'noStyle'} prop - The property name to upgrade.\n */\n #upgradeProperty(prop) {\n /** @type {any} */\n const instance = this;\n\n if (Object.prototype.hasOwnProperty.call(instance, prop)) {\n const value = instance[prop];\n delete instance[prop];\n instance[prop] = value;\n }\n }\n\n /**\n * Defines a custom element with the given name.\n * The name must contain a dash (-).\n *\n * @param {string} [elementName='files-dropzone'] - The name of the custom element.\n * @example\n *\n * FilesDropzone.defineCustomElement('my-dropzone');\n */\n static defineCustomElement(elementName = COMPONENT_NAME) {\n if (typeof window !== 'undefined' && !window.customElements.get(elementName)) {\n window.customElements.define(elementName, FilesDropzone);\n }\n }\n}\n\nexport { FilesDropzone };\n","// @ts-check\n\n/**\n * Checks if a file is valid based on the accepted file type specifiers.\n *\n * @param {File} file - The File object to validate.\n * @param {string} [acceptedTypeSpecifiers=''] - The accepted file type specifiers.\n * @returns {boolean} - True if the file is valid, false otherwise.\n */\nexport function isValidFile(file, acceptedTypeSpecifiers = '') {\n if (!acceptedTypeSpecifiers) {\n return true;\n }\n\n const acceptedMimeTypesList = [\n ...new Set(acceptedTypeSpecifiers.split(',').map(v => v.trim()).filter(Boolean))\n ];\n\n const fileMimeType = file.type;\n const baseMimeType = fileMimeType.replace(/\\/.*$/, '');\n\n for (const validType of acceptedMimeTypesList) {\n if (validType.charAt(0) === '.') {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {\n return true;\n }\n } else if (/\\/\\*$/.test(validType)) {\n // Check for mime type that looks like \"image/*\" or similar.\n if (baseMimeType === validType.replace(/\\/.*$/, '')) {\n return true;\n }\n } else {\n if (fileMimeType === validType) {\n return true;\n }\n }\n }\n\n return false;\n}\n","// @ts-check\n\n/**\n * A map of common file extensions and their associated MIME types.\n */\nconst COMMON_MIME_TYPES = new Map([\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\n ['aac', 'audio/aac'],\n ['abw', 'application/x-abiword'],\n ['arc', 'application/x-freearc'],\n ['avif', 'image/avif'],\n ['avi', 'video/x-msvideo'],\n ['azw', 'application/vnd.amazon.ebook'],\n ['bin', 'application/octet-stream'],\n ['bmp', 'image/bmp'],\n ['bz', 'application/x-bzip'],\n ['bz2', 'application/x-bzip2'],\n ['cda', 'application/x-cdf'],\n ['csh', 'application/x-csh'],\n ['css', 'text/css'],\n ['csv', 'text/csv'],\n ['doc', 'application/msword'],\n ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n ['eot', 'application/vnd.ms-fontobject'],\n ['epub', 'application/epub+zip'],\n ['gz', 'application/gzip'],\n ['gif', 'image/gif'],\n ['heic', 'image/heic'],\n ['heif', 'image/heif'],\n ['htm', 'text/html'],\n ['html', 'text/html'],\n ['ico', 'image/vnd.microsoft.icon'],\n ['ics', 'text/calendar'],\n ['jar', 'application/java-archive'],\n ['jpeg', 'image/jpeg'],\n ['jpg', 'image/jpeg'],\n ['jxl', 'image/jxl'],\n ['js', 'text/javascript'],\n ['json', 'application/json'],\n ['jsonld', 'application/ld+json'],\n ['markdown', 'text/markdown'],\n ['md', 'text/markdown'],\n ['mid', 'audio/midi'],\n ['midi', 'audio/midi'],\n ['mjs', 'text/javascript'],\n ['mp3', 'audio/mpeg'],\n ['mp4', 'video/mp4'],\n ['mpeg', 'video/mpeg'],\n ['mpkg', 'application/vnd.apple.installer+xml'],\n ['odp', 'application/vnd.oasis.opendocument.presentation'],\n ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],\n ['odt', 'application/vnd.oasis.opendocument.text'],\n ['oga', 'audio/ogg'],\n ['ogv', 'video/ogg'],\n ['ogx', 'application/ogg'],\n ['opus', 'audio/opus'],\n ['otf', 'font/otf'],\n ['png', 'image/png'],\n ['pdf', 'application/pdf'],\n ['php', 'application/x-httpd-php'],\n ['ppt', 'application/vnd.ms-powerpoint'],\n ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],\n ['rar', 'application/vnd.rar'],\n ['rtf', 'application/rtf'],\n ['sh', 'application/x-sh'],\n ['svg', 'image/svg+xml'],\n ['swf', 'application/x-shockwave-flash'],\n ['tar', 'application/x-tar'],\n ['tif', 'image/tiff'],\n ['tiff', 'image/tiff'],\n ['ts', 'video/mp2t'],\n ['ttf', 'font/ttf'],\n ['txt', 'text/plain'],\n ['vsd', 'application/vnd.visio'],\n ['wav', 'audio/wav'],\n ['weba', 'audio/webm'],\n ['webm', 'video/webm'],\n ['webp', 'image/webp'],\n ['woff', 'font/woff'],\n ['woff2', 'font/woff2'],\n ['xhtml', 'application/xhtml+xml'],\n ['xls', 'application/vnd.ms-excel'],\n ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n ['xml', 'application/xml'],\n ['xul', 'application/vnd.mozilla.xul+xml'],\n ['zip', 'application/zip'],\n ['7z', 'application/x-7z-compressed'],\n\n // Others\n ['mkv', 'video/x-matroska'],\n ['mov', 'video/quicktime'],\n ['msg', 'application/vnd.ms-outlook']\n]);\n\nconst FILES_TO_IGNORE = [\n // Thumbnail cache files for macOS and Windows\n '.DS_Store', // macOs\n 'Thumbs.db' // Windows\n];\n\n/**\n * Adds a `type` property to the file object if it doesn't have one and the file has an extension.\n * This is needed because Firefox doesn't add a type property to files dragged from the desktop.\n * @bug https://bugzilla.mozilla.org/show_bug.cgi?id=1424689\n *\n * @param {File} file - The file object to add the type property to.\n * @returns {File} - The file object with the type property added.\n */\nconst toFileWithMimeType = file => {\n const { name } = file;\n const hasExtension = name && name.lastIndexOf('.') !== -1;\n\n if (hasExtension && !file.type) {\n const extension = (name.split('.').pop() || '').toLowerCase();\n const type = COMMON_MIME_TYPES.get(extension);\n\n if (type) {\n Object.defineProperty(file, 'type', {\n value: type,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n }\n\n return file;\n};\n\n/**\n * Adds a `path` property to the file object if it doesn't have one.\n * If `path` is not provided, the `webkitRelativePath` property of the file will be used\n * or the file's name if `webkitRelativePath` is not available.\n *\n * @param {File} file - The file object to add the path property to.\n * @param {string} [path] - The path to set on the file object.\n * @returns {File} - The file object with the path property added.\n */\nconst toFileWithPath = (file, path) => {\n const fileWithMimeType = toFileWithMimeType(file);\n\n // @ts-ignore\n if (typeof fileWithMimeType.path !== 'string') {\n const { webkitRelativePath } = file;\n\n Object.defineProperty(fileWithMimeType, 'path', {\n value: typeof path === 'string' ? path : webkitRelativePath || file.name,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n\n return fileWithMimeType;\n};\n\n/**\n * Wrap `FileSystemDirectoryReader.readEntries` in a promise to make working with read entries easier.\n * https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */\nconst readEntriesPromise = async directoryReader => {\n return await new Promise((resolve, reject) => {\n directoryReader.readEntries(resolve, reject);\n });\n};\n\n/**\n * Read all entries in a directory or sub-directory\n * by calling `readEntries` until it returns an empty array.\n *\n * @param {FileSystemDirectoryReader} directoryReader - The directory reader to read entries from.\n * @returns {Promise<FileSystemEntry[]>} - A promise that resolves with an array of `FileSystemEntry` objects.\n */\nconst readAllDirectoryEntries = async directoryReader => {\n const entries = [];\n let readEntries = await readEntriesPromise(directoryReader);\n\n while (readEntries.length > 0) {\n entries.push(...readEntries);\n readEntries = await readEntriesPromise(directoryReader);\n }\n\n return entries;\n};\n\n/**\n * Get a `File` object from a `FileSystemFileEntry` object.\n *\n * @param {FileSystemFileEntry} fileEntry - The file entry to get a `File` object from.\n * @returns {Promise<File>} - A promise that resolves with a `File` object.\n */\nconst getFileFromFileEntry = fileEntry => {\n return new Promise((resolve, reject) => {\n fileEntry.file(file => resolve(toFileWithPath(file, fileEntry.fullPath)), reject);\n });\n};\n\n/**\n * Get an array of `File` objects from a `DataTransferItemList` object.\n *\n * @param {DataTransferItemList} dataTransferItemList - The item list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromDataTransferItemList = async dataTransferItemList => {\n const files = [];\n\n // Chromium browsers read only 100 files at a time as per the spec, so we need to use\n // BFS (Breadth-first search) to traverse the entire directory/file structure.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#javascript_content\n const queue = [];\n\n for (const item of dataTransferItemList) {\n if (item.kind !== 'file') {\n // Ignore non-file items, such as links.\n continue;\n }\n\n // https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry\n // This function is implemented as `webkitGetAsEntry()` in non-WebKit browsers\n // including Firefox at this time but it may be renamed to `getAsEntry()` in the future.\n // @ts-ignore\n const entry = item.getAsEntry ? item.getAsEntry() : item.webkitGetAsEntry();\n\n queue.push(entry);\n }\n\n while (queue.length > 0) {\n const entry = queue.shift();\n\n if (!entry) {\n continue;\n } else if (entry.isFile) {\n const file = await getFileFromFileEntry(entry);\n\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(file);\n }\n } else if (entry.isDirectory) {\n queue.push(...await readAllDirectoryEntries(entry.createReader()));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from a `FileList` object.\n *\n * @param {FileList} fileList - The file list to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromFileList = async fileList => {\n const files = [];\n\n for (const file of fileList) {\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(toFileWithPath(file));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from an event.\n * This function supports both `drop` and `change` events.\n *\n * @param {*} evt - The event to get an array of `File` objects from.\n * @returns {Promise<File[]>} - A promise that resolves with an array of `File` objects.\n */\nexport const getFilesFromEvent = async evt => {\n if (evt.dataTransfer) {\n return evt.dataTransfer.items\n ? await getFilesFromDataTransferItemList(evt.dataTransfer.items)\n : await getFilesFromFileList(evt.dataTransfer.files);\n }\n\n return await getFilesFromFileList(evt.target.files);\n};\n"],"names":["$f31161edf38949e9$var$COMMON_MIME_TYPES","Map","$f31161edf38949e9$var$FILES_TO_IGNORE","$f31161edf38949e9$var$toFileWithMimeType","file","name","hasExtension","lastIndexOf","type","extension","split","pop","toLowerCase","get","Object","defineProperty","value","writable","configurable","enumerable","$f31161edf38949e9$var$toFileWithPath","path","fileWithMimeType","webkitRelativePath","$f31161edf38949e9$var$readEntriesPromise","directoryReader","Promise","resolve","reject","readEntries","$f31161edf38949e9$var$readAllDirectoryEntries","entries","length","push","$f31161edf38949e9$var$getFileFromFileEntry","fileEntry","fullPath","$f31161edf38949e9$var$getFilesFromDataTransferItemList","dataTransferItemList","files","queue","item","kind","entry","getAsEntry","webkitGetAsEntry","shift","isFile","indexOf","isDirectory","createReader","$f31161edf38949e9$var$getFilesFromFileList","fileList","$f31161edf38949e9$export$6d52664cd15c442","evt","dataTransfer","items","target","$862aa3736b0514bc$var$COMPONENT_NAME","$862aa3736b0514bc$var$TOO_MANY_FILES","$862aa3736b0514bc$var$template","document","createElement","$862aa3736b0514bc$var$styles","innerHTML","$862aa3736b0514bc$export$6ccd1735166caad9","HTMLElement","fileInput","dropzoneEl","constructor","shadowRoot","attachShadow","mode","appendChild","content","cloneNode","getElementById","observedAttributes","attributeChangedCallback","oldValue","newValue","accept","disabled","removeAttribute","setAttribute","multiple","noKeyboard","connectedCallback","upgradeProperty","addEventListener","handleFileInputChange","handleDragEnter","handleDragOver","handleDragLeave","handleDrop","handleClick","handleKeyUp","autoFocus","focus","disconnectedCallback","removeEventListener","getAttribute","toString","hasAttribute","toggleAttribute","maxFiles","num","Number","Infinity","Math","floor","abs","maxSize","isNaN","minSize","noClick","noDrag","noStyle","handleFilesSelect","error","dispatchEvent","CustomEvent","bubbles","composed","detail","Event","preventDefault","dropEffect","classList","add","part","remove","click","key","Array","isArray","acceptedFiles","rejectedFiles","filesLength","errors","code","message","fileHasValidType","acceptedTypeSpecifiers","acceptedMimeTypesList","Set","map","v","trim","filter","Boolean","fileMimeType","baseMimeType","replace","validType","charAt","test","fileExceedsMaxSize","size","fileIsSmallerThanMinSize","defaultValue","openFileDialog","prop","prototype","hasOwnProperty","call","instance","defineCustomElement","elementName","window","customElements","define","FilesDropzone"],"version":3,"file":"files-dropzone.js.map"}
@@ -1 +1 @@
1
- {"version":3,"file":"files-selector.d.ts","sourceRoot":"","sources":["../../src/utils/files-selector.js"],"names":[],"mappings":"AA+QO,6CAFM,QAAQ,IAAI,EAAE,CAAC,CAU3B"}
1
+ {"version":3,"file":"files-selector.d.ts","sourceRoot":"","sources":["../../src/utils/files-selector.js"],"names":[],"mappings":"AAiRO,6CAFM,QAAQ,IAAI,EAAE,CAAC,CAU3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@georapbox/files-dropzone-element",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A custom element that creates a drag and drop zone for files",
5
5
  "main": "dist/files-dropzone.js",
6
6
  "module": "dist/files-dropzone.js",
@@ -38,6 +38,8 @@ const COMMON_MIME_TYPES = new Map([
38
38
  ['js', 'text/javascript'],
39
39
  ['json', 'application/json'],
40
40
  ['jsonld', 'application/ld+json'],
41
+ ['markdown', 'text/markdown'],
42
+ ['md', 'text/markdown'],
41
43
  ['mid', 'audio/midi'],
42
44
  ['midi', 'audio/midi'],
43
45
  ['mjs', 'text/javascript'],