@digital-blueprint/formalize-app
Version:
[GitHub Repository](https://github.com/digital-blueprint/formalize-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/formalize-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/formalize-app/) | [Formalize Bundle](https:
2,705 lines • 390 kB
JavaScript
/*!
* License: LGPL-2.1-or-later
* Dependencies:
*
* @webcomponents/scoped-custom-element-registry: BSD-3-Clause
* @dbp-toolkit/app-shell: LGPL-2.1-or-later
* lit-html: BSD-3-Clause
* @dbp-toolkit/language-select: LGPL-2.1-or-later
* @dbp-toolkit/auth: LGPL-2.1-or-later
* @dbp-toolkit/theme-switcher: LGPL-2.1-or-later
* universal-router: MIT
* @dbp-toolkit/matomo: LGPL-2.1-or-later
* cssfilter: MIT
* xss: MIT
* @dbp-toolkit/form-elements: LGPL-2.1-or-later
* html2pdf.js: MIT
* exceljs: MIT
* jspdf-autotable: MIT
* keycloak-js: Apache-2.0
* pdfjs-dist: Apache-2.0
* jszip: (MIT OR GPL-3.0-or-later)
* @babel/runtime: MIT
* fflate: MIT
* iobuffer: MIT
* pako: (MIT AND Zlib)
* fast-png: MIT
* jspdf: MIT
* core-js: MIT
* performance-now: MIT
* raf: MIT
* rgbcolor: MIT OR SEE LICENSE IN FEEL-FREE.md
* svg-pathdata: MIT
* stackblur-canvas: MIT
* canvg: MIT
* dompurify: (MPL-2.0 OR Apache-2.0)
* i18next: MIT
* @dbp-toolkit/common: LGPL-2.1-or-later
* @lit/reactive-element: BSD-3-Clause
* lit-element: BSD-3-Clause
* @open-wc/dedupe-mixin: MIT
* @open-wc/scoped-elements: MIT
* dialog-polyfill: BSD
* jquery: MIT
* select2: MIT
* @dbp-toolkit/notification: LGPL-2.1-or-later
* @dbp-toolkit/tabulator-table: LGPL-2.1-or-later
* tabulator-tables: MIT
* @dbp-toolkit/file-handling: LGPL-2.1-or-later
* webdav: MIT
* jose: MIT
* file-saver: MIT
* @dbp-toolkit/grant-permission-dialog: LGPL-2.1-or-later
* @dbp-toolkit/pdf-viewer: LGPL-2.1-or-later
*/
import{A as e,D as t,S as n,T as r,n as i,t as a,w as o,x as s}from"./ref.DqB7ABXf.js";import{$ as c,A as l,D as u,G as d,J as f,K as p,L as m,O as h,Q as g,R as _,X as v,b as y,d as b,f as x,g as S,i as ee,k as C,l as w,m as T,p as E,r as D,s as O,u as te,v as ne,w as re,z as ie}from"./directive-helpers.C6Xz79AM.js";import{t as k}from"./class-map.B2bFA_il.js";import{t as ae}from"./modal.DfjeZb2d.js";import{n as oe,t as se}from"./notification.0izelRLi.js";import{n as ce,t as le}from"./tabulator-table-styles.Csmskvac.js";import{t as ue}from"./resource-select.Bx5DnWv9.js";var de={clipboard:{"add-files":`Dateien der Zwischenablage hinzufügen`,"add-files-btn":`Dateien hinzufügen`,"clear-clipboard-body":`Die Zwischenablage wurde erfolgreich geleert.`,"clear-clipboard-title":`Zwischenablage geleert`,"clear-count-clipboard-body_one":`Eine Datei wurde erfolgreich aus der Zwischenablage entfernt.`,"clear-count-clipboard-body_other":`{{count}} Dateien wurde erfolgreich aus der Zwischenablage entfernt.`,"clear-count-clipboard-title_one":`Datei entfernt`,"clear-count-clipboard-title_other":`Dateien entfernt`,"file-mod":`Geändert`,"file-name":`Name`,"file-size":`Größe`,"file-type":`Art`,"file-warning":`Achtung!`,"file-warning-body_one":`Es befindet sich noch eine Datei in der Zwischenablage. Die Zwischenablage wird beim Verlassen der Seite verworfen.`,"file-warning-body_other":`Es befinden sich noch {{count}} Dateien in der Zwischenablage. Die Zwischenablage wird beim Verlassen der Seite verworfen.`,"no-data":`Aktuell befinden sich keine Dateien in der Zwischenablage.`,"remove-all":`Alle Dateien aus der Zwischenablage entfernen`,"remove-all-btn":`Dateien entfernen`,"remove-count_one":`Eine Datei aus der Zwischenablage entfernen`,"remove-count_other":`{{count}} Dateien aus der Zwischenablage entfernen`,"remove-count-btn_one":`Datei entfernen`,"remove-count-btn_other":`{{count}} Dateien entfernen`,"save-all":`Alle Dateien aus der Zwischenablage sichern`,"save-all-btn":`Dateien sichern`,"save-count_one":`Eine Datei aus der Zwischenablage sichern`,"save-count_other":`{{count}} Dateien aus der Zwischenablage sichern`,"save-count-btn_one":`Datei sichern`,"save-count-btn_other":`{{count}} Dateien sichern`,"saved-files-body_one":`Eine Datei wurde erfolgreich temporär in der Zwischenablage abgelegt und kann jetzt innerhalb dieser Applikation verwendet werden.`,"saved-files-body_other":`{{count}} Dateien wurde erfolgreich temporär in der Zwischenablage abgelegt und können jetzt innerhalb dieser Applikation verwendet werden.`,"saved-files-title_one":`Datei erfolgreich abgelegt`,"saved-files-title_other":`Dateien erfolgreich abgelegt`,"select-all":`Alle auswählen`,"select-nothing":`Nichts auswählen`,"sink-btn_one":`{{count}} Datei ablegen`,"sink-btn_other":`{{count}} Dateien ablegen`,"sink-title":`Dateien in der Zwischenablage ablegen`,"source-btn_one":`Datei auswählen`,"source-btn_other":`{{count}} Dateien auswählen`,"source-btn-none":`Dateien auswählen`,"source-title":`Von der Zwischenablage auswählen`,"upload-area-text":`Sie können in diesem Bereich Dokumente per Drag & Drop oder per Direktauswahl hochladen.`,"upload-button-label":`Dateien auswählen`,warning:`Vorsicht! Wenn Sie den Browser schließen oder die Seite neu laden wird die bestehende Zwischenablage automatisch verworfen!`},"demo-title":`Datei Abgabe Demo`,"file-sink":{clipboard:`Zwischenablage`,"local-button_one":`Datei herunterladen`,"local-button_other":`Dateien herunterladen`,"local-intro_one":`{{count}} Datei herunterladen`,"local-intro_other":`{{count}} Dateien herunterladen`,"nav-local":`Lokaler Computer`,"preparing-download":`Dateien werden vorbereitet`,"select-directory":``,"upload-success-body_one":`Sie haben {{count}} Datei erfolgreich in {{name}} hochgeladen.`,"upload-success-body_other":`Sie haben {{count}} Dateien erfolgreich in {{name}} hochgeladen.`,"upload-success-title":`Erfolgreich hochgeladen`},"file-source":{clipboard:`Zwischenablage`,"empty-file-error-text":`{{filename}} hat size=0 und wird abgelehnt!`,"empty-file-error-title":`Leere Dateien sind nicht erlaubt`,"mime-type-body":`Das Dateiformat wird von dieser Applikation nicht unterstützt.`,"mime-type-title":`Nicht unterstützes Dateiformat`,"nav-local":`Lokaler Computer`,"no-usable-files-hint":`Laden Sie eine ZIP Datei mit Dateien von folgendem Typ hoch: `,"no-usable-files-in-zip":`ZIP Datei enthält keine verwendbaren Dateien`,"not-allowed-mime-type-file-error-text":`{{filename}} hat nicht erlaubt mime type`,"not-allowed-mime-type-file-error-title":`Nicht erlaubt MIME-Type`,"too-big-file-body":`Die maximale erlaubte Dateigröße beträgt {{size}}.`,"too-big-file-title":`Datei ist zu groß!`},intro:`Sie können in diesem Bereich Dateien per Drag & Drop oder per Direktauswahl hochladen. Die Dateien dürfen sich auch in ZIP-Archiven befinden.`,"nextcloud-file-picker":{abort:`Vorgang abbrechen`,"abort-message":`Vorgang wurde abgebrochen.`,"add-folder":`Neuen Ordner erstellen`,"add-folder-close":`Neuer Ordner Dialog schließen`,"add-folder-error":`Die Ressource "{{folder}}" ist bereits vorhanden.`,"add-folder-error-empty":`Der Ordnername darf nicht leer sein.`,"add-folder-open":`Neuer Ordner Dialog öffnen`,"add-folder-success":`Der Ordner "{{folder}}" wurde erfolgreich erstellt.`,"all-recent-files-link-text":`Alle neuesten Dateien`,"auth-info":`Eine neue Seite wird geöffnet, um Ihr Konto zu verbinden.`,"auth-progress":`Anmeldung läuft`,"connect-nextcloud":`{{name}} verbinden`,"error-save-to-favorites":`Speichern in Favoriten nicht möglich! Bitte wählen Sie einen Ordner innerhalb der Favoriten aus.`,"error-save-to-recent":`Speichern in den neuesten Dateien nicht möglich! Bitte wählen Sie einen Ordner innerhalb der neuesten Dateien aus.`,"favorites-link-text":`Meine Favoriten`,"favorites-title":`Favoriten`,"file-error":`Das Dateiformat wird nicht unterstützt oder die Datei ist fehlerhaft und konnte nicht hochgeladen werden.`,"file-upload-error":`Entschuldigung, etwas ist schief gelaufen. Bitte versuchen Sie es später noch einmal.`,filename:`Name`,"folder-home":`In das Home Verzeichnis springen`,forbidden:`Sie sind nicht berechtigt, diese Aktion in diesem Ordner auszuführen.`,"init-text-1":`Wählen Sie Ihre Dateien von {{name}}.`,"init-text-2":`Sie müssen sich zuerst authentifizieren.`,"last-modified":`Geändert`,"load-in-folder":`Ins aktuelle Verzeichnis laden`,"load-path-link":`Gehe zu {{path}}`,"load-to-folder":`Im ausgewählten Ordner hochladen`,"loadpath-nextcloud-file-picker":`Das {{name}} Verzeichnis wird geladen.`,"log-out":`Verbindung trennen`,"mime-type":`Art`,"more-menu":``,"my-recent-files-link-text":`Meine neuesten Dateien`,"my-recent-files-title":`Meine neuesten Dateien`,"new-folder-dialog-button-cancel":`Abbrechen`,"new-folder-dialog-button-ok":`Erstellen`,"new-folder-dialog-default-name":`Neuer Ordner`,"new-folder-dialog-label":`Name eingeben:`,"new-folder-dialog-title":`Neuen Ordner erstellen`,"new-folder-placeholder":`Neuer Ordner`,"no-data":`In diesem Ordner befinden sich keine Dateien.`,"no-data-type":`In diesem Ordner befinden sich keine Dateien vom benötigten Typ.`,"no-favorites":`Es wurden keine Favoriten des entsprechenden Typs gefunden. Definieren Sie Dateien und Ordner in Ihrer {{name}} als Favoriten, um diese hier anzuzeigen.`,"no-recent-files":`Es wurden keine entsprechenden Dateien und Ordner innerhalb der letzten 3 Monate gefunden.`,onlycreate:`Sie dürfen in diesem Ordner nur neue Dateien erstellen.`,onlyedit:`Sie dürfen in diesem Ordner nur Dateien bearbeiten.`,"open-nextcloud-file-picker":`Dateien von {{name}} wählen`,readonly:`Sie dürfen in diesem Ordner nichts hochladen.`,"recent-files-title":`Neueste Dateien`,"refresh-nextcloud-file-picker":`Erneut verbinden`,"remember-me":`Mit {{name}} verbunden bleiben`,"replace-cancel":`Abbrechen`,"replace-cancel-all":`Alle abbrechen`,"replace-mode-all":`Für alle zukünftigen Konflikte übernehmen`,"replace-new_name":`Neuer Name`,"replace-replace":`Ersetzen`,"replace-skip":`Überspringen`,"replace-text":`Was möchten Sie tun`,"replace-title-1":`Es ist bereits eine Datei mit dem Namen `,"replace-title-2":` vorhanden`,"select-files":`Dateien auswählen`,"select-files-btn_one":`Datei auswählen`,"select-files-btn_other":`{{count}} Dateien auswählen`,size:`Größe`,"something-went-wrong":`Etwas ist schief gelaufen. Bitte verbinden Sie sich erneut.`,"upload-to":`Es wird nach {{- path}} hochgeladen ...`,"webdav-error":`Etwas ist schief gelaufen: {{error}}`},"upload-label":`Dateiauswahl`},fe={clipboard:{"add-files":`Add files to clipboard`,"add-files-btn":`Add files`,"clear-clipboard-body":`The clipboard was successfully cleared.`,"clear-clipboard-title":`Clipboard cleared`,"clear-count-clipboard-body_one":`One file was successfully removed from clipboard.`,"clear-count-clipboard-body_other":`{{count}} files were successfully removed from clipboard.`,"clear-count-clipboard-title_one":`File removed`,"clear-count-clipboard-title_other":`Files removed`,"file-mod":`Last modified`,"file-name":`Name`,"file-size":`Size`,"file-type":`Type`,"file-warning":`Attention!`,"file-warning-body_one":`There is still a file on the clipboard. The clipboard is discarded when you exit the page.`,"file-warning-body_other":`There are still {{count}} files on the clipboard. The clipboard is discarded when you exit the page.`,"no-data":`There are no files`,"remove-all":`Remove all files from the clipboard`,"remove-all-btn":`Remove all`,"remove-count_one":`Remove file from the clipboard`,"remove-count_other":`Remove {{count}} files from the clipboard`,"remove-count-btn_one":`Remove file`,"remove-count-btn_other":`Remove {{count}} files`,"save-all":`Save all files from the clipboard`,"save-all-btn":`Save all`,"save-count_one":`Save one file from the clipboard`,"save-count_other":`Save {{count}} files from the clipboard`,"save-count-btn_one":`Save file`,"save-count-btn_other":`Save {{count}} files`,"saved-files-body_one":`A file was successfully stored temporarily in the clipboard and can now be used within this application.`,"saved-files-body_other":`{{count}} files were successfully stored temporarily in the clipboard and can now be used within this application.`,"saved-files-title_one":`File successfully filed`,"saved-files-title_other":`Files successfully filed`,"select-all":`Select all`,"select-nothing":`Select nothing`,"sink-btn_one":`Store {{count}} file`,"sink-btn_other":`Store {{count}} files`,"sink-title":`Store files on the clipboard`,"source-btn_one":`Select file`,"source-btn_other":`Select {{count}} files`,"source-btn-none":`Select files`,"source-title":`Select files from clipboard`,"upload-area-text":`In this area you can upload documents up to a size of 32MB via Drag & Drop or by selecting them directly. `,"upload-button-label":`Load to clipboard`,warning:`Attention! If you close the browser or reload the page the existing clipboard is automatically discarded!`},"demo-title":`File Upload Demo`,"file-sink":{clipboard:`Clipboard`,"local-button_one":`Download file`,"local-button_other":`Download files`,"local-intro_one":`Download {{count}} file`,"local-intro_other":`Download {{count}} files`,"nav-local":`My device`,"preparing-download":`Preparing files to download`,"select-directory":``,"upload-success-body_one":`You have successfully uploaded {{count}} file to {{name}}.`,"upload-success-body_other":`You have successfully uploaded {{count}} files to {{name}}.`,"upload-success-title":`Successful uploaded`},"file-source":{clipboard:`Clipboard`,"empty-file-error-text":`{{filename}} has size=0 and is denied!`,"empty-file-error-title":`Empty files are not allowed`,"mime-type-body":`The file format is not supported by this application. For file {{filename}}`,"mime-type-title":`Unsupported file format`,"nav-local":`My device`,"no-usable-files-hint":`Upload a ZIP file with file type(s) of `,"no-usable-files-in-zip":`ZIP file does not contain any usable files`,"not-allowed-mime-type-file-error-text":`{{filename}} has not allowed MIME-Type`,"not-allowed-mime-type-file-error-title":`Not allowed MIME-Type`,"too-big-file-body":`The file can have a maximum of {{size}}.`,"too-big-file-title":`The file is too big!`},intro:`Upload multiple files with the file dialog or by dragging and dropping images onto the dashed region.`,"nextcloud-file-picker":{abort:`Cancel process`,"abort-message":`The process was canceled.`,"add-folder":`Add new folder`,"add-folder-close":`Close new folder dialogue`,"add-folder-error":`The resource "{{folder}}" you tried to create already exists.`,"add-folder-error-empty":`The folder name can not be empty.`,"add-folder-open":`Open new folder dialogue`,"add-folder-success":`The folder '{{folder}}' was created successfully.`,"all-recent-files-link-text":`All Recent Files`,"auth-info":`A new page will open to connect your account.`,"auth-progress":`Authentification in progress`,"connect-nextcloud":`Connect {{name}}`,"error-save-to-favorites":`Saving to Favorites not possible! Please select a folder within the Favorites.`,"error-save-to-recent":`Saving to Recent Files not possible! Please select a folder within the Recent Files.`,"favorites-link-text":`My Favorites`,"favorites-title":`Favorites`,"file-error":`The file format is not supported or the file is corrupt and could not be uploaded.`,"file-upload-error":`Sorry, something went wrong. Please try again later.`,filename:`Filename`,"folder-home":`Jump to the home directory`,forbidden:`You don't have permissions to perform this action in this folder.`,"init-text-1":`Chose your files from {{name}}.`,"init-text-2":`You need to authenticate first.`,"last-modified":`Last modified`,"load-in-folder":`Load into the current directory`,"load-path-link":`Go to {{path}}`,"load-to-folder":`Upload to the selected folder`,"loadpath-nextcloud-file-picker":`Loading directory from {{name}}.`,"log-out":`Disconnect`,"mime-type":`Type`,"more-menu":``,"my-recent-files-link-text":`My Recent Files`,"my-recent-files-title":`My Recent Files`,"new-folder-dialog-button-cancel":`Cancel`,"new-folder-dialog-button-ok":`Create`,"new-folder-dialog-default-name":`New folder`,"new-folder-dialog-label":`Enter a name:`,"new-folder-dialog-title":`Create a new folder`,"new-folder-placeholder":`New folder`,"no-data":`No data available in this folder.`,"no-data-type":`No data available in this folder.`,"no-favorites":`No favorites of the relevant type were found. Define files and folders as favorites in your {{name}} to display them here`,"no-recent-files":`No relevant files and folders were found within the last 3 months.`,onlycreate:`You are only allowed to create new files in this directory.`,onlyedit:`You are only allowed to edit files in this directory.`,"open-nextcloud-file-picker":`Select files from your {{name}}`,readonly:`You are not allowed to uploade files in this directory.`,"recent-files-title":`Recent Files`,"refresh-nextcloud-file-picker":`Connect again`,"remember-me":`Stay connected with {{name}}`,"replace-cancel":`Cancel`,"replace-cancel-all":`Cancel all`,"replace-mode-all":`Do this for the next conflicts`,"replace-new_name":`New Name`,"replace-replace":`Replace`,"replace-skip":`Ignore`,"replace-text":`What do you want to do`,"replace-title-1":`There is already a file with the name `,"replace-title-2":` in this location`,"select-files":`Select files`,"select-files-btn_one":`Select file`,"select-files-btn_other":`Select {{count}} files`,size:`Size`,"something-went-wrong":`Something went wrong. Please reload.`,"upload-to":`Uploading to {{- path}} ...`,"webdav-error":`Something went wrong`},"upload-label":`Select some files`};function pe(){return g({en:fe,de},`de`,`en`)}
/*! For license information please see index.js.LICENSE.txt */
var me={2(e){function t(e,t,i){e instanceof RegExp&&(e=n(e,i)),t instanceof RegExp&&(t=n(t,i));var a=r(e,t,i);return a&&{start:a[0],end:a[1],pre:i.slice(0,a[0]),body:i.slice(a[0]+e.length,a[1]),post:i.slice(a[1]+t.length)}}function n(e,t){var n=t.match(e);return n?n[0]:null}function r(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:((i=r.pop())<a&&(a=i,o=l),l=n.indexOf(t,u+1)),u=c<l&&c>=0?c:l;r.length&&(s=[a,o])}return s}e.exports=t,t.range=r},101(e,t,n){var r;e=n.nmd(e),function(){var i=(e&&e.exports,typeof global==`object`&&global);i.global!==i&&i.window;var a=function(e){this.message=e};(a.prototype=/* @__PURE__ */ Error()).name=`InvalidCharacterError`;var o=function(e){throw new a(e)},s=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,c=/[\t\n\f\r ]/g,l={encode:function(e){e=String(e),/[^\0-\xFF]/.test(e)&&o(`The string to be encoded contains characters outside of the Latin1 range.`);for(var t,n,r,i,a=e.length%3,c=``,l=-1,u=e.length-a;++l<u;)t=e.charCodeAt(l)<<16,n=e.charCodeAt(++l)<<8,r=e.charCodeAt(++l),c+=s.charAt((i=t+n+r)>>18&63)+s.charAt(i>>12&63)+s.charAt(i>>6&63)+s.charAt(63&i);return a==2?(t=e.charCodeAt(l)<<8,n=e.charCodeAt(++l),c+=s.charAt((i=t+n)>>10)+s.charAt(i>>4&63)+s.charAt(i<<2&63)+`=`):a==1&&(i=e.charCodeAt(l),c+=s.charAt(i>>2)+s.charAt(i<<4&63)+`==`),c},decode:function(e){var t=(e=String(e).replace(c,``)).length;t%4==0&&(t=(e=e.replace(/==?$/,``)).length),(t%4==1||/[^+a-zA-Z0-9/]/.test(e))&&o(`Invalid character: the string to be decoded is not correctly encoded.`);for(var n,r,i=0,a=``,l=-1;++l<t;)r=s.indexOf(e.charAt(l)),n=i%4?64*n+r:r,i++%4&&(a+=String.fromCharCode(255&n>>(-2*i&6)));return a},version:`1.0.0`};(r=function(){return l}.call(t,n,t,e))===void 0||(e.exports=r)}()},172(e,t){t.d=function(e){if(!e)return 0;for(var t=(e=e.toString()).length,n=e.length;n--;){var r=e.charCodeAt(n);56320<=r&&r<=57343&&n--,127<r&&r<=2047?t++:2047<r&&r<=65535&&(t+=2)}return t}},526(e){var t={utf8:{stringToBytes:function(e){return t.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(t.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join(``)}}};e.exports=t},298(e){var t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join(``)},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var i=e[r]<<16|e[r+1]<<8|e[r+2],a=0;a<4;a++)8*r+6*a<=8*e.length?n.push(t.charAt(i>>>6*(3-a)&63)):n.push(`=`);return n.join(``)},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,``);for(var n=[],r=0,i=0;r<e.length;i=++r%4)i!=0&&n.push((t.indexOf(e.charAt(r-1))&2**(-2*i+8)-1)<<2*i|t.indexOf(e.charAt(r))>>>6-2*i);return n}};e.exports=n},135(e){function t(e){return!!e.constructor&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e)}e.exports=function(e){return e!=null&&(t(e)||function(e){return typeof e.readFloatLE==`function`&&typeof e.slice==`function`&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},542(e,t,n){(function(){var t=n(298),r=n(526).utf8,i=n(135),a=n(526).bin,o=function(e,n){e.constructor==String?e=n&&n.encoding===`binary`?a.stringToBytes(e):r.stringToBytes(e):i(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var s=t.bytesToWords(e),c=8*e.length,l=1732584193,u=-271733879,d=-1732584194,f=271733878,p=0;p<s.length;p++)s[p]=16711935&(s[p]<<8|s[p]>>>24)|4278255360&(s[p]<<24|s[p]>>>8);s[c>>>5]|=128<<c%32,s[14+(c+64>>>9<<4)]=c;var m=o._ff,h=o._gg,g=o._hh,_=o._ii;for(p=0;p<s.length;p+=16){var v=l,y=u,b=d,x=f;l=m(l,u,d,f,s[p+0],7,-680876936),f=m(f,l,u,d,s[p+1],12,-389564586),d=m(d,f,l,u,s[p+2],17,606105819),u=m(u,d,f,l,s[p+3],22,-1044525330),l=m(l,u,d,f,s[p+4],7,-176418897),f=m(f,l,u,d,s[p+5],12,1200080426),d=m(d,f,l,u,s[p+6],17,-1473231341),u=m(u,d,f,l,s[p+7],22,-45705983),l=m(l,u,d,f,s[p+8],7,1770035416),f=m(f,l,u,d,s[p+9],12,-1958414417),d=m(d,f,l,u,s[p+10],17,-42063),u=m(u,d,f,l,s[p+11],22,-1990404162),l=m(l,u,d,f,s[p+12],7,1804603682),f=m(f,l,u,d,s[p+13],12,-40341101),d=m(d,f,l,u,s[p+14],17,-1502002290),l=h(l,u=m(u,d,f,l,s[p+15],22,1236535329),d,f,s[p+1],5,-165796510),f=h(f,l,u,d,s[p+6],9,-1069501632),d=h(d,f,l,u,s[p+11],14,643717713),u=h(u,d,f,l,s[p+0],20,-373897302),l=h(l,u,d,f,s[p+5],5,-701558691),f=h(f,l,u,d,s[p+10],9,38016083),d=h(d,f,l,u,s[p+15],14,-660478335),u=h(u,d,f,l,s[p+4],20,-405537848),l=h(l,u,d,f,s[p+9],5,568446438),f=h(f,l,u,d,s[p+14],9,-1019803690),d=h(d,f,l,u,s[p+3],14,-187363961),u=h(u,d,f,l,s[p+8],20,1163531501),l=h(l,u,d,f,s[p+13],5,-1444681467),f=h(f,l,u,d,s[p+2],9,-51403784),d=h(d,f,l,u,s[p+7],14,1735328473),l=g(l,u=h(u,d,f,l,s[p+12],20,-1926607734),d,f,s[p+5],4,-378558),f=g(f,l,u,d,s[p+8],11,-2022574463),d=g(d,f,l,u,s[p+11],16,1839030562),u=g(u,d,f,l,s[p+14],23,-35309556),l=g(l,u,d,f,s[p+1],4,-1530992060),f=g(f,l,u,d,s[p+4],11,1272893353),d=g(d,f,l,u,s[p+7],16,-155497632),u=g(u,d,f,l,s[p+10],23,-1094730640),l=g(l,u,d,f,s[p+13],4,681279174),f=g(f,l,u,d,s[p+0],11,-358537222),d=g(d,f,l,u,s[p+3],16,-722521979),u=g(u,d,f,l,s[p+6],23,76029189),l=g(l,u,d,f,s[p+9],4,-640364487),f=g(f,l,u,d,s[p+12],11,-421815835),d=g(d,f,l,u,s[p+15],16,530742520),l=_(l,u=g(u,d,f,l,s[p+2],23,-995338651),d,f,s[p+0],6,-198630844),f=_(f,l,u,d,s[p+7],10,1126891415),d=_(d,f,l,u,s[p+14],15,-1416354905),u=_(u,d,f,l,s[p+5],21,-57434055),l=_(l,u,d,f,s[p+12],6,1700485571),f=_(f,l,u,d,s[p+3],10,-1894986606),d=_(d,f,l,u,s[p+10],15,-1051523),u=_(u,d,f,l,s[p+1],21,-2054922799),l=_(l,u,d,f,s[p+8],6,1873313359),f=_(f,l,u,d,s[p+15],10,-30611744),d=_(d,f,l,u,s[p+6],15,-1560198380),u=_(u,d,f,l,s[p+13],21,1309151649),l=_(l,u,d,f,s[p+4],6,-145523070),f=_(f,l,u,d,s[p+11],10,-1120210379),d=_(d,f,l,u,s[p+2],15,718787259),u=_(u,d,f,l,s[p+9],21,-343485551),l=l+v>>>0,u=u+y>>>0,d=d+b>>>0,f=f+x>>>0}return t.endian([l,u,d,f])};o._ff=function(e,t,n,r,i,a,o){var s=e+(t&n|~t&r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},o._gg=function(e,t,n,r,i,a,o){var s=e+(t&r|n&~r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},o._hh=function(e,t,n,r,i,a,o){var s=e+(t^n^r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},o._ii=function(e,t,n,r,i,a,o){var s=e+(n^(t|~r))+(i>>>0)+o;return(s<<a|s>>>32-a)+t},o._blocksize=16,o._digestsize=16,e.exports=function(e,n){if(e==null)throw Error(`Illegal argument `+e);var r=t.wordsToBytes(o(e,n));return n&&n.asBytes?r:n&&n.asString?a.bytesToString(r):t.bytesToHex(r)}})()},285(e,t,n){var r=n(2);e.exports=function(e,t){if(!e)return[];var n=(t||={}).max==null?1e5:t.max,r=t.maxLength==null?4e6:t.maxLength;return e.substr(0,2)===`{}`&&(e=`\\{\\}`+e.substr(2)),v(function(e){return e.split(`\\\\`).join(i).split(`\\{`).join(a).split(`\\}`).join(o).split(`\\,`).join(s).split(`\\.`).join(c)}(e),n,r,!0).map(u)};var i=`\0SLASH`+Math.random()+`\0`,a=`\0OPEN`+Math.random()+`\0`,o=`\0CLOSE`+Math.random()+`\0`,s=`\0COMMA`+Math.random()+`\0`,c=`\0PERIOD`+Math.random()+`\0`;function l(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function u(e){return e.split(i).join(`\\`).split(a).join(`{`).split(o).join(`}`).split(s).join(`,`).split(c).join(`.`)}function d(e){if(!e)return[``];var t=[],n=r(`{`,`}`,e);if(!n)return e.split(`,`);var i=n.pre,a=n.body,o=n.post,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;var c=d(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function f(e){return`{`+e+`}`}function p(e){return/^-?0\d/.test(e)}function m(e,t){return e<=t}function h(e,t){return e>=t}function g(e,t,n,r,i,a){for(var o=[],s=0,c=0;c<e.length;c++)for(var l=0;l<n.length;l++){if(o.length>=r)return o;var u=e[c]+t+n[l];if(!a||u){if(s+u.length>i)return o;o.push(u),s+=u.length}}return o}function _(e,t,n,r){var i=e.split(/\.\./),a=[];if(i[0]===void 0||i[1]===void 0)return a;var o=l(i[0]),s=l(i[1]),c=Math.max(i[0].length,i[1].length),u=i.length===3&&i[2]!==void 0?Math.max(Math.abs(l(i[2])),1):1,d=m;s<o&&(u*=-1,d=h);for(var f=i.some(p),g=0,_=o;d(_,s)&&a.length<n;_+=u){var v;if(t)(v=String.fromCharCode(_))===`\\`&&(v=``);else if(v=String(_),f){var y=c-v.length;if(y>0){var b=Array(y+1).join(`0`);v=_<0?`-`+b+v.slice(1):b+v}}if(g+v.length>r)break;a.push(v),g+=v.length}return a}function v(e,t,n,i){for(var a=[``],s=!1,c=!0;;){let E=r(`{`,`}`,e);if(!E)return g(a,e,[``],t,n,s);let D=E.pre;if(/\$$/.test(D)){if(a=g(a,D+`{`+E.body+`}`,[``],t,n,s&&!E.post.length),c=!1,!E.post.length)break;e=E.post}else{var l,u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(E.body),p=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(E.body),m=u||p,h=E.body.indexOf(`,`)>=0;if(!m&&!h){if(E.post.match(/,(?!,).*\}/)){e=E.pre+`{`+E.body+o+E.post,i=!0;continue}return g(a,D+`{`+E.body+`}`+E.post,[``],t,n,s)}if(c&&=(s=i&&!m,!1),m)l=_(E.body,p,t,n);else{var y=d(E.body);if(y.length===1&&y[0]!==void 0&&(y=v(y[0],t,n,!1).map(f)).length===1){if(a=g(a,D+y[0],[``],t,n,s&&!E.post.length),!E.post.length)break;e=E.post;continue}for(var b=s&&!E.post.length&&!D,x=0;b&&x<a.length;x++)a[x]&&(b=!1);l=[];var S=0;t:for(var ee=0;ee<y.length;ee++)for(var C=v(y[ee],t,n,!1),w=0;w<C.length;w++){var T=C[w];if(!b||T){if(l.length>=t||S+T.length>n)break t;l.push(T),S+=T.length}}}if(a=g(a,D,l,t,n,s&&!E.post.length),!E.post.length)break;e=E.post}}return a}},829(e){function t(e){return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}function n(e){var t=typeof Map==`function`?/* @__PURE__ */ new Map:void 0;return n=function(e){if(e===null||(n=e,Function.toString.call(n).indexOf(`[native code]`)===-1))return e;var n;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return r(e,arguments,a(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),i(o,e)},n(e)}function r(e,t,n){return r=function(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch{return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&i(a,n.prototype),a},r.apply(null,arguments)}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}var o=function(e){function n(e){var r;return function(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}(this,n),(r=function(e,n){return!n||t(n)!==`object`&&typeof n!=`function`?function(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}(e):n}(this,a(n).call(this,e))).name=`ObjectPrototypeMutationError`,r}return function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(n,e),n}(n(Error));function s(e,n){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},i=n.split(`.`),a=i.length,o=function(t){var n=i[t];if(!e)return{v:void 0};if(n===`+`){if(Array.isArray(e))return{v:e.map((function(n,a){var o=i.slice(t+1);return o.length>0?s(n,o.join(`.`),r):r(e,a,i,t)}))};var a=i.slice(0,t).join(`.`);throw Error(`Object at wildcard (${a}) is not an array`)}e=r(e,n,i,t)},c=0;c<a;c++){var l=o(c);if(t(l)===`object`)return l.v}return e}function c(e,t){return e.length===t+1}e.exports={set:function(e,n,r){if(t(e)!=`object`||e===null||n===void 0)return e;if(typeof n==`number`)return e[n]=r,e[n];try{return s(e,n,(function(e,t,n,i){if(e===Reflect.getPrototypeOf({}))throw new o(`Attempting to mutate Object.prototype`);if(!e[t]){var a=Number.isInteger(Number(n[i+1])),s=n[i+1]===`+`;e[t]=a||s?[]:{}}return c(n,i)&&(e[t]=r),e[t]}))}catch(t){if(t instanceof o)throw t;return e}},get:function(e,n){if(t(e)!=`object`||e===null||n===void 0)return e;if(typeof n==`number`)return e[n];try{return s(e,n,(function(e,t){return e[t]}))}catch{return e}},has:function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(t(e)!=`object`||e===null||n===void 0)return!1;if(typeof n==`number`)return n in e;try{var i=!1;return s(e,n,(function(e,t,n,a){if(!c(n,a))return e&&e[t];i=r.own?e.hasOwnProperty(t):t in e})),i}catch{return!1}},hasOwn:function(e,t,n){return this.has(e,t,n||{own:!0})},isIn:function(e,n,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};if(t(e)!=`object`||e===null||n===void 0)return!1;try{var a=!1,o=!1;return s(e,n,(function(e,n,i,s){return a=a||e===r||!!e&&e[n]===r,o=c(i,s)&&t(e)===`object`&&n in e,e&&e[n]})),i.validPath?a&&o:a}catch{return!1}},ObjectPrototypeMutationError:o}},47(e,t,n){var r=n(410),i=function(e){return typeof e==`string`};function a(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r];i&&i!==`.`&&(i===`..`?n.length&&n[n.length-1]!==`..`?n.pop():t&&n.push(`..`):n.push(i))}return n}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s={};function c(e){return o.exec(e).slice(1)}s.resolve=function(){for(var e=``,t=!1,n=arguments.length-1;n>=-1&&!t;n--){var r=n>=0?arguments[n]:process.cwd();if(!i(r))throw TypeError(`Arguments to path.resolve must be strings`);r&&(e=r+`/`+e,t=r.charAt(0)===`/`)}return(t?`/`:``)+(e=a(e.split(`/`),!t).join(`/`))||`.`},s.normalize=function(e){var t=s.isAbsolute(e),n=e.substr(-1)===`/`;return(e=a(e.split(`/`),!t).join(`/`))||t||(e=`.`),e&&n&&(e+=`/`),(t?`/`:``)+e},s.isAbsolute=function(e){return e.charAt(0)===`/`},s.join=function(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];if(!i(n))throw TypeError(`Arguments to path.join must be strings`);n&&(e+=e?`/`+n:n)}return s.normalize(e)},s.relative=function(e,t){function n(e){for(var t=0;t<e.length&&e[t]===``;t++);for(var n=e.length-1;n>=0&&e[n]===``;n--);return t>n?[]:e.slice(t,n+1)}e=s.resolve(e).substr(1),t=s.resolve(t).substr(1);for(var r=n(e.split(`/`)),i=n(t.split(`/`)),a=Math.min(r.length,i.length),o=a,c=0;c<a;c++)if(r[c]!==i[c]){o=c;break}var l=[];for(c=o;c<r.length;c++)l.push(`..`);return(l=l.concat(i.slice(o))).join(`/`)},s._makeLong=function(e){return e},s.dirname=function(e){var t=c(e),n=t[0],r=t[1];return n||r?(r&&=r.substr(0,r.length-1),n+r):`.`},s.basename=function(e,t){var n=c(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},s.extname=function(e){return c(e)[3]},s.format=function(e){if(!r.isObject(e))throw TypeError(`Parameter 'pathObject' must be an object, not `+typeof e);if(!i(e.root||``))throw TypeError(`'pathObject.root' must be a string or undefined, not `+typeof e.root);return(e.dir?e.dir+s.sep:``)+(e.base||``)},s.parse=function(e){if(!i(e))throw TypeError(`Parameter 'pathString' must be a string, not `+typeof e);var t=c(e);if(!t||t.length!==4)throw TypeError(`Invalid path '`+e+`'`);return t[1]=t[1]||``,t[2]=t[2]||``,t[3]=t[3]||``,{root:t[0],dir:t[0]+t[1].slice(0,t[1].length-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}},s.sep=`/`,s.delimiter=`:`,e.exports=s},647(e,t){var n=Object.prototype.hasOwnProperty;function r(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}}function i(e){try{return encodeURIComponent(e)}catch{return null}}t.stringify=function(e,t){t||=``;var r,a,o=[];for(a in typeof t!=`string`&&(t=`?`),e)if(n.call(e,a)){if((r=e[a])||r!=null&&!isNaN(r)||(r=``),a=i(a),r=i(r),a===null||r===null)continue;o.push(a+`=`+r)}return o.length?t+o.join(`&`):``},t.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,i={};t=n.exec(e);){var a=r(t[1]),o=r(t[2]);a===null||o===null||a in i||(i[a]=o)}return i}},670(e){e.exports=function(e,t){if(t=t.split(`:`)[0],!(e=+e))return!1;switch(t){case`http`:case`ws`:return e!==80;case`https`:case`wss`:return e!==443;case`ftp`:return e!==21;case`gopher`:return e!==70;case`file`:return!1}return e!==0}},737(e,t,n){var r=n(670),i=n(647),a=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,o=/[\n\r\t]/g,s=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,c=/:\d+$/,l=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,u=/^[a-zA-Z]:/;function d(e){return(e||``).toString().replace(a,``)}var f=[[`#`,`hash`],[`?`,`query`],function(e,t){return h(t.protocol)?e.replace(/\\/g,`/`):e},[`/`,`pathname`],[`@`,`auth`,1],[NaN,`host`,void 0,1,1],[/:(\d*)$/,`port`,void 0,1],[NaN,`hostname`,void 0,1,1]],p={hash:1,query:1};function m(e){var t,n=(typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{}).location||{},r={},i=typeof(e||=n);if(e.protocol===`blob:`)r=new _(unescape(e.pathname),{});else if(i===`string`)for(t in r=new _(e,{}),p)delete r[t];else if(i===`object`){for(t in e)t in p||(r[t]=e[t]);r.slashes===void 0&&(r.slashes=s.test(e.href))}return r}function h(e){return e===`file:`||e===`ftp:`||e===`http:`||e===`https:`||e===`ws:`||e===`wss:`}function g(e,t){e=(e=d(e)).replace(o,``),t||={};var n,r=l.exec(e),i=r[1]?r[1].toLowerCase():``,a=!!r[2],s=!!r[3],c=0;return a?s?(n=r[2]+r[3]+r[4],c=r[2].length+r[3].length):(n=r[2]+r[4],c=r[2].length):s?(n=r[3]+r[4],c=r[3].length):n=r[4],i===`file:`?c>=2&&(n=n.slice(2)):h(i)?n=r[4]:i?a&&(n=n.slice(2)):c>=2&&h(t.protocol)&&(n=r[4]),{protocol:i,slashes:a||h(i),slashesCount:c,rest:n}}function _(e,t,n){if(e=(e=d(e)).replace(o,``),!(this instanceof _))return new _(e,t,n);var a,s,c,l,p,v,y=f.slice(),b=typeof t,x=this,S=0;for(b!==`object`&&b!==`string`&&(n=t,t=null),n&&typeof n!=`function`&&(n=i.parse),a=!(s=g(e||``,t=m(t))).protocol&&!s.slashes,x.slashes=s.slashes||a&&t.slashes,x.protocol=s.protocol||t.protocol||``,e=s.rest,(s.protocol===`file:`&&(s.slashesCount!==2||u.test(e))||!s.slashes&&(s.protocol||s.slashesCount<2||!h(x.protocol)))&&(y[3]=[/(.*)/,`pathname`]);S<y.length;S++)typeof(l=y[S])==`function`?e=l(e,x):(c=l[0],v=l[1],c==c?typeof c==`string`?~(p=c===`@`?e.lastIndexOf(c):e.indexOf(c))&&(typeof l[2]==`number`?(x[v]=e.slice(0,p),e=e.slice(p+l[2])):(x[v]=e.slice(p),e=e.slice(0,p))):(p=c.exec(e))&&(x[v]=p[1],e=e.slice(0,p.index)):x[v]=e,x[v]=x[v]||a&&l[3]&&t[v]||``,l[4]&&(x[v]=x[v].toLowerCase()));n&&(x.query=n(x.query)),a&&t.slashes&&x.pathname.charAt(0)!==`/`&&(x.pathname!==``||t.pathname!==``)&&(x.pathname=function(e,t){if(e===``)return t;for(var n=(t||`/`).split(`/`).slice(0,-1).concat(e.split(`/`)),r=n.length,i=n[r-1],a=!1,o=0;r--;)n[r]===`.`?n.splice(r,1):n[r]===`..`?(n.splice(r,1),o++):o&&(r===0&&(a=!0),n.splice(r,1),o--);return a&&n.unshift(``),i!==`.`&&i!==`..`||n.push(``),n.join(`/`)}(x.pathname,t.pathname)),x.pathname.charAt(0)!==`/`&&h(x.protocol)&&(x.pathname=`/`+x.pathname),r(x.port,x.protocol)||(x.host=x.hostname,x.port=``),x.username=x.password=``,x.auth&&=(~(p=x.auth.indexOf(`:`))?(x.username=x.auth.slice(0,p),x.username=encodeURIComponent(decodeURIComponent(x.username)),x.password=x.auth.slice(p+1),x.password=encodeURIComponent(decodeURIComponent(x.password))):x.username=encodeURIComponent(decodeURIComponent(x.auth)),x.password?x.username+`:`+x.password:x.username),x.origin=x.protocol!==`file:`&&h(x.protocol)&&x.host?x.protocol+`//`+x.host:`null`,x.href=x.toString()}_.prototype={set:function(e,t,n){var a=this;switch(e){case`query`:typeof t==`string`&&t.length&&(t=(n||i.parse)(t)),a[e]=t;break;case`port`:a[e]=t,r(t,a.protocol)?t&&(a.host=a.hostname+`:`+t):(a.host=a.hostname,a[e]=``);break;case`hostname`:a[e]=t,a.port&&(t+=`:`+a.port),a.host=t;break;case`host`:a[e]=t,c.test(t)?(t=t.split(`:`),a.port=t.pop(),a.hostname=t.join(`:`)):(a.hostname=t,a.port=``);break;case`protocol`:a.protocol=t.toLowerCase(),a.slashes=!n;break;case`pathname`:case`hash`:if(t){var o=e===`pathname`?`/`:`#`;a[e]=t.charAt(0)===o?t:o+t}else a[e]=t;break;case`username`:case`password`:a[e]=encodeURIComponent(t);break;case`auth`:var s=t.indexOf(`:`);~s?(a.username=t.slice(0,s),a.username=encodeURIComponent(decodeURIComponent(a.username)),a.password=t.slice(s+1),a.password=encodeURIComponent(decodeURIComponent(a.password))):a.username=encodeURIComponent(decodeURIComponent(t))}for(var l=0;l<f.length;l++){var u=f[l];u[4]&&(a[u[1]]=a[u[1]].toLowerCase())}return a.auth=a.password?a.username+`:`+a.password:a.username,a.origin=a.protocol!==`file:`&&h(a.protocol)&&a.host?a.protocol+`//`+a.host:`null`,a.href=a.toString(),a},toString:function(e){e&&typeof e==`function`||(e=i.stringify);var t,n=this,r=n.host,a=n.protocol;a&&a.charAt(a.length-1)!==`:`&&(a+=`:`);var o=a+(n.protocol&&n.slashes||h(n.protocol)?`//`:``);return n.username?(o+=n.username,n.password&&(o+=`:`+n.password),o+=`@`):n.password?(o+=`:`+n.password,o+=`@`):n.protocol!==`file:`&&h(n.protocol)&&!r&&n.pathname!==`/`&&(o+=`@`),(r[r.length-1]===`:`||c.test(n.hostname)&&!n.port)&&(r+=`:`),o+=r+n.pathname,(t=typeof n.query==`object`?e(n.query):n.query)&&(o+=t.charAt(0)===`?`?t:`?`+t),n.hash&&(o+=n.hash),o}},_.extractProtocol=g,_.location=m,_.trimLeft=d,_.qs=i,e.exports=_},410(){},388(){},805(){},345(){},800(){}},he={};function A(e){var t=he[e];if(t!==void 0)return t.exports;var n=he[e]={id:e,loaded:!1,exports:{}};return me[e].call(n.exports,n,n.exports,A),n.loaded=!0,n.exports}A.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return A.d(t,{a:t}),t},A.d=(e,t)=>{for(var n in t)A.o(t,n)&&!A.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},A.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),A.nmd=e=>(e.paths=[],e.children||=[],e);var ge=A(737),_e=A.n(ge);function ve(e){if(!ye(e))throw Error(`Parameter was not an error`)}function ye(e){return!!e&&typeof e==`object`&&(t=e,Object.prototype.toString.call(t)===`[object Error]`)||e instanceof Error;var t}var j=class e extends Error{constructor(e,t){let{options:n,shortMessage:r}=function(e){let t,n=``;if(e.length===0)t={};else if(ye(e[0]))t={cause:e[0]},n=e.slice(1).join(` `)||``;else if(e[0]&&typeof e[0]==`object`)t=Object.assign({},e[0]),n=e.slice(1).join(` `)||``;else{if(typeof e[0]!=`string`)throw Error(`Invalid arguments passed to Layerr`);t={},n=n=e.join(` `)||``}return{options:t,shortMessage:n}}([...arguments]),i=r;if(n.cause&&(i=`${i}: ${n.cause.message}`),super(i),this.message=i,n.name&&typeof n.name==`string`?this.name=n.name:this.name=`Layerr`,n.cause&&Object.defineProperty(this,"_cause",{value:n.cause}),Object.defineProperty(this,"_info",{value:{}}),n.info&&typeof n.info==`object`&&Object.assign(this._info,n.info),Error.captureStackTrace){let e=n.constructorOpt||this.constructor;Error.captureStackTrace(this,e)}}static cause(e){return ve(e),e._cause&&ye(e._cause)?e._cause:null}static fullStack(t){ve(t);let n=e.cause(t);return n?`${t.stack}\ncaused by: ${e.fullStack(n)}`:t.stack??``}static info(t){ve(t);let n={},r=e.cause(t);return r&&Object.assign(n,e.info(r)),t._info&&Object.assign(n,t._info),n}toString(){let e=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(e=`${e}: ${this.message}`),e}},be=A(47),xe=A.n(be);const Se=`__PATH_SEPARATOR_POSIX__`,Ce=`__PATH_SEPARATOR_WINDOWS__`;function M(e){try{let t=e.replace(/\//g,Se).replace(/\\\\/g,Ce);return encodeURIComponent(t).split(Ce).join(`\\\\`).split(Se).join(`/`)}catch(e){throw new j(e,`Failed encoding path`)}}function we(e){return e.startsWith(`/`)?e:`/`+e}function Te(e){let t=e;return t[0]!==`/`&&(t=`/`+t),/^.+\/$/.test(t)&&(t=t.substr(0,t.length-1)),t}function Ee(e){let t=new(_e())(e).pathname;return t.length<=0&&(t=`/`),Te(t)}function N(...e){return function(){return function(e){var t=[];if(e.length===0)return``;if(typeof e[0]!=`string`)throw TypeError(`Url must be a string. Received `+e[0]);e[0].match(/^[^/:]+:\/*$/)&&e.length>1&&(e[0]=e.shift()+e[0]),e[0]=e[0].match(/^file:\/\/\//)?e[0].replace(/^([^/:]+):\/*/,`$1:///`):e[0].replace(/^([^/:]+):\/*/,`$1://`);for(var n=0;n<e.length;n++){var r=e[n];if(typeof r!=`string`)throw TypeError(`Url must be a string. Received `+r);r!==``&&(n>0&&(r=r.replace(/^[\/]+/,``)),r=n<e.length-1?r.replace(/[\/]+$/,``):r.replace(/[\/]+$/,`/`),t.push(r))}var i=t.join(`/`),a=(i=i.replace(/\/(\?|&|#[^!])/g,`$1`)).split(`?`);return a.shift()+(a.length>0?`?`:``)+a.join(`&`)}(typeof arguments[0]==`object`?arguments[0]:[].slice.call(arguments))}(e.reduce(((e,t,n)=>((n===0||t!==`/`||t===`/`&&e[e.length-1]!==`/`)&&e.push(t),e)),[]))}var De=A(542),Oe=A.n(De);function ke(e,t){let n=e.url.replace(`//`,``),r=n.indexOf(`/`)==-1?`/`:n.slice(n.indexOf(`/`)),i=e.method?e.method.toUpperCase():`GET`,a=!!/(^|,)\s*auth\s*($|,)/.test(t.qop)&&`auth`,o=`00000000${t.nc}`.slice(-8),s=function(e,t,n,r,i,a,o){let s=o||Oe()(`${t}:${n}:${r}`);return e&&e.toLowerCase()===`md5-sess`?Oe()(`${s}:${i}:${a}`):s}(t.algorithm,t.username,t.realm,t.password,t.nonce,t.cnonce,t.ha1),c=Oe()(`${i}:${r}`),l=a?Oe()(`${s}:${t.nonce}:${o}:${t.cnonce}:${a}:${c}`):Oe()(`${s}:${t.nonce}:${c}`),u={username:t.username,realm:t.realm,nonce:t.nonce,uri:r,qop:a,response:l,nc:o,cnonce:t.cnonce,algorithm:t.algorithm,opaque:t.opaque},d=[];for(let e in u)u[e]&&(e===`qop`||e===`nc`||e===`algorithm`?d.push(`${e}=${u[e]}`):d.push(`${e}="${u[e]}"`));return`Digest ${d.join(`, `)}`}function Ae(e){return(e.headers&&e.headers.get(`www-authenticate`)||``).split(/\s/)[0].toLowerCase()===`digest`}var je=A(101),Me=A.n(je);function Ne(e){return Me().decode(e)}function Pe(e,t){var n;return`Basic ${n=`${e}:${t}`,Me().encode(n)}`}let P=function(e){return e.Auto=`auto`,e.Digest=`digest`,e.None=`none`,e.Password=`password`,e.Token=`token`,e}({}),Fe=function(e){return e.DataTypeNoLength=`data-type-no-length`,e.InvalidAuthType=`invalid-auth-type`,e.InvalidOutputFormat=`invalid-output-format`,e.LinkUnsupportedAuthType=`link-unsupported-auth`,e.InvalidUpdateRange=`invalid-update-range`,e.NotSupported=`not-supported`,e}({});function Ie(e,t,n,r,i){switch(e.authType){case P.Auto:t&&n&&(e.headers.Authorization=Pe(t,n));break;case P.Digest:e.digest=function(e,t,n){return{username:e,password:t,ha1:n,nc:0,algorithm:`md5`,hasDigestAuth:!1}}(t,n,i);break;case P.None:break;case P.Password:e.headers.Authorization=Pe(t,n);break;case P.Token:e.headers.Authorization=`${(a=r).token_type} ${a.access_token}`;break;default:throw new j({info:{code:Fe.InvalidAuthType}},`Invalid auth type: ${e.authType}`)}var a}A(345),A(800);const Le=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope?self:typeof window<`u`?window:globalThis,Re=Le.fetch.bind(Le);Le.Headers,Le.Request,Le.Response;const ze=`@@HOTPATCHER`,Be=()=>{};function Ve(e){return{original:e,methods:[e],final:!1}}var He=class{constructor(){this._configuration={registry:{},getEmptyAction:`null`},this.__type__=ze}get configuration(){return this._configuration}get getEmptyAction(){return this.configuration.getEmptyAction}set getEmptyAction(e){this.configuration.getEmptyAction=e}control(e,t=!1){if(!e||e.__type__!==ze)throw Error(`Failed taking control of target HotPatcher instance: Invalid type or object`);return Object.keys(e.configuration.registry).forEach((n=>{this.configuration.registry.hasOwnProperty(n)?t&&(this.configuration.registry[n]=Object.assign({},e.configuration.registry[n])):this.configuration.registry[n]=Object.assign({},e.configuration.registry[n])})),e._configuration=this.configuration,this}execute(e,...t){return(this.get(e)||Be)(...t)}get(e){let t=this.configuration.registry[e];if(!t)switch(this.getEmptyAction){case`null`:return null;case`throw`:throw Error(`Failed handling method request: No method provided for override: ${e}`);default:throw Error(`Failed handling request which resulted in an empty method: Invalid empty-action specified: ${this.getEmptyAction}`)}return function(...e){if(e.length===0)throw Error(`Failed creating sequence: No functions provided`);return function(...t){let n=t,r=this;for(;e.length>0;)n=[e.shift().apply(r,n)];return n[0]}}(...t.methods)}isPatched(e){return!!this.configuration.registry[e]}patch(e,t,n={}){let{chain:r=!1}=n;if(this.configuration.registry[e]&&this.configuration.registry[e].final)throw Error(`Failed patching '${e}': Method marked as being final`);if(typeof t!=`function`)throw Error(`Failed patching '${e}': Provided method is not a function`);if(r)this.configuration.registry[e]?this.configuration.registry[e].methods.push(t):this.configuration.registry[e]=Ve(t);else if(this.isPatched(e)){let{original:n}=this.configuration.registry[e];this.configuration.registry[e]=Object.assign(Ve(t),{original:n})}else this.configuration.registry[e]=Ve(t);return this}patchInline(e,t,...n){return this.isPatched(e)||this.patch(e,t),this.execute(e,...n)}plugin(e,...t){return t.forEach((t=>{this.patch(e,t,{chain:!0})})),this}restore(e){if(!this.isPatched(e))throw Error(`Failed restoring method: No method present for key: ${e}`);if(typeof this.configuration.registry[e].original!=`function`)throw Error(`Failed restoring method: Original method not found or of invalid type for key: ${e}`);return this.configuration.registry[e].methods=[this.configuration.registry[e].original],this}setFinal(e){if(!this.configuration.registry.hasOwnProperty(e))throw Error(`Failed marking '${e}' as final: No method found for key`);return this.configuration.registry[e].final=!0,this}};let Ue=null;function We(){return Ue||=new He,Ue}function Ge(e){return function(e){if(typeof e!=`object`||!e||Object.prototype.toString.call(e)!=`[object Object]`)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e)?Object.assign({},e):Object.setPrototypeOf(Object.assign({},e),Object.getPrototypeOf(e))}function Ke(...e){let t=null,n=[...e];for(;n.length>0;){let e=n.shift();t=t?qe(t,e):Ge(e)}return t}function qe(e,t){let n=Ge(e);return Object.keys(t).forEach((e=>{n.hasOwnProperty(e)?Array.isArray(t[e])?n[e]=Array.isArray(n[e])?[...n[e],...t[e]]:[...t[e]]:typeof t[e]==`object`&&t[e]?n[e]=typeof n[e]==`object`&&n[e]?qe(n[e],t[e]):Ge(t[e]):n[e]=t[e]:n[e]=t[e]})),n}function Je(e){let t={};return e.forEach(((e,n)=>{t[n]=e})),t}function Ye(...e){if(e.length===0)return{};let t={};return e.reduce(((e,n)=>(Object.keys(n).forEach((r=>{let i=r.toLowerCase();t.hasOwnProperty(i)?e[t[i]]=n[r]:(t[i]=r,e[r]=n[r])})),e)),{})}A(805);const Xe=typeof ArrayBuffer==`function`,{toString:Ze}=Object.prototype;function Qe(e){return Xe&&(e instanceof ArrayBuffer||Ze.call(e)===`[object ArrayBuffer]`)}function $e(e){return e!=null&&e.constructor!=null&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e)}function et(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function tt(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const nt=et((function(e){let t=e._digest;return delete e._digest,t.hasDigestAuth&&(e=Ke(e,{headers:{Authorization:ke(e,t)}})),tt(it(e),(function(n){let r=!1;return i=function(e){return r?e:n},(a=function(){if(n.status==401)return t.hasDigestAuth=function(e,t){if(!Ae(e))return!1;let n=/([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi;for(;;){let r=e.headers&&e.headers.get(`www-authenticate`)||``,i=n.exec(r);if(!i)break;t[i[1]]=i[2]||i[3]}return t.nc+=1,t.cnonce=function(){let e=``;for(let t=0;t<32;++t)e=`${e}${`abcdef0123456789`[Math.floor(16*Math.random())]}`;return e}(),!0}(n,t),function(){if(t.hasDigestAuth)return tt(it(e=Ke(e,{headers:{Authorization:ke(e,t)}})),(function(e){return e.status==401?t.hasDigestAuth=!1:t.nc++,r=!0,e}))}();t.nc++}())&&a.then?a.then(i):i(a);var i,a}))})),rt=et((function(e,t){return tt(it(e),(function(n){return n.ok?(t.authType=P.Password,n):n.status==401&&Ae(n)?(t.authType=P.Digest,Ie(t,t.username,t.password,void 0,void 0),e._digest=t.digest,nt(e)):n}))})),F=et((function(e,t){return t.authType===P.Auto?rt(e,t):e._digest?nt(e):it(e)}));function I(e,t,n){let r=Ge(e);return r.headers=Ye(t.headers,r.headers||{},n.headers||{}),n.data!==void 0&&(r.data=n.data),n.signal&&(r.signal=n.signal),t.httpAgent&&(r.httpAgent=t.httpAgent),t.httpsAgent&&(r.httpsAgent=t.httpsAgent),t.digest&&(r._digest=t.digest),typeof t.withCredentials==`boolean`&&(r.withCredentials=t.withCredentials),r}function it(e){let t=We();return t.patchInline(`request`,(e=>t.patchInline(`fetch`,Re,e.url,function(e){let t={},n={method:e.method};if(e.headers&&(t=Ye(t,e.headers)),e.data!==void 0){let[r,i]=function(e){if(typeof e==`string`||$e(e)||Qe(e))return[e,{}];if(e&&typeof e==`object`)return[JSON.stringify(e),{"content-type":`application/json`}];throw Error(`Unable to convert request body: Unexpected body type: `+typeof e)}(e.data);n.body=r,t=Ye(t,i)}return e.signal&&(n.signal=e.signal),e.withCredentials&&(n.credentials=`include`),n.headers=t,n}(e))),e)}var at=A(285);const ot=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},st={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},ct=e=>e.replace(/[[\]\\-]/g,`\\$&`),lt=e=>e.join(``),ut=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;t:for(;a<e.length;){let t=e.charAt(a);if(t!==`!`&&t!==`^`||a!==n+1){if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t!==`\\`||c){if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(st))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue t}}c=!1,d?(t>d?r.push(ct(d)+`-`+ct(t)):t===d&&r.push(ct(t)),d=``,a++):e.startsWith(`-]`,a+1)?(r.push(ct(t+`-`)),a+=2):e.startsWith(`-`,a+1)?(d=t,a+=2):(r.push(ct(t)),a++)}else c=!0,a++}else l=!0,a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[(f=r[0].length===2?r[0].slice(-1):r[0],f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`)),!1,u-n,!1];var f;let p=`[`+(l?`^`:``)+lt(r)+`]`,m=`[`+(l?``:`^`)+lt(i)+`]`;return[r.length&&i.length?`(`+p+`|`+m+`)`:r.length?p:m,s,u-n,!0]},dt=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`);var L;const ft=/* @__PURE__ */ new Set([`!`,`?`,`+`,`*`,`@`]),pt=e=>ft.has(e),mt=e=>pt(e.type),ht=/* @__PURE__ */ new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),gt=/* @__PURE__ */ new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),_t=/* @__PURE__ */ new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),vt=/* @__PURE__ */ new Map([[`!`,/* @__PURE__ */ new Map([[`!`,`@`]])],[`?`,/* @__PURE__ */ new Map([[`*`,`*`],[`+`,`*`]])],[`@`,/* @__PURE__ */ new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,/* @__PURE__ */ new Map([[`?`,`*`],[`*`,`*`]])]]),yt=`(?!\\.)`,bt=/* @__PURE__ */ new Set([`[`,`.`]),xt=/* @__PURE__ */ new Set([`..`,`.`]),St=/* @__PURE__ */ new Set(`().*{}+?[]^$\\!`),Ct=`[^/]`,wt=Ct+`+?`;var Tt=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e!==`!`||this.#e.#s||this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.#l=this.type?this.type+`(`+this.#r.map((e=>String(e))).join(`|`)+`)`:this.#r.map((e=>String(e))).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;let e;for(this.toString(),this.#s=!0;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof L&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map((e=>typeof e==`string`?e:e.toJSON())):[this.type,...this.#r.map((e=>e.toJSON()))];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof L&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new L(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`)o=!o,d+=n;else if(s)u===c+1?n!==`^`&&n!==`!`||(l=!0):n!==`]`||u===c+2&&l||(s=!1),d+=n;else if(n!==`[`){if(!r.noext&&pt(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new L(n,t);u=L.#f(e,a,u,r,i+1),t.push(a)}else d+=n}else s=!0,c=u,l=!1,d+=n}return t.push(d),u}let u=n+1,d=new L(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`)o=!o,p+=n;else if(s)u===c+1?n!==`^`&&n!==`!`||(l=!0):n!==`]`||u===c+2&&l||(s=!1),p+=n;else if(n!==`[`){if(pt(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new L(n,d);d.push(o),u=L.#f(e,o,u,r,i+a)}else if(n!==`|`){if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}else d.push(p),p=``,f.push(d),d=new L(null,t)}else s=!0,c=u,l=!1,p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,gt)}#m(e,t=ht){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!(!n||typeof n!=`object`||n.type===null)&&this.#h(n.type,t)}#h(e,t=_t){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new L(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!vt.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!(!t||typeof t!=`object`||t.type===null)&&this.#v(t.type)}#b(e){let t=vt.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}#x(){if(mt(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}static fromGlob(e,t={}){let n=new L(null,void 0,t);return L.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!mt(this)){let n=this.isStart()&&this.isEnd(),r=this.#r.map((t=>{let[r,i,a,o]=typeof t==`string`?L.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r})).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&(this.#r.length!==1||!xt.has(this.#r[0]))){let n=bt,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?`(?!(?:^|/)\\.\\.?(?:$|/))`:o?yt:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,dt(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,dt(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;return o=this.type===`!`&&this.#u?(this.isStart()&&!t?yt:``)+wt:r+i+(this.type===`!`?`))`+(!this.isStart()||t||e?``:yt)+`[^/]*?)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`),[o,dt(i),this.#t=!!this.#t,this.#n]}#S(e){return this.#r.map((t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n})).filter((e=>!(this.isStart()&&this.isEnd()&&!e))).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r)r=!1,i+=(St.has(c)?`\\`:``)+c,o=!1;else if(c!==`\\`){if(c===`[`){let[n,r,c,l]=ut(e,s);if(c){i+=n,a||=r,s+=c-1,t||=l,o=!1;continue}}if(c!==`*`)o=!1,c===`?`?(i+=Ct,t=!0):i+=c.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);else{if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?wt:`[^/]*?`,t=!0}}else s===e.length-1?i+=`\\\\`:r=!0}return[i,dt(e),!!t,a]}};L=Tt;const R=(e,t,n={})=>(ot(t),!(!n.nocomment&&t.charAt(0)===`#`)&&new Yt(t,n).match(e)),Et=/^\*+([^+@!?\*\[\(]*)$/,Dt=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Ot=e=>t=>t.endsWith(e),kt=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),At=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),jt=/^\*+\.\*+$/,Mt=e=>!e.startsWith(`.`)&&e.includes(`.`),Nt=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Pt=/^\.\*+$/,Ft=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),It=/^\*+$/,Lt=e=>e.length!==0&&!e.startsWith(`.`),Rt=e=>e.length!==0&&e!==`.`&&e!==`..`,zt=/^\?+([^+@!?\*\[\(]*)?$/,Bt=([e,t=``])=>{let n=Wt([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Vt=([e,t=``])=>{let n=Gt([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Ht=([e,t=``])=>{let n=Gt([e]);return t?e=>n(e)&&e.endsWith(t):n},Ut=([e,t=``])=>{let n=Wt([e]);return t?e=>n(e)&&e.endsWith(t):n},Wt=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},Gt=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},Kt=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`;R.sep=Kt===`win32`?`\\`:`/`;const z=Symbol(`globstar **`);R.GLOBSTAR=z,R.filter=(e,t={})=>n=>R(n,e,t);const B=(e,t={})=>Object.assign({},e,t);R.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return R;let t=R;return Object.assign(((n,r,i={})=>t(n,r,B(e,i))),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,B(e,n))}static defaults(n){return t.defaults(B(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,B(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,B(e,r))}},unescape:(n,r={})=>t.unescape(n,B(e,r)),escape:(n,r={})=>t.escape(n,B(e,r)),filter:(n,r={})=>t.filter(n,B(e,r)),defaults:n=>t.defaults(B(e,n)),makeRe:(n,r={})=>t.makeRe(n,B(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,B(e,r)),match:(n,r,i={})=>t.match(n,r,B(e,i)),sep:t.sep,GLOBSTAR:z})};const qt=(e,t={})=>(ot(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:at(e));R.braceExpand=qt,R.makeRe=(e,t={})=>new Yt(e,t).makeRe(),R.match=(e,t,n={})=>{let r=new Yt(t,n);return e=e.filter((e=>r.match(e))),r.options.nonull&&!e.length&&e.push(t),e};const Jt=/[?*]|[+@!]\(.*?\)|\[|\]/;var Yt=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){ot(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||Kt,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||!1===t.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!(!this.isWindows||!this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`)return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map((e=>this.slashSplit(e)));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map(((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=!(e[0]!==``||e[1]!==``||e[2]!==`?`&&Jt.test(e[2])||Jt.test(e[3])),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map((e=>this.parse(e)))];if(n)return[e[0],...e.slice(1).map((e=>this.parse(e)))]}return e.map((e=>this.parse(e)))}));if(this.debug(this.pattern,r),this.set=r.filter((e=>e.indexOf(!1)===-1)),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]===`**`&&(e[t][n]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map((e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e}))}levelOneOptimize(e){return e.map((e=>(e=e.reduce(((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)}),[])).length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||r!==`.`&&r!==``||(t=!0,e.splice(n,1),n--)}e[0]!==`.`||e.length!==2||e[1]!==`.`&&e[1]!==``||(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||r!==`.`&&r!==``||(t=!0,n.splice(e,1),e--)}n[0]!==`.`||n.length!==2||n[1]!==`.`&&n[1]!==``||(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter((e=>e.length))}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]!==`*`||!t[i]||!this.options.dot&&t[i].startsWith(`.`)||t[i]===`**`){if(t[i]!==`*`||!e[r]||!this.options.dot&&e[r].startsWith(`.`)||e[r]===`**`||o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else{if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=a?3:n?0:void 0,c=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])?3:o?0:void 0;if(typeof s==`number`&&typeof c==`number`){let[n,a]=[e[s],t[c]];n.toLowerCase()===a.toLowerCase()&&(t[c]=n,i=c,r=s)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(z)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(z,i),o=t.lastIndexOf(z),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===z?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(!1!==s)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n,r=t[o],i=e[a];if(this.debug(t,r,i),!1===r||r===z||(typeof r==`string`?(n=i===r,this.debug(`string match`,r,i,n)):(n=r.test(i),this.debug(`pattern match`,r,i,n)),!n))return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return qt(this.pattern,this.options)}parse(e){ot(e);let t=this.options;if(e===`**`)return z;if(e===``)return``;let n,r=null;(n=e.match(It))?r=t.dot?Rt:Lt:(n=e.match(Et))?r=(t.nocase?t.dot?At:kt:t.dot?Ot:Dt)(n[1]):(n=e.match(zt))?r=(t.nocase?t.dot?Vt:Bt:t.dot?Ht:Ut)(n):(n=e.match(jt))?r=t.dot?Nt:Mt:(n=e.match(Pt))&&(r=Ft);let i=Tt.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?`[^/]*?`:t.dot?`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`:`(?:(?!(?:\\/|^)\\.).)*?`,r=new Set(t.nocase?[`i`]:[]),i=e.map((e=>{let t=e.map((e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`):e===z?z:e._src}));return t.forEach(((e,r)=>{let i=t[r+1],a=t[r-1];e===z&&a!==z&&(a===void 0?i!==void 0&&i!==z?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|`+n+`)?`:i!==z&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=z))})),t.filter((e=>e!==z)).join(`/`)})).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e<i.length;e++){let o=i[e],s=r;if(n.matchBase&&o.length===1&&(s=[a]),this.matchOne(s,o,t))return!!n.flipNegate||!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return R.defaults(e).Minimatch}};function Xt(e,t=``){let n=/* @__PURE__ */ Error(`${t}Invalid response: ${e.status} ${e.statusText}`);return n.status=e.status,n.response=e,n}function V(e,t){let{status:n}=t;if(n===401&&e.digest)return t;if(n>=400)throw Xt(t);return t}function Zt(e,t,n=!1){return n?{data:t,headers:e.headers?Je(e.headers):{},status:e.status,statusText:e.statusText}:t}R.AST=Tt,R.Minimatch=Yt,R.escape=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),R.unescape=dt;const Qt=($t=function(e,t,n,r={}){let i=I({url:N(e.remoteURL,M(t)),method:`COPY`,headers:{Destination:N(e.remoteURL,M(n)),Overwrite:!1===r.overwrite?`F`:`T`,Depth:r.shallow?`0`:`infinity`}},e,r);return o=function(t){V(e,t)},(a=F(i,e))&&a.then||(a=Promise.resolve(a)),o?a.then(o):a;var a,o},function(){var e=[...arguments];try{return Promise.resolve($t.apply(this,e))}catch(e){return Promise.reject(e)}});var $t;const en=`:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD`,tn=RegExp(`^[`+en+`][`+en+`\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),nn=function(e){return tn.exec(e)!=null},rn=[`hasOwnProperty`,`toString`,`valueOf`,`__defineGetter__`,`__defineSetter__`,`__lookupGetter__`,`__lookupSetter__`],an=[`__proto__`,`constructor`,`prototype`],on=e=>rn.includes(e)?`__`+e:e,sn={preserveOrder:!1,attributeNamePrefix:`@_`,attributesGroupName:!1,textNodeName:`#text`,ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0,unicode:!1},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:on};function cn(e,t){if(typeof e!=`string`)return;let n=e.toLowerCase();if(rn.some((e=>n===e.toLowerCase()))||an.some((e=>n===e.toLowerCase())))throw Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}function ln(e,t){return typeof e==`boolean`?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:`all`}:typeof e==`object`&&e?{enabled:!1!==e.enabled,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??1e3),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null,appliesTo:e.appliesTo??`all`}:ln(!0)}const un=function(e){let t=Object.assign({},sn,e),n=[{value:t.attributeNamePrefix,name:`attributeNamePrefix`},{value:t.attributesGroupName,name:`attributesGroupName`},{value:t.textNodeName,name:`textNodeName`},{value:t.cdataPropName,name:`cdataPropName`},{value:t.commentPropName,name:`commentPropName`}];for(let{value:e,name:t}of n)e&&cn(e,t);return t.onDangerousProperty===null&&(t.onDangerousProperty=on),t.processEntities=ln(t.processEntities,t.htmlEntities),t.unpairedTagsSet=new Set(t.unpairedTags),t.stopNodes&&Array.isArray(t.stopNodes)&&(t.stopNodes=t.stopNodes.map((e=>typeof e==`string`&&e.startsWith(`*.`)?`..`+e.substring(2):e))),t};let dn;dn=typeof Symbol==`function`?Symbol(`XML Node Metadata`):`@@xmlMetadata`;var fn=class{constructor(e){this.tagname=e,this.child=[],this[`:@`]=Object.create(null)}add(e,t){e===`__proto__`&&(e=`#__proto__`),this.child.push({[e]:t})}addChild(e,t){e.tagname===`__proto__`&&(e.tagname=`#__proto__`),e[`:@`]&&Object.keys(e[`:@`]).length>0?this.child.push({[e.tagname]:e.child,":@":e[`:@`]}):this.child.push({[e.tagname]:e.child}),this.addStartIndex(t)}addStartIndex(e){e!==void 0&&(this.child[this.child.length-1][dn]={startIndex:e})}addEndIndex(e){let t=this.child[this.child.length-1];t!==void 0&&t[dn]!==void 0&&t[dn].endIndex===void 0&&(t[dn].endIndex=e)}static getMetaDataSymbol(){return dn}};const pn=`:A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�`,mn=(e,t,n=``)=>{let r=`[${e.replace(`:`,``)}][${t.replace(`:`,``)}]*`;return{name:RegExp(`^[${e}][${t}]*$`,n),ncName:RegExp(`^${r}$`,n),qName:RegExp(`^${r}(?::${r})?$`,n),nmToken:RegExp(`^[${t}]+$`,n),nmTokens:RegExp(`^[${t}]+(?:\\s+[${t}]+)*$`,n)}},hn=mn(pn,pn+`\\-\\.\\d·̀-ͯ‿-⁀`),gn=mn(`:A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,`:A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-\\-\\.\\d·̀-ͯ҇‿-⁀`,`u`),_n=`:A-Za-z_`,vn=mn(_n,_n+`\\-\\.\\d`),yn=(e=`1.0`,t=!1)=>t?vn:e===`1.1`?gn:hn,bn=(e,{xmlVersion:t=`1.0`,asciiOnly:n=!1}={})=>yn(t,n).qName.test(e),xn=[`name`,`ncName`,`qName`,`nmToken`,`nmTokens`],Sn=(e,{xmlVersion:t=`1.0`,asciiOnly:n=!1,maxCacheSize:r=2048}={})=>{if(!xn.includes(e))throw TypeError(`Unknown production "${e}". Must be one of: ${xn.join(`, `)}`);let i=yn(t,n)[e],a=/* @__PURE__ */ new Map,o=e=>{let t=a.get(e);if(t!==void 0)return t;let n=i.test(e);return a.size<r&&a.set(e,n),n};return o.reset=()=>{a=/* @__PURE__ */ new Map},o};var Cn=class{constructor(e,t){this.suppressValidationErr=!e,this.options=e,this.xmlVersion=t||1}setXmlVersion(e=1){this.xmlVersion=e}readDocType(e,t){let n=Object.create(null),r=0;if(e[t+3]!==`O`||e[t+4]!==`C`||e[t+5]!==`T`||e[t+6]!==`Y`||e[t+7]!==`P`||e[t+8]!==`E`)throw Error(`Invalid Tag instead of DOCTYPE`);{t+=9;let i=1,a=!1,o=!1,s=null,c=``;for(;t<e.length;t++)if(s===null){if(a||o||e[t]!==`"`&&e[t]!==`'`){if(e[t]!==`<`||o){if(e[t]===`>`){if(o?e[t-1]===`-`&&e[t-2]===`-`&&(o=!1,i--):i--,i===0)break}else e[t]===`[`?a=!0:c+=e[t]}else{if(a&&wn(e,`!ENTITY`,t)){let i,a;if(t+=7,[i,a,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),a.indexOf(`&`)===-1){if(!1!==this.options.enabled&&this.options.maxEntityCount!=null&&r>=this.options.maxEntityCount)throw Error(`Entity count (${r+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);n[i]=a,r++}}else if(a&&wn(e,`!ELEMENT`,t)){t+=8;let{index:n}=this.readElementExp(e,t+1);t=n}else if(a&&wn(e,`!ATTLIST`,t))t+=8;else if(a&&wn(e,`!NOTATION`,t)){t+=9;let{index:n}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=n}else{if(!wn(e,`!--`,t))throw Error(`Invalid DOCTYPE`);o=!0}i++,c=``}}else s=e[t],c+=e[t]}else e[t]===s&&(s=null),c+=e[t];if(s!==null||i!==0)throw Error(`Unclosed DOCTYPE`)}return{entities:n,i:t}}readEntityExp(e,t){let n=t=H(e,t);for(;t<e.length&&!/\s/.test(e[t])&&e[t]!==`"`&&e[t]!==`'`;)t++;let r=e.substring(n,t);if(Tn(r,{xmlVersion:this.xmlVersion}),t=H(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()===`SYSTEM`)throw Error(`External entities are not supported`);if(e[t]===`%`)throw Error(`Parameter entities are not supported`)}let i=``;if([t,i]=this.readIdentifierVal(e,t,`entity`),!1!==this.options.enabled&&this.options.maxEntitySize!=null&&i.length>this.options.maxEntitySize)throw Error(`Entity "${r}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[r,i,--t]}readNotationExp(e,t){let n=t=H(e,t);for(;t<e.length&&!/\s/.test(e[t]);)t++;let r=e.substring(n,t);!this.suppressValidationErr&&Tn(r,{xmlVersion:this.xmlVersion}),t=H(e,t);let i=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&i!==`SYSTEM`&&i!==`PUBLIC`)throw Error(`Expected SYSTEM or PUBLIC, found "${i}"`);t+=i.length,t=H(e,t);let a=null,o=null;if(i===`PUBLIC`)[t,a]=this.readIdentifierVal(e,t,`publicIdentifier`),e[t=H(e,t)]!==`"`&&e[t]!==`'`||([t,o]=this.readIdentifierVal(e,t,`systemIdentifier`));else if(i===`SYSTEM`&&([t,o]=this.readIdentifierVal(e,t,`systemIdentifier`),!this.suppressValidationErr&&!o))throw Error(`Missing mandatory system identifier for SYSTEM notation`);return{notationName:r,publicIdentifier:a,systemIdentifier:o,index:--t}}readIdentifierVal(e,t,n){let r=``,i=e[t];if(i!==`"`&&i!==`'`)throw Error(`Expected quoted string, found "${i}"`);let a=++t;for(;t<e.length&&e[t]!==i;)t++;if(r=e.substring(a,t),e[t]!==i)throw Error(`Unterminated ${n} value`);return[++t,r]}readElementExp(e,t){let n=t=H(e,t);for(;t<e.length&&!/\s/.test(e[t]);)t++;let r=e.substring(n,t);if(!this.suppressValidationErr&&!bn(r,{xmlVersion:this.xmlVersion}))throw Error(`Invalid element name: "${r}"`);let i=``;if(e[t=H(e,t)]===`E`&&wn(e,`MPTY`,t))t+=4;else if(e[t]===`A`&&wn(e,`NY`,t))t+=2;else if(e[t]===`(`){let n=++t;for(;t<e.length&&e[t]!==`)`;)t++;if(i=e.substring(n,t),e[t]!==`)`)throw Error(`Unterminated content model`)}else if(!this.suppressValidationErr)throw Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:r,contentModel:i.trim(),index:t}}readAttlistExp(e,t){let n=t=H(e,t);for(;t<e.length&&!/\s/.test(e[t]);)t++;let r=e.substring(n,t);for(Tn(r,{xmlVersion:this.xmlVersion}),n=t=H(e,t);t<e.length&&!/\s/.test(e[t]);)t++;let i=e.substring(n,t);if(!Tn(i,{xmlVersion:this.xmlVersion}))throw Error(`Invalid attribute name: "${i}"`);t=H(e,t);let a=``;if(e.substring(t,t+8).toUpperCase()===`NOTATION`){if(a=`NOTATION`,e[t=H(e,t+=8)]!==`(`)throw Error(`Expected '(', found "${e[t]}"`);t++;let n=[];for(;t<e.length&&e[t]!==`)`;){let r=t;for(;t<e.length&&e[t]!==`|`&&e[t]!==`)`;)t++;let i=e.substring(r,t);if(i=i.trim(),!Tn(i,{xmlVersion:this.xmlVersion}))throw Error(`Invalid notation name: "${i}"`);n.push(i),e[t]===`|`&&(t++,t=H(e,t))}if(e[t]!==`)`)throw Error(`Unterminated list of notations`);t++,a+=` (`+n.join(`|`)+`)`}else{let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;if(a+=e.substring(n,t),!this.suppressValidationErr&&![`CDATA`,`ID`,`IDREF`,`IDREFS`,`ENTITY`,`ENTITIES`,`NMTOKEN`,`NMTOKENS`].includes(a.toUpperCase()))throw Error(`Invalid attribute type: "${a}"`)}t=H(e,t);let o=``;return e.substring(t,t+8).toUpperCase()===`#REQUIRED`?(o=`#REQUIRED`,t+=8):e.substring(t,t+7).toUpperCase()===`#IMPLIED`?(o=`#IMPLIED`,t+=7):[t,o]=this.readIdentifierVal(e,t,`ATTLIST`),{elementName:r,attributeName:i,attributeType:a,defaultValue:o,index:t}}};const H=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function wn(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function Tn(e,t){if(bn(e,{xmlVersion:t}))return e;throw Error(`Invalid entity name ${e}`)}const En=[48,1632,1776,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,65296,120782,120792,120802,120812,120822,66720,68912,69734,69872,69942,70096,70384,70736,70864,71248,71360,71472,71904,72016,72688,72784,73040,73120,73552,92768,92864,93008,123200,123632,124144,125264,130032],Dn=/* @__PURE__ */ new Map,On=1632,kn=(/* @__PURE__ */ new Uint8Array(63904)).fill(255);for(let e of En)for(let t=0;t<10;t++){let n=e+t;n<=65535?kn[n-On]=t:Dn.set(n,t)}const An=/* @__PURE__ */ new Set([8722,65293,65123]),jn=/^[-+]?0x[a-fA-F0-9]+$/,Mn=/^0b[01]+$/,Nn=/^0o[0-7]+$/,Pn=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Fn={hex:!0,binary:!1,octal:!1,leadingZeros:!0,decimalPoint:`.`,eNotation:!0,infinity:`original`,unicode:!1};function In(e,t={}){if(t=Object.assign({},Fn,t),!e||typeof e!=`string`)return e;let n=e.trim();if(n.length===0||t.skipLike!==void 0&&t.skipLike.test(n))return e;if(n===`0`||t.unicode&&(n=function(e){if(typeof e!=`string`)return e;let t=e.length;if(t===0)return e;let n=-1;for(let r=0;r<t;r++){let i=e.charCodeAt(r);if(!(i>=48&&i<=57||i===45)){if(i<On){if(An.has(i)){n=r;break}}else if(i>=55296&&i<=56319){if(r+1<t){let t=e.charCodeAt(r+1);if(t>=56320&&t<=57343){let e=65536+(i-55296<<10)+(t-56320);if(Dn.has(e)){n=r;break}}}}else if(kn[i-On]!==255||An.has(i)){n=r;break}}}if(n===-1)return e;let r=[];n>0&&r.push(e.slice(0,n));for(let i=n;i<t;i++){let n=e.charCodeAt(i);if(n>=48&&n<=57||n===45){r.push(e[i]);continue}if(n<On){r.push(An.has(n)?`-`:e[i]);continue}if(n>=55296&&n<=56319){if(i+1<t){let t=e.charCodeAt(i+1);if(t>=56320&&t<=57343){let e=65536+(n-55296<<10)+(t-56320),a=Dn.get(e);if(a!==void 0){r.push(String.fromCharCode(a+48)),i++;continue}}}r.push(e[i]);continue}if(An.has(n)){r.push(`-`);continue}let a=kn[n-On];r.push(a===255?e[i]:String.fromCharCode(a+48))}return r.join(``)}(n),n===`0`))return 0;if(t.hex&&jn.test(n))return Rn(n,16);if(t.binary&&Mn.test(n))return Rn(n,2);if(t.octal&&Nn.test(n))return Rn(n,8);if(isFinite(n)){if(n.includes(`e`)||n.includes(`E`))return function(e,t,n){if(!n.eNotation)return e;let r=t.match(Ln);if(r){let i=r[1]||``,a=r[3].indexOf(`e`)===-1?`E`:`e`,o=r[2],s=i?e[o.length+1]===a:e[o.length]===a;return o.length>1&&s?e:(o.length!==1||!r[3].startsWith(`.${a}`)&&r[3][0]!==a)&&o.length>0?n.leadingZeros&&!s?(t=(r[1]||``)+r[3],Number(t)):e:Number(t)}return e}(e,n,t);{let r=Pn.exec(n);if(r){let i=r[1]||``,a=r[2],o=function(e){if(e&&e.indexOf(`.`)!==-1){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return(e=e.slice(0,t))===`.`?e=`0`:e[0]===`.`?e=`0`+e:e[e.length-1]===`.`&&(e=e.substring(0,e.length-1)),e}return e}(r[3]),s=i?e[a.length+1]===`.`:e[a.length]===`.`;if(!t.leadingZeros&&(a.length>1||a.length===1&&!s))return e;{let r=Number(n),s=String(r);if(r===0)return r;if(s.search(/[eE]/)!==-1)return t.eNotation?r:e;if(n.indexOf(`.`)!==-1)return s===`0`||s===o||s===`${i}${o}`?r:e;let c=a?o:n;return a?c===s||i+c===s?r:e:c===s||c===i+s?r:e}}return e}}return function(e,t,n){let r=t===1/0;switch(n.infinity.toLowerCase()){case`null`:return null;case`infinity`:return t;case`string`:return r?`Infinity`:`-Infinity`;default:return e}}(e,Number(n),t)}const Ln=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Rn(e,t){let n=e.trim();if(t!==2&&t!==8||(e=n.substring(2)),parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw Error(`parseInt, Number.parseInt, window.parseInt are not supported`)}var zn=class{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){let e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){let e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){let t=this._matcher.path;if(t.length!==0)return t[t.length-1].values?.[e]}hasAttr(e){let t=this._matcher.path;if(t.length===0)return!1;let n=t[t.length-1];return n.values!==void 0&&e in n.values}getAnyParentAttr(e){return this._matcher.getAnyParentAttr(e)}hasAnyParentAttr(e){return this._matcher.hasAnyParentAttr(e)}getPosition(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,t=!0){return this._matcher.toString(e,t)}toArray(){return this._matcher.path.map((e=>e.tag))}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}},Bn=class{constructor(e={}){this.separator=e.separator||`.`,this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new zn(this),this._keptAttrs=[]}push(e,t=null,n=null,r=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let i=this.path.length,a=this.siblingStacks[i];a||(a={counts:/* @__PURE__ */ new Map,total:0},this.siblingStacks[i]=a);let o=n?`${n}:${e}`:e,s=a.counts.get(o)||0,c=a.total;a.counts.set(o,s+1),a.total++;let l={tag:e,position:c,counter:s};n!=null&&(l.namespace=n),t!=null&&(l.values=t),this.path.push(l);let u=this.path.length,d=r===null?null:r.keep;if(d!=null&&d.length>0&&t)for(let e=0;e<d.length;e++){let n=d[e];t[n]!==void 0&&this._keptAttrs.push({depth:u,name:n,value:t[n]})}}pop(){if(this.path.length===0)return;this._pathStringCache=null;let e=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);let t=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=t;)this._keptAttrs.pop();return e}updateCurrent(e){if(this.path.length>0){let t=this.path[this.path.length-1];e!=null&&(t.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;let t=this.path[this.path.length-1];return t.values!==void 0&&e in t.values}getAnyParentAttr(e){let t=this._keptAttrs;for(let n=t.length-1;n>=0;n--)if(t[n].name===e)return t[n].value}hasAnyParentAttr(e){let t=this._keptAttrs;for(let n=t.length-1;n>=0;n--)if(t[n].name===e)return!0;return!1}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,t=!0){let n=e||this.separator;if(n===this.separator&&!0===t){if(this._pathStringCache!==null)return this._pathStringCache;let e=this.path.map((e=>e.namespace?`${e.namespace}:${e.tag}`:e.tag)).join(n);return this._pathStringCache=e,e}return this.path.map((e=>t&&e.namespace?`${e.namespace}:${e.tag}`:e.tag)).join(n)}toArray(){return this.path.map((e=>e.tag))}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(e){let t=e.segments;return t.length!==0&&(e.hasDeepWildcard()?this._matchWithDeepWildcard(t):this._matchSimple(t))}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let t=0;t<e.length;t++)if(!this._matchSegment(e[t],this.path[t],t===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let t=this.path.length-1,n=e.length-1;for(;n>=0&&t>=0;){let r=e[n];if(r.type===`deep-wildcard`){if(n--,n<0)return!0;let r=e[n],i=!1;for(let e=t;e>=0;e--)if(this._matchSegment(r,this.path[e],e===this.path.length-1)){t=e-1,n--,i=!0;break}if(!i)return!1}else{if(!this._matchSegment(r,this.path[t],t===this.path.length-1))return!1;t--,n--}}return n<0}_matchSegment(e,t,n){if(e.tag!==`*`&&e.tag!==t.tag||e.namespace!==void 0&&e.namespace!==`*`&&e.namespace!==t.namespace||e.attrName!==void 0&&(!n||!t.values||!(e.attrName in t.values)||e.attrValue!==void 0&&String(t.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!n)return!1;let r=t.counter??0;if(e.position===`first`&&r!==0||e.position===`odd`&&r%2!=1||e.position===`even`&&r%2!=0||e.position===`nth`&&r!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map((e=>({...e}))),siblingStacks:this.siblingStacks.map((e=>e&&{counts:new Map(e.counts),total:e.total})),keptAttrs:this._keptAttrs.map((e=>({...e})))}}restore(e){this._pathStringCache=null,this.path=e.path.map((e=>({...e}))),this.siblingStacks=e.siblingStacks.map((e=>e&&{counts:new Map(e.counts),total:e.total})),this._keptAttrs=(e.keptAttrs||[]).map((e=>({...e})))}readOnly(){return this._view}},Vn=class{constructor(e,t={},n){this.pattern=e,this.separator=t.separator||`.`,this.segments=this._parse(e),this.data=n,this._hasDeepWildcard=this.segments.some((e=>e.type===`deep-wildcard`)),this._hasAttributeCondition=this.segments.some((e=>e.attrName!==void 0)),this._hasPositionSelector=this.segments.some((e=>e.position!==void 0))}_parse(e){let t=[],n=0,r=``;for(;n<e.length;)e[n]===this.separator?n+1<e.length&&e[n+1]===this.separator?(r.trim()&&(t.push(this._parseSegment(r.trim())),r=``),t.push({type:`deep-wildcard`}),n+=2):(r.trim()&&t.push(this._parseSegment(r.trim())),r=``,n++):(r+=e[n],n++);return r.trim()&&t.push(this._parseSegment(r.trim())),t}_parseSegment(e){let t={type:`tag`},n=null,r=e,i=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(i&&(r=i[1]+i[3],i[2])){let e=i[2].slice(1,-1);e&&(n=e)}let a,o,s=r;if(r.includes(`::`)){let t=r.indexOf(`::`);if(a=r.substring(0,t).trim(),s=r.substring(t+2).trim(),!a)throw Error(`Invalid namespace in pattern: ${e}`)}let c=null;if(s.includes(`:`)){let e=s.lastIndexOf(`:`),t=s.substring(0,e).trim(),n=s.substring(e+1).trim();[`first`,`last`,`odd`,`even`].includes(n)||/^nth\(\d+\)$/.test(n)?(o=t,c=n):o=s}else o=s;if(!o)throw Error(`Invalid segment pattern: ${e}`);if(t.tag=o,a&&(t.namespace=a),n){if(n.includes(`=`)){let e=n.indexOf(`=`);t.attrName=n.substring(0,e).trim(),t.attrValue=n.substring(e+1).trim()}else t.attrName=n.trim()}if(c){let e=c.match(/^nth\((\d+)\)$/);e?(t.position=`nth`,t.positionValue=parseInt(e[1],10)):t.position=c}return t}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}},Hn=class{constructor(){this._byDepthAndTag=/* @__PURE__ */ new Map,this._wildcardByDepth=/* @__PURE__ */ new Map,this._deepWildcards=[],this._deepByTerminalTag=/* @__PURE__ */ new Map,this._patterns=/* @__PURE__ */ new Set,this._sealed=!1}add(e){if(this._sealed)throw TypeError(`ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.`);if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard()){let t=e.segments[e.segments.length-1];if(t&&t.type!==`deep-wildcard`&&t.tag!==`*`){let n=t.tag;this._deepByTerminalTag.has(n)||this._deepByTerminalTag.set(n,[]),this._deepByTerminalTag.get(n).push(e)}else this._deepWildcards.push(e);return this}let t=e.length,n=e.segments[e.segments.length-1]?.tag;if(n&&n!==`*`){let r=`${t}:${n}`;this._byDepthAndTag.has(r)||this._byDepthAndTag.set(r,[]),this._byDepthAndTag.get(r).push(e)}else this._wildcardByDepth.has(t)||this._wildcardByDepth.set(t,[]),this._wildcardByDepth.get(t).push(e);return this}addAll(e){for(let t of e)this.add(t);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){let t=e.getDepth(),n=e.getCurrentTag(),r=`${t}:${n}`,i=this._byDepthAndTag.get(r);if(i){for(let t=0;t<i.length;t++)if(e.matches(i[t]))return i[t]}let a=this._wildcardByDepth.get(t);if(a){for(let t=0;t<a.length;t++)if(e.matches(a[t]))return a[t]}let o=this._deepByTerminalTag.get(n);if(o){for(let t=0;t<o.length;t++)if(e.matches(o[t]))return o[t]}for(let t=0;t<this._deepWildcards.length;t++)if(e.matches(this._deepWildcards[t]))return this._deepWildcards[t];return null}};const Un={cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,euro:`€`,dollar:`$`,fnof:`ƒ`,inr:`₹`,af:`؋`,birr:`ብር`,peso:`₱`,rub:`₽`,won:`₩`,yuan:`¥`,cedil:`¸`},Wn={amp:`&`,apos:`'`,gt:`>`,lt:`<`,quot:`"`},Gn={nbsp:`\xA0`,copy:`©`,reg:`®`,trade:`™`,mdash:`—`,ndash:`–`,hellip:`…`,laquo:`«`,raquo:`»`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,bull:`•`,para:`¶`,sect:`§`,deg:`°`,frac12:`½`,frac14:`¼`,frac34:`¾`},Kn=Object.freeze({ALLOW:`allow`,BLOCK:`block`,THROW:`throw`}),qn=/* @__PURE__ */ new Set(`!?\\\\/[]$%{}^&*()<>|+`);function Jn(e){if(e[0]===`#`)throw Error(`[EntityReplacer] Invalid character '#' in entity name: "${e}"`);for(let t of e)if(qn.has(t))throw Error(`[EntityReplacer] Invalid character '${t}' in entity name: "${e}"`);return e}function Yn(...e){let t=Object.create(null);for(let n of e)if(n)for(let e of Object.keys(n)){let r=n[e];if(typeof r==`string`)t[e]=r;else if(r&&typeof r==`object`&&r.val!==void 0){let n=r.val;typeof n==`string`&&(t[e]=n)}}return t}const Xn=`external`,Zn=`base`,U=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Qn=/* @__PURE__ */ new Set([9,10,13]);var $n=class{constructor(e={}){var t;this._limit=e.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof e.postCheck==`function`?e.postCheck:e=>e,this._limitTiers=(t=this._limit.applyLimitsTo??Xn)&&t!==Xn?t===`all`?/* @__PURE__ */ new Set([`all`]):t===Zn?/* @__PURE__ */ new Set([Zn]):Array.isArray(t)?new Set(t):/* @__PURE__ */ new Set([Xn]):/* @__PURE__ */ new Set([Xn]),this._numericAllowed=e.numericAllowed??!0,this._baseMap=Yn(Wn,e.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]),this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);let n=function(e){if(!e)return{xmlVersion:1,onLevel:U.allow,nullLevel:U.remove};let t=e.xmlVersion===1.1?1.1:1,n=U[e.onNCR]??U.allow,r=U[e.nullNCR]??U.remove;return{xmlVersion:t,onLevel:n,nullLevel:Math.max(r,U.remove)}}(e.ncr);this._ncrXmlVersion=n.xmlVersion,this._ncrOnLevel=n.onLevel,this._ncrNullLevel=n.nullLevel,this._onExternalEntity=typeof e.onExternalEntity==`function`?e.onExternalEntity:null,this._onInputEntity=typeof e.onInputEntity==`function`?e.onInputEntity:null}_applyRegistrationHook(e,t,n,r){if(!e)return!0;let i=e(t,n);if(i===Kn.BLOCK)return!1;if(i===Kn.THROW)throw Error(`[EntityDecoder] Registration of ${r} entity "&${t};" was rejected by hook`);return!0}setExternalEntities(e){if(e)for(let t of Object.keys(e))Jn(t);if(!this._onExternalEntity)return void(this._externalMap=Yn(e));let t=Yn(e),n=Object.create(null);for(let[e,r]of Object.entries(t))this._applyRegistrationHook(this._onExternalEntity,e,r,`external`)&&(n[e]=r);this._externalMap=n}addExternalEntity(e,t){Jn(e),typeof t==`string`&&t.indexOf(`&`)===-1&&this._applyRegistrationHook(this._onExternalEntity,e,t,`external`)&&(this._externalMap[e]=t)}addInputEntities(e){if(this._totalExpansions=0,this._expandedLength=0,!this._onInputEntity)return void(this._inputMap=Yn(e));let t=Yn(e),n=Object.create(null);for(let[e,r]of Object.entries(t))this._applyRegistrationHook(this._onInputEntity,e,r,`input`)&&(n[e]=r);this._inputMap=n}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1}decode(e){if(typeof e!=`string`||e.length===0||e.indexOf(`&`)===-1)return e;let t=e,n=[],r=e.length,i=0,a=0,o=this._maxTotalExpansions>0,s=this._maxExpandedLength>0,c=o||s;for(;a<r;){if(e.charCodeAt(a)!==38){a++;continue}let t=a+1;for(;t<r&&e.charCodeAt(t)!==59&&t-a<=32;)t++;if(t>=r||e.charCodeAt(t)!==59){a++;continue}let l=e.slice(a+1,t);if(l.length===0){a++;continue}let u,d;if(this._removeSet.has(l))u=``,d===void 0&&(d=Xn);else{if(this._leaveSet.has(l)){a++;continue}if(l.charCodeAt(0)===35){let e=this._resolveNCR(l);if(e===void 0){a++;continue}u=e,d=Zn}else{let e=this._resolveName(l);u=e?.value,d=e?.tier}}if(u!==void 0){if(a>i&&n.push(e.slice(i,a)),n.push(u),i=t+1,a=i,c&&this._tierCounts(d)){if(o&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(s){let e=u.length-(l.length+2);if(e>0&&(this._expandedLength+=e,this._expandedLength>this._maxExpandedLength))throw Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}else a++}i<r&&n.push(e.slice(i));let l=n.length===0?e:n.join(``);return this._postCheck(l,t)}_tierCounts(e){return!!this._limitTiers.has(`all`)||this._limitTiers.has(e)}_resolveName(e){return e in this._inputMap?{value:this._inputMap[e],tier:Xn}:e in this._externalMap?{value:this._externalMap[e],tier:Xn}:e in this._baseMap?{value:this._baseMap[e],tier:Zn}:void 0}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!Qn.has(e)?U.remove:-1}_applyNCRAction(e,t,n){switch(e){case U.allow:return String.fromCodePoint(n);case U.remove:return``;case U.leave:return;case U.throw:throw Error(`[EntityDecoder] Prohibited numeric character reference &${t}; (U+${n.toString(16).toUpperCase().padStart(4,`0`)})`);default:return String.fromCodePoint(n)}}_resolveNCR(e){let t=e.charCodeAt(1),n;if(n=t===120||t===88?parseInt(e.slice(2),16):parseInt(e.slice(1),10),Number.isNaN(n)||n<0||n>1114111)return;let r=this._classifyNCR(n);if(!this._numericAllowed&&r<U.remove)return;let i=r===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,r);return this._applyNCRAction(i,e,n)}};const er=[{id:`sql-block-comment-open`,description:`SQL block comment open: /* ... */ — unusual in legitimate user text`,pattern:/\/\*/},{id:`sql-union-select`,description:`UNION SELECT — most common SQL injection aggregation attack`,pattern:/\bUNION\s{1,20}(?:ALL\s{1,20})?SELECT\b/i},{id:`sql-drop-table`,description:`DROP TABLE — destructive DDL injection`,pattern:/\bDROP\s{1,20}TABLE\b/i},{id:`sql-drop-database`,description:`DROP DATABASE — destructive DDL injection`,pattern:/\bDROP\s{1,20}DATABASE\b/i},{id:`sql-insert-into`,description:`INSERT INTO — data injection`,pattern:/\bINSERT\s{1,20}INTO\b/i},{id:`sql-delete-from`,description:`DELETE FROM — data deletion injection`,pattern:/\bDELETE\s{1,20}FROM\b/i},{id:`sql-update-set`,description:`UPDATE ... SET — data modification injection`,pattern:/\bUPDATE\b[\s\S]{1,60}\bSET\b/i},{id:`sql-exec-xp`,description:`EXEC xp_ — MSSQL extended stored procedure execution`,pattern:/\bEXEC(?:UTE)?\s{1,20}xp_/i},{id:`sql-tautology-string`,description:`Classic string tautology: ' OR '1'='1 or " OR "1"="1"`,pattern:/'\s{0,10}OR\s{0,10}'[^']{0,20}'\s*=\s*'[^']{0,20}/i},{id:`sql-tautology-numeric`,description:`Numeric tautology: OR 1=1`,pattern:/\bOR\s{1,10}1\s*=\s*1\b/i},{id:`sql-always-true-zero`,description:`Numeric tautology: OR 0=0`,pattern:/\bOR\s{1,10}0\s*=\s*0\b/i},{id:`sql-sleep-benchmark`,description:`Time-based blind injection: SLEEP() or BENCHMARK()`,pattern:/\b(?:SLEEP|BENCHMARK)\s*\(/i},{id:`sql-waitfor-delay`,description:`MSSQL time-based blind injection: WAITFOR DELAY`,pattern:/\bWAITFOR\s{1,20}DELAY\b/i},{id:`sql-char-function`,description:`CHAR() function — used to obfuscate injected strings`,pattern:/\bCHAR\s*\(\s*\d{1,3}/i},{id:`sql-information-schema`,description:`INFORMATION_SCHEMA — reconnaissance query for table/column enumeration`,pattern:/\bINFORMATION_SCHEMA\b/i}],tr=[...er,{id:`sql-line-comment`,description:`SQL line comment: -- followed by whitespace or end of string`,pattern:/--(?:\s|$)/},{id:`sql-stacked-query`,description:`Stacked queries: semicolon immediately followed by a SQL keyword`,pattern:/;\s{0,10}(?:SELECT|INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|EXEC)\b/i},{id:`sql-hex-encoding`,description:`Hex-encoded string injection: 0x41414141 style (MySQL)`,pattern:/\b0x[0-9a-f]{4,}/i}],nr=[{id:`html-script-open`,description:`<script opening tag`,pattern:/<script[\s>/]/i},{id:`html-script-close`,description:`<\/script closing tag`,pattern:/<\/script[\s>]/i},{id:`html-javascript-protocol`,description:`javascript: URI scheme (with optional whitespace/encoding)`,pattern:/j[\t\n\r ]*a[\t\n\r ]*v[\t\n\r ]*a[\t\n\r ]*s[\t\n\r ]*c[\t\n\r ]*r[\t\n\r ]*i[\t\n\r ]*p[\t\n\r ]*t[\t\n\r ]*:/i},{id:`html-vbscript-protocol`,description:`vbscript: URI scheme`,pattern:/vbscript[\t\n\r ]*:/i},{id:`html-data-html`,description:`data:text/html URI — can execute scripts in browsers`,pattern:/data[\t\n\r ]*:[\t\n\r ]*text\/html/i},{id:`html-data-xhtml`,description:`data:application/xhtml+xml URI`,pattern:/data[\t\n\r ]*:[\t\n\r ]*application\/xhtml/i},{id:`html-data-svg`,description:`data:image/svg+xml URI — can execute scripts`,pattern:/data[\t\n\r ]*:[\t\n\r ]*image\/svg\+xml/i},{id:`html-inline-event-handler`,description:`Inline event handler attributes: onclick=, onerror=, onload=, etc.`,pattern:/\bon\w{1,30}\s*=/i},{id:`html-entity-obfuscated-script`,description:`HTML-entity-encoded <script (e.g. <script or <script)`,pattern:/(?:�*3[Cc];?|�*60;?|<)\s*script/i},{id:`html-entity-obfuscated-javascript`,description:`HTML-entity-encoded javascript: (partial — catches common j or j for "j")`,pattern:/(?:�*6[Aa];?|�*106;?)\s*(?:�*61;?|a)[\s\S]{0,80}script\s*:/i},{id:`html-style-expression`,description:`CSS expression() — IE-era code execution in style attributes`,pattern:/style[\s\S]{0,20}expression\s*\(/i},{id:`html-object-embed`,description:`<object or <embed tags that can load active content`,pattern:/<(?:object|embed)[\s>/]/i},{id:`html-base-tag`,description:`<base href= — can hijack all relative URLs on a page`,pattern:/<base[\s>]/i},{id:`html-meta-refresh`,description:`<meta http-equiv="refresh" — can redirect users`,pattern:/<meta[\s\S]{0,40}http-equiv[\s\S]{0,20}refresh/i},{id:`html-srcdoc`,description:`srcdoc= attribute on iframes — embeds HTML that can run scripts`,pattern:/srcdoc\s*=/i},{id:`html-iframe`,description:`<iframe tag`,pattern:/<iframe[\s>/]/i},{id:`html-form`,description:`<form tag — can be used for phishing / credential harvesting injection`,pattern:/<form[\s>/]/i}],rr=[{id:`xml-cdata-injection`,description:`CDATA section injection: <![CDATA[ breaks out of text node context`,pattern:/<!\[CDATA\[/i},{id:`xml-cdata-close`,description:`CDATA close sequence: ]]> can terminate an enclosing CDATA section`,pattern:/\]\]>/},{id:`xml-processing-instruction`,description:`XML processing instruction: <?xml-stylesheet or <?php etc.`,pattern:/<\?(?:xml[\- ]|php|asp)/i},{id:`xml-doctype-injection`,description:`DOCTYPE declaration embedded in content — can define entities`,pattern:/<!DOCTYPE(?:[\s[]|$)/i},{id:`xml-entity-system`,description:`SYSTEM keyword — used in external entity declarations (XXE)`,pattern:/\bSYSTEM\s+["']/i},{id:`xml-entity-public`,description:`PUBLIC keyword — used in external entity declarations (XXE)`,pattern:/\bPUBLIC\s+["']/i},{id:`xml-entity-declaration`,description:`<!ENTITY declaration — defines entities, potential XXE or entity expansion`,pattern:/<!ENTITY[\s%]/i},{id:`xml-billion-laughs`,description:`Entity reference chaining / billion laughs: repeated &eX; style references`,pattern:/(?:&\w{1,20};){3,}/},{id:`xml-namespace-confusion`,description:`xmlns: attribute injection — can redefine namespaces to confuse parsers`,pattern:/\bxmlns(?::\w{1,40})?\s*=/i},{id:`xml-comment-injection`,description:`<!-- comment injection — can hide content from some parsers`,pattern:/<!--/},{id:`xml-comment-close`,description:`--> closes an enclosing XML comment`,pattern:/-->/},{id:`xml-pi-close`,description:`?> closes an enclosing processing instruction`,pattern:/\?>/}],ir=[{id:`svg-script-element`,description:`<script element inside SVG executes JavaScript`,pattern:/<script[\s>/]/i},{id:`svg-xlink-href-javascript`,description:`xlink:href with javascript: — classic SVG XSS via <a> or <use>`,pattern:/xlink\s*:\s*href\s*=\s*["']?\s*javascript\s*:/i},{id:`svg-href-javascript`,description:`href= with javascript: in SVG context (<a>, <animate>, etc.)`,pattern:/href\s*=\s*["']?\s*javascript\s*:/i},{id:`svg-foreignobject`,description:`<foreignObject embeds HTML inside SVG — can execute scripts`,pattern:/<foreignObject[\s>/]/i},{id:`svg-use-external`,description:`<use xlink:href or href pointing to external resource (non-fragment URL)`,pattern:/<use[\s\S]{0,60}(?:xlink\s*:\s*)?href\s*=\s*(?:["'][^#]|[^"'#\s>])/i},{id:`svg-animate-href`,description:`<animate attributeName="href" — can dynamically change href to javascript:`,pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*href["']/i},{id:`svg-animate-xlinkhref`,description:`<animate attributeName="xlink:href"`,pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*xlink\s*:\s*href["']/i},{id:`svg-set-javascript`,description:`<set to="javascript:..." — sets an attribute to a javascript: URI`,pattern:/<set[\s\S]{0,80}to\s*=\s*["']?\s*javascript\s*:/i},{id:`svg-event-handler`,description:`SVG-specific event handler attributes: onload=, onerror=, onactivate=, etc.`,pattern:/\bon(?:load|error|activate|begin|end|repeat|focus|blur|click|mouse\w{1,20}|key\w{1,20})\s*=/i},{id:`svg-handler-generic`,description:`Generic on* handler catch-all for SVG attributes`,pattern:/\bon\w{1,30}\s*=/i},{id:`svg-filter-feimage`,description:`<feImage href= — filter primitive that can load external resources`,pattern:/<feImage[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=/i},{id:`svg-image-external`,description:`<image xlink:href with http/https or javascript protocol`,pattern:/<image[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=\s*["']?\s*(?:https?|javascript)\s*:/i},{id:`svg-style-javascript`,description:`style= attribute containing javascript: (e.g. background:url(javascript:...))`,pattern:/style\s*=[\s\S]{0,60}javascript\s*:/i}],ar=[{id:`shell-path-traversal-unix`,description:`Unix path traversal: ../ — climbing the directory tree`,pattern:/\.\.\//},{id:`shell-path-traversal-windows`,description:`Windows path traversal: ..\\ — climbing the directory tree`,pattern:/\.\.\\/},{id:`shell-path-traversal-encoded`,description:`URL-encoded path traversal: %2e%2e or %2f variants`,pattern:/%2e%2e|%2f\.\.|\.\.%2f/i},{id:`shell-null-byte`,description:`Null byte injection: \\x00 or %00 — truncates strings in C-backed functions`,pattern:/\x00|%00/},{id:`shell-semicolon`,description:`Semicolon command separator: cmd1; cmd2`,pattern:/;/},{id:`shell-pipe`,description:`Pipe operator: cmd1 | cmd2`,pattern:/\|/},{id:`shell-and-operator`,description:`AND operator: cmd1 && cmd2`,pattern:/&&/},{id:`shell-or-operator`,description:`OR operator: cmd1 || cmd2`,pattern:/\|\|/},{id:`shell-backtick`,description:"Backtick command substitution: `cmd`",pattern:/`/},{id:`shell-dollar-paren`,description:`Dollar-paren command substitution: $(cmd)`,pattern:/\$\(/},{id:`shell-dollar-brace`,description:"Dollar-brace variable expansion: ${var} — can be abused for injection",pattern:/\$\{/},{id:`shell-redirect-out`,description:`Output redirection: cmd > file or cmd >> file`,pattern:/>{1,2}/},{id:`shell-redirect-in`,description:`Input redirection: cmd < file`,pattern:/</},{id:`shell-newline-injection`,description:`Newline injection: \\n or \\r — can inject new shell commands`,pattern:/[\n\r]/},{id:`shell-glob-star`,description:`Glob expansion: * or ? — can expand to unintended files`,pattern:/[/\\][*?]/},{id:`shell-absolute-root`,description:`Absolute root path injection: string starting with / or \\ (Windows UNC)`,pattern:/^(?:\/|\\\\)/},{id:`shell-windows-drive`,description:`Windows drive letter path injection: C:\\ or D:/`,pattern:/^[a-zA-Z]:[/\\]/},{id:`shell-curl-wget`,description:`curl/wget with URL or flags — can exfiltrate data or download payloads`,pattern:/\b(?:curl|wget)\s+(?:https?:\/\/|ftp:\/\/|-)/i}],or=[{id:`redos-nested-quantifier-plus`,description:`Nested + quantifier inside a group with outer quantifier: (a+)+, (.+b)*, etc.`,pattern:/\([^)]*\+[^)]*\)[+*]/},{id:`redos-nested-quantifier-star`,description:`Nested * quantifier: (a*)* or (a*)+ — catastrophic backtracking`,pattern:/\([^)]*\*[^)]*\)[*+]/},{id:`redos-nested-groups`,description:`Doubly nested quantified groups: ((a+)+) — guaranteed catastrophic`,pattern:/\(\([^)]{0,40}\)[+*]\)[+*]/},{id:`redos-alternation-overlap`,description:`Overlapping alternation under quantifier: (a|a)+ — ambiguous NFA paths`,pattern:/\(([^|()]{1,20})\|(?:\1)(?:\|[^|()]{1,20}){0,5}\)[+*?]{1,2}/},{id:`redos-star-plus-concat`,description:`(x*x)+ pattern — triggers super-linear backtracking`,pattern:/\([^)]{0,10}\*[^)]{0,10}\)[+*]/},{id:`redos-dot-star-greedy`,description:`(.*){n,} or (.+){n,} — repeated greedy dot quantifiers`,pattern:/\(\.[*+]\)\{?\d/},{id:`redos-large-repetition`,description:`Very large fixed or range repetition count {1000,} or {1000,n} — denial of service via backtracking`,pattern:/\{\d{4,}(?:,\d*)?\}/},{id:`redos-catastrophic-alternation`,description:`Long alternation with many similar branches — polynomial backtracking risk`,pattern:/\([^)]{0,200}(?:\|[^|)]{0,50}){9,}\)/}],W=`["'\\s]*:`,sr=[{id:`nosql-where-operator`,description:`$where — executes arbitrary JavaScript server-side in MongoDB`,pattern:RegExp(`\\$where${W}`,`i`)},{id:`nosql-ne-operator`,description:`$ne — "not equal" operator used to bypass equality checks`,pattern:RegExp(`\\$ne${W}`,`i`)},{id:`nosql-gt-operator`,description:`$gt — "greater than" used to bypass password/value checks`,pattern:RegExp(`\\$gte?${W}`,`i`)},{id:`nosql-lt-operator`,description:`$lt / $lte — "less than" bypass variants`,pattern:RegExp(`\\$lte?${W}`,`i`)},{id:`nosql-regex-operator`,description:`$regex — can be used to extract data character by character (blind injection)`,pattern:RegExp(`\\$regex${W}`,`i`)},{id:`nosql-or-operator`,description:`$or — logical OR; used to create always-true conditions`,pattern:RegExp(`\\$or${W}\\s*\\[`,`i`)},{id:`nosql-and-operator`,description:`$and — logical AND operator injection`,pattern:RegExp(`\\$and${W}\\s*\\[`,`i`)},{id:`nosql-nor-operator`,description:`$nor — logical NOR operator injection`,pattern:RegExp(`\\$nor${W}\\s*\\[`,`i`)},{id:`nosql-exists-operator`,description:`$exists — can enumerate fields to determine schema`,pattern:RegExp(`\\$exists${W}`,`i`)},{id:`nosql-in-operator`,description:`$in — matches any value in a list; can enumerate values`,pattern:RegExp(`\\$in${W}\\s*\\[`,`i`)},{id:`nosql-expr-operator`,description:`$expr — allows aggregation expressions in queries (MongoDB 3.6+)`,pattern:RegExp(`\\$expr${W}`,`i`)},{id:`nosql-function-operator`,description:`$function — executes arbitrary JavaScript in MongoDB 4.4+`,pattern:RegExp(`\\$function${W}`,`i`)},{id:`nosql-accumulator-operator`,description:`$accumulator — custom aggregation with arbitrary JS execution`,pattern:RegExp(`\\$accumulator${W}`,`i`)},{id:`nosql-proto-pollution`,description:`__proto__ — prototype pollution via object key injection`,pattern:/__proto__/},{id:`nosql-constructor-prototype`,description:`constructor.prototype — alternative prototype pollution vector (dot notation or JSON key)`,pattern:/constructor[\s"':.,{\[]*prototype/i},{id:`nosql-proto-bracket`,description:`["__proto__"] — bracket-notation prototype pollution`,pattern:/\[["']__proto__["']\]/}],cr=[{id:`log-crlf-injection`,description:`CRLF injection: literal \\r or \\n embeds fake log lines`,pattern:/[\r\n]/},{id:`log-url-encoded-crlf`,description:`URL-encoded CRLF: %0d, %0a, %0D, %0A — decoded by some log parsers`,pattern:/%0[dDaA]/},{id:`log-unicode-newline`,description:`Unicode newline variants: U+2028 (line separator), U+2029 (paragraph separator)`,pattern:/[\u2028\u2029]/},{id:`log-log4shell-jndi`,description:"Log4Shell: ${jndi:...} triggers remote code execution in Apache Log4j",pattern:/\$\{jndi\s*:/i},{id:`log-log4shell-obfuscated`,description:"Obfuscated Log4Shell: ${::-j}... lookup-bypass prefix used to evade WAF detection",pattern:/\$\{::-/},{id:`log-log4j-lookup`,description:"Log4j lookup syntax: ${env:...}, ${sys:...}, ${ctx:...} — data exfiltration",pattern:/\$\{(?:env|sys|ctx|main|map|sd|web|docker|k8s|spring)\s*:/i},{id:`log-ssti-double-brace`,description:`SSTI double-brace: {{expression}} — Jinja2, Twig, Handlebars, etc.`,pattern:/\{\{[\s\S]{0,80}\}\}/},{id:`log-ssti-hash-brace`,description:`SSTI hash-brace: #{expression} — Thymeleaf, Velocity, Ruby ERB`,pattern:/#\{[\s\S]{0,80}\}/},{id:`log-ssti-dollar-brace`,description:"SSTI/EL injection: ${expression with operators or method calls} — JSP EL, Freemarker, SpEL",pattern:/\$\{[^}]*(?:\.|\(|\*|\+|\bclass\b|\bruntime\b|\bprocess\b|\bexec\b)[^}]{0,80}\}/i},{id:`log-ssti-percent-tag`,description:`SSTI ERB/ASP tag: <%= expression %> — Ruby ERB, ASP`,pattern:/<%=[\s\S]{0,80}%>/},{id:`log-null-byte`,description:`Null byte: \\x00 or %00 — can truncate log entries in C-backed loggers`,pattern:/\x00|%00/},{id:`log-ansi-escape`,description:`ANSI escape sequence: ESC[ — can manipulate terminal output when logs are tailed`,pattern:/\x1b\[/}];function lr(e,t){let n=t.label??`CUSTOM`;for(let r of t)if(r.pattern.test(e))return{context:n,id:r.id,description:r.description,pattern:r.pattern};return null}function ur(e,t){(function(e){if(typeof e!=`string`)throw TypeError(`is-unsafe: first argument must be a string, got `+typeof e)})(e),function(e){if(!(e instanceof RegExp)){if(!Array.isArray(e))throw TypeError(`is-unsafe: second argument must be a PatternList (e.g. HTML), an array of PatternLists (e.g. [HTML, XML]), or a RegExp. Got: `+typeof e);if(e.length===0)throw TypeError(`is-unsafe: context must not be an empty array`);if(Array.isArray(e[0])){for(let t of e)if(!Array.isArray(t)||t.length===0)throw TypeError(`is-unsafe: each context in the array must be a non-empty pattern array (PatternList)`)}}}(t);let{lists:n,regex:r}=function(e){return e instanceof RegExp?{lists:null,regex:e}:Array.isArray(e[0])?{lists:e,regex:null}:{lists:[e],regex:null}}(t);if(r)return r.test(e);for(let t of n)if(lr(e,t)!==null)return!0;return!1}function dr(e,t){if(!e)return{};let n=t.attributesGroupName?e[t.attributesGroupName]:e;if(!n)return{};let r={};for(let e in n)e.startsWith(t.attributeNamePrefix)?r[e.substring(t.attributeNamePrefix.length)]=n[e]:r[e]=n[e];return r}function fr(e){if(!e||typeof e!=`string`)return;let t=e.indexOf(`:`);if(t!==-1&&t>0){let n=e.substring(0,t);if(n!==`xmlns`)return n}}nr.label=`HTML`,rr.label=`XML`,ir.label=`SVG`,er.label=`SQL`,tr.label=`SQL-STRICT`,ar.label=`SHELL`,or.label=`REDOS`,sr.label=`NOSQL`,cr.label=`LOG`,Object.freeze({HTML:nr,XML:rr,SVG:ir,SQL:er,"SQL-STRICT":tr,SHELL:ar,REDOS:or,NOSQL:sr,LOG:cr});var pr=class{constructor(e,t){var n;this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=vr,this.parseTextData=mr,this.resolveNameSpace=hr,this.buildAttributesMap=_r,this.isItStopNode=Sr,this.replaceEntitiesValue=br,this.readStopNodeData=Er,this.saveTextToParentTag=xr,this.addChild=yr,this.ignoreAttributesFn=typeof(n=this.options.ignoreAttributes)==`function`?n:Array.isArray(n)?e=>{for(let t of n)if(typeof t==`string`&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0,this.doctypefound=!1;let r={...Wn};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities==`object`?r=this.options.htmlEntities:!0===this.options.htmlEntities&&(r={...Gn,...Un}),this.entityDecoder=new $n({namedEntities:{...r,...t},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo},onInputEntity:(e,t)=>ur(t,[nr,rr])?Kn.BLOCK:Kn.ALLOW})),this.matcher=new Bn,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new Hn;let i=this.options.stopNodes;if(i&&i.length>0){for(let e=0;e<i.length;e++){let t=i[e];typeof t==`string`?this.stopNodeExpressionsSet.add(new Vn(t)):t instanceof Vn&&this.stopNodeExpressionsSet.add(t)}this.stopNodeExpressionsSet.seal()}}};function mr(e,t,n,r,i,a,o){let s=this.options;if(e!==void 0&&(s.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e,t,n));let r=s.jPath?n.toString():n,c=s.tagValueProcessor(t,e,r,i,a);return c==null?e:typeof c!=typeof e||c!==e?c:s.trimValues||e.trim()===e?Dr(e,s.parseTagValue,s.numberParseOptions):e}}function hr(e){if(this.options.removeNSPrefix){let t=e.split(`:`),n=e.charAt(0)===`/`?`/`:``;if(t[0]===`xmlns`)return``;t.length===2&&(e=n+t[1])}return e}const gr=/* @__PURE__ */ RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,`gm`);function _r(e,t,n,r=!1){let i=this.options;if(!0===r||!0!==i.ignoreAttributes&&typeof e==`string`){let r=function(e,t){let n=[],r=t.exec(e);for(;r;){let i=[];i.startIndex=t.lastIndex-r[0].length;let a=r.length;for(let e=0;e<a;e++)i.push(r[e]);n.push(i),r=t.exec(e)}return n}(e,gr),a=r.length,o={},s=Array(a),c=!1,l={};for(let e=0;e<a;e++){let t=this.resolveNameSpace(r[e][1]),a=r[e][4];if(t.length&&a!==void 0){let r=a;i.trimValues&&(r=r.trim()),r=this.replaceEntitiesValue(r,n,this.readonlyMatcher),s[e]=r,l[t]=r,c=!0}}c&&typeof t==`object`&&t.updateCurrent&&t.updateCurrent(l);let u=i.jPath?t.toString():this.readonlyMatcher,d=!1;for(let e=0;e<a;e++){let t=this.resolveNameSpace(r[e][1]);if(this.ignoreAttributesFn(t,u))continue;let n=i.attributeNamePrefix+t;if(t.length){if(i.transformAttributeName&&(n=i.transformAttributeName(n)),n=kr(n,i),r[e][4]!==void 0){let r=s[e],a=i.attributeValueProcessor(t,r,u);o[n]=a==null?r:typeof a!=typeof r||a!==r?a:Dr(r,i.parseAttributeValue,i.numberParseOptions),d=!0}else i.allowBooleanAttributes&&(o[n]=!0,d=!0)}}if(!d)return;if(i.attributesGroupName&&!i.preserveOrder){let e={};return e[i.attributesGroupName]=o,e}return o}}const vr=function(e){e=e.replace(/\r\n?/g,`
`);let t=new fn(`!xml`),n=t,r=``;this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0,this.doctypefound=!1;let i=this.options,a=new Cn(i.processEntities),o=e.length;for(let s=0;s<o;s++)if(e[s]===`<`){let c=e.charCodeAt(s+1);if(c===47){let a=Cr(e,`>`,s,`Closing Tag is not closed.`),o=e.substring(s+2,a).trim();if(i.removeNSPrefix){let e=o.indexOf(`:`);e!==-1&&(o=o.substr(e+1))}o=Or(i.transformTagName,o,``,i).tagName,n&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher));let c=this.matcher.getCurrentTag();if(o&&i.unpairedTagsSet.has(o))throw Error(`Unpaired tag can not be used as closing tag: </${o}>`);c&&i.unpairedTagsSet.has(c)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,n=this.tagsNodeStack.pop()||t,i.captureMetaData&&n&&n.addEndIndex(a+1),r=``,s=a}else if(c===63){let t=Tr(e,s,!1,`?>`);if(!t)throw Error(`Pi Tag is not closed.`);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let o=this.buildAttributesMap(t.tagExp,this.matcher,t.tagName,!0);if(o){let e=o[this.options.attributeNamePrefix+`version`];this.entityDecoder.setXmlVersion(Number(e)||1),a.setXmlVersion(Number(e)||1)}if(!(i.ignoreDeclaration&&t.tagName===`?xml`||i.ignorePiTags)){let e=new fn(t.tagName);e.add(i.textNodeName,``),t.tagName!==t.tagExp&&t.attrExpPresent&&!0!==i.ignoreAttributes&&(e[`:@`]=o),this.addChild(n,e,this.readonlyMatcher,s),i.captureMetaData&&n.addEndIndex(t.closeIndex+2)}s=t.closeIndex+1}else if(c===33&&e.charCodeAt(s+2)===45&&e.charCodeAt(s+3)===45){let t=Cr(e,`-->`,s+4,`Comment is not closed.`);if(i.commentPropName){let a=e.substring(s+4,t-2);r=this.saveTextToParentTag(r,n,this.readonlyMatcher),n.add(i.commentPropName,[{[i.textNodeName]:a}])}s=t}else if(c===33&&e.charCodeAt(s+2)===68){if(this.doctypefound)throw Error(`Multiple DOCTYPE declarations found.`);this.doctypefound=!0;let t=a.readDocType(e,s);this.entityDecoder.addInputEntities(t.entities),s=t.i}else if(c===33&&e.charCodeAt(s+2)===91){let t=Cr(e,`]]>`,s,`CDATA is not closed.`)-2,a=e.substring(s+9,t);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let o=this.parseTextData(a,n.tagname,this.readonlyMatcher,!0,!1,!0,!0);o??=``,i.cdataPropName?n.add(i.cdataPropName,[{[i.textNodeName]:a}]):n.add(i.textNodeName,o),s=t+2}else{let a=Tr(e,s,i.removeNSPrefix);if(!a){let t=e.substring(Math.max(0,s-50),Math.min(o,s+50));throw Error(`readTagExp returned undefined at position ${s}. Context: "${t}"`)}let c=a.tagName,l=a.rawTagName,u=a.tagExp,d=a.attrExpPresent,f=a.closeIndex;if({tagName:c,tagExp:u}=Or(i.transformTagName,c,u,i),i.strictReservedNames&&(c===i.commentPropName||c===i.cdataPropName||c===i.textNodeName||c===i.attributesGroupName))throw Error(`Invalid tag name: ${c}`);n&&r&&n.tagname!==`!xml`&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher,!1));let p=n;p&&i.unpairedTagsSet.has(p.tagname)&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let m=!1;u.length>0&&u.lastIndexOf(`/`)===u.length-1&&(m=!0,c[c.length-1]===`/`?(c=c.substr(0,c.length-1),u=c):u=u.substr(0,u.length-1),d=c!==u);let h,g=null;h=fr(l),c!==t.tagname&&this.matcher.push(c,{},h),c!==u&&d&&(g=this.buildAttributesMap(u,this.matcher,c),g&&dr(g,i)),c!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let _=s;if(this.isCurrentNodeStopNode){let t=``;if(m)s=a.closeIndex;else if(i.unpairedTagsSet.has(c))s=a.closeIndex;else{let n=this.readStopNodeData(e,l,f+1);if(!n)throw Error(`Unexpected end of ${l}`);s=n.i,t=n.tagContent}let r=new fn(c);g&&(r[`:@`]=g),r.add(i.textNodeName,t),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(n,r,this.readonlyMatcher,_),i.captureMetaData&&n.addEndIndex(s+1)}else{if(m){({tagName:c,tagExp:u}=Or(i.transformTagName,c,u,i));let e=new fn(c);g&&(e[`:@`]=g),this.addChild(n,e,this.readonlyMatcher,_),i.captureMetaData&&n.addEndIndex(f+1),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(i.unpairedTagsSet.has(c)){let e=new fn(c);g&&(e[`:@`]=g),this.addChild(n,e,this.readonlyMatcher,_),i.captureMetaData&&n.addEndIndex(a.closeIndex+1),this.matcher.pop(),this.isCurrentNodeStopNode=!1,s=a.closeIndex;continue}{let e=new fn(c);if(this.tagsNodeStack.length>i.maxNestedTags)throw Error(`Maximum nested tags exceeded`);this.tagsNodeStack.push(n),g&&(e[`:@`]=g),this.addChild(n,e,this.readonlyMatcher,_),n=e}}r=``,s=f}}}else r+=e[s];return t.child};function yr(e,t,n,r){this.options.captureMetaData||(r=void 0);let i=this.options.jPath?n.toString():n,a=this.options.updateTag(t.tagname,i,t[`:@`]);!1===a||(typeof a==`string`&&(t.tagname=a),e.addChild(t,r))}function br(e,t,n){let r=this.options.processEntities;if(!r||!r.enabled)return e;if(r.allowedTags){let i=this.options.jPath?n.toString():n;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(t):r.allowedTags(t,i)))return e}if(r.tagFilter){let i=this.options.jPath?n.toString():n;if(!r.tagFilter(t,i))return e}return this.entityDecoder.decode(e)}function xr(e,t,n,r){return e&&=(r===void 0&&(r=t.child.length===0),(e=this.parseTextData(e,t.tagname,n,!1,!!t[`:@`]&&Object.keys(t[`:@`]).length!==0,r))!==void 0&&e!==``&&t.add(this.options.textNodeName,e),``),e}function Sr(){return this.stopNodeExpressionsSet.size!==0&&this.matcher.matchesAny(this.stopNodeExpressionsSet)}function Cr(e,t,n,r){let i=e.indexOf(t,n);if(i===-1)throw Error(r);return i+t.length-1}function wr(e,t,n,r){let i=e.indexOf(t,n);if(i===-1)throw Error(r);return i}function Tr(e,t,n,r=`>`){let i=function(e,t,n=`>`){let r=0,i=e.length,a=n.charCodeAt(0),o=n.length>1?n.charCodeAt(1):-1,s=``,c=t;for(let n=t;n<i;n++){let t=e.charCodeAt(n);if(r)t===r&&(r=0);else if(t===34||t===39)r=t;else if(t===a){if(o===-1||e.charCodeAt(n+1)===o)return s+=e.substring(c,n),{data:s,index:n}}else t!==9||r||(s+=e.substring(c,n)+` `,c=n+1)}}(e,t+1,r);if(!i)return;let a=i.data,o=i.index,s=a.search(/\s/),c=a,l=!0;s!==-1&&(c=a.substring(0,s),a=a.substring(s+1).trimStart());let u=c;if(n){let e=c.indexOf(`:`);e!==-1&&(c=c.substr(e+1),l=c!==i.data.substr(e+1))}return{tagName:c,tagExp:a,closeIndex:o,attrExpPresent:l,rawTagName:u}}function Er(e,t,n){let r=n,i=1,a=e.length;for(;n<a;n++)if(e[n]===`<`){let a=e.charCodeAt(n+1);if(a===47){let a=wr(e,`>`,n,`${t} is not closed`);if(e.substring(n+2,a).trim()===t&&(i--,i===0))return{tagContent:e.substring(r,n),i:a};n=a}else if(a===63)n=Cr(e,`?>`,n+1,`StopNode is not closed.`);else if(a===33&&e.charCodeAt(n+2)===45&&e.charCodeAt(n+3)===45)n=Cr(e,`-->`,n+3,`StopNode is not closed.`);else if(a===33&&e.charCodeAt(n+2)===91)n=Cr(e,`]]>`,n,`StopNode is not closed.`)-2;else{let r=Tr(e,n,!1);r&&((r&&r.tagName)===t&&r.tagExp[r.tagExp.length-1]!==`/`&&i++,n=r.closeIndex)}}}function Dr(e,t,n){if(t&&typeof e==`string`){let t=e.trim();return t===`true`||t!==`false`&&In(e,n)}return e===void 0?``:e}function Or(e,t,n,r){if(e){let r=e(t);n===t&&(n=r),t=r}return{tagName:t=kr(t,r),tagExp:n}}function kr(e,t){if(an.includes(e))throw Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return rn.includes(e)?t.onDangerousProperty(e):e}const Ar=fn.getMetaDataSymbol();function jr(e,t){if(!e||typeof e!=`object`)return{};if(!t)return e;let n={};for(let r in e)r.startsWith(t)?n[r.substring(t.length)]=e[r]:n[r]=e[r];return n}function Mr(e,t,n,r){return Nr(e,t,n,r)}function Nr(e,t,n,r){let i,a={};for(let o=0;o<e.length;o++){let s=e[o],c=Pr(s);if(c!==void 0&&c!==t.textNodeName){let e=jr(s[`:@`]||{},t.attributeNamePrefix);n.push(c,e)}if(c===t.textNodeName)i===void 0?i=s[c]:i+=``+s[c];else{if(c===void 0)continue;if(s[c]){let e=Nr(s[c],t,n,r),i=Ir(e,t);if(Object.keys(e).length===0&&t.alwaysCreateTextNode&&(e[t.textNodeName]=``),s[`:@`]?Fr(e,s[`:@`],r,t):Object.keys(e).length!==1||e[t.textNodeName]===void 0||t.alwaysCreateTextNode?Object.keys(e).length===0&&(t.alwaysCreateTextNode?e[t.textNodeName]=``:e=``):e=e[t.textNodeName],s[Ar]!==void 0&&typeof e==`object`&&e&&(e[Ar]=s[Ar]),a[c]!==void 0&&Object.prototype.hasOwnProperty.call(a,c))Array.isArray(a[c])||(a[c]=[a[c]]),a[c].push(e);else{let n=t.jPath?r.toString():r;a[c]=t.isArray(c,n,i)?[e]:e}c!==void 0&&c!==t.textNodeName&&n.pop()}}}return typeof i==`string`?i.length>0&&(a[t.textNodeName]=i):i!==void 0&&(a[t.textNodeName]=i),a}function Pr(e){let t=Object.keys(e);for(let e=0;e<t.length;e++){let n=t[e];if(n!==`:@`)return n}}function Fr(e,t,n,r){if(t){let i=Object.keys(t),a=i.length;for(let o=0;o<a;o++){let a=i[o],s=a.startsWith(r.attributeNamePrefix)?a.substring(r.attributeNamePrefix.length):a,c=r.jPath?n.toString()+`.`+s:n;e[a]=r.isArray(a,c,!0,!0)?[t[a]]:t[a]}}}function Ir(e,t){let{textNodeName:n}=t,r=Object.keys(e).length;return r===0||!(r!==1||!e[n]&&typeof e[n]!=`boolean`&&e[n]!==0)}const Lr={allowBooleanAttributes:!1,unpairedTags:[]};function Rr(e){return e===` `||e===` `||e===`
`||e===`\r`}function zr(e,t){let n=t;for(;t<e.length;t++)if(e[t]==`?`||e[t]==` `){let r=e.substr(n,t-n);if(t>5&&r===`xml`)return G(`InvalidXml`,`XML declaration allowed only at the start of the document.`,K(e,t));if(e[t]==`?`&&e[t+1]==`>`){t++;break}}return t}function Br(e,t){if(e.length>t+5&&e[t+1]===`-`&&e[t+2]===`-`){for(t+=3;t<e.length;t++)if(e[t]===`-`&&e[t+1]===`-`&&e[t+2]===`>`){t+=2;break}}else if(e.length>t+8&&e[t+1]===`D`&&e[t+2]===`O`&&e[t+3]===`C`&&e[t+4]===`T`&&e[t+5]===`Y`&&e[t+6]===`P`&&e[t+7]===`E`){let n=1;for(t+=8;t<e.length;t++)if(e[t]===`<`)n++;else if(e[t]===`>`&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]===`[`&&e[t+2]===`C`&&e[t+3]===`D`&&e[t+4]===`A`&&e[t+5]===`T`&&e[t+6]===`A`&&e[t+7]===`[`){for(t+=8;t<e.length;t++)if(e[t]===`]`&&e[t+1]===`]`&&e[t+2]===`>`){t+=2;break}}return t}function Vr(e,t){let n=``,r=``,i=!1;for(;t<e.length;t++){if(e[t]===`"`||e[t]===`'`)r===``?r=e[t]:r!==e[t]||(r=``);else if(e[t]===`>`&&r===``){i=!0;break}n+=e[t]}return r===``&&{value:n,index:t,tagClosed:i}}function Hr(e,t){let n=function(e){let t=[],n=e.length,r=0;for(;r<n;){let i=r;for(;r<n&&Rr(e[r]);)r++;if(r>=n)break;if(e[r]===`=`){r=i+1;continue}let a=e.slice(i,r),o=r;for(;r<n&&!Rr(e[r])&&e[r]!==`=`;)r++;let s=e.slice(o,r),c,l,u,d=r;for(;d<n&&Rr(e[d]);)d++;d<n&&e[d]===`=`&&(c=e.slice(r,d+1),r=d+1);let f=r;for(;f<n&&Rr(e[f]);)f++;if(f<n&&(e[f]===`"`||e[f]===`'`)){let t=f+1,n=e.indexOf(e[f],t);n!==-1&&(l=e[f],u=e.slice(t,n),r=n+1)}let p={startIndex:i};p[1]=a,p[2]=s,p[3]=c,p[4]=l!==void 0||void 0,p[5]=l,p[6]=u,t.push(p)}return t}(e),r={};for(let e=0;e<n.length;e++){if(n[e][1].length===0)return G(`InvalidAttr`,`Attribute '`+n[e][2]+`' has no space in starting.`,Gr(n[e]));if(n[e][3]!==void 0&&n[e][4]===void 0)return G(`InvalidAttr`,`Attribute '`+n[e][2]+`' is without value.`,Gr(n[e]));if(n[e][3]===void 0&&!t.allowBooleanAttributes)return G(`InvalidAttr`,`boolean attribute '`+n[e][2]+`' is not allowed.`,Gr(n[e]));let i=n[e][2];if(!Wr(i))return G(`InvalidAttr`,`Attribute '`+i+`' is an invalid name.`,Gr(n[e]));if(Object.prototype.hasOwnProperty.call(r,i))return G(`InvalidAttr`,`Attribute '`+i+`' is repeated.`,Gr(n[e]));r[i]=1}return!0}function Ur(e,t){if(e[++t]===`;`)return-1;if(e[t]===`#`)return function(e,t){let n=/\d/;for(e[t]===`x`&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===`;`)return t;if(!e[t].match(n))break}return-1}(e,++t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===`;`)break;return-1}return t}function G(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Wr(e){return nn(e)}function K(e,t){let n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Gr(e){return e.startIndex+e[1].length}var Kr=class{constructor(e){this.externalEntities={},this.options=un(e)}parse(e,t){if(typeof e!=`string`&&e.toString)e=e.toString();else if(typeof e!=`string`)throw Error(`XML data is accepted in String or Bytes[] form.`);if(t){!0===t&&(t={});let n=function(e,t){t=Object.assign({},Lr,t);let n=[],r=!1,i=!1;e[0]===``&&(e=e.substr(1));for(let a=0;a<e.length;a++)if(e[a]===`<`&&e[a+1]===`?`){if(a+=2,a=zr(e,a),a.err)return a}else{if(e[a]!==`<`){if(Rr(e[a]))continue;return G(`InvalidChar`,`char '`+e[a]+`' is not expected.`,K(e,a))}{let o=a;if(a++,e[a]===`!`){a=Br(e,a);continue}{let s=!1;e[a]===`/`&&(s=!0,a++);let c=``;for(;a<e.length&&e[a]!==`>`&&e[a]!==` `&&e[a]!==` `&&e[a]!==`
`&&e[a]!==`\r`;a++)c+=e[a];if(c=c.trim(),c[c.length-1]===`/`&&(c=c.substring(0,c.length-1),a--),!nn(c)){let t;return t=c.trim().length===0?`Invalid space after '<'.`:`Tag '`+c+`' is an invalid name.`,G(`InvalidTag`,t,K(e,a))}let l=Vr(e,a);if(!1===l)return G(`InvalidAttr`,`Attributes for '`+c+`' have open quote.`,K(e,a));let u=l.value;if(a=l.index,u[u.length-1]===`/`){let n=a-u.length;u=u.substring(0,u.length-1);let i=Hr(u,t);if(!0!==i)return G(i.err.code,i.err.msg,K(e,n+i.err.line));r=!0}else if(s){if(!l.tagClosed)return G(`InvalidTag`,`Closing tag '`+c+`' doesn't have proper closing.`,K(e,a));if(u.trim().length>0)return G(`InvalidTag`,`Closing tag '`+c+`' can't have attributes or invalid starting.`,K(e,o));if(n.length===0)return G(`InvalidTag`,`Closing tag '`+c+`' has not been opened.`,K(e,o));{let t=n.pop();if(c!==t.tagName){let n=K(e,t.tagStartPos);return G(`InvalidTag`,`Expected closing tag '`+t.tagName+`' (opened in line `+n.line+`, col `+n.col+`) instead of closing tag '`+c+`'.`,K(e,o))}n.length==0&&(i=!0)}}else{let s=Hr(u,t);if(!0!==s)return G(s.err.code,s.err.msg,K(e,a-u.length+s.err.line));if(!0===i)return G(`InvalidXml`,`Multiple possible root nodes found.`,K(e,a));t.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:o}),r=!0}for(a++;a<e.length;a++)if(e[a]===`<`){if(e[a+1]===`!`){a++,a=Br(e,a);continue}if(e[a+1]!==`?`)break;if(a=zr(e,++a),a.err)return a}else if(e[a]===`&`){let t=Ur(e,a);if(t==-1)return G(`InvalidChar`,`char '&' is not expected.`,K(e,a));a=t}else if(!0===i&&!Rr(e[a]))return G(`InvalidXml`,`Extra text at the end`,K(e,a));e[a]===`<`&&a--}}}return r?n.length==1?G(`InvalidTag`,`Unclosed tag '`+n[0].tagName+`'.`,K(e,n[0].tagStartPos)):!(n.length>0)||G(`InvalidXml`,`Invalid '`+JSON.stringify(n.map((e=>e.tagName)),null,4).replace(/\r?\n/g,``)+`' found.`,{line:1,col:1}):G(`InvalidXml`,`Start tag expected.`,1)}(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}let n=new pr(this.options,this.externalEntities),r=n.parseXml(e);return this.options.preserveOrder||r===void 0?r:Mr(r,this.options,n.matcher,n.readonlyMatcher)}addEntity(e,t){if(t.indexOf(`&`)!==-1)throw Error(`Entity value can't have '&'`);if(e.indexOf(`&`)!==-1||e.indexOf(`;`)!==-1)throw Error(`An entity must be set without '&' and ';'. Eg. use '#xD' for '
'`);if(t===`&`)throw Error(`An entity with value '&' is not permitted`);this.externalEntities[e]=t}static getMetaDataSymbol(){return fn.getMetaDataSymbol()}},qr=A(829),q=A.n(qr),Jr=function(e){return e.Array=`array`,e.Object=`object`,e.Original=`original`,e}(Jr||{});function Yr(e){let t=e.indexOf(`:`);return t===-1?e:e.slice(t+1)}function Xr(e){return typeof e==`string`?e:e.toArray().map(Yr).join(`.`)}function Zr(e,t){if(!e.endsWith(`propstat.prop.displayname`))return t}function Qr(e,t,n=Jr.Original){let r=q().get(e,t);return n===`array`&&!1===Array.isArray(r)?[r]:n===`object`&&Array.isArray(r)?r[0]:r}const $r=/* @__PURE__ */ new Set([`multistatus`,`response`,`propstat`,`prop`,`status`,`href`,`responsedescription`]);function ei(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ti(e,t){return t??={attributeNamePrefix:`@`,attributeParsers:[],tagParsers:[Zr]},new Promise((n=>{let r=function({attributeNamePrefix:e,attributeParsers:t,clarkNotationProps:n,entityDecoder:r,tagParsers:i}){let a={allowBooleanAttributes:!0,attributeNamePrefix:e,textNodeName:`text`,ignoreAttributes:!1,removeNSPrefix:!n,jPath:!1,numberParseOptions:{hex:!0,leadingZeros:!1},attributeValueProcessor(e,n,r){if(t.length===0||(i=e)===`xmlns`||i.startsWith(`xmlns:`))return n;var i;let a=Xr(r);for(let e of t)try{let t=e(a,n);if(t!==n)return t}catch{}return n},tagValueProcessor(e,t,n){if(i.length===0)return t;let r=Xr(n);for(let e of i)try{let n=e(r,t);if(n!==t)return n}catch{}return t}};return r&&(a.entityDecoder=new $n({limit:{maxTotalExpansions:r.limit?.maxTotalExpansions??0,maxExpandedLength:r.limit?.maxExpandedLength??0}})),new Kr(a)}(t).parse(e);t.clarkNotationProps&&function(e,t){if(!ei(e)&&!Array.isArray(e))return;let n=`${t}xmlns`,r=`${n}:`,i=r.length,a=`text`;function o(e){return e===n||e.length>i&&e.startsWith(r)}function s(e,t){let a=null;for(let o of Object.keys(e))o===n?(a||=new Map(t),a.set(``,e[o])):o.length>i&&o.startsWith(r)&&(a||=new Map(t),a.set(o.slice(i),e[o]));return a??t}function c(e){if(Array.isArray(e))return e.map(c);if(!ei(e))return e;let t={};for(let n of Object.keys(e))o(n)||(t[n]=c(e[n]));let n=Object.keys(t);return n.length===0?``:n.length===1&&n[0]===a?t[a]:t}function l(e,t,n,r){let i=e.indexOf(`:`),a=i===-1?``:e.slice(0,i),o=i===-1?e:e.slice(i+1),l=e=>(ei(e)?s(e,n):n).get(a)??``,u=(e,t)=>{let n=e?`{${e}}${o}`:o,i=r[n];i===void 0?r[n]=t:Array.isArray(i)?i.push(t):r[n]=[i,t]};if(Array.isArray(t))for(let e of t)u(l(e),c(e));else u(l(t),c(t))}function u(e,t){if(!ei(e))return e;let n=function(e,t){let n=s(e,t),r={};for(let t of Object.keys(e))o(t)||l(t,e[t],n,r);return r}(e,t);return Object.keys(n).length===0?``:n}(function e(t,n){if(Array.isArray(t)){for(let r=0;r<t.length;r+=1)t[r]=e(t[r],n);return t}if(!ei(t))return t;let r=s(t,n);for(let n of Object.keys(t)){if(o(n)){delete t[n];continue}let i=n.indexOf(`:`),a=i===-1?n:n.slice(i+1),s=t[n],c=n;$r.has(a)&&a!==n&&(delete t[n],t[a]=s,c=a),t[c]=a===`prop`?Array.isArray(s)?s.map((e=>u(e,r))):u(s,r):e(s,r)}return Object.keys(t).length===0?``:t})(e,/* @__PURE__ */ new Map)}(r,t.attributeNamePrefix??`@`),n(function(e){let{multistatus:t}=e;if(t===``)return{multistatus:{response:[]}};if(!t)throw Error(`Invalid response: No root multistatus found`);let n={multistatus:Array.isArray(t)?t[0]:t};return q().set(n,`multistatus.response`,Qr(n,`multistatus.response`,Jr.Array)),q().set(n,`multistatus.response`,q().get(n,`multistatus.response`).map((e=>function(e){let t=Object.assign({},e);return t.status?q().set(t,`status`,Qr(t,`status`,Jr.Object)):(q().set(t,`propstat`,Qr(t,`propstat`,Jr.Object)),q().set(t,`propstat.prop`,Qr(t,`propstat.prop`,Jr.Object))),t}(e)))),n}(r))}))}function ni(e,t,n=!1){let{getlastmodified:r=null,getcontentlength:i=`0`,resourcetype:a=null,getcontenttype:o=null,getetag:s=null}=e,c=a&&typeof a==`object`&&a.collection!==void 0?`directory`:`file`,l={filename:t,basename:xe().basename(t),lastmod:r,size:parseInt(i,10),type:c,etag:typeof s==`string`?s.replace(/"/g,``):null};return c===`file`&&(l.mime=o&&typeof o==`string`?o.split(`;`)[0]:``),n&&(e.displayname!==void 0&&(e.displayname=String(e.displayname)),l.props=e),l}function ri(e,t,n=!1){let r=null;try{e.multistatus.response[0].propstat&&(r=e.multistatus.response[0])}catch{}if(!r)throw Error(`Failed getting item stat: bad response`);let{propstat:{prop:i,status:a}}=r,[o,s,c]=a.split(` `,3),l=parseInt(s,10);if(l>=400){let e=/* @__PURE__ */ Error(`Invalid response: ${l} ${c}`);throw e.status=l,e}return ni(i,Te(t),n)}function ii(e){switch(String(e)){case`-3`:return`unlimited`;case`-2`:case`-1`:return`unknown`;default:return parseInt(String(e),10)}}function ai(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const oi=function(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}((function(e,t,n={}){let{details:r=!1}=n,i=I({url:N(e.remoteURL,M(t)),method:`PROPFIND`,headers:{Accept:`text/plain,application/xml`,Depth:`0`}},e,n);return ai(F(i,e),(function(n){return V(e,n),ai(n.text(),(function(i){return ai(ti(i,e.parsing),(function(e){return Zt(n,ri(e,t,r),r)}))}))}))}));function si(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const ci=li((function(e,t,n={}){let r=function(e){if(!e||e===`/`)return[];let t=e,n=[];do n.push(t),t=xe().dirname(t);while(t&&t!==`/`);return n}(Te(t));r.sort(((e,t)=>e.length>t.length?1:t.length>e.length?-1:0));let i=!1;return function(e,t,n){if(typeof e[fi]==`function`){var r,i,a,o=e[fi]();function n(e){try{for(;!(r=o.next()).done;)if((e=t(r.value))&&e.then){if(!mi(e))return void e.then(n,a||=J.bind(null,i=new pi,2));e=e.v}i?J(i,1,e):i=e}catch(e){J(i||=new pi,2,e)}}if(n(),o.return){var s=function(e){try{r.done||o.return()}catch{}return e};if(i&&i.then)return i.then(s,(function(e){throw s(e)}));s()}return i}if(!(`length`in e))throw TypeError(`Object is not iterable`);for(var c=[],l=0;l<e.length;l++)c.push(e[l]);return function(e,t,n){var r,i,a=-1;return function o(s){try{for(;++a<e.length&&(!n||!n());)if((s=t(a))&&s.then){if(!mi(s))return void s.then(o,i||=J.bind(null,r=new pi,2));s=s.v}r?J(r,1,s):r=s}catch(e){J(r||=new pi,2,e)}}(),r}(c,(function(e){return t(c[e])}),n)}(r,(function(r){return a=function(){return function(n,i){try{var a=si(oi(e,r),(function(e){if(e.type!==`directory`)throw Error(`Path includes a file: ${t}`)}))}catch(e){return i(e)}return a&&a.then?a.then(void 0,i):a}(0,(function(t){let a=t;return function(){if(a.status===404)return i=!0,di(hi(e,r,{...n,recursive:!1}));throw t}()}))},(o=function(){if(i)return di(hi(e,r,{...n,recursive:!1}))}())&&o.then?o.then(a):a();var a,o}),(function(){return!1}))}));function li(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function ui(){}function di(e,t){if(!t)return e&&e.then?e.then(ui):Promise.resolve()}const fi=typeof Symbol<`u`?Symbol.iterator||(Symbol.iterator=Symbol(`Symbol.iterator`)):`@@iterator`;function J(e,t,n){if(!e.s){if(n instanceof pi){if(!n.s)return void(n.o=J.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(J.bind(null,e,t),J.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}const pi=function(){function e(){}return e.prototype.then=function(t,n){let r=new e,i=this.s;if(i){let e=1&i?t:n;if(e){try{J(r,1,e(this.v))}catch(e){J(r,2,e)}return r}return this}return this.o=function(e){try{let i=e.v;1&e.s?J(r,1,t?t(i):i):n?J(r,1,n(i)):J(r,2,i)}catch(e){J(r,2,e)}},r},e}();function mi(e){return e instanceof pi&&1&e.s}const hi=li((function(e,t,n={}){if(!0===n.recursive)return ci(e,t,n);let r=I({url:N(e.remoteURL,(i=M(t),i.endsWith(`/`)?i:i+`/`)),method:`MKCOL`},e,n);var i;return si(F(r,e),(function(t){V(e,t)}))}));var gi=A(388),_i=A.n(gi);const vi=function(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}((function(e,t,n={}){let r={};if(typeof n.range==`object`&&typeof n.range.start==`number`){let e=`bytes=${n.range.start}-`;typeof n.range.end==`number`&&(e=`${e}${n.range.end}`),r.Range=e}let i=I({url:N(e.remoteURL,M(t)),method:`GET`,headers:r},e,n);return o=function(t){if(V(e,t),r.Range&&t.status!==206){let e=/* @__PURE__ */ Error(`Invalid response code for partial request: ${t.status}`);throw e.status=t.status,e}return n.callback&&setTimeout((()=>{n.callback(t)}),0),t.body},(a=F(i,e))&&a.then||(a=Promise.resolve(a)),o?a.then(o):a;var a,o})),yi=()=>{},bi=function(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}((function(e,t,n){n.url||=N(e.remoteURL,M(t));let r=I(n,e,{});return a=function(t){return V(e,t),t},(i=F(r,e))&&i.then||(i=Promise.resolve(i)),a?i.then(a):i;var i,a})),xi=function(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}((function(e,t,n={}){let r=I({url:N(e.remoteURL,M(t)),method:`DELETE`},e,n);return a=function(t){V(e,t)},(i=F(r,e))&&i.then||(i=Promise.resolve(i)),a?i.then(a):i;var i,a})),Si=function(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}((function(e,t,n={}){return function(r,i){try{var a=(o=oi(e,t,n),s=function(){return!0},c?s?s(o):o:(o&&o.then||(o=Promise.resolve(o)),s?o.then(s):o))}catch(e){return i(e)}var o,s,c;return a&&a.then?a.then(void 0,i):a}(0,(function(e){if(e.status===404)return!1;throw e}))}));function Ci(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const wi=function(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}((function(e,t,n={}){let r=I({url:N(e.remoteURL,M(t),`/`),method:`PROPFIND`,headers:{Accept:`text/plain,application/xml`,Depth:n.deep?`infinity`:`1`}},e,n);return Ci(F(r,e),(function(r){return V(e,r),Ci(r.text(),(function(i){if(!i)throw Error(`Failed parsing directory contents: Empty response`);return Ci(ti(i,e.parsing),(function(i){let a=we(t),o=function(e,t,n,r=!1,i=!1){let a=xe().join(t,`/`),{multistatus:{response:o}}=e,s=o.map((e=>{let t=function(e){try{return e.replace(/^https?:\/\/[^\/]+/,``)}catch(e){throw new j(e,`Failed normalising HREF`)}}(e.href),{propstat:{prop:n}}=e;return ni(n,a===`/`?decodeURIComponent(Te(t)):Te(xe().relative(decodeURIComponent(a),decodeURIComponent(t))),r)}));return i?s:s.filter((e=>e.basename&&(e.type===`file`||e.filename!==n.replace(/\/$/,``))))}(i,we(e.remoteBasePath||e.remotePath),a,n.details,n.includeSelf);return n.glob&&(o=function(e,t){return e.filter((e=>R(e.filename,t,{matchBase:!0})))}(o,n.glob)),Zt(r,o,n.details)}))}))}))}));function Ti(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}const Ei=Ti((function(e,t,n={}){let r=I({url:N(e.remoteURL,M(t)),method:`GET`,headers:{Accept:`text/plain`},transformResponse:[Ai]},e,n);return Di(F(r,e),(function(t){return V(e,t),Di(t.text(),(function(e){return Zt(t,e,n.details)}))}))}));function Di(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const Oi=Ti((function(e,t,n={}){let r=I({url:N(e.remoteURL,M(t)),method:`GET`},e,n);return Di(F(r,e),(function(t){let r;return V(e,t),function(e,t){var n=e();return n&&n.then?n.then(t):t()}((function(){return Di(t.arrayBuffer(),(function(e){r=e}))}),(function(){return Zt(t,r,n.details)}))}))})),ki=Ti((function(e,t,n={}){let{format:r=`binary`}=n;if(r!==`binary`&&r!==`text`)throw new j({info:{code:Fe.InvalidOutputFormat}},`Invalid output format: ${r}`);return r===`text`?Ei(e,t,n):Oi(e,t,n)})),Ai=e=>e;function Y(e){return typeof e==`number`&&Object.is(e,-0)?`-0`:String(e)}function ji(e){return Y(e).replace(/--/g,`- -`).replace(/--/g,`- -`).replace(/-$/,`- `)}function Mi(e){return Y(e).replace(/\]\]>/g,`]]]]><![CDATA[>`)}function Ni(e){return Y(e).replace(/"/g,`"`).replace(/'/g,`'`)}function Pi(e,t,n,r,i){return n.sanitizeName?i(e)?e:n.sanitizeName(e,{isAttribute:t,matcher:r.readOnly()}):e}function Fi(e,t){let n=``;t.format&&(n=`
`);let r=[];if(t.stopNodes&&Array.isArray(t.stopNodes))for(let e=0;e<t.stopNodes.length;e++){let n=t.stopNodes[e];typeof n==`string`?r.push(new Vn(n)):n instanceof Vn&&r.push(n)}let i=function(e,t){if(!Array.isArray(e)||e.length===0)return`1.0`;let n=e[0];if(Bi(n)===`?xml`){let e=n[`:@`];if(e){let n=t.attributeNamePrefix+`version`;if(e[n])return e[n]}}return`1.0`}(e,t),a=Sn(`qName`,{xmlVersion:i});return Ii(e,t,n,new Bn,r,a)}function Ii(e,t,n,r,i,a){let o=``,s=!1;if(t.maxNestedTags&&r.getDepth()>t.maxNestedTags)throw Error(`Maximum nested tags exceeded`);if(!Array.isArray(e)){if(e!=null){let n=Y(e);return n=Ui(n,t),n}return``}for(let c=0;c<e.length;c++){let l=e[c],u=Bi(l);if(u===void 0)continue;let d=u===t.textNodeName||u===t.cdataPropName||u===t.commentPropName||u[0]===`?`?u:Pi(u,!1,t,r,a),f=Li(l[`:@`],t);r.push(d,f);let p=Hi(r,i);if(d===t.textNodeName){let e=l[u];p||(e=t.tagValueProcessor(d,e),e=Ui(e,t)),e=Y(e),s&&(o+=n),o+=e,s=!1,r.pop();continue}if(d===t.cdataPropName){s&&(o+=n),o+=`<![CDATA[${Mi(l[u][0][t.textNodeName])}]]>`,s=!1,r.pop();continue}if(d===t.commentPropName){o+=n+`\x3c!--${ji(l[u][0][t.textNodeName])}--\x3e`,s=!0,r.pop();continue}if(d[0]===`?`){o+=(d===`?xml`?``:n)+`<${d}${Vi(l[`:@`],t,p,r,a)}?>`,s=!0,r.pop();continue}let m=n;m!==``&&(m+=t.indentBy);let h=n+`<${d}${Vi(l[`:@`],t,p,r,a)}`,g;g=p?Ri(l[u],t):Ii(l[u],t,m,r,i,a),t.unpairedTags.indexOf(d)===-1?g&&g.length!==0||!t.suppressEmptyNode?g&&g.endsWith(`>`)?o+=h+`>${g}${n}</${d}>`:(o+=h+`>`,g&&n!==``&&(g.includes(`/>`)||g.includes(`</`))?o+=n+t.indentBy+g+n:o+=g,o+=`</${d}>`):o+=h+`/>`:t.suppressUnpairedNode?o+=h+`>`:o+=h+`/>`,s=!0,r.pop()}return o}function Li(e,t){if(!e||t.ignoreAttributes)return null;let n={},r=!1;for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i.startsWith(t.attributeNamePrefix)?i.substr(t.attributeNamePrefix.length):i]=Ni(e[i]),r=!0);return r?n:null}function Ri(e,t){if(!Array.isArray(e))return e==null?``:Y(e);let n=``;for(let r=0;r<e.length;r++){let i=e[r],a=Bi(i);if(a===t.textNodeName)n+=Y(i[a]);else if(a===t.cdataPropName)n+=i[a][0][t.textNodeName];else if(a===t.commentPropName)n+=i[a][0][t.textNodeName];else{if(a&&a[0]===`?`)continue;if(a){let e=zi(i[`:@`],t),r=Ri(i[a],t);r&&r.length!==0?n+=`<${a}${e}>${r}</${a}>`:n+=`<${a}${e}/>`}}}return n}function zi(e,t){let n=``;if(e&&!t.ignoreAttributes)for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let i=e[r];!0===i&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${Ni(i)}"`}return n}function Bi(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(Object.prototype.hasOwnProperty.call(e,r)&&r!==`:@`)return r}}function Vi(e,t,n,r,i){let a=``;if(e&&!t.ignoreAttributes)for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let s=o.substr(t.attributeNamePrefix.length),c=n?s:Pi(s,!0,t,r,i),l;n?l=e[o]:(l=t.attributeValueProcessor(o,e[o]),l=Ui(l,t)),!0===l&&t.suppressBooleanAttributes?a+=` ${c}`:a+=` ${c}="${Ni(l)}"`}return a}function Hi(e,t){if(!t||t.length===0)return!1;for(let n=0;n<t.length;n++)if(e.matches(t[n]))return!0;return!1}function Ui(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){let r=t.entities[n];e=e.replace(r.regex,r.val)}return e}const Wi={attributeNamePrefix:`@_`,attributesGroupName:!1,textNodeName:`#text`,ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:` `,suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:/* @__PURE__ */ RegExp(`&`,`g`),val:`&`},{regex:/* @__PURE__ */ RegExp(`>`,`g`),val:`>`},{regex:/* @__PURE__ */ RegExp(`<`,`g`),val:`<`},{regex:/* @__PURE__ */ RegExp(`'`,`g`),val:`'`},{regex:/* @__PURE__ */ RegExp(`"`,`g`),val:`"`}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function X(e){if(this.options=Object.assign({},Wi,e),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map((e=>typeof e==`string`&&e.startsWith(`*.`)?`..`+e.substring(2):e))),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let e=0;e<this.options.stopNodes.length;e++){let t=this.options.stopNodes[e];typeof t==`string`?this.stopNodeExpressions.push(new Vn(t)):t instanceof Vn&&this.stopNodeExpressions.push(t)}var t;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=typeof(t=this.options.ignoreAttributes)==`function`?t:Array.isArray(t)?e=>{for(let n of t)if(typeof n==`string`&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Ji),this.processTextOrObjNode=Ki,this.options.format?(this.indentate=qi,this.tagEndChar=`>
`,this.newLine=`
`):(this.indentate=function(){return``},this.tagEndChar=`>`,this.newLine=``)}function Gi(e,t,n,r,i){return n.sanitizeName?i(e)?e:n.sanitizeName(e,{isAttribute:t,matcher:r.readOnly()}):e}function Ki(e,t,n,r,i){let a=this.extractAttributes(e);if(r.push(t,a),this.checkStopNode(r)){let i=this.buildRawContent(e),a=this.buildAttributesForStopNode(e);return r.pop(),this.buildObjectNode(i,t,a,n)}let o=this.j2x(e,n+1,r,i);return r.pop(),t[0]===`?`?this.buildTextValNode(``,t,o.attrStr,n,r):e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n,r):this.buildObjectNode(o.val,t,o.attrStr,n)}function qi(e){return this.options.indentBy.repeat(e)}function Ji(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}X.prototype.build=function(e){if(this.options.preserveOrder)return Fi(e,this.options);{Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e});let t=new Bn,n=function(e,t){let n=e[`?xml`];if(n&&typeof n==`object`){if(t.attributesGroupName&&n[t.attributesGroupName]){let e=n[t.attributesGroupName][t.attributeNamePrefix+`version`];if(e)return e}let e=n[t.attributeNamePrefix+`version`];if(e)return e}return`1.0`}(e,this.options),r=Sn(`qName`,{xmlVersion:n});return this.j2x(e,0,t,r).val}},X.prototype.j2x=function(e,t,n,r){let i=``,a=``;if(this.options.maxNestedTags&&n.getDepth()>=this.options.maxNestedTags)throw Error(`Maximum nested tags exceeded`);let o=this.options.jPath?n.toString():n,s=this.checkStopNode(n);for(let c in e){if(!Object.prototype.hasOwnProperty.call(e,c))continue;let l=c===this.options.textNodeName||c===this.options.cdataPropName||c===this.options.commentPropName||this.options.attributesGroupName&&c===this.options.attributesGroupName||this.isAttribute(c)||c[0]===`?`?c:Gi(c,!1,this.options,n,r);if(e[c]===void 0)this.isAttribute(c)&&(a+=``);else if(e[c]===null)this.isAttribute(c)||l===this.options.cdataPropName||l===this.options.commentPropName?a+=``:l[0]===`?`?a+=this.indentate(t)+`<`+l+`?`+this.tagEndChar:a+=this.indentate(t)+`<`+l+`/`+this.tagEndChar;else if(e[c]instanceof Date)a+=this.buildTextValNode(e[c],l,``,t,n);else if(typeof e[c]!=`object`){let u=this.isAttribute(c);if(u&&!this.ignoreAttributesFn(u,o)){let t=Gi(u,!0,this.options,n,r);i+=this.buildAttrPairStr(t,Y(e[c]),s)}else if(!u){if(c===this.options.textNodeName){let t=this.options.tagValueProcessor(c,Y(e[c]));a+=this.replaceEntitiesValue(t)}else{n.push(l);let r=this.checkStopNode(n);if(n.pop(),r){let n=Y(e[c]);a+=n===``?this.indentate(t)+`<`+l+this.closeTag(l)+this.tagEndChar:this.indentate(t)+`<`+l+`>`+n+`</`+l+this.tagEndChar}else a+=this.buildTextValNode(e[c],l,``,t,n)}}}else if(Array.isArray(e[c])){let i=e[c].length,o=``,s=``;for(let u=0;u<i;u++){let i=e[c][u];if(i!==void 0){if(i===null)l[0]===`?`?a+=this.indentate(t)+`<`+l+`?`+this.tagEndChar:a+=this.indentate(t)+`<`+l+`/`+this.tagEndChar;else if(typeof i==`object`){if(this.options.oneListGroup){n.push(l);let e=this.j2x(i,t+1,n,r);n.pop(),o+=e.val,this.options.attributesGroupName&&i.hasOwnProperty(this.options.attributesGroupName)&&(s+=e.attrStr)}else o+=this.processTextOrObjNode(i,l,t,n,r)}else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(l,i);e=this.replaceEntitiesValue(e),e=Y(e),o+=e}else{n.push(l);let e=this.checkStopNode(n);if(n.pop(),e){let e=Y(i);o+=e===``?this.indentate(t)+`<`+l+this.closeTag(l)+this.tagEndChar:this.indentate(t)+`<`+l+`>`+e+`</`+l+this.tagEndChar}else o+=this.buildTextValNode(i,l,``,t,n)}}}this.options.oneListGroup&&(o=this.buildObjectNode(o,l,s,t)),a+=o}else if(this.options.attributesGroupName&&c===this.options.attributesGroupName){let t=Object.keys(e[c]),a=t.length;for(let o=0;o<a;o++){let a=Gi(t[o],!0,this.options,n,r);i+=this.buildAttrPairStr(a,Y(e[c][t[o]]),s)}}else a+=this.processTextOrObjNode(e[c],l,t,n,r)}return{attrStr:i,val:a}},X.prototype.buildAttrPairStr=function(e,t,n){return n||(t=this.options.attributeValueProcessor(e,Y(t)),t=this.replaceEntitiesValue(t)),this.options.suppressBooleanAttributes&&t===`true`?` `+e:` `+e+`="`+Ni(t)+`"`},X.prototype.extractAttributes=function(e){if(!e||typeof e!=`object`)return null;let t={},n=!1;if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){let r=e[this.options.attributesGroupName];for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e.startsWith(this.options.attributeNamePrefix)?e.substring(this.options.attributeNamePrefix.length):e]=Ni(r[e]),n=!0)}else for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let i=this.isAttribute(r);i&&(t[i]=Ni(e[r]),n=!0)}return n?t:null},X.prototype.buildRawContent=function(e){if(typeof e==`string`)return e;if(typeof e!=`object`||!e)return String(e);if(e[this.options.textNodeName]!==void 0)return e[this.options.textNodeName];let t=``;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||this.isAttribute(n)||this.options.attributesGroupName&&n===this.options.attributesGroupName)continue;let r=e[n];if(n===this.options.textNodeName)t+=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`||typeof e==`number`)t+=`<${n}>${e}</${n}>`;else if(typeof e==`object`&&e){let r=this.buildRawContent(e),i=this.buildAttributesForStopNode(e);t+=r===``?`<${n}${i}/>`:`<${n}${i}>${r}</${n}>`}}else if(typeof r==`object`&&r){let e=this.buildRawContent(r),i=this.buildAttributesForStopNode(r);t+=e===``?`<${n}${i}/>`:`<${n}${i}>${e}</${n}>`}else t+=`<${n}>${r}</${n}>`}return t},X.prototype.buildAttributesForStopNode=function(e){if(!e||typeof e!=`object`)return``;let t=``;if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){let n=e[this.options.attributesGroupName];for(let e in n){if(!Object.prototype.hasOwnProperty.call(n,e))continue;let r=e.startsWith(this.options.attributeNamePrefix)?e.substring(this.options.attributeNamePrefix.length):e,i=n[e];!0===i&&this.options.suppressBooleanAttributes?t+=` `+r:t+=` `+r+`="`+Ni(i)+`"`}}else for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=this.isAttribute(n);if(r){let i=e[n];!0===i&&this.options.suppressBooleanAttributes?t+=` `+r:t+=` `+r+`="`+Ni(i)+`"`}}return t},X.prototype.buildObjectNode=function(e,t,n,r){if(e===``)return t[0]===`?`?this.indentate(r)+`<`+t+n+`?`+this.tagEndChar:this.indentate(r)+`<`+t+n+this.closeTag(t)+this.tagEndChar;if(t[0]===`?`)return this.indentate(r)+`<`+t+n+`?`+this.tagEndChar;{let i=`</`+t+this.tagEndChar,a=``;return t[0]===`?`&&(a=`?`,i=``),!n&&n!==``||e.indexOf(`<`)!==-1?!1!==this.options.commentPropName&&t===this.options.commentPropName&&a.length===0?this.indentate(r)+`\x3c!--${ji(e)}--\x3e`+this.newLine:this.indentate(r)+`<`+t+n+a+this.tagEndChar+e+this.indentate(r)+i:this.indentate(r)+`<`+t+n+a+`>`+e+i}},X.prototype.closeTag=function(e){let t=``;return this.options.unpairedTags.indexOf(e)===-1?t=this.options.suppressEmptyNode?`/`:`></${e}`:this.options.suppressUnpairedNode||(t=`/`),t},X.prototype.checkStopNode=function(e){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let t=0;t<this.stopNodeExpressions.length;t++)if(e.matches(this.stopNodeExpressions[t]))return!0;return!1},X.prototype.buildTextValNode=function(e,t,n,r,i){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName){let t=Mi(e);return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine}if(!1!==this.options.commentPropName&&t===this.options.commentPropName){let t=ji(e);return this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine}if(t[0]===`?`)return this.indentate(r)+`<`+t+n+`?`+this.tagEndChar;{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),i=Y(i),i===``?this.indentate(r)+`<`+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+`<`+t+n+`>`+i+`</`+t+this.tagEndChar}},X.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};const Yi=X;function Xi(e){return new Yi({attributeNamePrefix:`@_`,format:!0,ignoreAttributes:!1,suppressEmptyNode:!0}).build(Zi({lockinfo:{"@_xmlns:d":`DAV:`,lockscope:{exclusive:{}},locktype:{write:{}},owner:{href:e}}},`d`))}function Zi(e,t){let n={...e};for(let e in n)n.hasOwnProperty(e)&&(n[e]&&typeof n[e]==`object`&&e.indexOf(`:`)===-1?(n[`${t}:${e}`]=Zi(n[e],t),delete n[e]):!1===/^@_/.test(e)&&(n[`${t}:${e}`]=n[e],delete n[e]));return n}function Qi(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}function $i(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}const ea=$i((function(e,t,n,r={}){let i=I({url:N(e.remoteURL,M(t)),method:`UNLOCK`,headers:{"Lock-Token":n}},e,r);return Qi(F(i,e),(function(t){if(V(e,t),t.status!==204&&t.status!==200)throw Xt(t)}))})),ta=$i((function(e,t,n={}){let{refreshToken:r,timeout:i=na}=n,a={Accept:`text/plain,application/xml`,Timeout:i};r&&(a.If=r);let o=I({url:N(e.remoteURL,M(t)),method:`LOCK`,headers:a,data:Xi(e.contactHref)},e,n);return Qi(F(o,e),(function(t){return V(e,t),Qi(t.text(),(function(e){let n=function(e){return new Kr({removeNSPrefix:!0,parseAttributeValue:!0,parseTagValue:!0}).parse(e)}(e),r=q().get(n,`prop.lockdiscovery.activelock.locktoken.href`),i=q().get(n,`prop.lockdiscovery.activelock.timeout`);if(!r)throw Xt(t,`No lock token received: `);return{token:r,serverTimeout:i}}))}))})),na=`Infinite, Second-4100000000`;function ra(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const ia=function(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}((function(e,t={}){let n=t.path||`/`,r=I({url:N(e.remoteURL,n),method:`PROPFIND`,headers:{Accept:`text/plain,application/xml`,Depth:`0`}},e,t);return ra(F(r,e),(function(n){return V(e,n),ra(n.text(),(function(r){return ra(ti(r,e.parsing),(function(e){return Zt(n,function(e){try{let[t]=e.multistatus.response,{propstat:{prop:{"quota-used-bytes":n,"quota-available-bytes":r}}}=t;return n!==void 0&&r!==void 0?{used:parseInt(String(n),10),available:ii(r)}:null}catch{}return null}(e),t.details)}))}))}))}));function aa(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const oa=function(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}((function(e,t,n={}){let{details:r=!1}=n,i=I({url:N(e.remoteURL,M(t)),method:`SEARCH`,headers:{Accept:`text/plain,application/xml`,"Content-Type":e.headers[`Content-Type`]||`application/xml; charset=utf-8`}},e,n);return aa(F(i,e),(function(n){return V(e,n),aa(n.text(),(function(i){return aa(ti(i,e.parsing),(function(e){return Zt(n,function(e,t,n){let r={truncated:!1,results:[]};return r.truncated=e.multistatus.response.some((e=>(e.status||e.propstat?.status).split(` `,3)?.[1]===`507`&&e.href.replace(/\/$/,``).endsWith(M(t).replace(/\/$/,``)))),e.multistatus.response.forEach((e=>{if(e.propstat===void 0)return;let t=e.href.split(`/`).map(decodeURIComponent).join(`/`);r.results.push(ni(e.propstat.prop,t,n))})),r}(e,t,r),r)}))}))}))})),sa=function(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}((function(e,t,n,r={}){let i=I({url:N(e.remoteURL,M(t)),method:`MOVE`,headers:{Destination:N(e.remoteURL,M(n)),Overwrite:!1===r.overwrite?`F`:`T`}},e,r);return o=function(t){V(e,t)},(a=F(i,e))&&a.then||(a=Promise.resolve(a)),o?a.then(o):a;var a,o}));var ca=A(172);function la(e){if(Qe(e))return e.byteLength;if($e(e))return e.length;if(typeof e==`string`)return(0,ca.d)(e);throw new j({info:{code:Fe.DataTypeNoLength}},`Cannot calculate data length: Invalid type`)}const ua=function(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}((function(e,t,n,r={}){let{contentLength:i=!0,overwrite:a=!0}=r,o={"Content-Type":`application/octet-stream`};!1===i||(o[`Content-Length`]=typeof i==`number`?`${i}`:`${la(n)}`),a||(o[`If-None-Match`]=`*`);let s=I({url:N(e.remoteURL,M(t)),method:`PUT`,headers:o,data:n},e,r);return l=function(t){try{V(e,t)}catch(e){let t=e;if(t.status!==412||a)throw t;return!1}return!0},(c=F(s,e))&&c.then||(c=Promise.resolve(c)),l?c.then(l):c;var c,l})),da=function(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}((function(e,t,n={}){let r=I({url:N(e.remoteURL,M(t)),method:`OPTIONS`},e,n);return a=function(t){try{V(e,t)}catch(e){throw e}return{compliance:(t.headers.get(`DAV`)??``).split(`,`).map((e=>e.trim())),server:t.headers.get(`Server`)??``}},(i=F(r,e))&&i.then||(i=Promise.resolve(i)),a?i.then(a):i;var i,a}));function fa(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}const pa=ga((function(e,t,n,r,i,a={}){if(n>r||n<0)throw new j({info:{code:Fe.InvalidUpdateRange}},`Invalid update range ${n} for partial update`);let o={"Content-Type":`application/octet-stream`,"Content-Length":``+(r-n+1),"Content-Range":`bytes ${n}-${r}/*`},s=I({url:N(e.remoteURL,M(t)),method:`PUT`,headers:o,data:i},e,a);return fa(F(s,e),(function(t){V(e,t)}))}));function ma(e,t){var n=e();return n&&n.then?n.then(t):t(n)}const ha=ga((function(e,t,n,r,i,a={}){if(n>r||n<0)throw new j({info:{code:Fe.InvalidUpdateRange}},`Invalid update range ${n} for partial update`);let o={"Content-Type":`application/x-sabredav-partialupdate`,"Content-Length":``+(r-n+1),"X-Update-Range":`bytes=${n}-${r}`},s=I({url:N(e.remoteURL,M(t)),method:`PATCH`,headers:o,data:i},e,a);return fa(F(s,e),(function(t){V(e,t)}))}));function ga(e){return function(){var t=[...arguments];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}const _a=ga((function(e,t,n,r,i,a={}){return fa(da(e,t,a),(function(o){let s=!1;return ma((function(){if(o.compliance.includes(`sabredav-partialupdate`))return fa(ha(e,t,n,r,i,a),(function(e){return s=!0,e}))}),(function(c){let l=!1;return s?c:ma((function(){if(o.server.includes(`Apache`)&&o.compliance.includes(`<http://apache.org/dav/propset/fs/1>`))return fa(pa(e,t,n,r,i,a),(function(e){return l=!0,e}))}),(function(e){if(l)return e;throw new j({info:{code:Fe.NotSupported}},`Not supported`)}))}))}))}));function va(e,t={}){let{authType:n=null,remoteBasePath:r,contactHref:i=`https://github.com/perry-mitchell/webdav-client/blob/master/LOCK_CONTACT.md`,entityDecoder:a,ha1:o,headers:s={},httpAgent:c,httpsAgent:l,password:u,token:d,username:f,withCredentials:p}=t,m=n;m||=f||u?P.Password:P.None;let h={authType:m,remoteBasePath:r,contactHref:i,ha1:o,headers:Object.assign({},s),httpAgent:c,httpsAgent:l,password:u,parsing:{attributeNamePrefix:t.attributeNamePrefix??`@`,attributeParsers:[],entityDecoder:a,tagParsers:[Zr]},remotePath:Ee(e),remoteURL:e,token:d,username:f,withCredentials:p};return Ie(h,f,u,d,o),{copyFile:(e,t,n)=>Qt(h,e,t,n),createDirectory:(e,t)=>hi(h,e,t),createReadStream:(e,t)=>function(e,t,n={}){let r=new(_i()).PassThrough;return vi(e,t,n).then((e=>{e.pipe(r)})).catch((e=>{r.emit(`error`,e)})),r}(h,e,t),createWriteStream:(e,t,n)=>function(e,t,n={},r=yi){let i=new(_i()).PassThrough,a={};!1===n.overwrite&&(a[`If-None-Match`]=`*`);let o=I({url:N(e.remoteURL,M(t)),method:`PUT`,headers:a,data:i,maxRedirects:0},e,n);return F(o,e).then((t=>V(e,t))).then((e=>{setTimeout((()=>{r(e)}),0)})).catch((e=>{i.emit(`error`,e)})),i}(h,e,t,n),customRequest:(e,t)=>bi(h,e,t),deleteFile:(e,t)=>xi(h,e,t),exists:(e,t)=>Si(h,e,t),getDirectoryContents:(e,t)=>wi(h,e,t),getFileContents:(e,t)=>ki(h,e,t),getFileDownloadLink:e=>function(e,t){let n=N(e.remoteURL,M(t)),r=/^https:/i.test(n)?`https`:`http`;switch(e.authType){case P.None:break;case P.Password:{let t=Ne(e.headers.Authorization.replace(/^Basic /i,``).trim());n=n.replace(/^https?:\/\//,`${r}://${t}@`);break}default:throw new j({info:{code:Fe.LinkUnsupportedAuthType}},`Unsupported auth type for file link: ${e.authType}`)}return n}(h,e),getFileUploadLink:e=>function(e,t){let n=`${N(e.remoteURL,M(t))}?Content-Type=application/octet-stream`,r=/^https:/i.test(n)?`https`:`http`;switch(e.authType){case P.None:break;case P.Password:{let t=Ne(e.headers.Authorization.replace(/^Basic /i,``).trim());n=n.replace(/^https?:\/\//,`${r}://${t}@`);break}default:throw new j({info:{code:Fe.LinkUnsupportedAuthType}},`Unsupported auth type for file link: ${e.authType}`)}return n}(h,e),getHeaders:()=>Object.assign({},h.headers),getQuota:e=>ia(h,e),lock:(e,t)=>ta(h,e,t),moveFile:(e,t,n)=>sa(h,e,t,n),putFileContents:(e,t,n)=>ua(h,e,t,n),partialUpdateFileContents:(e,t,n,r,i)=>_a(h,e,t,n,r,i),getDAVCompliance:e=>da(h,e),search:(e,t)=>oa(h,e,t),setHeaders:e=>{h.headers=Object.assign({},e)},stat:(e,t)=>oi(h,e,t),unlock:(e,t,n)=>ea(h,e,t,n),registerAttributeParser:e=>{h.parsing.attributeParsers.push(e)},registerTagParser:e=>{h.parsing.tagParsers.push(e)}}}var ya=`@dbp-toolkit/file-handling`;function ba(){return v`
/**************************\\
Modal Styles
\\**************************/
.file-handling-modal {
--dbp-modal-height: 70vh;
--dbp-modal-width: 70%;
--dbp-modal-min-width: 60%;
--dbp-modal-max-width: 600px;
--dbp-modal-min-height: 50%;
--dbp-modal-max-height: 90vh;
--dbp-modal-container-height: 100%;
--dbp-modal-content-min-height: 0;
--dbp-modal-content-slot-height: 100%;
--dbp-modal-content-slot-min-height: 0;
--dbp-modal-slotted-content-height: 100%;
--dbp-modal-slotted-content-min-height: 0;
--dbp-modal-content-overflow-y: hidden;
--dbp-modal-full-height-line-left: 150px;
--dbp-modal-full-height-line-border: var(--dbp-border);
--dbp-modal-title-padding: 0.25em 0 0
calc(var(--dbp-modal-full-height-line-left) + 20px);
}
.file-handling-modal.modal-container-full-size {
--dbp-modal-height: 100%;
--dbp-modal-width: 100%;
--dbp-modal-min-width: 100%;
--dbp-modal-min-height: 100%;
--dbp-modal-max-height: 100%;
}
.nextcloud-modal {
--dbp-modal-content-overflow-y: hidden;
}
.file-handling-modal-content {
grid-template-columns: 150px 1fr;
grid-template-rows: 1fr;
gap: 1px 1px;
grid-template-areas: 'sidebar main';
position: relative;
display: grid;
height: 100%;
width: 100%;
min-height: 0;
box-sizing: border-box;
}
.modal-nav {
overflow: hidden;
background-color: var(--dbp-background);
border-right: none;
grid-area: sidebar;
}
.modal-nav > button,
.modal-nav > div {
cursor: pointer;
padding: 5px;
text-align: center;
width: 100%;
background-color: var(--dbp-background);
color: var(--dbp-content);
border: 0;
}
.modal-nav > button:focus-visible {
box-shadow: inset 0px 0px 3px 1px var(--dbp-primary);
}
.modal-nav .nav-icon {
width: 35px;
height: 35px;
}
.modal-nav .active p {
font-weight: bold;
}
.modal-nav .active .nav-icon {
color: var(--dbp-accent);
}
.modal-content {
padding: 10px 20px 20px 20px;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
min-height: 0;
box-sizing: border-box;
}
.modal-content .source-main {
/*flex-grow: 1;*/
/*justify-content: center;*/
/*align-items: center;*/
height: 100%;
width: 100%;
display: flex;
align-items: flex-end;
min-height: 0;
box-sizing: border-box;
}
.modal-content .source-main.hidden {
display: none;
}
.modal-header {
grid-area: header;
display: flex;
padding: 10px 20px 0px 20px;
flex-direction: row-reverse;
justify-content: space-between;
align-items: center;
}
.clipboard-container {
height: 100%;
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
overflow-x: auto;
}
/**************************\\
Picker Styles
\\**************************/
#nextcloud-file-picker,
#clipboard-file-picker {
width: 100%;
height: 100%;
margin: var(--FUMargin, 0px);
padding: var(--FUPadding, 20px);
box-sizing: border-box;
}
#fileElem {
position: absolute !important;
clip: rect(1px, 1px, 1px, 1px);
overflow: hidden;
height: 1px;
width: 1px;
word-wrap: normal;
}
#fileElem:focus + button {
outline: none !important;
outline-width: 0 !important;
box-shadow: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: 0px 0px 5px 1px var(--dbp-primary);
}
#nextcloud-file-picker.hidden {
display: none;
}
#modal-picker-content {
grid-area: main;
}
/**********************************\\
Tabulator table styles
\\*********************************/
.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
display: inline-flex;
padding: 0px;
}
.checkmark {
height: 20px;
width: 20px;
left: 10px;
top: 8px;
}
.button-container .checkmark::after {
left: 7px;
top: 2px;
width: 5px;
height: 11px;
}
/*.tabulator .tabulator-tableHolder {*/
/* overflow: hidden;*/
/*}*/
.force-no-select {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/*.tabulator .tabulator-tableHolder {*/
/* !* height: unset !important; !*TODO find a better way to do this*!*/
/*}*/
/* .tabulator-row-handle {
padding: 0px !important;
}*/
/*.tabulator .tabulator-header .tabulator-col {*/
/* min-height: 37px !important;*/
/*}*/
.filename {
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
white-space: nowrap;
}
.modal--loading-indicator {
--dbp-modal-width: 300px;
--dbp-modal-max-height: 300px;
--dbp-modal-content-overflow-y: hidden;
}
.modal--loading-indicator [slot='content'] {
text-align: center;
}
.select-all-icon {
height: 40px;
position: absolute;
top: -1.1em;
}
.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title {
padding-top: 4px;
padding-bottom: 4px;
font-weight: normal;
font-size: 1rem;
}
@media only screen and (max-width: 768px) {
.tabulator .tabulator-tableHolder {
white-space: inherit;
}
.modal-container {
width: 100%;
height: 100%;
max-width: 100%;
}
}
/**************************\\
Tablett Portrait Styles
\\**************************/
@media only screen and (max-width: 768px) {
.file-handling-modal {
--dbp-modal-full-height-line-display: none;
--dbp-modal-title-padding: 0.25em 0 0 0;
--dbp-modal-width: calc(100% - 40px);
--dbp-modal-min-width: calc(100% - 40px);
--dbp-modal-max-width: calc(100% - 40px);
--dbp-modal-height: 100%;
--dbp-modal-min-height: 100%;
--dbp-modal-max-height: 100%;
--dbp-modal-full-height-line-left: 0;
}
.file-handling-modal-content {
grid-template-columns: 1fr;
grid-template-rows: minmax(0, 1fr) auto;
grid-template-areas: 'main' 'nav';
gap: 0;
}
.nav-wrapper.modal-nav {
display: flex;
grid-area: nav;
width: 100%;
height: auto;
border: none;
border-top: var(--dbp-border);
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
.nav-wrapper.modal-nav::-webkit-scrollbar {
display: none;
}
.nav-wrapper.modal-nav > nav.modal-nav {
display: flex;
width: 100%;
height: auto;
}
.modal-nav > button,
.modal-nav > div {
flex: 1 0 auto;
}
.modal-nav .nav-icon {
height: 20px;
}
.modal-content {
grid-area: main;
padding: 0;
width: 100%;
min-width: 0;
overflow: auto;
}
.modal-content .source-main {
width: 100%;
}
.modal-header {
grid-area: header;
padding: 5px;
}
#nextcloud-file-picker,
#clipboard-file-picker {
padding: 0px;
}
}
/**************************\\
Mobile Portrait Styles
\\**************************/
@media only screen and (max-width: 768px) {
}
`}const xa=new TextEncoder,Sa=new TextDecoder,Ca=new TextDecoder(`utf-8`,{fatal:!0}),wa=2**32;function Ta(...e){let t=e.reduce((e,{length:t})=>e+t,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Ea(e,t,n){if(t<0||t>=wa)throw RangeError(`value must be >= 0 and <= ${wa-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,t&255],n)}function Da(e){let t=Math.floor(e/wa),n=e%wa,r=/* @__PURE__ */ new Uint8Array(8);return Ea(r,t,0),Ea(r,n,4),r}function Oa(e){let t=/* @__PURE__ */ new Uint8Array(4);return Ea(t,e),t}const ka=/[^\x00-\x7f]/;function Aa(e){if(typeof e==`string`&&e.length>=128){if(ka.test(e))throw TypeError(`non-ASCII string encountered in encode()`);return xa.encode(e)}let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>127)throw TypeError(`non-ASCII string encountered in encode()`);t[n]=r}return t}function ja(e,t=!1){if(Uint8Array.prototype.toBase64)return e.toBase64({alphabet:t?`base64url`:`base64`,omitPadding:t});let n=32768,r=[];for(let t=0;t<e.length;t+=n)r.push(String.fromCharCode.apply(null,e.subarray(t,t+n)));let i=btoa(r.join(``));return t?i.replace(/=/g,``).replace(/\+/g,`-`).replace(/\//g,`_`):i}function Ma(e,t=!1){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e,{alphabet:t?`base64url`:`base64`});if(t){if(e.includes(`+`)||e.includes(`/`))throw TypeError(`Invalid base64url`);e=e.replace(/-/g,`+`).replace(/_/g,`/`)}let n=atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}async function Na(e,t){let n=`SHA-${e.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(n,t))}var Pa=class extends Error{static code=`ERR_JOSE_GENERIC`;code=`ERR_JOSE_GENERIC`;constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},Fa=class extends Pa{static code=`ERR_JOSE_ALG_NOT_ALLOWED`;code=`ERR_JOSE_ALG_NOT_ALLOWED`},Z=class extends Pa{static code=`ERR_JOSE_NOT_SUPPORTED`;code=`ERR_JOSE_NOT_SUPPORTED`},Ia=class extends Pa{static code=`ERR_JWE_DECRYPTION_FAILED`;code=`ERR_JWE_DECRYPTION_FAILED`;constructor(e=`decryption operation failed`,t){super(e,t)}},Q=class extends Pa{static code=`ERR_JWE_INVALID`;code=`ERR_JWE_INVALID`};function La(e){try{return Ma(typeof e==`string`?e:Sa.decode(e),!0)}catch(e){throw TypeError(`The input to be decoded is not correctly encoded.`,{cause:e})}}function $(e){return ja(typeof e==`string`?xa.encode(e):e,!0)}function Ra(e,t){if(!(e instanceof Uint8Array))throw TypeError(`${t} must be an instance of Uint8Array`)}function za(e){if(typeof e!=`object`||!e||Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Ba(...e){let t=/* @__PURE__ */ new Set;for(let n of e)if(n)for(let e of Object.keys(n)){if(t.has(e))return!1;t.add(e)}return!0}function Va(e,t){if(e!==void 0)throw TypeError(`${t} can only be called once`)}function Ha(e,t,n){try{return La(e)}catch{throw new n(`Failed to base64url decode the ${t}`)}}function Ua(e,t,n){try{return Aa(e)}catch{throw new n(`The ${t} is not a valid base64url string`)}}function Wa(e,t,n){let r;try{r=JSON.parse(Ca.decode(La(e)))}catch{throw new t(n)}if(!za(r))throw new t(n);return r}const Ga={__proto__:null};function Ka(e,t){if(t!==void 0&&(!Array.isArray(t)||t.some(e=>typeof e!=`string`)))throw TypeError(`"${e}" option must be an array of strings`);return t===void 0?void 0:new Set(t)}function qa(e,t){let{crit:n}=t??{};if(Array.isArray(n)&&new Set(n).size!==n.length)throw new e(`"crit" (Critical) Header Parameter MUST NOT contain duplicate values`)}function Ja(e,t,n,r,i){if(i.crit!==void 0&&r?.crit===void 0)throw new e(`"crit" (Critical) Header Parameter MUST be integrity protected`);if(!r||r.crit===void 0)return[];if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(e=>typeof e!=`string`||e.length===0))throw new e(`"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present`);let a=n===void 0?t:{__proto__:null,...n,...t};for(let t of r.crit){if(!(t in a))throw new Z(`Extension Header Parameter "${t}" is not recognized`);if(!Object.hasOwn(i,t)||i[t]===void 0)throw new e(`Extension Header Parameter "${t}" is missing`);if(a[t]&&(!Object.hasOwn(r,t)||r[t]===void 0))throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}return r.crit}function Ya(e,t){let n,r;try{n=JSON.stringify(t),r=JSON.parse(n)}catch(t){throw new e(`JOSE Header is not valid JSON`,{cause:t})}if(!za(r))throw new e(`JOSE Header is not a JSON object`);return[r,n]}const Xa=e=>e[Symbol.toStringTag],Za=(e,t,n)=>{let{alg:r}=e;if(t.use!==void 0){let e=n===`sign`||n===`verify`?`sig`:`enc`;if(t.use!==e)throw TypeError(`Invalid key for this operation, its "use" must be "${e}" when present`)}if(t.alg!==void 0&&t.alg!==r)throw TypeError(`Invalid key for this operation, its "alg" must be "${r}" when present`);if(Array.isArray(t.key_ops)){let r=n===`encrypt`||n===`decrypt`?e.ops?.[n===`encrypt`?0:1]:n;if(r&&!t.key_ops.includes(r))throw TypeError(`Invalid key for this operation, its "key_ops" must include "${r}" when present`)}};async function Qa(e,t,n){let{alg:r,secret:i}=e,a=n===`decrypt`||n===`sign`;if(i&&t instanceof Uint8Array)return t;let o,s;if(za(t)){if(o=mo(t),typeof o.kty!=`string`)throw so(r,t,i);if(!(i?o.kty===`oct`&&typeof o.k==`string`:o.kty!==`oct`&&(a?o.kty===`AKP`&&typeof o.priv==`string`||typeof o.d==`string`:o.d===void 0&&o.priv===void 0)))throw TypeError(i?`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`:`JSON Web Key for this operation must be a ${a?`private`:`public`} JWK`);if(Za(e,o,n),o.kty===`oct`)return La(o.k);if(!Object.isFrozen(t)){let{key_ops:e}=t;Array.isArray(e)&&Object.freeze(e),Object.freeze(t)}}else{if(!io(t))throw so(r,t,i);let e=i?`secret`:a?`private`:`public`;if(t.type!==e&&(i||[`secret`,`public`,`private`].includes(t.type)))throw TypeError(`${Xa(t)} instances must be of type "${e}" for the ${r} algorithm`);if(no(t))return t;if(s=t,s.type===`secret`)return s.export()}$a||=/* @__PURE__ */ new WeakMap;let c=t,l=$a.get(c);if(l?.[r])return l[r];if(l||$a.set(c,l={}),s&&typeof s.toCryptoKey==`function`){let t=s.type===`public`,n=eo[s.asymmetricKeyDetails?.namedCurve],i=e.resolve?.({crv:n,asymmetricKeyType:s.asymmetricKeyType})??e.subtle;return l[r]=s.toCryptoKey(i,t,e.usages[+!t])}return o??=s.export({format:`jwk`}),o.alg=r,l[r]=await go(e,o)}let $a;const eo={__proto__:null,prime256v1:`P-256`,secp384r1:`P-384`,secp521r1:`P-521`};function to(e){if(!no(e))throw Error(`CryptoKey instance expected`)}const no=e=>{if(e?.[Symbol.toStringTag]===`CryptoKey`)return!0;try{return e instanceof CryptoKey}catch{return!1}},ro=e=>e?.[Symbol.toStringTag]===`KeyObject`,io=e=>no(e)||ro(e);function ao(e,t,...n){if(n.length>2){let t=n.pop();e+=`one of type ${n.join(`, `)}, or ${t}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t==`function`&&t.name?e+=` Received function ${t.name}`:typeof t==`object`&&t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}const oo=(e,...t)=>ao(`Key must be `,e,...t);function so(e,t,n){let r=[`CryptoKey`,`KeyObject`,`JSON Web Key`];return n&&r.push(`Uint8Array`),TypeError(ao(`Key for the ${e} algorithm must be `,t,...r))}const co=(e,t=`algorithm.name`)=>/* @__PURE__ */ TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);function lo(e,t){if(t&&!e.usages.includes(t))throw TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function uo(e,t){let{modulusLength:n}=t.algorithm;if(typeof n!=`number`||n<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}function fo(e,t,n){let r=e.algorithm;if(r.name!==t.name)throw co(t.name);if(t.hash&&r.hash?.name!==t.hash)throw co(t.hash,`algorithm.hash`);if(t.namedCurve&&r.namedCurve!==t.namedCurve)throw co(t.namedCurve,`algorithm.namedCurve`);if(t.length!==void 0&&r.length!==t.length)throw co(t.length,`algorithm.length`);lo(e,n)}function po(e){return{__proto__:null,...e}}function mo(e){let t=po(e);if(t.ext!==void 0&&typeof t.ext!=`boolean`)throw TypeError(`"ext" (Extractable) Parameter must be a boolean`);if(t.key_ops!==void 0){let e=t.key_ops,n=Array.isArray(e)?[...e]:void 0;if(!n||n.some(e=>typeof e!=`string`)||new Set(n).size!==n.length)throw TypeError(`"key_ops" (Key Operations) Parameter must be an array of unique strings`);t.key_ops=n}return t}function ho(e){if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`"extractable" option must be a boolean`);return e}async function go(e,t,n){if(!e.kty.includes(t.kty))throw new Z(`Invalid or unsupported JWK "alg" (Algorithm) Parameter value`);let r=e.resolve?.({kty:t.kty,crv:t.crv})??e.subtle,i=!!(t.d||t.priv),a={...t,ext:n??t.ext};return a.kty!==`AKP`&&delete a.alg,delete a.use,crypto.subtle.importKey(`jwk`,a,r,a.ext??!i,t.key_ops??e.usages[+!!i])}async function _o(e,t,n,r=!1){return e instanceof Uint8Array&&(e=await crypto.subtle.importKey(`raw`,e,t,r,[n])),fo(e,t,n),e}const vo=e=>crypto.getRandomValues(new Uint8Array(e.cekBits>>3));function yo(e,t){let n=e.byteLength<<3;if(n!==t)throw new Q(`Invalid Content Encryption Key length. Expected ${t} bits, got ${n} bits`)}const bo=e=>crypto.getRandomValues(new Uint8Array(e.ivBits>>3));function xo(e,t){if(t.length<<3!==e.ivBits)throw new Q(`Invalid Initialization Vector length`)}async function So(e,t,n){if(!(t instanceof Uint8Array))throw TypeError(oo(t,`Uint8Array`));let r=e.cekBits>>1;return[await crypto.subtle.importKey(`raw`,t.subarray(r>>3),`AES-CBC`,!1,[n]),await crypto.subtle.importKey(`raw`,t.subarray(0,r>>3),{hash:`SHA-${r<<1}`,name:`HMAC`},!1,[`sign`]),r]}async function Co(e,t,n){return new Uint8Array((await crypto.subtle.sign(`HMAC`,e,t)).slice(0,n>>3))}async function wo(e,t,n,r,i){let[a,o,s]=await So(e,n,`encrypt`),c=new Uint8Array(await crypto.subtle.encrypt({iv:r,name:`AES-CBC`},a,t));return{ciphertext:c,tag:await Co(o,Ta(i,r,c,Da(i.length*8)),s),iv:r}}async function To(e,t){let n={name:`HMAC`,hash:`SHA-256`},r=await crypto.subtle.generateKey(n,!1,[`sign`,`verify`]),i=await crypto.subtle.sign(n,r,e);return crypto.subtle.verify(n,r,i,t)}async function Eo(e,t,n,r,i,a){let[o,s,c]=await So(e,t,`decrypt`),l=await Co(s,Ta(a,r,n,Da(a.length*8)),c);try{if(await To(i,l))return new Uint8Array(await crypto.subtle.decrypt({iv:r,name:`AES-CBC`},o,n))}catch{}throw new Ia}async function Do(e,t,n,r,i){if(!no(n)&&!(n instanceof Uint8Array))throw TypeError(oo(n,`CryptoKey`,`KeyObject`,`Uint8Array`,`JSON Web Key`));if(r?xo(e,r):r=bo(e),n instanceof Uint8Array&&yo(n,e.cekBits),e.cbc)return wo(e,t,n,r,i);let a=await _o(n,e.subtle,`encrypt`),o=new Uint8Array(await crypto.subtle.encrypt({additionalData:i,iv:r,name:`AES-GCM`,tagLength:128},a,t));return{ciphertext:o.subarray(0,-16),tag:o.subarray(-16),iv:r}}async function Oo(e,t,n,r,i,a){if(!no(t)&&!(t instanceof Uint8Array))throw TypeError(oo(t,`CryptoKey`,`KeyObject`,`Uint8Array`,`JSON Web Key`));if(!r)throw new Q(`JWE Initialization Vector missing`);if(!i)throw new Q(`JWE Authentication Tag missing`);if(!e.cbc&&i.length!==16)throw new Q(`Invalid Authentication Tag length`);if(xo(e,r),t instanceof Uint8Array&&yo(t,e.cekBits),e.cbc)return Eo(e,t,n,r,i,a);let o=await _o(t,e.subtle,`decrypt`);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:a,iv:r,name:`AES-GCM`,tagLength:128},o,Ta(n,i)))}catch{throw new Ia}}function ko(e){let t={__proto__:null};for(let n in e)t[n]={...e[n],alg:n};return t}const Ao=[[`encrypt`,`wrapKey`],[`decrypt`,`unwrapKey`]],jo=[[],[`deriveBits`]],Mo=[[],[]];function No(e){return{kty:[`RSA`],mode:`key-encryption`,subtle:{name:`RSA-OAEP`,hash:`SHA-${e}`},usages:Ao,ops:[`wrapKey`,`unwrapKey`]}}function Po(e){return{kty:[`EC`,`OKP`],mode:e,subtle:{name:`ECDH`},resolve:({kty:e,crv:t,asymmetricKeyType:n})=>{if(t===`X25519`||n===`x25519`)return{name:`X25519`};if(e===`OKP`)throw new Z(`Invalid or unsupported JWK "alg" (Algorithm) Parameter value`);return{name:`ECDH`,namedCurve:t}},usages:jo,ops:[void 0,`deriveBits`]}}function Fo(e,t=!1){return{kty:[`oct`],mode:`key-wrapping`,secret:!0,subtle:{name:t?`AES-GCM`:`AES-KW`,length:e},usages:Mo,ops:t?[`encrypt`,`decrypt`]:[`wrapKey`,`unwrapKey`]}}function Io(){return{kty:[`oct`],mode:`key-wrapping`,secret:!0,subtle:{name:`PBKDF2`},usages:Mo,ops:[`deriveBits`,`deriveBits`]}}const Lo=ko({dir:{kty:[`oct`],mode:`direct-encryption`,secret:!0,subtle:{name:`AES-GCM`},usages:Mo,ops:[`encrypt`,`decrypt`]},"RSA-OAEP":No(1),"RSA-OAEP-256":No(256),"RSA-OAEP-384":No(384),"RSA-OAEP-512":No(512),"ECDH-ES":Po(`direct-key-agreement`),"ECDH-ES+A128KW":Po(`key-agreement-with-key-wrapping`),"ECDH-ES+A192KW":Po(`key-agreement-with-key-wrapping`),"ECDH-ES+A256KW":Po(`key-agreement-with-key-wrapping`),A128KW:Fo(128),A192KW:Fo(192),A256KW:Fo(256),A128GCMKW:Fo(128,!0),A192GCMKW:Fo(192,!0),A256GCMKW:Fo(256,!0),"PBES2-HS256+A128KW":Io(),"PBES2-HS384+A192KW":Io(),"PBES2-HS512+A256KW":Io()}),Ro=[`encrypt`,`decrypt`];function zo(e,t=!1){return{kty:[`oct`],secret:!0,subtle:{name:t?`AES-CBC`:`AES-GCM`,length:e},usages:Mo,ops:Ro,cekBits:e,ivBits:t?128:96,cbc:t}}const Bo=ko({A128GCM:zo(128),A192GCM:zo(192),A256GCM:zo(256),"A128CBC-HS256":zo(256,!0),"A192CBC-HS384":zo(384,!0),"A256CBC-HS512":zo(512,!0)});function Vo(e,t){throw new Z(`Invalid or unsupported "${e}" (JWE ${t}) header value`)}function Ho(e){return(typeof e==`string`?Lo[e]:void 0)??Vo(`alg`,`Algorithm`)}function Uo(e){return e.mode===`key-wrapping`||e.mode===`key-encryption`||e.mode===`key-agreement-with-key-wrapping`}function Wo(e){return(typeof e==`string`?Bo[e]:void 0)??Vo(`enc`,`Encryption Algorithm`)}function Go(e,t){if(e.algorithm.name!==`ECDH`&&e.algorithm.name!==`X25519`)throw TypeError(`CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519`);lo(e,t)}async function Ko(e,t,n){let r=await _o(t,Ho(e).subtle,`wrapKey`,!0),i=await crypto.subtle.importKey(`raw`,n,{hash:`SHA-256`,name:`HMAC`},!0,[`sign`]);return new Uint8Array(await crypto.subtle.wrapKey(`raw`,i,r,`AES-KW`))}async function qo(e,t,n){let r=await _o(t,Ho(e).subtle,`unwrapKey`,!0),i=await crypto.subtle.unwrapKey(`raw`,n,r,`AES-KW`,{hash:`SHA-256`,name:`HMAC`},!0,[`sign`]);return new Uint8Array(await crypto.subtle.exportKey(`raw`,i))}function Jo(e,t,n){fo(t,Ho(e).subtle,n),uo(e,t)}async function Yo(e,t,n,r){if(!(e instanceof Uint8Array)||e.length<8)throw new Q(`PBES2 Salt Input must be 8 or more octets`);if(!Number.isSafeInteger(n)||Math.sign(n)!==1)throw new Q(`PBES2 Count Input must be a positive integer`);let i=Ta(Aa(t),Uint8Array.of(0),e),a=parseInt(t.slice(13,16),10),o={hash:`SHA-${t.slice(8,11)}`,iterations:n,name:`PBKDF2`,salt:i},s=await _o(r,Ho(t).subtle,`deriveBits`);return new Uint8Array(await crypto.subtle.deriveBits(o,s,a))}function Xo(e){return Ta(Oa(e.length),e)}async function Zo(e,t,n){let r=t>>3,i=Math.ceil(r/32),a=new Uint8Array(i*32);for(let t=1;t<=i;t++){let r=await Na(`sha256`,Ta(Oa(t),e,n));a.set(r,(t-1)*32)}return a.slice(0,r)}async function Qo(e,t,n,r,i=/* @__PURE__ */ new Uint8Array,a=/* @__PURE__ */ new Uint8Array){Go(e),Go(t,`deriveBits`);let o=Ta(Xo(Aa(n)),Xo(i),Xo(a),Oa(r));return Zo(new Uint8Array(await crypto.subtle.deriveBits({name:e.algorithm.name,public:e},t,e.algorithm.name===`X25519`?256:Math.ceil(parseInt(e.algorithm.namedCurve.slice(-3),10)/8)<<3)),r,o)}function $o(e){to(e);let t=e.algorithm.namedCurve;if(t!==`P-256`&&t!==`P-384`&&t!==`P-521`&&e.algorithm.name!==`X25519`)throw new Z(`ECDH with the provided key is not allowed or not supported by your javascript runtime`)}function es(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`)throw new Q(`JOSE Header "${t}" (Agreement Party${t===`apu`?`U`:`V`}Info) invalid`);return Ha(n,t,Q)}}function ts(e,t){if(e!==void 0&&t!==void 0&&e.byteLength===t.byteLength){for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return;throw new Q(`JOSE Header "apu" and "apv" values must be distinct`)}}function ns(e){if(e===void 0)throw new Q(`JWE Encrypted Key missing`)}function rs(e){if(e!==void 0)throw new Q(`Encountered unexpected JWE Encrypted Key`)}function is(e){if(e!==void 0&&e!==1/0&&(!Number.isSafeInteger(e)||e<1))throw TypeError(`maxPBES2Count must be a positive safe integer or Infinity`)}async function as(e,t,n,r,i,a){let{alg:o}=e,s=e.mode;if(s===`direct-encryption`)return rs(r),n;let c=s===`direct-key-agreement`;switch(c?rs(r):ns(r),e.subtle.name){case`ECDH`:{let{epk:r}=i;if(!za(r)||[`d`,`k`,`p`,`q`,`dp`,`dq`,`qi`,`oth`,`priv`].some(e=>Object.hasOwn(r,e)))throw new Q(`JOSE Header "epk" (Ephemeral Public Key) missing or invalid`);$o(n);let a=await go(e,r),s=es(i,`apu`),l=es(i,`apv`);ts(s,l);let u=await Qo(a,n,c?t.alg:o,c?t.cekBits:parseInt(o.slice(-5,-2),10),s,l);if(c)return u;n=u;break}case`RSA-OAEP`:return to(n),Jo(o,n,`decrypt`),new Uint8Array(await crypto.subtle.decrypt(`RSA-OAEP`,n,r));case`PBKDF2`:{if(typeof i.p2c!=`number`)throw new Q(`JOSE Header "p2c" (PBES2 Count) missing or invalid`);is(a);let e=a??1e4;if(i.p2c>e)throw new Q(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`);if(typeof i.p2s!=`string`)throw new Q(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`);n=await Yo(Ha(i.p2s,`p2s`,Q),o,i.p2c,n);break}case`AES-GCM`:{if(typeof i.iv!=`string`)throw new Q(`JOSE Header "iv" (Initialization Vector) missing or invalid`);if(typeof i.tag!=`string`)throw new Q(`JOSE Header "tag" (Authentication Tag) missing or invalid`);let e=Ha(i.iv,`iv`,Q),t=Ha(i.tag,`tag`,Q);if(e.byteLength!==12)throw new Q(`Invalid Initialization Vector length`);if(t.byteLength!==16)throw new Q(`Invalid Authentication Tag length`);return Oo(Wo(o.slice(0,-2)),n,r,e,t,/* @__PURE__ */ new Uint8Array)}}return qo(o.slice(-6),n,r)}async function os(e,t,n,r,i,a={}){let{alg:o,mode:s}=e,c=Uo(e);if(i!==void 0&&!c)throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${o}`);let l=await Qa(s===`direct-encryption`?t:e,n,`encrypt`);if(s===`direct-encryption`)return[l,void 0,void 0];let u=c?i??vo(t):void 0;u&&yo(u,t.cekBits);let d,f;switch(e.subtle.name){case`ECDH`:{$o(l);let{apu:n,apv:i}=a;n!==void 0&&Ra(n,`"apu"`),i!==void 0&&Ra(i,`"apv"`);let c=n??es(r,`apu`),u=i??es(r,`apv`);ts(c,u);let d;d=a.epk===void 0?(await crypto.subtle.generateKey(l.algorithm,!0,[`deriveBits`])).privateKey:await Qa(e,a.epk,`decrypt`);let p=crypto.subtle,m=d;if(!m.extractable){if(typeof p.getPublicKey!=`function`)throw TypeError(`CryptoKey for "epk" must be extractable`);m=await p.getPublicKey(d,[])}let{x:h,y:g,crv:_,kty:v}=await p.exportKey(`jwk`,m),y=s===`direct-key-agreement`,b=await Qo(l,d,y?t.alg:o,y?t.cekBits:parseInt(o.slice(-5,-2),10),c,u),x={x:h,crv:_,kty:v};if(v===`EC`&&(x.y=g),f={epk:x},n!==void 0&&(f.apu=$(n)),i!==void 0&&(f.apv=$(i)),y)return[b,void 0,f];l=b;break}case`RSA-OAEP`:to(l),Jo(o,l,`encrypt`),d=new Uint8Array(await crypto.subtle.encrypt(`RSA-OAEP`,l,u));break;case`PBKDF2`:{let{p2c:e=2048,p2s:t=crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16))}=a;l=await Yo(t,o,e,l),f={p2c:e,p2s:$(t)};break}case`AES-GCM`:{let e=a.iv===void 0?crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(12)):a.iv;if(!(e instanceof Uint8Array))throw TypeError(`"iv" must be an instance of Uint8Array`);let t=await Do(Wo(o.slice(0,-2)),u,l,e,/* @__PURE__ */ new Uint8Array);d=t.ciphertext,f={iv:$(t.iv),tag:$(t.tag)}}}if(d??=await Ko(o.slice(-6),l,u),!(d instanceof Uint8Array)||!d.byteLength)throw TypeError(`JWE key management algorithm did not produce an Encrypted Key`);return[u,d,f]}function ss(e,t){if(e.zip!==void 0&&e.zip!==`DEF`)throw new Z(`Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.`);if(e.zip!==void 0&&!t?.zip)throw new Q(`JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.`)}function cs(e){if(typeof globalThis[e]>`u`)throw new Z(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`)}async function ls(e,t,n=1/0){let r=e.writable.getWriter();r.write(t).catch(()=>{}),r.close().catch(()=>{});let i=[],a=0,o=e.readable.getReader();for(;;){let{value:e,done:t}=await o.read();if(t)break;if(i.push(e),a+=e.byteLength,n!==1/0&&a>n)throw new Q(`Decompressed plaintext exceeded the configured limit`)}return Ta(...i)}async function us(e){return cs(`CompressionStream`),ls(new CompressionStream(`deflate-raw`),e)}async function ds(e,t){return cs(`DecompressionStream`),ls(new DecompressionStream(`deflate-raw`),e,t)}function fs(e){let{protected:t,ciphertext:n,iv:r,tag:i,aad:a}=e,o;return t!==void 0&&(o=Wa(t,Q,`JWE Protected Header is invalid`)),[o,Ha(n,`ciphertext`,Q),r===void 0?void 0:Ha(r,`iv`,Q),i===void 0?void 0:Ha(i,`tag`,Q),Ua((t??``)+(a===void 0?``:`.${a}`),`aad`,Q)]}function ps(e){return[e&&Ka(`keyManagementAlgorithms`,e.keyManagementAlgorithms),e&&Ka(`contentEncryptionAlgorithms`,e.contentEncryptionAlgorithms),e?.crit,e?.maxPBES2Count,e?.maxDecompressedLength]}async function ms(e,t,n,r=fs(e)){let[i,a,o,s,c]=r,{header:l,unprotected:u,aad:d}=e,f;if(l!==void 0||u!==void 0){if(!Ba(i,l,u))throw new Q(`JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint`);f={...i,...l,...u}}else f=i??{};let[p,m,h,g,_]=t,{encrypted_key:v}=e;Ja(Q,Ga,h,i,f),ss(f,i);let{alg:y,enc:b}=f;if(typeof y!=`string`||!y)throw new Q(`missing JWE Algorithm (alg) in JWE Header`);let x=Lo[y];if(v===``&&(!x||!Uo(x)))throw new Q(`JWE Encrypted Key incorrect type`);let S=x?.mode===`integrated-encryption`;if(!S&&(typeof b!=`string`||!b))throw new Q(`missing JWE Encryption Algorithm (enc) in JWE Header`);if(p&&!p.has(y)||!p&&y.startsWith(`PBES2`))throw new Fa(`"alg" (Algorithm) Header Parameter value not allowed`);let ee;if(S){if(b!==void 0)throw new Q(`JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption`);if(o?.byteLength)throw new Q(`JWE Initialization Vector must be empty for integrated encryption`);if(s?.byteLength)throw new Q(`JWE Authentication Tag must be empty for integrated encryption`)}else{if(m&&!m.has(b))throw new Fa(`"enc" (Encryption Algorithm) Header Parameter value not allowed`);ee=Wo(b)}let C;if(v!==void 0)try{C=Ha(v,`encrypted_key`,Q)}catch(e){if(!x||!Uo(x))throw e;C=/* @__PURE__ */ new Uint8Array}let w=!1;typeof n==`function`&&(n=await n(i,e),w=!0);let T=x??Ho(y);Uo(T)&&C===void 0&&(C=/* @__PURE__ */ new Uint8Array);let E=await Qa(T.mode===`direct-encryption`?ee:T,n,`decrypt`),D;if(T.mode===`integrated-encryption`)D=await T.decrypt(E,C,a,c,i,f);else{let e=ee,t;try{t=await as(T,e,E,C,f,g),Uo(T)&&t instanceof Uint8Array&&t.byteLength<<3!==e.cekBits&&(t=vo(e))}catch(n){if(n instanceof TypeError||n instanceof Q||n instanceof Z)throw n;t=vo(e)}D=await Oo(e,t,a,o,s,c)}if(f.zip===`DEF`){let e=_??25e4;if(e===0)throw new Z(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`);if(e!==1/0&&(!Number.isSafeInteger(e)||e<1))throw TypeError(`maxDecompressedLength must be 0, a positive safe integer, or Infinity`);D=await ds(D,e).catch(e=>{throw e instanceof Q?e:new Q(`Failed to decompress plaintext`,{cause:e})})}return{plaintext:D,...i&&{protectedHeader:i},...d!==void 0&&{additionalAuthenticatedData:Ha(d,`aad`,Q)},...u&&{sharedUnprotectedHeader:u},...l&&{unprotectedHeader:l},...w&&{key:E}}}async function hs(e,t,n){if(e instanceof Uint8Array&&(e=Sa.decode(e)),typeof e!=`string`)throw new Q(`Compact JWE must be a string or Uint8Array`);let{0:r,1:i,2:a,3:o,4:s,length:c}=e.split(`.`);if(c!==5)throw new Q(`Invalid Compact JWE`);return ms({ciphertext:o,iv:a||void 0,protected:r,tag:s||void 0,encrypted_key:i||void 0},t,n)}async function gs(e,t,n){return hs(e,ps(n),t)}function _s(e,t,n){if(!Ba(e,t,n))throw new Q(`JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint`)}function vs(e,t,n=!1){if(!e[1]&&!e[2]&&!e[3])throw new Q(`either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()`);t!==void 0&&(e[8]=t?.crit);let[,r,i,a,o,s,c,l,u]=e;if(o!==void 0&&Ra(o,`JWE Additional Authenticated Data`),s!==void 0&&Ra(s,`JWE Content Encryption Key`),c!==void 0&&Ra(c,`JWE Initialization Vector`),!n&&r!==void 0&&(r=Ya(Q,r)[0],e[1]=r),i!==void 0&&(i=Ya(Q,i)[0],e[2]=i),!n&&a!==void 0&&(a=Ya(Q,a)[0],e[3]=a),l!==void 0&&!za(l))throw TypeError(`JWE Key Management Parameters must be an object`);_s(r,i,a);let d={...r,...i,...a};qa(Q,r),Ja(Q,Ga,u,r,d),ss(d,r);let{alg:f,enc:p}=d;if(typeof f!=`string`||!f)throw new Q(`JWE "alg" (Algorithm) Header Parameter missing or invalid`);let m=Lo[f];if(m?.mode===`integrated-encryption`){if(p!==void 0)throw new Q(`JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption`);if(s!==void 0)throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${f}`);if(c!==void 0)throw TypeError(`setInitializationVector cannot be called with JWE "alg" (Algorithm) Header ${f}`);return[d,void 0,m]}if(typeof p!=`string`||!p)throw new Q(`JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid`);return[d,Wo(p),m]}async function ys(e,t,n){let[r,i,a]=t,[o,s,c,l,u,d,f,p,,m]=e,h=s,g=c,_=a??Ho(r.alg),v,y,b;_.mode===`integrated-encryption`?b=await Qa(_,n,`encrypt`):[b,v,y]=await os(_,i,n,r,d,p),y&&(m?g=g?{...g,...y}:y:h=h?{...h,...y}:y,_s(h,g,l));let x=h?$(JSON.stringify(h)):``,S=u?.byteLength?$(u):void 0,ee=Aa(S?`${x}.${S}`:x),C=o;r.zip===`DEF`&&(C=await us(C).catch(e=>{throw new Q(`Failed to compress plaintext`,{cause:e})}));let w,T,E;_.mode===`integrated-encryption`?[v,w]=await _.encrypt(b,C,ee,h,r,p):{ciphertext:w,tag:T,iv:E}=await Do(i,C,b,f,ee);let D={ciphertext:$(w)};return E&&(D.iv=$(E)),T&&(D.tag=$(T)),v?.byteLength&&(D.encrypted_key=$(v)),S&&(D.aad=S),h&&(D.protected=x),l&&(D.unprotected=l),g&&(D.header=g),D}async function bs(e,t,n){return ys(e,vs(e,n),t)}function xs(e){return[e.protected,e.encrypted_key,e.iv,e.ciphertext,e.tag].join(`.`)}const Ss=[[`verify`],[`sign`]];function Cs(e){let t={name:`HMAC`,hash:`SHA-${e}`};return{kty:[`oct`],secret:!0,subtle:t,signing:t,usages:Ss}}function ws(e,t){let n={name:t?`RSA-PSS`:`RSASSA-PKCS1-v1_5`,hash:`SHA-${e}`};return{kty:[`RSA`],subtle:n,signing:t?{...n,saltLength:t}:n,usages:Ss,minRsaBits:2048}}function Ts(e,t){return{kty:[`EC`],crv:e,subtle:{name:`ECDSA`,namedCurve:e},signing:{name:`ECDSA`,hash:`SHA-${t}`},usages:Ss}}function Es(){let e={name:`Ed25519`};return{kty:[`OKP`],crv:`Ed25519`,subtle:e,signing:e,usages:Ss}}function Ds(e){let t={name:`ML-DSA-${e}`};return{kty:[`AKP`],subtle:t,signing:t,usages:Ss}}const Os=ko({HS256:Cs(256),HS384:Cs(384),HS512:Cs(512),RS256:ws(256),RS384:ws(384),RS512:ws(512),PS256:ws(256,32),PS384:ws(384,48),PS512:ws(512,64),ES256:Ts(`P-256`,256),ES384:Ts(`P-384`,384),ES512:Ts(`P-521`,512),EdDSA:Es(),Ed25519:Es(),"ML-DSA-44":Ds(44),"ML-DSA-65":Ds(65),"ML-DSA-87":Ds(87)});var ks=class{#e;constructor(e){Ra(e,`plaintext`),this.#e=[e]}setContentEncryptionKey(e){return Va(this.#e[5],`setContentEncryptionKey`),this.#e[5]=e,this}setInitializationVector(e){return Va(this.#e[6],`setInitializationVector`),this.#e[6]=e,this}setProtectedHeader(e){return Va(this.#e[1],`setProtectedHeader`),this.#e[1]=e,this}setKeyManagementParameters(e){return Va(this.#e[7],`setKeyManagementParameters`),this.#e[7]=e,this}async encrypt(e,t){return xs(await bs([...this.#e],e,t))}};function As(e=`JWK "alg" (Algorithm) Parameter`){throw new Z(`Invalid or unsupported ${e} value`)}function js(e,t){return(typeof e==`string`?Os[e]??Lo[e]:void 0)??As(t)}async function Ms(e,t,n){if(!za(e))throw TypeError(`JWK must be an object`);let r=mo(e),i=ho(n?.extractable),{alg:a}=r;if(t??=a,r.kty!==`oct`&&!t)throw TypeError(`"alg" argument is required when "jwk.alg" is not present`);switch(r.kty){case`oct`:if(typeof r.k!=`string`)throw TypeError(`missing "k" (Key Value) Parameter value`);return La(r.k);case`AKP`:if(typeof a!=`string`||!a)throw TypeError(`missing "alg" (Algorithm) Parameter value`);if(t!==a)throw TypeError(`JWK alg and alg option value mismatch`);return go(js(t),r,i);case`RSA`:case`EC`:case`OKP`:return go(js(t),r,i);default:throw new Z(`Unsupported "kty" (Key Type) Parameter value`)}}async function Ns(e,t){let n=new TextEncoder,r=await Ms({kty:`oct`,k:$(e)},`PBES2-HS256+A128KW`);return await new ks(n.encode(t)).setProtectedHeader({alg:`PBES2-HS256+A128KW`,enc:`A256GCM`}).encrypt(r)}async function Ps(e,t){let n=await gs(t,await Ms({kty:`oct`,k:$(e)},`PBES2-HS256+A128KW`),{keyManagementAlgorithms:[`PBES2-HS256+A128KW`],contentEncryptionAlgorithms:[`A256GCM`]});return new TextDecoder().decode(n.plaintext)}function Fs(e){let t=e.split(`.`);if(t.length<2)throw Error(`invalid JWT`);let n=t[1],r=Uint8Array.from(atob(n),e=>e.charCodeAt(0));return JSON.parse(new TextDecoder().decode(r))}async function Is(e,t,n,r={}){return n instanceof Blob&&((r.contentLength===!0||r.contentLength===void 0)&&(r.contentLength=n.size),n=await n.arrayBuffer()),e.putFileContents(t,n,r)}var Ls=class extends w(C(E),pe){constructor(){super(),this.auth={},this.authUrl=``,this.webDavUrl=``,this.fullWebDavUrl=``,this.nextcloudName=`Nextcloud`,this.nextcloudFileURL=``,this.loginWindow=null,this.isPickerActive=!1,this.statusText=null,this.lastDirectoryPath=`/`,this.directoryPath=``,this.webDavClient=null,this.tabulatorTable=null,this.allowedMimeTypes=``,this.directoriesOnly=!1,this.maxSelectedItems=Number.MAX_VALUE,this.loading=!1,this._onReceiveWindowMessage=e=>{this.onReceiveWindowMessage(e)},this.folderIsSelected=this._i18n.t(`nextcloud-file-picker.load-in-folder`),this.generatedFilename=``,this.replaceFilename=``,this.customFilename=``,this.uploadFileObject=null,this.uploadFileDirectory=null,this.fileList=[],this.fileNameCounter=1,this.activeDirectoryRights=`RGDNVCK`,this.activeDirectoryACL=``,this.forAll=!1,this.uploadCount=0,this.abortUploadButton=!1,this.abortUpload=!1,this.authInfo=``,this.selectBtnDisabled=!0,this.storeSession=!1,this.boundCloseAdditionalMenuHandler=this.hideAdditionalMenu.bind(this),this.initateOpenAdditionalMenu=!1,this.isInFavorites=!1,this.isInFilteredRecent=!1,this.isInRecent=!1,this.userName=``,this.menuHeightBreadcrumb=-1,this.boundCloseBreadcrumbMenuHandler=this.hideBreadcrumbMenu.bind(this),this.initateOpenBreadcrumbMenu=!1,this.boundClickOutsideNewFolderHandler=this.deleteNewFolderEntry.bind(this),this.initateOpenNewFolder=!1,this.disableRowClick=!1,this.boundRefreshOnWindowSizeChange=this.refreshOnWindowSizeChange.bind(this),this.boundCancelNewFolderHandler=this.cancelNewFolder.bind(this),this.boundSelectHandler=this.selectAllFiles.bind(this),this._loginStatus=``,this._loginState=[]}static get scopedElements(){return{"dbp-icon":l,"dbp-mini-spinner":o,"dbp-modal":ae}}static get properties(){return{...super.properties,auth:{type:Object},authUrl:{type:String,attribute:`auth-url`},webDavUrl:{type:String,attribute:`web-dav-url`},fullWebDavUrl:{type:String,attribute:!1},nextcloudFileURL:{type:String,attribute:`nextcloud-file-url`},nextcloudName:{type:String,attribute:`nextcloud-name`},isPickerActive:{type:Boolean,attribute:!1},statusText:{type:Object,attribute:!1},folderIsSelected:{type:String,attribute:!1},authInfo:{type:String,attribute:`auth-info`},directoryPath:{type:String,attribute:`directory-path`},allowedMimeTypes:{type:String,attribute:`allowed-mime-types`},directoriesOnly:{type:Boolean,attribute:`directories-only`},maxSelectedItems:{type:Number,attribute:`max-selected-items`},loading:{type:Boolean,attribute:!1},replaceFilename:{type:String,attribute:!1},uploadFileObject:{type:Object,attribute:!1},uploadFileDirectory:{type:String,attribute:!1},activeDirectoryRights:{type:String,attribute:!1},activeDirectoryACL:{type:String,attribute:!1},abortUploadButton:{type:Boolean,attribute:!1},selectBtnDisabled:{type:Boolean,attribute:!0},userName:{type:Boolean,attribute:!1},storeSession:{type:Boolean,attribute:`store-nextcloud-session`},disableRowClick:{type:Boolean,attribute:!1}}}update(e){e.forEach((e,t)=>{switch(t){case`auth`:this._updateAuth();break;case`directoriesOnly`:this.directoriesOnly&&this._(`#select_all_wrapper`)&&(this._(`#select_all_wrapper`).classList.remove(`button-container`),this._(`#select_all_wrapper`).classList.add(`hidden`)),!this.directoriesOnly&&this._(`#select_all_wrapper`)&&(this._(`#select_all_wrapper`).classList.add(`button-container`),this._(`#select_all_wrapper`).classList.remove(`hidden`))}}),super.update(e)}disconnectedCallback(){window.removeEventListener(`message`,this._onReceiveWindowMessage),window.removeEventListener(`resize`,this.boundRefreshOnWindowSizeChange),this.tabulatorTable.off(`tableBuilt`),this.tabulatorTable.off(`rowSelectionChanged`),this.tabulatorTable.off(`rowClick`),this.tabulatorTable.off(`rowAdded`),this.tabulatorTable.off(`dataLoaded`),super.disconnectedCallback()}connectedCallback(){super.connectedCallback();let e=this._i18n;this._loginStatus=``,this._loginState=[],this._loginCalled=!1,this.updateComplete.then(()=>{window.addEventListener(`message`,this._onReceiveWindowMessage),this.tabulatorTable=new ce(this._(`#directory-content-table`),{layout:`fitColumns`,selectableRows:this.maxSelectedItems,placeholder:this.directoriesOnly?e.t(`nextcloud-file-picker.no-data`):e.t(`nextcloud-file-picker.no-data-type`),responsiveLayout:`collapse`,responsiveLayoutCollapseStartOpen:!1,columnHeaderVertAlign:`middle`,columnDefaults:{vertAlign:`middle`,hozAlign:`left`,resizable:!1},columns:[{minWidth:40,headerSort:!1,formatter:`responsiveCollapse`},{title:`<label id="select_all_wrapper" class="button-container select-all-icon"><input type="checkbox" id="select_all" name="select_all" value="select_all"><span class="checkmark" id="select_all_checkmark"></span></label>`,field:`type`,hozAlign:`center`,width:40,headerSort:!1,responsive:1,formatter:(e,t,n)=>{let r=`<dbp-icon name="empty-file" class="nextcloud-picker-icon `+(this.directoriesOnly?`nextcloud-picker-icon-disabled`:``)+`"></dbp-icon>`,i=e.getValue()===`directory`?`<dbp-icon name="folder" class="nextcloud-picker-icon"></dbp-icon>`:r,a=this.createScopedElement(`div`);return a.innerHTML=i,a}},{title:e.t(`nextcloud-file-picker.filename`),responsive:0,widthGrow:5,minWidth:150,field:`basename`,sorter:`alphanum`,formatter:e=>{let t=this.createScopedElement(`div`);return t.classList.add(`filename`),t.innerHTML=e.getValue(),t}},{title:e.t(`nextcloud-file-picker.size`),responsive:4,widthGrow:1,minWidth:84,field:`size`,formatter:(e,t,n)=>e.getRow().getData().type===`directory`?``:c(e.getValue())},{title:e.t(`nextcloud-file-picker.mime-type`),responsive:2,widthGrow:1,minWidth:58,field:`mime`,formatter:(e,t,n)=>{if(e.getValue()===void 0)return``;let[,r]=e.getValue().split(`/`);return r}},{title:e.t(`nextcloud-file-picker.last-modified`),responsive:3,widthGrow:1,minWidth:150,field:`lastmod`,sorter:(e,t,n,r,i,a,o)=>Date.parse(e)-Date.parse(t),formatter:function(e,t,n){let r=Date.parse(e.getValue()),i=new Date(r),a=i.getFullYear(),o=(`0`+(i.getMonth()+1)).slice(-2),s=(`0`+i.getDate()).slice(-2),c=(`0`+i.getHours()).slice(-2),l=(`0`+i.getMinutes()).slice(-2);return s+`.`+o+`.`+a+` `+c+`:`+l}},{title:`rights`,field:`props.permissions`,visible:!1},{title:`acl`,field:`props.acl-list.acl.acl-permissions`,visible:!1}],initialSort:[{column:`basename`,dir:`asc`},{column:`type`,dir:`asc`}],rowFormatter:e=>{let t=e.getData();this.checkFileType(t,this.allowedMimeTypes)||(e.getElement().classList.add(`no-select`),e.getElement().classList.remove(`tabulator-selectable`)),this.directoriesOnly&&t.mime!==void 0&&(e.getElement().classList.add(`no-select`),e.getElement().classList.remove(`tabulator-selectable`)),!this.directoriesOnly&&t.mime===void 0&&e.getElement().classList.add(`no-select-styles`)}}),this.tabulatorTable.on(`tableBuilt`,this.tableBuiltFunction.bind(this)),this.tabulatorTable.on(`rowSelectionChanged`,this.rowSelectionChangedFunction.bind(this)),this.tabulatorTable.on(`rowClick`,this.rowClickFunction.bind(this)),this.tabulatorTable.on(`rowAdded`,this.rowAddedFunction.bind(this)),this.tabulatorTable.on(`dataLoaded`,this.dataLoadedFunction.bind(this)),this.allowedMimeTypes!==void 0&&this.allowedMimeTypes!==``&&!this.directoriesOnly&&this.tabulatorTable.setFilter(this.checkFileType,this.allowedMimeTypes),window.addEventListener(`resize`,this.boundRefreshOnWindowSizeChange)})}tableBuiltFunction(){this._(`#select_all`)&&this._(`#select_all`).addEventListener(`click`,this.boundSelectHandler),this.directoriesOnly&&this._(`#select_all_wrapper`)&&(this._(`#select_all_wrapper`).classList.remove(`button-container`),this._(`#select_all_wrapper`).classList.add(`hidden`))}rowSelectionChangedFunction(e,t){let n=this._i18n;this.disableRowClick||(this.folderIsSelected=e.length>0&&this.directoriesOnly?n.t(`nextcloud-file-picker.load-to-folder`):n.t(`nextcloud-file-picker.load-in-folder`),this.selectBtnDisabled=!(!this.directoriesOnly&&this.tabulatorTable&&this.tabulatorTable.getSelectedRows().filter(e=>e.getData().type!=`directory`&&this.checkFileType(e.getData(),this.allowedMimeTypes)).length>0),this._(`#select_all_checkmark`)&&(this._(`#select_all_checkmark`).title=this.checkAllSelected()?n.t(`clipboard.select-nothing`):n.t(`clipboard.select-all`)),this.requestUpdate())}rowClickFunction(e,t){let n=this._i18n,r=t.getData();if(!t.getElement().classList.contains(`no-select`)&&!this.disableRowClick){if(this.directoriesOnly){let r=t.getData();this.directoryClicked(e,r),this.folderIsSelected=n.t(`nextcloud-file-picker.load-in-folder`)}else switch(r.type){case`directory`:this.directoryClicked(e,r);break;case`file`:this.tabulatorTable!==null&&this.tabulatorTable.getSelectedRows().length===this.tabulatorTable.getRows().filter(e=>e.getData().type!=`directory`&&this.checkFileType(e.getData(),this.allowedMimeTypes)).length?this._(`#select_all`).checked=!0:this._(`#select_all`).checked=!1}}else t.deselect()}rowAddedFunction(e){this.disableRowClick||e.getElement().classList.toggle(`addRowAnimation`)}dataLoadedFunction(e){this.tabulatorTable!==null&&setTimeout(()=>{this._(`.tabulator-responsive-collapse-toggle-open`)&&this._a(`.tabulator-responsive-collapse-toggle-open`).forEach(e=>e.addEventListener(`click`,this.toggleCollapse.bind(this))),this._(`.tabulator-responsive-collapse-toggle-close`)&&this._a(`.tabulator-responsive-collapse-toggle-close`).forEach(e=>e.addEventListener(`click`,this.toggleCollapse.bind(this)))},0)}_updateAuth(){this._loginStatus=this.auth[`login-status`];let e=[this.isLoggedIn(),this.isLoading()];this._loginState.toString()!==e.toString()&&this.requestUpdate(),this._loginState=e,this.isLoggedIn()&&!this._loginCalled&&(this._loginCalled=!0,this.checkLocalStorage())}isLoggedIn(){return this.auth&&this.auth.token}isLoading(){return this._loginStatus!==`logged-out`&&!this.isLoggedIn()&&this.auth.token!==void 0}async checkLocalStorage(){if(!this.isLoggedIn()||!this.auth){for(let e of Object.keys(localStorage))(e.includes(`nextcloud-webdav-username-`)||e.includes(`nextcloud-webdav-password-`)||e.includes(`nextcloud-webdav-url-`))&&localStorage.removeItem(e);return}let e=this.auth[`user-id`],t=this.auth.token?Fs(this.auth.token):null,n=typeof t?.sid==`string`?t.sid:``,r=localStorage.getItem(`nextcloud-webdav-username-`+e),i=localStorage.getItem(`nextcloud-webdav-password-`+e),a=localStorage.getItem(`nextcloud-webdav-url-`+e);if(this.storeSession&&n&&r&&i&&a)try{let e=await Ps(n,r),t=await Ps(n,i);this.fullWebDavUrl=await Ps(n,a),this.webDavClient=va(this.fullWebDavUrl,{username:e,password:t}),this.userName=e,this.isPickerActive=!0,this.loadDirectory(this.directoryPath)}catch{localStorage.removeItem(`nextcloud-webdav-username-`+e),localStorage.removeItem(`nextcloud-webdav-password-`+e),localStorage.removeItem(`nextcloud-webdav-url-`+e);return}}checkFileType(e,t){if(t===``||e.mime===void 0)return!0;let[n,r]=e.mime.split(`/`),i=t.split(`,`),a=!0;return i.forEach(e=>{let[t,i]=e.split(`/`);a&&=t!==`*`&&t!==n||i!==`*`&&i!==r}),!a}_openFilePicker(){let e=this._i18n;if(this.disableRowClick=!1,this.webDavClient===null){this.loading=!0,this.statusText=f`
${e.t(`nextcloud-file-picker.auth-progress`)}
`;let t=this.authUrl+`?target-origin=`+encodeURIComponent(window.location.href);this.loginWindow=window.open(t,`Nextcloud Login`,`width=400,height=400,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no`)}else this.loadDirectory(this.directoryPath)}_a(e){return this.renderRoot.querySelectorAll(e)}async onReceiveWindowMessage(e){if(this.webDavClient===null){let t=e.data;if(t.type===`webapppassword`){if(this.loginWindow!==null&&this.loginWindow.close(),this.webDavClient=va(t.webdavUrl||this.webDavUrl+`/`+t.loginName,{username:t.loginName,password:t.token}),this.fullWebDavUrl=t.webdavUrl,this.storeSession&&this.isLoggedIn()&&this._(`#remember-checkbox`)&&this._(`#remember-checkbox`).checked){let e=this.auth[`user-id`],n=this.auth.token?Fs(this.auth.token):null,r=typeof n?.sid==`string`?n.sid:``;if(r){let n=await Ns(r,t.loginName),i=await Ns(r,t.token),a=await Ns(r,t.webdavUrl);localStorage.setItem(`nextcloud-webdav-username-`+e,n),localStorage.setItem(`nextcloud-webdav-password-`+e,i),localStorage.setItem(`nextcloud-webdav-url-`+e,a)}}this.loadDirectory(this.directoryPath),this.userName=t.loginName}}}toggleCollapse(e){let t=this.tabulatorTable;setTimeout(function(){t.redraw()},0)}filterUserFilesOnly(e){let t=[];for(let n=0;n<e.length;n++)if(e){let r=e[n].props.permissions;!r.includes(`M`)&&!r.includes(`S`)&&t.push(e[n])}return t}parseFileAndBaseName(e){for(e[0]!==`/`&&(e=`/`+e);/^.+\/$/.test(e);)e=e.substr(0,e.length-1);e=decodeURIComponent(e);let t=this.webDavUrl.split(`/`),n=e.split(`/`);for(let e=0;e<n.length;e++){let r=n[e];t.forEach(t=>{t===r&&(n.shift(),e--)})}n.shift();let r=n[n.length-1];return[`/`+n.join(`/`),r]}mapResponseToObject(e){let t=[];return e.forEach(e=>{if(!e.propstat)throw Error(`Missing WebDAV properties for ${e.href}: ${e.status}`);let[n,r]=this.parseFileAndBaseName(e.href),i=e.propstat.prop,a=typeof i.getetag==`string`?i.getetag.replace(/"/g,``):null,o=i.getcontentlength?i.getcontentlength:`0`,s=i.resourcetype&&typeof i.resourcetype==`object`&&i.resourcetype.collection!==void 0?`directory`:`file`,c;s===`file`&&(c=i.getcontenttype&&typeof i.getcontenttype==`string`?i.getcontenttype.split(`;`)[0]:``);let l={getetag:a,getlastmodified:i.getlastmodified,getcontentlength:o,permissions:i.permissions,resourcetype:s,getcontenttype:i.getcontenttype},u={basename:r,etag:a,filename:n,lastmod:i.getlastmodified,mime:c,props:l,size:parseInt(o,10),type:s};t.push(u)}),t}loadFavorites(){this.hideAdditionalMenu();let e=this._i18n;if((this.directoryPath===void 0||this.directoryPath===void 0)&&(this.directoryPath=``),console.log(`load nextcloud favorites`),this.selectAllButton=!0,this.loading=!0,this.statusText=f`
${e.t(`nextcloud-file-picker.loadpath-nextcloud-file-picker`,{name:this.nextcloudName})}
`,this.lastDirectoryPath=this.directoryPath,this.directoryPath=``,this.isInRecent=!1,this.isInFilteredRecent=!1,this.isInFavorites=!0,this.webDavClient===null){this.tabulatorTable.clearData(),this.webDavClient=null;let t=f`
${e.t(`nextcloud-file-picker.something-went-wrong`)}
<button
class="button"
title="${e.t(`nextcloud-file-picker.refresh-nextcloud-file-picker`)}"
@click="${()=>{this._openFilePicker()}}">
<dbp-icon name="reload"></dbp-icon>
</button>
`;this.loading=!1,this.statusText=t;return}this.webDavClient.customRequest(`/`,{method:`REPORT`,data:`<?xml version="1.0"?> <oc:filter-files xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"> <oc:filter-rules> <oc:favorite>1</oc:favorite> </oc:filter-rules> <d:prop> <d:getlastmodified /> <d:resourcetype /> <d:getcontenttype /> <d:getcontentlength /> <d:getetag /> <oc:permissions /> </d:prop> </oc:filter-files>`}).then(async t=>ti(await t.text()).then(t=>{let n=this.mapResponseToObject(t.multistatus.response);this.loading=!1,this.statusText=null,this.tabulatorTable.setData(n),this.tabulatorTable.setSort([{column:`basename`,dir:`asc`},{column:`type`,dir:`asc`}]),this._(`.tabulator-placeholder-contents`)&&(this._(`.tabulator-placeholder-contents`).innerText=e.t(`nextcloud-file-picker.no-favorites`,{name:this.nextcloudName})),this.isPickerActive=!0,this._(`.nextcloud-content`).scrollTop=0,this._(`#download-button`).setAttribute(`disabled`,`true`)})).catch(t=>{if(console.error(t.message),this.webDavClient!==null&&t.message.search(`401`)===-1)console.log(`error in load directory`),this.directoryPath=``,this.loadDirectory(``);else{this.loading=!1,this.statusText=f`
<span class="error">
${e.t(`nextcloud-file-picker.webdav-error`,{error:t.message})}
</span>
`,this.isPickerActive=!1,this.tabulatorTable.clearData(),this.webDavClient=null;let n=f`
${e.t(`nextcloud-file-picker.something-went-wrong`)}
<button
class="button"
title="${e.t(`nextcloud-file-picker.refresh-nextcloud-file-picker`)}"
@click="${()=>{this._openFilePicker()}}">
<dbp-icon name="reload"></dbp-icon>
</button>
`;this.loading=!1,this.statusText=n}this.isInFavorites=!1})}loadAllRecentFiles(){this.hideAdditionalMenu();let e=this._i18n;(this.directoryPath===void 0||this.directoryPath===void 0)&&(this.directoryPath=``),console.log(`load recent files`),this.selectAllButton=!0,this.loading=!0,this.statusText=f`
${e.t(`nextcloud-file-picker.loadpath-nextcloud-file-picker`,{name:this.nextcloudName})}
`,this.lastDirectoryPath=this.directoryPath,this.directoryPath=``,this.isInFavorites=!1,this.isInFilteredRecent=!1,this.isInRecent=!0;let t=/* @__PURE__ */ new Date;t.setMonth(t.getMonth()-3);let n=t.toISOString().split(`.`)[0]+`Z`;if(this.webDavClient===null||this.userName===null){this.tabulatorTable.clearData(),this.webDavClient=null;let t=f`
${e.t(`nextcloud-file-picker.something-went-wrong`)}
<button
class="button"
title="${e.t(`nextcloud-file-picker.refresh-nextcloud-file-picker`)}"
@click="${()=>{this._openFilePicker()}}">
<dbp-icon name="reload"></dbp-icon>
</button>
`;this.loading=!1,this.statusText=t;return}this.webDavClient.customRequest(`../..`,{method:`SEARCH`,headers:{"Content-Type":`text/xml`},data:`<?xml version="1.0" encoding='UTF-8'?> <d:searchrequest xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"> <d:basicsearch> <d:select> <d:prop> <d:getlastmodified /> <d:resourcetype /> <d:getcontenttype /> <d:getcontentlength /> <d:getetag /> <oc:permissions /> <oc:size/> <oc:owner-id/> <oc:owner-display-name/> </d:prop> </d:select> <d:from> <d:scope> <d:href>`+this.fullWebDavUrl+`</d:href> <d:depth>infinity</d:depth> </d:scope> </d:from> <d:where> <d:and> <d:gte> <d:prop> <d:getlastmodified/> </d:prop> <d:literal>`+n+`</d:literal> </d:gte> <d:or>`+this.getMimeTypes()+` </d:or> </d:and> </d:where> <d:orderby> <d:order> <d:prop> <d:getlastmodified/> </d:prop> <d:descending/> </d:order> </d:orderby> <d:limit> <d:nresults>15</d:nresults> </d:limit> </d:basicsearch> </d:searchrequest>`}).then(async t=>ti(await t.text()).then(t=>{let n=this.mapResponseToObject(t.multistatus.response);this.loading=!1,this.statusText=null,this.tabulatorTable.setData(n),this.tabulatorTable.setSort([{column:`lastmod`,dir:`desc`}]),this._(`.tabulator-placeholder-contents`)&&(this._(`.tabulator-placeholder-contents`).innerText=e.t(`nextcloud-file-picker.no-recent-files`,{name:this.nextcloudName})),this.isPickerActive=!0,this._(`.nextcloud-content`).scrollTop=0,this._(`#download-button`).setAttribute(`disabled`,`true`)})).catch(t=>{if(console.error(t.message),this.webDavClient!==null&&t.message.search(`401`)===-1)console.log(`error in load directory`),this.directoryPath=``,this.loadDirectory(``);else{this.loading=!1,this.statusText=f`
<span class="error">
${e.t(`nextcloud-file-picker.webdav-error`,{error:t.message})}
</span>
`,this.isPickerActive=!1,this.tabulatorTable.clearData(),this.webDavClient=null;let n=f`
${e.t(`nextcloud-file-picker.something-went-wrong`)}
<button
class="button"
title="${e.t(`nextcloud-file-picker.refresh-nextcloud-file-picker`)}"
@click="${()=>{this._openFilePicker()}}">
<dbp-icon name="reload"></dbp-icon>
</button>
`;this.loading=!1,this.statusText=n}this.isInRecent=!1})}getMimeTypes(){let e=``;return this.allowedMimeTypes&&this.allowedMimeTypes!==`*/*`?this.allowedMimeTypes.split(`,`).forEach(t=>{e+=` <d:like> <d:prop> <d:getcontenttype/> </d:prop> <d:literal>`+t+`</d:literal> </d:like>`}):e=` <d:like> <d:prop> <d:getcontenttype/> </d:prop> <d:literal>application/%</d:literal> </d:like> <d:like> <d:prop> <d:getcontenttype/> </d:prop> <d:literal>text/%</d:literal> </d:like> <d:like> <d:prop> <d:getcontenttype/> </d:prop> <d:literal>image/%</d:literal> </d:like> <d:like> <d:prop> <d:getcontenttype/> </d:prop> <d:literal>video/%</d:literal> </d:like> <d:like> <d:prop> <d:getcontenttype/> </d:prop> <d:literal>audio/%</d:literal> </d:like> <d:like> <d:prop> <d:getcontenttype/> </d:prop> <d:literal>font/%</d:literal> </d:like>`,e}loadMyRecentFiles(){this.hideAdditionalMenu();let e=this._i18n;(this.directoryPath===void 0||this.directoryPath===void 0)&&(this.directoryPath=``),console.log(`load only my recent files`),this.selectAllButton=!0,this.loading=!0,this.statusText=f`
${e.t(`nextcloud-file-picker.loadpath-nextcloud-file-picker`,{name:this.nextcloudName})}
`,this.lastDirectoryPath=this.directoryPath,this.directoryPath=``,this.isInFavorites=!1,this.isInRecent=!1,this.isInFilteredRecent=!0;let t=/* @__PURE__ */ new Date;t.setMonth(t.getMonth()-3);let n=t.toISOString().split(`.`)[0]+`Z`;if(this.webDavClient===null||this.userName===null){this.tabulatorTable.clearData(),this.webDavClient=null;let t=f`
${e.t(`nextcloud-file-picker.something-went-wrong`)}
<button
class="button"
title="${e.t(`nextcloud-file-picker.refresh-nextcloud-file-picker`)}"
@click="${()=>{this._openFilePicker()}}">
<dbp-icon name="reload"></dbp-icon>
</button>
`;this.loading=!1,this.statusText=t;return}this.webDavClient.customRequest(`../..`,{method:`SEARCH`,headers:{"Content-Type":`text/xml`},data:`<?xml version="1.0" encoding='UTF-8'?> <d:searchrequest xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"> <d:basicsearch> <d:select> <d:prop> <d:getlastmodified /> <d:resourcetype /> <d:getcontenttype /> <d:getcontentlength /> <d:getetag /> <oc:permissions /> <oc:size/> <oc:owner-id/> <oc:owner-display-name/> </d:prop> </d:select> <d:from> <d:scope> <d:href>`+this.fullWebDavUrl+`</d:href> <d:depth>infinity</d:depth> </d:scope> </d:from> <d:where> <d:and> <d:gte> <d:prop> <d:getlastmodified/> </d:prop> <d:literal>`+n+`</d:literal> </d:gte> <d:or>`+this.getMimeTypes()+` </d:or> </d:and> </d:where> <d:orderby> <d:order> <d:prop> <d:getlastmodified/> </d:prop> <d:descending/> </d:order> </d:orderby> <d:limit> <d:nresults>15</d:nresults> </d:limit> </d:basicsearch> </d:searchrequest>`}).then(async t=>ti(await t.text()).then(t=>{let n=this.mapResponseToObject(t.multistatus.response);n=this.filterUserFilesOnly(n),this.loading=!1,this.statusText=null,this.tabulatorTable.setData(n),this.tabulatorTable.setSort([{column:`lastmod`,dir:`desc`}]),this._(`.tabulator-placeholder-contents`)&&(this._(`.tabulator-placeholder-contents`).innerText=e.t(`nextcloud-file-picker.no-recent-files`,{name:this.nextcloudName})),this.isPickerActive=!0,this._(`.nextcloud-content`).scrollTop=0,this._(`#download-button`).setAttribute(`disabled`,`true`)})).catch(t=>{if(console.error(t.message),this.webDavClient!==null&&t.message.search(`401`)===-1)console.log(`error in load directory`),this.directoryPath=``,this.loadDirectory(``);else{this.loading=!1,this.statusText=f`
<span class="error">
${e.t(`nextcloud-file-picker.webdav-error`,{error:t.message})}
</span>
`,this.isPickerActive=!1,this.tabulatorTable.clearData(),this.webDavClient=null;let n=f`
${e.t(`nextcloud-file-picker.something-went-wrong`)}
<button
class="button"
title="${e.t(`nextcloud-file-picker.refresh-nextcloud-file-picker`)}"
@click="${()=>{this._openFilePicker()}}">
<dbp-icon name="reload"></dbp-icon>
</button>
`;this.loading=!1,this.statusText=n}this.isInFilteredRecent=!1})}loadDirectory(e){this.hideAdditionalMenu();let t=this._i18n;if((this.directoryPath===void 0||this.directoryPath===void 0)&&(this.directoryPath=``),e===void 0&&(e=``),this.disableRowClick=!1,this.loading=!0,this.statusText=f`
${t.t(`nextcloud-file-picker.loadpath-nextcloud-file-picker`,{name:this.nextcloudName})}
`,this.lastDirectoryPath=this.directoryPath,this.directoryPath=e,this._(`#select_all`)&&(this._(`#select_all`).checked=!1),this.webDavClient===null){this.tabulatorTable.clearData(),this.webDavClient=null;let e=f`
${t.t(`nextcloud-file-picker.something-went-wrong`)}
<button
class="button"
title="${t.t(`nextcloud-file-picker.refresh-nextcloud-file-picker`)}"
@click="${()=>{this._openFilePicker()}}">
<dbp-icon name="reload"></dbp-icon>
</button>
`;this.loading=!1,this.statusText=e;return}this.webDavClient.getDirectoryContents(e,{details:!0,data:`<?xml version="1.0"?><d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns" xmlns:ocs="http://open-collaboration-services.org/ns"> <d:prop> <d:getlastmodified /> <d:resourcetype /> <d:getcontenttype /> <d:getcontentlength /> <d:getetag /> <oc:permissions /> <nc:acl-list> <nc:acl> <nc:acl-permissions /> </nc:acl> </nc:acl-list> </d:prop></d:propfind>`}).then(e=>{this.loading=!1,this.statusText=null,this.tabulatorTable.setData(e.data),this.tabulatorTable.setSort([{column:`basename`,dir:`asc`},{column:`type`,dir:`asc`}]),this.isPickerActive=!0,this.isInFavorites=!1,this.isInRecent=!1,this.isInFilteredRecent=!1,this._(`.nextcloud-content`).scrollTop=0,!this.activeDirectoryRights.includes(`CK`)&&!this.activeDirectoryRights.includes(`NV`)?this._(`#download-button`).setAttribute(`disabled`,`true`):this._(`#download-button`).removeAttribute(`disabled`),this._(`#directory-content-table`).querySelector(`div.tabulator-tableHolder > div.tabulator-placeholder > span`)&&(this._(`#directory-content-table`).querySelector(`div.tabulator-tableHolder > div.tabulator-placeholder > span`).innerText=this.directoriesOnly?t.t(`nextcloud-file-picker.no-data`):t.t(`nextcloud-file-picker.no-data-type`))}).catch(n=>{if(console.error(n.message),e!==`/`&&e!==``&&this.webDavClient!==null&&n.message.search(`401`)===-1)console.log(`error in load directory`),this.directoryPath=``,this.loadDirectory(``);else{this.loading=!1,this.statusText=f`
<span class="error">
${t.t(`nextcloud-file-picker.webdav-error`,{error:n.message})}
</span>
`,this.isPickerActive=!1,this.tabulatorTable.clearData(),this.webDavClient=null;let e=f`
${t.t(`nextcloud-file-picker.something-went-wrong`)}
<button
class="button"
title="${t.t(`nextcloud-file-picker.refresh-nextcloud-file-picker`)}"
@click="${()=>{this._openFilePicker()}}">
<dbp-icon name="reload"></dbp-icon>
</button>
`;this.loading=!1,this.statusText=e,this.sendSetPropertyEvent(`analytics-event`,{category:`FileHandlingNextcloud`,action:`WebdavClientError`})}})}directoryClicked(e,t){t.props===void 0?this.activeDirectoryRights=`SGDNVCK`:(this.activeDirectoryRights=t.props.permissions,this.activeDirectoryACL=t.props[`acl-list`]!==void 0&&t.props[`acl-list`].acl[`acl-permissions`]!==void 0&&t.props[`acl-list`].acl[`acl-permissions`]?t.props[`acl-list`].acl[`acl-permissions`]:``),this.loadDirectory(t.filename),e.preventDefault()}downloadFiles(e){e.forEach(t=>this.downloadFile(t,e.length)),this.tabulatorTable.deselectRow(),this._(`#select_all`)&&(this._(`#select_all`).checked=!1);let t={count:e.length},n=new CustomEvent(`dbp-nextcloud-file-picker-number-files`,{detail:t,bubbles:!0,composed:!0});this.dispatchEvent(n),e.length>0&&this.sendSetPropertyEvent(`analytics-event`,{category:`FileHandlingNextcloud`,action:`DownloadFiles`,name:e.length})}downloadFile(e,t){if(this.webDavClient===null)throw Error(`WebDAV client is not available`);let n=this._i18n;this.loading=!0,this.statusText=f`
Loading ${e.filename}...
`,this.webDavClient.getFileContents(e.filename,{format:`binary`,details:!1}).then(n=>{if(!(n instanceof ArrayBuffer))throw Error(`Unexpected WebDAV file response`);let r={file:new File([n],e.basename,{type:e.mime}),data:e,maxUpload:t},i=new CustomEvent(`dbp-nextcloud-file-picker-file-downloaded`,{detail:r,bubbles:!0,composed:!0});this.dispatchEvent(i),this.loading=!1,this.statusText=null}).catch(e=>{console.error(e.message),this.loading=!1,this.statusText=f`
<span class="error">
${n.t(`nextcloud-file-picker.webdav-error`,{error:e.message})}
</span>
`})}sendDirectory(e){let t=this._i18n;if(this.isInFavorites){this.statusText=f`
<span class="error">
${t.t(`nextcloud-file-picker.error-save-to-favorites`)}
</span>
`;return}if(this.isInRecent||this.isInFilteredRecent){this.statusText=f`
<span class="error">${t.t(`nextcloud-file-picker.error-save-to-recent`)}</span>
`;return}this.tabulatorTable.deselectRow();let n;n=e[0]?e[0].filename:this.directoryPath,this.loading=!0,this.statusText=f`
${t.t(`nextcloud-file-picker.upload-to`,{path:n})}
`;let r=new CustomEvent(`dbp-nextcloud-file-picker-file-uploaded`,{detail:n,bubbles:!0,composed:!0});this.dispatchEvent(r)}async uploadFiles(e,t){let n=this._i18n;this.loading=!0,this.statusText=f`
${n.t(`nextcloud-file-picker.upload-to`,{path:t})}
`,this.fileList=[...e],this.fileList!==void 0&&this.fileList.length>0&&this.sendSetPropertyEvent(`analytics-event`,{category:`FileHandlingNextcloud`,action:`UploadFiles`,name:e.length}),this.forAll=!1,this.setRepeatForAllConflicts(),await this.uploadFile(t)}async uploadFile(e){let t=this._i18n;if(this.abortUpload){this.abortUpload=!1,this.abortUploadButton=!1,this.forAll=!1,this.loading=!1,this.statusText=f`
${t.t(`nextcloud-file-picker.abort-message`)}
`,this._(`#replace_mode_all`).checked=!1;return}if(this.fileList.length!==0){let n=this.fileList[0];this.replaceFilename=n.name;let r=e+`/`+n.name;this.loading=!0,this.statusText=f`
${t.t(`nextcloud-file-picker.upload-to`,{path:r})}
`,await Is(this.webDavClient,r,n,{overwrite:!1}).then(async t=>{t?(this.uploadCount+=1,this.fileList.shift(),await this.uploadFile(e)):(this.generatedFilename=this.getNextFilename(),this._(`#replace-filename`).value=this.generatedFilename,this.forAll?(this.uploadFileObject=n,this.uploadFileDirectory=e,this.abortUploadButton=!0,await this.uploadFileAfterConflict()):this.replaceModalDialog(n,e))}).catch(e=>{this.uploadError(e)})}else{this.loadDirectory(this.directoryPath),this.loading=!1,this.statusText=null,this._(`#replace_mode_all`).checked=!1,this.forAll=!1,this.customFilename=``;let e=new CustomEvent(`dbp-nextcloud-file-picker-file-uploaded-finished`,{bubbles:!0,composed:!0,detail:this.uploadCount});this.uploadCount=0,this.abortUpload=!1,this.abortUploadButton=!1,this.dispatchEvent(e)}}uploadError(e){let t=this._i18n;if(this.loading=!1,e.response&&e.response.status)switch(e.response.status){case 403:this.statusText=f`
<span class="error">
<dbp-icon name="warning-high"></dbp-icon>
${t.t(`nextcloud-file-picker.forbidden`)}
</span>
`;return;case 415:this.statusText=f`
<span class="error">
<dbp-icon name="warning-high"></dbp-icon>
${t.t(`nextcloud-file-picker.file-error`)}
</span>
`,this.sendSetPropertyEvent(`analytics-event`,{category:`FileHandlingNextcloud`,action:`UploadFilesPutfilesError`,name:`415`});return}this.statusText=f`
<span class="error">
<dbp-icon name="warning-high"></dbp-icon>
${t.t(`nextcloud-file-picker.file-upload-error`)}
</span>
`,this.sendSetPropertyEvent(`analytics-event`,{category:`FileHandlingNextcloud`,action:`UploadFilesPutfilesError`,name:e}),console.error(e)}async uploadFileAfterConflict(){let e=this._i18n;if(this.abortUpload){this.abortUpload=!1,this.abortUploadButton=!1,this.forAll=!1,this.loading=!1,this.statusText=f`
${e.t(`nextcloud-file-picker.abort-message`)}
`,this._(`#replace_mode_all`).checked=!1;return}let t,n=!1,r=this.uploadFileObject,i=this.uploadFileDirectory;if(this._(`input[name='replacement']:checked`).value===`ignore`)return this.closeModal(`#replace-modal`),this.forAll?this.fileList=[]:this.fileList.shift(),await this.uploadFile(i),!0;this._(`input[name='replacement']:checked`).value===`new-name`?(this.generatedFilename!==this._(`#replace-filename`).value&&(this.customFilename=this._(`#replace-filename`).value),t=i+`/`+this._(`#replace-filename`).value,this.closeModal(`#replace-modal`),this.replaceFilename=this._(`#replace-filename`).value):(t=i+`/`+this.uploadFileObject.name,n=!0),this.loading=!0,this.statusText=f`
${e.t(`nextcloud-file-picker.upload-to`,{path:t})}
`,await Is(this.webDavClient,t,r,{overwrite:n}).then(async e=>{this.closeModal(`#replace-modal`),this.uploadCount+=1,this.fileList.shift(),await this.uploadFile(i)}).catch(async e=>{e.message.search(`412`)===-1?this.uploadError(e):(this.closeModal(`#replace-modal`),this.generatedFilename=this.getNextFilename(),this._(`#replace-filename`).value=this.generatedFilename,this.forAll?(this.uploadFileObject=r,this.uploadFileDirectory=i,this.abortUploadButton=!0,await this.uploadFileAfterConflict()):this.replaceModalDialog(r,i))}),this.fileNameCounter=1}checkRights(e){let t,n=this.activeDirectoryRights,r=this.tabulatorTable.searchRows(`basename`,`=`,this.replaceFilename);return t=r[0]!==void 0&&r[0]?r[0].getData().props.permissions:``,n.includes(`CK`)&&t.includes(`NV`)?-1:n.includes(`CK`)&&!t.includes(`NV`)?1:!n.includes(`CK`)&&t.includes(`NV`)?2:0}replaceModalDialog(e,t){let n=this._i18n;this.uploadFileObject=e,this.uploadFileDirectory=t;let r=this.checkRights(e);if(r===0){this.loading=!1,this.statusText=f`
${n.t(`nextcloud-file-picker.readonly`)}
`;return}r===1?(this.loading=!1,this.statusText=f`
${n.t(`nextcloud-file-picker.onlycreate`)}
`,this._(`#replace-replace`).setAttribute(`disabled`,`true`),this._(`#replace-new-name`).removeAttribute(`disabled`),this._(`#replace-replace`).checked=!1,this._(`#replace-new-name`).checked=!0,this.setInputFieldVisibility(),this._(`#replace-new-name`).focus()):r===2?(this.loading=!1,this.statusText=f`
${n.t(`nextcloud-file-picker.onlyedit`)}
`,this._(`#replace-new-name`).setAttribute(`disabled`,`true`),this._(`#replace-replace`).removeAttribute(`disabled`),this._(`#replace-new-name`).checked=!1,this._(`#replace-replace`).checked=!0,this.setInputFieldVisibility(),this._(`#replace-replace`).focus()):(this._(`#replace-new-name`).removeAttribute(`disabled`),this._(`#replace-replace`).removeAttribute(`disabled`),this._(`#replace-replace`).checked=!1,this._(`#replace-new-name`).checked=!0,this.setInputFieldVisibility(),this._(`#replace-new-name`).focus()),this.openModal(`#replace-modal`)}closeDialog(e){this.tabulatorTable&&this.tabulatorTable.deselectRow(),this._(`#select_all`)&&(this._(`#select_all`).checked=!1)}openModal(e){let t=this._(e);if(!t)return;let n=()=>{t.isOpen()||t.open()};t.modalDialog?n():t.updateComplete.then(n)}closeModal(e){let t=this._(e);t&&t.modalDialog&&t.isOpen()&&t.close()}handleModalClosed(e){e.detail.id===`replace-modal-dialog`&&(this.statusText=null,this.loading=!1,this.keepPageScrollLockedIfParentModalOpen()),e.detail.id===`new-folder-modal-dialog`&&(this.cleanupNewFolderEntry(),this.keepPageScrollLockedIfParentModalOpen())}keepPageScrollLockedIfParentModalOpen(){let e=this.closest(`dbp-modal`),t=e?.modalDialog;e?.isOpen()&&t&&(t.ownerDocument.documentElement.style.overflow=`hidden`)}getNextFilename(){let e,t;t=this.forAll&&this.customFilename!==``?this.customFilename.split(`.`):this.replaceFilename.split(`.`);let n=t[0].split(`(`);if(n.length>1){let r=n[1].split(`)`);if(r.length>1&&!isNaN(parseInt(r[0]))){let t=parseInt(r[0]);this.fileNameCounter=t+1,e=n[0]+`(`+this.fileNameCounter+`)`}else e=t[0]+`(`+this.fileNameCounter+`)`}else e=t[0]+`(`+this.fileNameCounter+`)`;if(t.length>1)for(let n=1;n<t.length;n++)e=e+`.`+t[n];return this.fileNameCounter++,e}setInputFieldVisibility(){this._(`#replace-filename`).disabled=!this._(`#replace-new-name`).checked}getCancelText(){let e=this._i18n;return this.fileList.length>1?e.t(`nextcloud-file-picker.replace-cancel-all`):e.t(`nextcloud-file-picker.replace-cancel`)}cancelOverwrite(){this.statusText=null,this.loading=!1,this.fileList=[]}setRepeatForAllConflicts(){this.forAll=this._(`#replace_mode_all`).checked}openAddFolderDialogue(){let e=this._i18n;this._(`.addRowAnimation`)&&this._(`.addRowAnimation`).classList.remove(`addRowAnimation`),this._(`#new-folder-wrapper`).classList.toggle(`hidden`),this._(`#new-folder-wrapper`).classList.contains(`hidden`)?(this._(`#add-folder-button`).setAttribute(`name`,`plus`),this._(`#add-folder-button`).setAttribute(`title`,e.t(`nextcloud-file-picker.add-folder-open`))):(this._(`#add-folder-button`).setAttribute(`name`,`close`),this._(`#add-folder-button`).setAttribute(`title`,e.t(`nextcloud-file-picker.add-folder-close`)),this._(`#new-folder`).focus())}addOpenFolderTableEntry(){this._(`.addRowAnimation`)&&this._(`.addRowAnimation`).classList.remove(`addRowAnimation`),this.disableRowClick=!0,this.initateOpenNewFolder=!0,setTimeout(()=>{this._(`#tf-new-folder-dialog`).select()},0),this.openModal(`#new-folder-modal`),this._(`#tf-new-folder-dialog`).addEventListener(`keydown`,({key:e})=>{e===`Enter`&&this.addNewFolder()}),this._(`#new-folder-modal-box`).addEventListener(`click`,e=>{e.stopPropagation()}),document.addEventListener(`keydown`,this.boundCancelNewFolderHandler),document.addEventListener(`click`,this.boundClickOutsideNewFolderHandler)}cancelNewFolder(e){e.key===`Escape`&&(this.deleteNewFolderEntry(),e.stopPropagation())}deleteNewFolderEntry(){if(this.initateOpenNewFolder){this.initateOpenNewFolder=!1;return}this.disableRowClick=!1,this.closeModal(`#new-folder-modal`),this.cleanupNewFolderEntry()}cleanupNewFolderEntry(){let e=this._i18n;document.removeEventListener(`click`,this.boundClickOutsideNewFolderHandler),document.removeEventListener(`keydown`,this.boundCancelNewFolderHandler),this._(`#tf-new-folder-dialog`)&&(this._(`#tf-new-folder-dialog`).value=e.t(`nextcloud-file-picker.new-folder-dialog-default-name`))}addNewFolder(){if(this.webDavClient===null)throw Error(`WebDAV client is not available`);let e=this._i18n;if(this._(`#tf-new-folder-dialog`).value!==``){let t=this._(`#tf-new-folder-dialog`).value;this.directoryPath===void 0&&(this.directoryPath=``),this.deleteNewFolderEntry();let n=this.directoryPath+`/`+t;this.webDavClient.createDirectory(n).then(r=>{this.tabulatorTable.setSort();let i=/* @__PURE__ */ new Date;this.tabulatorTable.addRow({type:`directory`,filename:n,basename:t,lastmod:i,props:{permissions:`RGDNVCK`}},!0),this.statusText=f`
${e.t(`nextcloud-file-picker.add-folder-success`,{folder:t})}
`,this.loading=!1}).catch(n=>{this.loading=!1,this.statusText=n.message.search(`405`)===-1?f`
<span class="error">
${e.t(`nextcloud-file-picker.webdav-error`,{error:n.message})}
</span>
`:f`
<span class="error">
${e.t(`nextcloud-file-picker.add-folder-error`,{folder:t})}
</span>
`})}else this.statusText=f`
<span class="error">${e.t(`nextcloud-file-picker.add-folder-error-empty`)}</span>
`}addFolder(){if(this.webDavClient===null)throw Error(`WebDAV client is not available`);let e=this._i18n;if(this._(`#new-folder`).value!==``){let t=this._(`#new-folder`).value;this.directoryPath===void 0&&(this.directoryPath=``);let n=this.directoryPath+`/`+t;this.webDavClient.createDirectory(n).then(r=>{this.tabulatorTable.setSort();let i=/* @__PURE__ */ new Date;this.tabulatorTable.addRow({type:`directory`,filename:n,basename:t,lastmod:i,props:{permissions:`RGDNVCK`}},!0),this.statusText=f`
${e.t(`nextcloud-file-picker.add-folder-success`,{folder:t})}
`,this.loading=!1}).catch(n=>{this.loading=!1,this.statusText=n.message.search(`405`)===-1?f`
<span class="error">
${e.t(`nextcloud-file-picker.webdav-error`,{error:n.message})}
</span>
`:f`
<span class="error">
${e.t(`nextcloud-file-picker.add-folder-error`,{folder:t})}
</span>
`}),this._(`#new-folder`).value=``,this.openAddFolderDialogue()}}selectAllFiles(){this.checkAllSelected()?this.tabulatorTable.getSelectedRows().forEach(e=>e.deselect()):this.tabulatorTable.selectRow(this.tabulatorTable.getRows().filter(e=>e.getData().type!=`directory`&&this.checkFileType(e.getData(),this.allowedMimeTypes)))}checkAllSelected(){if(this.tabulatorTable){let e=this.tabulatorTable.getRows().filter(e=>e.getData().type!=`directory`&&this.checkFileType(e.getData(),this.allowedMimeTypes)).length;if(this.tabulatorTable.getSelectedRows().length===e)return!0}return!1}logOut(){if(this.webDavClient=null,this.isPickerActive=!1,this.auth){let e=this.auth[`user-id`];localStorage.removeItem(`nextcloud-webdav-username`+e),localStorage.removeItem(`nextcloud-webdav-password`+e),localStorage.removeItem(`nextcloud-webdav-url-`+e)}}getBreadcrumb(){let e=this._i18n;this.directoryPath===void 0&&(this.directoryPath=``);let t=[];if(t[0]=f`
<span class="breadcrumb">
<a
class="home-link"
@click="${()=>{this.loadDirectory(``)}}"
title="${e.t(`nextcloud-file-picker.folder-home`)}">
<dbp-icon name="home"></dbp-icon>
</a>
</span>
`,this.isInFavorites)t[1]=f`
<span class="first">›</span>
<span class="breadcrumb special">
<a
@click="${()=>{this.loadFavorites()}}"
title="${e.t(`nextcloud-file-picker.favorites-title`)}">
${e.t(`nextcloud-file-picker.favorites-title`)}
</a>
</span>
`;else if(this.isInRecent)t[1]=f`
<span class="first">›</span>
<span class="breadcrumb special">
<a
@click="${()=>{this.loadAllRecentFiles()}}"
title="${e.t(`nextcloud-file-picker.recent-files-title`)}">
${e.t(`nextcloud-file-picker.recent-files-title`)}
</a>
</span>
`;else if(this.isInFilteredRecent)t[1]=f`
<span class="first">›</span>
<span class="breadcrumb special">
<a
@click="${()=>{this.loadMyRecentFiles()}}"
title="${e.t(`nextcloud-file-picker.my-recent-files-title`)}">
${e.t(`nextcloud-file-picker.my-recent-files-title`)}
</a>
</span>
`;else{let n=this.directoryPath.split(`/`);if(n[1]===``)return t;for(let r=1;r<n.length;r++){let i=``;for(let e=1;e<=r;e++)i+=`/`,i+=n[e];r===1?t[r]=f`
<span class="first breadcrumb-arrow">›</span>
<span class="breadcrumb">
<a
@click="${()=>{this.loadDirectory(i)}}"
title="${e.t(`nextcloud-file-picker.load-path-link`,{path:n[r]})}">
${n[r]}
</a>
</span>
`:t[r]=f`
<span class="breadcrumb-arrow">›</span>
<span class="breadcrumb">
<a
@click="${()=>{this.loadDirectory(i)}}"
title="${e.t(`nextcloud-file-picker.load-path-link`,{path:n[r]})}">
${n[r]}
</a>
</span>
`}let r=t.length,i=window.innerWidth;if(r>3&&i<=768){let i=[];for(let t=1;t<n.length-1;t++){let r=``;for(let e=1;e<=t;e++)r+=`/`,r+=n[e];i[t]=f`
<li class="breadcrumb-${t}" id="breadcrumb-${t}">
<a
@click="${()=>{this.loadDirectory(r)}}"
title="${e.t(`nextcloud-file-picker.load-path-link`,{path:n[t]})}">
<dbp-icon name="folder" class="breadcrumb-folder"></dbp-icon>
${n[t]}
</a>
</li>
`}let a=[];return a[0]=t[0],a[1]=f`
<span class="first breadcrumb-arrow">›</span>
<span class="breadcrumb">
<a
class="extended-breadcrumb-link"
@click="${()=>{this.toggleBreadcrumbMenu()}}">
. . .
</a>
<div class="breadcrumb-menu">
<ul class="extended-breadcrumb-menu hidden">
${i}
</ul>
</div>
</span>
`,a[2]=t[r-1],a}}return t}toggleBreadcrumbMenu(){let e=this.renderRoot.querySelector(`ul.extended-breadcrumb-menu`),t=this.renderRoot.querySelector(`a.extended-breadcrumb-link`);if(e===null||t===null)return;e.classList.toggle(`hidden`),this.menuHeightBreadcrumb=e.clientHeight;let n=t.getBoundingClientRect().bottom,r=this._(`.nextcloud-header`).offsetHeight,i=this.menuHeightBreadcrumb+r>=this._(`.wrapper`).offsetHeight,a=this._(`.wrapper`).offsetWidth;if(i&&!e.classList.contains(`hidden`)){let t=this._(`.wrapper`).offsetHeight-this._(`.nextcloud-nav`).offsetHeight;e.setAttribute(`style`,`position: fixed;top: `+n+`px;height: `+t+`px;max-width: `+a+`px;overflow-y: auto;`),e.scrollTop=0,this._(`.nextcloud-content`).setAttribute(`style`,`overflow:hidden;`)}else i&&e.classList.contains(`hidden`)&&(this._(`.nextcloud-content`).removeAttribute(`style`,`overflow:hidden;`),e.removeAttribute(`style`));e.classList.contains(`hidden`)?(document.removeEventListener(`click`,this.boundCloseBreadcrumbMenuHandler),this._(`.nextcloud-content`).removeAttribute(`style`,`overflow:hidden;`),e.removeAttribute(`style`)):(i||e.setAttribute(`style`,`max-width: `+a+`px;`),document.addEventListener(`click`,this.boundCloseBreadcrumbMenuHandler),this.initateOpenBreadcrumbMenu=!0)}hideBreadcrumbMenu(){if(this.initateOpenBreadcrumbMenu){this.initateOpenBreadcrumbMenu=!1;return}let e=this.renderRoot.querySelector(`ul.extended-breadcrumb-menu`);e&&!e.classList.contains(`hidden`)&&this.toggleBreadcrumbMenu()}refreshOnWindowSizeChange(){this.requestUpdate()}getNextCloudLink(){return this.nextcloudFileURL+this.directoryPath}toggleMoreMenu(){let e=this.renderRoot.querySelector(`ul.extended-menu`),t=this.renderRoot.querySelector(`a.extended-menu-link`);e!==null&&t!==null&&(e.classList.toggle(`hidden`),e.classList.contains(`hidden`)?document.removeEventListener(`click`,this.boundCloseAdditionalMenuHandler):(document.addEventListener(`click`,this.boundCloseAdditionalMenuHandler),this.initateOpenAdditionalMenu=!0))}hideAdditionalMenu(){if(this.initateOpenAdditionalMenu){this.initateOpenAdditionalMenu=!1;return}let e=this.renderRoot.querySelector(`ul.extended-menu`);e&&!e.classList.contains(`hidden`)&&this.toggleMoreMenu()}_atChangeInput(e){this._(`#new-folder-confirm-btn`)&&(this._(`#new-folder-confirm-btn`).disabled=this._(`#tf-new-folder-dialog`)&&this._(`#tf-new-folder-dialog`).value===``)}static get styles(){return v`
${ne()}
${S()}
${u()}
${re()}
${le()}
${ba()}
.breadcrumb-folder {
padding-right: 5px;
color: var(--dbp-muted);
font-size: 1.4em;
padding-top: 7px;
}
.breadcrumb.special a {
overflow: visible;
}
.breadcrumb-menu {
display: inline;
}
.breadcrumb {
border-bottom: var(--dbp-border);
}
.breadcrumb:last-child,
.breadcrumb:first-child {
border-bottom: none;
}
.breadcrumb a {
display: inline-block;
height: 33px;
vertical-align: middle;
line-height: 33px;
}
span.first {
margin-left: -6px;
}
a.home-link {
padding-left: 6px;
padding-right: 6px;
margin-left: -6px;
}
.extended-menu-link {
padding: 7px;
}
.extended-breadcrumb-menu li a {
max-width: none;
display: inline;
}
.nextcloud-nav {
position: relative;
width: 100%;
display: flex;
justify-content: space-between;
}
.nextcloud-nav p {
align-self: center;
}
.nextcloud-nav h2 {
padding-top: 10px;
}
.nextcloud-nav a {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.nextcloud-nav a.home-link {
font-size: 1.4em;
}
.nextcloud-header.hidden {
display: none !important;
}
.nextcloud-header {
padding-bottom: 7px;
width: 100%;
}
.nextcloud-header div button {
justify-self: start;
}
.extended-breadcrumb-menu li {
padding: 7px;
padding-right: 46px;
overflow: hidden;
}
.extended-breadcrumb-menu li:hover {
background-color: var(--dbp-hover-background-color);
}
.extended-breadcrumb-menu li.active {
background-color: var(--dbp-content-surface);
}
.extended-breadcrumb-menu li:hover > a {
color: var(--dbp-hover-color, var(--dbp-content));
}
.extended-breadcrumb-menu li.active > a {
color: var(--dbp-on-content-surface);
}
.extended-breadcrumb-menu a.inactive {
color: var(--dbp-muted);
pointer-events: none;
cursor: default;
}
.extended-breadcrumb-menu {
list-style: none;
border: var(--dbp-border);
position: absolute;
background-color: var(--dbp-background);
z-index: 1000;
}
input[type='text']#tf-new-folder:focus {
border: none;
background: transparent;
height: 100%;
}
input[type='text']#tf-new-folder:focus-visible {
outline: none;
box-shadow: none;
}
input[type='text']#tf-new-folder::placeholder {
color: #333;
font-weight: 300;
}
#tf-new-folder::-webkit-input-placeholder {
color: #333;
font-weight: 300;
}
#tf-new-folder:-moz-placeholder {
color: #333;
font-weight: 300;
}
#tf-new-folder::-moz-placeholder {
color: #333;
font-weight: 300;
}
#tf-new-folder::-ms-input-placeholder {
color: #333;
font-weight: 300;
}
input[type='text']#tf-new-folder {
border: 0px;
background: transparent;
width: 100%;
height: 100%;
margin-left: -8px;
color: white;
}
input[type='text']#tf-new-folder.smaller {
width: calc(100% - 42px);
}
.visible {
display: unset;
}
.block {
margin-bottom: 10px;
}
.error {
background-color: var(--dbp-background);
color: var(--dbp-danger);
}
.filter-options-wrapper {
padding-right: 0px;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 4px;
}
.extended-menu a.inactive {
color: var(--dbp-muted);
pointer-events: none;
cursor: default;
}
.extended-menu a {
padding: 7px 54px 7px 15px;
display: block;
}
.extended-menu {
list-style: none;
border: var(--dbp-border);
position: absolute;
background-color: var(--dbp-background);
z-index: 1000;
right: 0px;
border-radius: var(--dbp-border-radius);
}
.extended-menu li:hover {
background-color: var(--dbp-hover-background-color);
}
.extended-menu li.active {
background-color: var(--dbp-content-surface);
}
.extended-menu li:hover > a {
color: var(--dbp-hover-color, var(--dbp-content));
}
.extended-menu li.active > a {
color: var(--dbp-on-content-surface);
}
.extended-menu li.inactive:hover {
background-color: var(--dbp-background);
}
.extended-menu li.inactive > a {
color: var(--dbp-muted);
pointer-events: none;
cursor: default;
}
.nextcloud-intro {
text-align: center;
}
.nextcloud-logo {
width: 80px;
height: 95px;
justify-self: end;
transition: all 0.5s ease;
margin: auto;
}
.nextcloud-logo-image {
height: 100%;
width: 100%;
background-image: var(
--dbp-override-image-nextcloud,
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M69.3 86.1l-46.1 0C11 85.9 1.1 75.9 1.1 63.7c0-11.8 9.1-21.4 20.6-22.4 0.5-15.2 13-27.4 28.3-27.4 3.4 0 6.6 0.5 9.2 1.6 6.2 2.1 11.4 6.4 14.8 12 6.5 1 12.7 4.3 16.9 9.1 5 5.5 7.8 12.6 7.8 19.9C98.8 72.8 85.6 86.1 69.3 86.1zM23.6 80.6h45.7c13.3 0 24-10.8 24-24 0-6-2.3-11.8-6.4-16.2 -3.7-4.2-9.1-6.9-14.9-7.5l-1.4-0.2L70 31.4c-2.8-5.1-7.2-8.9-12.6-10.7l-0.1 0c-2-0.8-4.5-1.2-7.2-1.2 -12.6 0-22.9 10.3-22.9 22.9v4.5h-3.6c-9.3 0-17 7.6-17 17C6.6 73 14.3 80.6 23.6 80.6z'/%3E%3C/svg%3E")
);
background-repeat: no-repeat;
background-position: center;
}
.nextcloud-logo-sm {
width: 40px;
justify-self: inherit;
margin-right: 70px;
display: none;
}
.m-inherit {
margin: inherit;
}
.wrapper {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
position: relative;
}
.select-button {
justify-self: end;
}
.nextcloud-content {
width: 100%;
height: 100%;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.nextcloud-footer {
background-color: var(--dbp-background);
width: 100%;
padding-top: 10px;
}
.nextcloud-footer-grid {
width: 100%;
display: flex;
align-items: center;
flex-direction: row-reverse;
justify-content: space-between;
}
.additional-menu {
white-space: nowrap;
height: 33px;
margin-right: -11px;
}
#replace-modal-box {
display: flex;
flex-direction: column;
justify-content: center;
padding: 30px;
max-height: 450px;
min-height: 450px;
min-width: 380px;
max-width: 190px;
}
#replace-modal-box .modal-header {
display: flex;
justify-content: space-evenly;
align-items: baseline;
}
#replace-modal-box .modal-header h2 {
font-size: 1.2rem;
padding-right: 5px;
}
#replace-modal-box .modal-content {
display: flex;
flex-direction: column;
height: 100%;
justify-content: space-evenly;
}
#replace-modal-box .radio-btn {
margin-right: 5px;
}
#replace-modal-box .modal-content label {
display: block;
width: 100%;
text-align: left;
}
#replace-modal-box #replace-filename {
display: block;
width: 100%;
margin-top: 8px;
}
#replace-modal-box input[type='text']:disabled {
color: var(--dbp-muted);
}
#replace-modal-box .modal-content div {
display: flex;
}
#replace-modal-box .modal-footer {
padding-top: 15px;
}
#replace-modal-box .modal-footer .modal-footer-btn {
display: flex;
justify-content: space-between;
padding-bottom: 15px;
}
input:disabled + label {
color: var(--dbp-muted);
}
.inline-block {
display: inline-block;
}
.inline-block {
position: absolute;
right: 0px;
z-index: 1;
background-color: var(--dbp-background);
bottom: -45px;
}
.addRowAnimation {
color: var(--dbp-content);
animation: added 0.4s ease;
}
#abortButton {
background-color: var(--dbp-background);
color: var(--dbp-danger);
}
#abortButton:hover {
color: var(--dbp-on-content-surface);
}
.menu-buttons {
display: flex;
gap: 1em;
}
@keyframes added {
0% {
background-color: var(--dbp-background);
}
50% {
background-color: var(--dbp-success-surface);
}
100% {
background-color: var(--dbp-background);
}
}
.spinner {
font-size: 0.7em;
}
.nextcloud-picker-icon-disabled {
opacity: 0.4;
}
.button.button,
.button,
button.dt-button {
background-color: var(--dbp-background);
}
#new-folder {
padding-right: 50px;
}
#replace-modal-box .modal-header {
padding: 0px;
}
#replace-modal-content {
padding: 0px;
align-items: baseline;
}
#replace-modal-content div {
width: 100%;
}
#replace-modal-box .modal-header h2 {
text-align: left;
}
#replace-modal .checkmark {
height: 20px;
width: 20px;
left: 0px;
top: 1px;
}
.table-wrapper {
max-width: 100%;
width: 100%;
}
.remember-container {
display: inline-block;
line-height: 28px;
padding-left: 34px;
}
.remember-container .checkmark {
left: 7px;
top: 3px;
}
.more-menu {
height: 22.4px;
width: 19px;
margin-top: 4px;
}
#new-folder-modal-box {
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 15px 20px 20px 20px;
max-height: 190px;
min-height: 190px;
min-width: 320px;
max-width: 400px;
}
#new-folder-modal-box header.modal-header {
padding: 0px;
display: flex;
justify-content: space-between;
}
#new-folder-modal-box footer.modal-footer .modal-footer-btn {
padding: 0px;
display: flex;
justify-content: space-between;
}
#new-folder-modal-content {
display: block;
padding-left: 0px;
padding-right: 0px;
overflow: unset;
}
#new-folder-modal-content div .input {
width: 100%;
}
#new-folder-modal-content .nf-label {
padding-bottom: 2px;
}
@media only screen and (orientation: portrait) and (max-width: 768px) {
.nextcloud-header {
padding-bottom: 0px;
grid-area: header-l;
margin-bottom: 0px;
}
.nextcloud-nav h2 > a {
font-size: 1.3rem;
}
.nextcloud-nav h2 {
padding-top: 8px;
}
.nextcloud-nav a {
font-size: 1rem;
/** max-width: max-content; **/
}
.nextcloud-nav .home-link {
font-size: 1.2rem;
}
.nextcloud-logo-sm {
display: none;
}
.nextcloud-logo {
margin: 0 auto;
}
.nextcloud-content,
.nextcloud-intro {
grid-area: content;
height: 100%;
justify-content: center;
}
.nextcloud-intro {
text-align: center;
display: flex;
flex-direction: column;
}
.nextcloud-footer {
bottom: 0px;
width: 100%;
left: 0px;
}
.nextcloud-footer-grid {
display: flex;
justify-content: center;
flex-direction: column-reverse;
}
.breadcrumb-arrow {
font-size: 1.6em;
vertical-align: middle;
padding-bottom: 3px;
padding-left: 2px;
padding-right: 2px;
}
.breadcrumb .extended-breadcrumb-menu a {
display: inherit;
}
.extended-breadcrumb-link {
margin-top: -4px;
font-size: 1.2em !important; /**TODO for demo purpose only */
font-weight: 400;
}
.extended-menu {
top: 38px;
}
.additional-menu {
position: inherit;
right: 0px;
margin-right: -12px;
}
.additional-menu button {
float: right;
}
.inline-block {
width: inherit;
position: absolute;
right: 52px;
z-index: 1;
background-color: var(--dbp-background);
bottom: 0px;
}
.add-folder-button {
right: 0px;
position: absolute;
}
.button-wrapper {
justify-self: start;
}
.wrapper {
display: flex;
justify-content: space-between;
}
.mobile-hidden {
display: none;
}
.info-box {
position: relative;
}
.select-button {
margin: 0px;
}
#new-folder {
width: 100%;
}
#replace-modal-box {
min-width: 100%;
max-width: 100%;
}
.hidden {
display: none;
}
}
`}render(){let e=this._i18n,t=m(ya,`tabulator-tables/css/tabulator.min.css`);return f`
<div class="wrapper">
<link rel="stylesheet" href="${t}" />
<div class="nextcloud-intro ${k({hidden:this.isPickerActive})}">
<div
class="nextcloud-logo ${k({"nextcloud-logo-sm":this.isPickerActive})}">
<div class="nextcloud-logo-image"></div>
</div>
<div class="block text-center ${k({hidden:this.isPickerActive})}">
<h2 class="m-inherit">${this.nextcloudName}</h2>
<p class="m-inherit">
${e.t(`nextcloud-file-picker.init-text-1`,{name:this.nextcloudName})}
<br />
${e.t(`nextcloud-file-picker.init-text-2`)}
<br />
<br />
</p>
</div>
<div class="block ${k({hidden:this.isPickerActive})}">
<button
class="button is-primary"
title="${e.t(`nextcloud-file-picker.open-nextcloud-file-picker`,{name:this.nextcloudName})}"
@click="${()=>{this._openFilePicker()}}">
${e.t(`nextcloud-file-picker.connect-nextcloud`,{name:this.nextcloudName})}
</button>
</div>
<div
class="block text-center m-inherit ${k({hidden:!this.storeSession||!this.isLoggedIn()})}">
<label class="button-container remember-container">
${e.t(`nextcloud-file-picker.remember-me`,{name:this.nextcloudName})}
<input type="checkbox" id="remember-checkbox" name="remember" />
<span class="checkmark"></span>
</label>
</div>
<div
class="block text-center m-inherit ${k({hidden:this.isPickerActive})}">
<p class="m-inherit">
<br />
${e.t(`nextcloud-file-picker.auth-info`)}
<slot name="auth-info">
<br />
${this.authInfo}
</slot>
</p>
</div>
</div>
<div class="nextcloud-header ${k({hidden:!this.isPickerActive})}">
<div class="nextcloud-nav">
<p>${this.getBreadcrumb()}</p>
<div class="menu-buttons">
<div class="add-folder ${k({hidden:this.storeSession})}">
<div class="inline-block">
<div id="new-folder-wrapper" class="hidden">
<input
type="text"
placeholder="${e.t(`nextcloud-file-picker.new-folder-placeholder`)}"
name="new-folder"
class="input"
id="new-folder" />
<button
class="button add-folder-button"
title="${e.t(`nextcloud-file-picker.add-folder`)}"
@click="${()=>{this.addFolder()}}">
<dbp-icon
name="checkmark-circle"
class="nextcloud-add-folder"></dbp-icon>
</button>
</div>
</div>
</div>
</div>
<div class="additional-menu">
<a
class="extended-menu-link"
@click="${()=>{this.toggleMoreMenu()}}"
title="${e.t(`nextcloud-file-picker.more-menu`)}">
<dbp-icon name="menu-dots" class="more-menu"></dbp-icon>
</a>
<ul class="extended-menu hidden">
<li
class="${k({active:this.isInFavorites})}"
id="favorites-item">
<a class="" @click="${this.loadFavorites}">
${e.t(`nextcloud-file-picker.favorites-link-text`)}
</a>
</li>
<li
class="${k({active:this.isInFilteredRecent})}"
id="my-recent-item">
<a class="" @click="${this.loadMyRecentFiles}">
${e.t(`nextcloud-file-picker.my-recent-files-link-text`)}
</a>
</li>
<li
class="${k({active:this.isInRecent})}"
id="all-recent-item">
<a class="" @click="${this.loadAllRecentFiles}">
${e.t(`nextcloud-file-picker.all-recent-files-link-text`)}
</a>
</li>
<li
class="${k({inactive:this.isInRecent||this.isInFavorites||this.isInFilteredRecent||this.disableRowClick})}">
<a
class=""
@click="${()=>{this.addOpenFolderTableEntry()}}">
${e.t(`nextcloud-file-picker.add-folder`)}
</a>
</li>
<li
class="${k({hidden:!this.storeSession})}"
title="${e.t(`nextcloud-file-picker.log-out`)}">
<a
class=""
@click="${()=>{this.logOut(),this.hideAdditionalMenu()}}">
${e.t(`nextcloud-file-picker.log-out`)}
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="nextcloud-content ${k({hidden:!this.isPickerActive})}">
<div class="table-wrapper">
<div id="directory-content-table" class="force-no-select"></div>
</div>
</div>
<div class="nextcloud-footer ${k({hidden:!this.isPickerActive})}">
<div class="nextcloud-footer-grid">
<button
id="download-button"
class="button select-button is-primary ${k({hidden:!this.directoriesOnly||this.directoriesOnly&&this.abortUploadButton&&this.forAll})}"
@click="${()=>{this.sendDirectory(this.tabulatorTable.getSelectedData())}}"
?disabled="${this.selectBtnDisabled}">
<dbp-icon class="nav-icon" name="cloud-upload"></dbp-icon>
${this.folderIsSelected}
</button>
<button
class="button select-button is-primary ${k({hidden:this.directoriesOnly})}"
@click="${()=>{this.downloadFiles(this.tabulatorTable.getSelectedData())}}"
?disabled="${this.selectBtnDisabled}">
${this.tabulatorTable&&this.tabulatorTable.getSelectedRows().filter(e=>e.getData().type!=`directory`&&this.checkFileType(e.getData(),this.allowedMimeTypes)).length===0?e.t(`nextcloud-file-picker.select-files`):e.t(`nextcloud-file-picker.select-files-btn`,{count:this.tabulatorTable?this.tabulatorTable.getSelectedRows().length:0})}
</button>
<button
id="abortButton"
class="button select-button hidden ${k({visible:this.directoriesOnly&&this.forAll&&this.abortUploadButton})}"
title="${e.t(`nextcloud-file-picker.abort`)}"
@click="${()=>{this.abortUpload=!0}}">
${e.t(`nextcloud-file-picker.abort`)}
</button>
<div
class="block info-box ${k({hidden:this.statusText===null})}">
<dbp-mini-spinner
class="spinner ${k({hidden:this.loading===!1})}"></dbp-mini-spinner>
<span>${this.statusText}</span>
</div>
</div>
</div>
</div>
<dbp-modal
id="replace-modal"
modal-id="replace-modal-dialog"
class="nextcloud-modal"
lang="${this.lang}"
@dbp-modal-closed="${e=>this.handleModalClosed(e)}">
<div slot="title">
<h2 id="replace-modal-title">
${e.t(`nextcloud-file-picker.replace-title-1`)}
<span style="word-break: break-all;">${this.replaceFilename}</span>
${e.t(`nextcloud-file-picker.replace-title-2`)}.
</h2>
</div>
<div slot="content" id="replace-modal-box" class="modal-content">
<h3>${e.t(`nextcloud-file-picker.replace-text`)}?</h3>
<div>
<label class="button-container">
<span>${e.t(`nextcloud-file-picker.replace-new_name`)}:</span>
<input
type="radio"
id="replace-new-name"
class="radio-btn"
name="replacement"
value="new-name"
checked
@click="${()=>{this.setInputFieldVisibility()}}" />
<span class="radiobutton"></span>
<input
type="text"
id="replace-filename"
class="input"
name="replace-filename"
value=""
onClick="this.select();" />
</label>
</div>
<div>
<label class="button-container">
<span>${e.t(`nextcloud-file-picker.replace-replace`)}</span>
<input
type="radio"
id="replace-replace"
name="replacement"
value="replace"
@click="${()=>{this.setInputFieldVisibility()}}" />
<span class="radiobutton"></span>
</label>
</div>
<div>
<label class="button-container">
<span>${e.t(`nextcloud-file-picker.replace-skip`)}</span>
<input
type="radio"
class="radio-btn"
name="replacement"
value="ignore"
@click="${()=>{this.setInputFieldVisibility()}}" />
<span class="radiobutton"></span>
</label>
</div>
</div>
<div slot="footer" class="modal-footer">
<div class="modal-footer-btn">
<button
class="button"
aria-label="Close this dialog window"
@click="${()=>{this.cancelOverwrite(),this.closeModal(`#replace-modal`)}}">
${this.getCancelText()}
</button>
<button
class="button select-button is-primary"
@click="${()=>{this.uploadFileAfterConflict().catch(e=>this.uploadError(e))}}">
OK
</button>
</div>
<div>
<label class="button-container">
${e.t(`nextcloud-file-picker.replace-mode-all`)}
<input
type="checkbox"
id="replace_mode_all"
name="replace_mode_all"
value="replace_mode_all"
@click="${()=>{this.setRepeatForAllConflicts()}}" />
<span class="checkmark"></span>
</label>
</div>
</div>
</dbp-modal>
<dbp-modal
id="new-folder-modal"
modal-id="new-folder-modal-dialog"
class="nextcloud-modal"
title="${e.t(`nextcloud-file-picker.new-folder-dialog-title`)}"
lang="${this.lang}"
@dbp-modal-closed="${e=>this.handleModalClosed(e)}">
<div slot="content" id="new-folder-modal-box" class="modal-content">
<div class="nf-label">
${e.t(`nextcloud-file-picker.new-folder-dialog-label`)}
</div>
<div>
<input
type="text"
class="input"
name="tf-new-folder-dialog"
id="tf-new-folder-dialog"
value="${e.t(`nextcloud-file-picker.new-folder-dialog-default-name`)}"
@input="${()=>{this._atChangeInput()}}" />
</div>
</div>
<div slot="footer" class="modal-footer">
<div class="modal-footer-btn">
<button
class="button"
aria-label="Close this dialog window"
@click="${()=>{this.deleteNewFolderEntry()}}">
${e.t(`nextcloud-file-picker.new-folder-dialog-button-cancel`)}
</button>
<button
class="button select-button is-primary"
id="new-folder-confirm-btn"
@click="${()=>{this.addNewFolder()}}">
${e.t(`nextcloud-file-picker.new-folder-dialog-button-ok`)}
</button>
</div>
</div>
</dbp-modal>
`}};const Rs=`file-sink`,zs=`file-source`;var Bs=class extends w(C(T),pe){constructor(){super(),this.allowedMimeTypes=``,this.clipboardFiles={files:[]},this.clipboardSelectBtnDisabled=!0,this.tabulatorTable=null,this._onReceiveBeforeUnload=this.onReceiveBeforeUnload.bind(this),this.boundSelectHandler=this.selectAllFiles.bind(this),this.filesToSave=[],this.numberOfSelectedFiles=0,this.enabledTargets=`local`,this.countUploadFiles=0,this.buttonsDisabled=!1,this.nextcloudWebAppPasswordURL=``,this.nextcloudWebDavURL=``,this.nextcloudName=``,this.nextcloudFileURL=``,this.nextcloudAuthInfo=``,this.nextcloudStoreSession=!1,this.authInfo=``,this.allowNesting=!1,Promise.resolve().then(()=>Us).then(({FileSink:e})=>this.defineScopedElement(`dbp-file-sink`,e)).catch(e=>console.error(e)),import(`./file-source.DRQEpAaB.js`).then(e=>e.n).then(({FileSource:e})=>this.defineScopedElement(`dbp-file-source`,e)).catch(e=>console.error(e)),this.mode=`table-only`}static get scopedElements(){return{"dbp-icon":l}}static get properties(){return{...super.properties,allowedMimeTypes:{type:String,attribute:`allowed-mime-types`},clipboardSelectBtnDisabled:{type:Boolean},clipboardFiles:{type:Object,attribute:`clipboard-files`},filesToSave:{type:Array,attribute:`files-to-save`},numberOfSelectedFiles:{type:Number,attribute:!1},enabledTargets:{type:String,attribute:`enabled-targets`},buttonsDisabled:{type:Boolean},nextcloudWebAppPasswordURL:{type:String,attribute:`nextcloud-auth-url`},nextcloudWebDavURL:{type:String,attribute:`nextcloud-web-dav-url`},nextcloudName:{type:String,attribute:`nextcloud-name`},nextcloudFileURL:{type:String,attribute:`nextcloud-file-url`},nextcloudAuthInfo:{type:String,attribute:`nextcloud-auth-info`},nextcloudStoreSession:{type:Boolean,attribute:`nextcloud-store-session`},mode:{type:String,attribute:`mode`},allowNesting:{type:Boolean,attribute:`allow-nesting`}}}_(e){return this.renderRoot.querySelector(e)}_a(e){return this.renderRoot.querySelectorAll(e)}update(e){e.forEach((e,t)=>{t===`clipboardFiles`&&this.tabulatorTable&&this.generateClipboardTable()}),super.update(e)}toggleCollapse(e){let t=this.tabulatorTable;setTimeout(function(){t.redraw()},0)}connectedCallback(){let e=this._i18n;super.connectedCallback(),this.updateComplete.then(()=>{this.tabulatorTable=new ce(this._(`#clipboard-content-table`),{layout:`fitColumns`,selectableRows:!0,placeholder:e.t(`clipboard.no-data`),responsiveLayout:`collapse`,responsiveLayoutCollapseStartOpen:!1,columnHeaderVertAlign:`middle`,columnDefaults:{vertAlign:`middle`,hozAlign:`left`,resizable:!1},columns:[{minWidth:40,headerSort:!1,formatter:`responsiveCollapse`},{title:`<label class="button-container select-all-icon"><input type="checkbox" id="select_all" name="select_all" value="select_all"><span class="checkmark" id="select_all_checkmark"></span></label>`,field:`type`,hozAlign:`center`,width:40,headerSort:!1,responsive:1,formatter:(e,t,n)=>{let r=this.createScopedElement(`div`);return r.innerHTML=`<dbp-icon name="empty-file" class="nextcloud-picker-icon "></dbp-icon>`,r}},{title:e.t(`clipboard.file-name`),responsive:0,widthGrow:5,minWidth:150,field:`name`,sorter:`alphanum`,formatter:e=>{let t=this.createScopedElement(`div`);return t.classList.add(`filename`),t.innerHTML=e.getValue(),t}},{title:e.t(`clipboard.file-size`),responsive:4,widthGrow:1,minWidth:84,field:`size`,formatter:(e,t,n)=>c(e.getValue())},{title:e.t(`clipboard.file-type`),responsive:2,widthGrow:1,minWidth:58,field:`type`,formatter:(e,t,n)=>{if(e.getValue()===void 0)return``;let[,r]=e.getValue().split(`/`);return r}},{title:e.t(`clipboard.file-mod`),responsive:3,widthGrow:1,minWidth:150,field:`lastModified`,sorter:(e,t,n,r,i,a,o)=>Date.parse(e)-Date.parse(t),formatter:function(e,t,n){let r=new Date(e.getValue()),i=r.getFullYear(),a=(`0`+(r.getMonth()+1)).slice(-2),o=(`0`+r.getDate()).slice(-2),s=(`0`+r.getHours()).slice(-2),c=(`0`+r.getMinutes()).slice(-2);return o+`.`+a+`.`+i+` `+s+`:`+c}},{title:`file`,field:`file`,visible:!1}],initialSort:[{column:`name`,dir:`asc`},{column:`type`,dir:`asc`}]}),this.tabulatorTable.on(`tableBuilt`,this.tableBuiltFunction.bind(this)),this.tabulatorTable.on(`rowClick`,this.rowClickFunction.bind(this)),this.tabulatorTable.on(`rowSelectionChanged`,this.rowSelectionChangedFunction.bind(this)),this.tabulatorTable.on(`dataChanged`,this.dataChangedFunction.bind(this))});let t=window;t.clipboardWarning||=(window.addEventListener(`beforeunload`,this._onReceiveBeforeUnload,!1),!0)}tableBuiltFunction(){this.tabulatorTable.addRow([{}]).then(function(e){e.delete()}),this.generateClipboardTable(),this._(`#select_all`)&&this._(`#select_all`).addEventListener(`click`,this.boundSelectHandler)}rowClickFunction(e,t){this.numberOfSelectedFiles=this.tabulatorTable===null?0:this.tabulatorTable.getSelectedRows().length,this.tabulatorTable!==null&&this.tabulatorTable.getSelectedRows().length===this.tabulatorTable.getRows().filter(e=>this.checkFileType(e.getData())).length?this._(`#select_all`).checked=!0:this._(`#select_all`).checked=!1}rowSelectionChangedFunction(e,t){let n=this._i18n;this.clipboardSelectBtnDisabled=!(this.tabulatorTable&&this.tabulatorTable.getSelectedRows().length>0),this._(`#select_all_checkmark`)&&(this._(`#select_all_checkmark`).title=this.checkAllSelected()?n.t(`clipboard.select-nothing`):n.t(`clipboard.select-all`))}dataChangedFunction(){this.tabulatorTable!==null&&setTimeout(()=>{this._(`.tabulator-responsive-collapse-toggle-open`)&&this._a(`.tabulator-responsive-collapse-toggle-open`).forEach(e=>e.addEventListener(`click`,this.toggleCollapse.bind(this))),this._(`.tabulator-responsive-collapse-toggle-close`)&&this._a(`.tabulator-responsive-collapse-toggle-close`).forEach(e=>e.addEventListener(`click`,this.toggleCollapse.bind(this)))},0)}disconnectedCallback(){super.disconnectedCallback(),this.tabulatorTable.off(`tableBuilt`),this.tabulatorTable.off(`rowClick`),this.tabulatorTable.off(`rowSelectionChanged`),this.tabulatorTable.off(`dataChanged`)}selectAllFiles(){this.checkAllSelected()?(this.tabulatorTable.getSelectedRows().forEach(e=>e.deselect()),this.numberOfSelectedFiles=0):(this.tabulatorTable.selectRow(this.tabulatorTable.getRows().filter(e=>e.getData().type!=`directory`&&this.checkFileType(e.getData()))),this.numberOfSelectedFiles=this.tabulatorTable.getSelectedRows().length)}checkAllSelected(){if(this.tabulatorTable){let e=this.tabulatorTable.getRows().filter(e=>e.getData().type!=`directory`&&this.checkFileType(e.getData())).length;if(this.tabulatorTable.getSelectedRows().length===e)return!0}return!1}checkFileType(e){if(this.allowedMimeTypes===``||!e.type)return!0;let[t,n]=e.type.split(`/`),r=this.allowedMimeTypes.split(`,`),i=!0;return r.forEach(e=>{let[r,a]=e.split(`/`);i&&=r!==`*`&&r!==t||a!==`*`&&a!==n}),!i||(console.log(`mime type ${e.type} of file '${e.name}' is not compatible with ${this.allowedMimeTypes}`),!1)}generateClipboardTable(){if(this.numberOfSelectedFiles=0,this.clipboardFiles.files&&this.tabulatorTable){let e=[];for(let t=0;t<this.clipboardFiles.files.length;t++)e[t]={name:this.clipboardFiles.files[t].name,size:this.clipboardFiles.files[t].size,type:this.clipboardFiles.files[t].type,lastModified:this.clipboardFiles.files[t].lastModified,file:this.clipboardFiles.files[t]};if(this.tabulatorTable.clearData(),this.tabulatorTable.setData(e),this.clipboardFiles.files.length>0){let e=this._a(`.tabulator-placeholder`);e&&e.forEach(e=>e.style.display=`none`)}else{let e=this._a(`.tabulator-placeholder`);e&&e.forEach(e=>e.style.display=`inherit`)}}this._(`#select_all`)&&(this._(`#select_all`).checked=!1)}_sendClipboardFiles(e){let t=this._i18n;for(let t=0;t<e.length;t++)this._sendFileEvent(e[t].file,e.length);this.tabulatorTable.deselectRow(),O({summary:t.t(`clipboard.saved-files-title`,{count:e.length}),body:t.t(`clipboard.saved-files-body`,{count:e.length}),type:`success`,timeout:5});let n=new CustomEvent(`dbp-file-source-file-upload-finished`,{detail:{count:e.length},bubbles:!0,composed:!0});this.dispatchEvent(n)}_sendFileEvent(e,t){let n=new CustomEvent(`dbp-clipboard-file-picker-file-downloaded`,{detail:{file:e,data:e,maxUpload:t},bubbles:!0,composed:!0});this.dispatchEvent(n)}onReceiveBeforeUnload(e){let t=this._i18n;if(this.clipboardFiles.files.length!==0&&e.target&&e.target.activeElement&&e.target.activeElement.nodeName){if(O({summary:t.t(`clipboard.file-warning`),body:t.t(`clipboard.file-warning-body`,{count:this.clipboardFiles.files.length}),type:`warning`,timeout:5}),!e.isTrusted&&confirm(`##carefulsaveialuge`))return;e.preventDefault(),e.returnValue=``}}saveFilesToClipboardEvent(e){let t=[];if(this.clipboardFiles&&this.clipboardFiles.files.length!==0&&(t=t.concat(this.clipboardFiles.files)),t=t.concat(e.detail.file),this.filesToSave=t,t&&t.length!==0){let e={files:t};this.sendSetPropertyEvent(`clipboard-files`,e);let n=new CustomEvent(`dbp-clipboard-file-picker-file-uploaded`,{bubbles:!0,composed:!0});this.dispatchEvent(n)}this.countUploadFiles+=1,this.countUploadFiles===e.detail.maxUpload?(this.buttonsDisabled=!1,this.countUploadFiles=0):this.buttonsDisabled=!0}saveFilesToClipboard(){let e=this._i18n,t=[];if(this.clipboardFiles&&this.clipboardFiles.files.length!==0&&(t=t.concat(this.clipboardFiles.files)),t=t.concat(this.filesToSave),this.filesToSave&&this.filesToSave.length!==0){let n={files:t};this.sendSetPropertyEvent(`clipboard-files`,n);let r=new CustomEvent(`dbp-clipboard-file-picker-file-uploaded`,{bubbles:!0,composed:!0});this.dispatchEvent(r),O({summary:e.t(`clipboard.saved-files-title`,{count:this.filesToSave.length}),body:e.t(`clipboard.saved-files-body`,{count:this.filesToSave.length}),type:`success`,timeout:5})}}finishedSaveFilesToClipboard(e){let t=this._i18n;O({summary:t.t(`clipboard.saved-files-title`,{count:e.detail.count}),body:t.t(`clipboard.saved-files-body`,{count:e.detail.count}),type:`success`,timeout:5})}openFileSink(){if(this._(`#file-sink-clipboard`)){let e=[];this.tabulatorTable.getSelectedData().length>0?this.tabulatorTable.getSelectedData().forEach(t=>{e.push(t.file)}):e=this.clipboardFiles.files,this._(`#file-sink-clipboard`).files=Object.create(e),this._(`#file-sink-clipboard`).openDialog()}}openFileSource(){this._(`#file-source-clipboard`)&&this._(`#file-source-clipboard`).openDialog()}clearClipboard(){let e=this._i18n;if(this.tabulatorTable&&this.tabulatorTable.getSelectedData().length>0){let t=this.tabulatorTable.getSelectedData().length;this.tabulatorTable.deleteRow(this.tabulatorTable.getSelectedRows());let n={files:[]};this.tabulatorTable.getRows().forEach(e=>n.files.push(e.getData().file)),this.sendSetPropertyEvent(`clipboard-files`,n),O({summary:e.t(`clipboard.clear-count-clipboard-title`,{count:t}),body:e.t(`clipboard.clear-count-clipboard-body`,{count:t}),type:`success`,timeout:5}),this.numberOfSelectedFiles=0}else this.sendSetPropertyEvent(`clipboard-files`,{files:[]}),O({summary:e.t(`clipboard.clear-clipboard-title`),body:e.t(`clipboard.clear-clipboard-body`),type:`success`,timeout:5})}getAdditionalButtons(){let e=this._i18n,t=this.clipboardFiles.files.length===0||this.clipboardSelectBtnDisabled;return t=this.buttonsDisabled?!0:t,f`
<div class="flex-container additional-button-container">
<div class="btn-flex-container-mobile">
<button
id="clipboard-add-files-button"
@click="${()=>{this.openFileSource()}}"
class="button ${k({hidden:this.mode===Rs||this.mode===zs})}"
title="${e.t(`clipboard.add-files`)}"
?disabled="${this.buttonsDisabled}">
<dbp-icon class="nav-icon" name="clipboard"></dbp-icon>
${e.t(`clipboard.add-files-btn`)}
</button>
<button
id="clipboard-remove-files-button"
@click="${()=>{this.clearClipboard()}}"
class="button"
title="${this.numberOfSelectedFiles>0?e.t(`clipboard.remove-count`,{count:this.numberOfSelectedFiles}):e.t(`clipboard.remove-all`)}"
?disabled="${t}">
${this.numberOfSelectedFiles>0?e.t(`clipboard.remove-count-btn`,{count:this.numberOfSelectedFiles}):e.t(`clipboard.remove-all-btn`)}
</button>
</div>
<div class="btn-flex-container-mobile">
<button
id="clipboard-save-files-button"
@click="${()=>{this.openFileSink()}}"
?disabled="${t}"
class="button"
title="${this.numberOfSelectedFiles>0?e.t(`clipboard.save-count`,{count:this.numberOfSelectedFiles}):e.t(`clipboard.save-all`)}">
${this.numberOfSelectedFiles>0?e.t(`clipboard.save-count-btn`,{count:this.numberOfSelectedFiles}):e.t(`clipboard.save-all-btn`)}
</button>
</div>
</div>
<dbp-file-source
id="file-source-clipboard"
context="${e.t(`clipboard.add-files`)}"
allowed-mime-types="${this.allowedMimeTypes}"
nextcloud-auth-url="${this.nextcloudWebAppPasswordURL}"
nextcloud-web-dav-url="${this.nextcloudWebDavURL}"
nextcloud-name="${this.nextcloudName}"
nextcloud-file-url="${this.nextcloudFileURL}"
nexcloud-auth-info="${this.nextcloudAuthInfo}"
?nextcloud-store-session="${this.nextcloudStoreSession}"
enabled-targets="${this.allowNesting?this.enabledTargets:this.enabledTargets.replace(`clipboard`,``)}"
decompress-zip
lang="${this.lang}"
text="${e.t(`clipboard.upload-area-text`)}"
button-label="${e.t(`clipboard.upload-button-label`)}"
@dbp-file-source-file-selected="${this.saveFilesToClipboardEvent}"
@dbp-nextcloud-file-picker-number-files="${this.finishedSaveFilesToClipboard}"
@dbp-file-source-file-upload-finished="${this.finishedSaveFilesToClipboard}"></dbp-file-source>
<dbp-file-sink
id="file-sink-clipboard"
context="${this.numberOfSelectedFiles>0?e.t(`clipboard.save-count`,{count:this.numberOfSelectedFiles}):e.t(`clipboard.save-all`)}"
filename="clipboard-documents.zip"
allowed-mime-types="${this.allowedMimeTypes}"
enabled-targets="${this.allowNesting?this.enabledTargets:this.enabledTargets.replace(`clipboard`,``)}"
nextcloud-auth-url="${this.nextcloudWebAppPasswordURL}"
nextcloud-web-dav-url="${this.nextcloudWebDavURL}"
nextcloud-name="${this.nextcloudName}"
nextcloud-file-url="${this.nextcloudFileURL}"
nexcloud-auth-info="${this.nextcloudAuthInfo}"
?nextcloud-store-session="${this.nextcloudStoreSession}"
lang="${this.lang}"></dbp-file-sink>
`}getClipboardSink(){let e=this._i18n,t=m(ya,`tabulator-tables/css/tabulator.min.css`);return f`
<div class="wrapper">
<div class="content">
<h3>${e.t(`clipboard.sink-title`)}</h3>
<div class="warning-container">
<dbp-icon name="warning-high" class="warning-icon"></dbp-icon>
<p>${e.t(`clipboard.warning`)}</p>
</div>
<div>
${this.getAdditionalButtons()}
<link rel="stylesheet" href="${t}" />
<div class="table-wrapper">
<div id="clipboard-content-table" class="force-no-select"></div>
</div>
</div>
</div>
<div class="clipboard-footer">
<button
class="button select-button is-primary"
title="${e.t(`clipboard.sink-btn`,{count:this.filesToSave.length})}"
@click="${()=>{this.saveFilesToClipboard()}}">
<dbp-icon class="nav-icon" name="clipboard"></dbp-icon>
${e.t(`clipboard.sink-btn`,{count:this.filesToSave.length})}
</button>
</div>
</div>
`}getClipboardSource(){let e=m(ya,`tabulator-tables/css/tabulator.min.css`),t=this._i18n;return f`
<div class="wrapper">
<div class="content">
<h3>${t.t(`clipboard.source-title`)}</h3>
<div class="warning-container">
<dbp-icon name="warning-high" class="warning-icon"></dbp-icon>
<p>${t.t(`clipboard.warning`)}</p>
</div>
<div>
${this.getAdditionalButtons()}
<link rel="stylesheet" href="${e}" />
<div class="table-wrapper">
<div id="clipboard-content-table" class="force-no-select"></div>
</div>
</div>
</div>
<div class="clipboard-footer">
<button
class="button select-button is-primary"
?disabled="${this.clipboardSelectBtnDisabled}"
@click="${()=>{this._sendClipboardFiles(this.tabulatorTable.getSelectedData())}}">
${this.tabulatorTable&&this.tabulatorTable.getSelectedRows().length>0?t.t(`clipboard.source-btn`,{count:this.tabulatorTable?this.tabulatorTable.getSelectedRows().length:0}):t.t(`clipboard.source-btn-none`)}
</button>
</div>
</div>
`}static get styles(){return v`
${h()}
${ne(!1)}
${S()}
${u()}
${y()}
${re()}
${le()}
${ba()}
a {
border-bottom: var(--dbp-border);
padding: 0;
}
a:hover {
color: var(--dbp-hover-color, var(--dbp-content));
background-color: var(--dbp-hover-background-color);
}
h2:first-child {
margin-top: 0;
margin-bottom: 0px;
}
.subheadline {
font-style: italic;
padding-left: 2em;
margin-top: -1px;
margin-bottom: 1.2em;
}
.warning-container {
display: flex;
flex-direction: inherit;
align-items: center;
}
.warning-icon {
margin-right: 10px;
font-size: 1.5rem;
margin-top: -23px;
}
.container {
margin-top: 2rem;
}
.flex-container {
margin-bottom: 5px;
}
.select-btn-wrapper {
float: right;
}
.init {
margin: 0px;
}
.flex-container {
display: flex;
justify-content: space-between;
}
.table-wrapper {
position: relative;
}
.clipboard-footer {
background-color: var(--dbp-background);
width: 100%;
padding-top: 10px;
display: flex;
align-items: end;
flex-direction: column;
}
.wrapper {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
/* position: relative; */
}
.content {
width: 100%;
height: 100%;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.additional-button-container {
margin-top: 0.5rem;
}
.warning-container p {
margin-top: 0px;
}
@media only screen and (orientation: portrait) and (max-width: 768px) {
.flex-container {
justify-content: space-between;
display: flex;
}
.btn-flex-container-mobile {
width: 100%;
display: flex;
justify-content: space-between;
margin-bottom: 5px;
}
.select-btn-wrapper {
width: 100%;
display: flex;
justify-content: end;
float: none;
}
.flex-container {
display: block;
}
.btn-flex-container-mobile {
flex-direction: column;
}
.btn-flex-container-mobile button:nth-child(2) {
margin-top: 5px;
}
.warning-icon {
margin-right: 10px;
font-size: 85px;
margin-top: -43px;
}
}
`}render(){let e=m(ya,`tabulator-tables/css/tabulator.min.css`);return this.mode===Rs?this.getClipboardSink():this.mode===zs?this.getClipboardSource():f`
<div>
${this.getAdditionalButtons()}
<link rel="stylesheet" href="${e}" />
<div class="table-wrapper">
<table id="clipboard-content-table" class="force-no-select"></table>
</div>
</div>
`}},Vs=class extends C(E){constructor(){super()}static get properties(){return{...super.properties}}handleScroll(e){if(!this._(`.right-paddle`)||!this._(`.left-paddle`))return;let t=e.currentTarget.scrollLeft,n=e.currentTarget.scrollWidth-e.currentTarget.clientWidth;t>0&&this._(`.left-paddle`).classList.remove(`hidden`),t<n&&this._(`.right-paddle`).classList.remove(`hidden`),t>=n&&this._(`.right-paddle`).classList.add(`hidden`),t<=0&&this._(`.left-paddle`).classList.add(`hidden`)}handleScrollRight(e){let t=e.scrollWidth-e.clientWidth,n=e,r=0,i=setInterval(function(){n.scrollLeft+=10,r+=10,r>=t&&window.clearInterval(i)},25)}handleScrollLeft(e){let t=e,n=e.scrollWidth-e.clientWidth,r=setInterval(function(){t.scrollLeft-=10,n-=10,n<=0&&window.clearInterval(r)},25)}},Hs=/* @__PURE__ */ r(((e,t)=>{(function(t,n){typeof define==`function`&&define.amd?define([],n):e===void 0?(n(),t.FileSaver={exports:{}}.exports):n()})(e,function(){function e(e,t){return t===void 0?t={autoBom:!1}:typeof t!=`object`&&(console.warn(`Deprecated: Expected third argument to be a object`),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function n(e,t,n){var r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){s(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function r(e){var t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function i(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{var t=document.createEvent(`MouseEvents`);t.initMouseEvent(`click`,!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:void 0,o=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=a.saveAs||(typeof window!=`object`||window!==a?function(){}:`download`in HTMLAnchorElement.prototype&&!o?function(e,t,o){var s=a.URL||a.webkitURL,c=document.createElement(`a`);t=t||e.name||`download`,c.download=t,c.rel=`noopener`,typeof e==`string`?(c.href=e,c.origin===location.origin?i(c):r(c.href)?n(e,t,o):i(c,c.target=`_blank`)):(c.href=s.createObjectURL(e),setTimeout(function(){s.revokeObjectURL(c.href)},4e4),setTimeout(function(){i(c)},0))}:`msSaveOrOpenBlob`in navigator?function(t,a,o){if(a=a||t.name||`download`,typeof t!=`string`)navigator.msSaveOrOpenBlob(e(t,o),a);else if(r(t))n(t,a,o);else{var s=document.createElement(`a`);s.href=t,s.target=`_blank`,setTimeout(function(){i(s)})}}:function(e,t,r,i){if(i||=open(``,`_blank`),i&&(i.document.title=i.document.body.innerText=`downloading...`),typeof e==`string`)return n(e,t,r);var s=e.type===`application/octet-stream`,c=/constructor/i.test(a.HTMLElement)||a.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||s&&c||o)&&typeof FileReader<`u`){var u=new FileReader;u.onloadend=function(){var e=u.result;e=l?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),i?i.location.href=e:location=e,i=null},u.readAsDataURL(e)}else{var d=a.URL||a.webkitURL,f=d.createObjectURL(e);i?i.location=f:location.href=f,i=null,setTimeout(function(){d.revokeObjectURL(f)},4e4)}});a.saveAs=s.saveAs=s,t!==void 0&&(t.exports=s)})})),Us=/* @__PURE__ */ t({FileSink:()=>Gs}),Ws=/* @__PURE__ */ e(Hs(),1),Gs=class extends w(C(Vs),pe){constructor(){super(),this.auth={},this.boundSwMessageHandler=this.handleSwMessage.bind(this),this.context=``,this.nextcloudAuthUrl=``,this.nextcloudWebDavUrl=``,this.nextcloudName=`Nextcloud`,this.nextcloudPath=``,this.nextcloudFileURL=``,this.nextcloudStoreSession=!1,this.buttonLabel=``,this.filename=`files.zip`,this.files=[],this.activeTarget=`local`,this.isDialogOpen=!1,this.enabledTargets=`local`,this.firstOpen=!0,this.fullsizeModal=!1,this.nextcloudAuthInfo=``,this.streamed=!1,this.sumContentLengths=-1,this._swRegistration=null,this.initialFileHandlingState={target:``,path:``},this.loadingDownloadFiles=!1,this._streamedDownloadInProgress=!1}static get scopedElements(){return{"dbp-icon":l,"dbp-mini-spinner":o,"dbp-modal":ae,"dbp-nextcloud-file-picker":Ls,"dbp-clipboard":Bs}}static get properties(){return{...super.properties,context:{type:String,attribute:`context`},filename:{type:String},files:{type:Array,attribute:!1},enabledTargets:{type:String,attribute:`enabled-targets`},nextcloudAuthUrl:{type:String,attribute:`nextcloud-auth-url`},nextcloudWebDavUrl:{type:String,attribute:`nextcloud-web-dav-url`},nextcloudName:{type:String,attribute:`nextcloud-name`},nextcloudFileURL:{type:String,attribute:`nextcloud-file-url`},nextcloudAuthInfo:{type:String,attribute:`nextcloud-auth-info`},nextcloudStoreSession:{type:Boolean,attribute:`nextcloud-store-session`},buttonLabel:{type:String,attribute:`button-label`},isDialogOpen:{type:Boolean,attribute:!1},activeTarget:{type:String,attribute:`active-target`},firstOpen:{type:Boolean,attribute:!1},nextcloudPath:{type:String,attribute:!1},fullsizeModal:{type:Boolean,attribute:`fullsize-modal`},initialFileHandlingState:{type:Object,attribute:`initial-file-handling-state`},streamed:{type:Boolean,attribute:`streamed`},sumContentLengths:{type:Number,attribute:`content-length`},auth:{type:Object},loadingDownloadFiles:{type:Boolean,attribute:!1}}}connectedCallback(){if(super.connectedCallback(),this.streamed){let e=m(ya,`stream-sw.js`);navigator.serviceWorker.register(e).then(e=>{this._swRegistration=e,window.navigator.userAgent.includes(`Firefox`)&&setInterval(function(){e.active?.postMessage(`keep-alive`)},3e3)}).catch(e=>console.error(e))}this.updateComplete.then(()=>{if(this._(`nav.modal-nav`).addEventListener(`scroll`,this.handleScroll.bind(this)),this.enabledTargets.split(`,`).length>1)this._(`.right-paddle`).addEventListener(`click`,this.handleScrollRight.bind(this,this._(`nav.modal-nav`))),this._(`.left-paddle`).addEventListener(`click`,this.handleScrollLeft.bind(this,this._(`nav.modal-nav`)));else{let e=this._(`.paddles`);e&&e.classList.add(`hidden`)}this.streamed&&navigator.serviceWorker.addEventListener(`message`,this.boundSwMessageHandler)})}disconnectedCallback(){this.streamed&&navigator.serviceWorker.removeEventListener(`message`,this.boundSwMessageHandler),super.disconnectedCallback()}handleStreamedDownload(){let e=document.createElement(`form`);e.enctype=`multipart/form-data`,e.style.display=`none`;let t=this.filename||`files.zip`;t.toLowerCase().endsWith(`.zip`)||(t+=`.zip`),e.action=m(ya,`downloadZip/`+encodeURIComponent(t)),e.method=`POST`;let n=!1;if(this.sumContentLengths>=0){let t=document.createElement(`input`);t.name=`sumContentLengths`,t.value=String(this.sumContentLengths),e.appendChild(t)}if(this.auth!=null&&this.auth.token!=null){let t=document.createElement(`input`);t.name=`authorization`,t.value=`Bearer `+this.auth.token,e.appendChild(t)}if(this.files.forEach(t=>{if((!Object.hasOwn(t,`name`)||!Object.hasOwn(t,`url`))&&!(t instanceof File)){console.error(`Given object cannot be streamed!`),n=!0;return}let r=document.createElement(`input`);if(t instanceof File){r.type=`file`,e.querySelector(`input[name="${t.name}"]`)!==null&&(t=new File([t],_(t.name)+`-`+Math.random().toString(36).substring(7)+`.`+ie(t.name),{type:t.type})),r.name=t.name;let n=new DataTransfer;n.items.add(t),r.files=n.files}else{let n=new URL(t.url);r.type=`url`,e.querySelector(`input[name="${t.name}"]`)!==null&&(t.name=_(t.name)+`-`+Math.random().toString(36).substring(7)+`.`+ie(t.name)),r.name=t.name,r.value=n.toString()}e.appendChild(r)}),!n){for(this.appendChild(e),e.requestSubmit(),this._streamedDownloadInProgress=!0;e.hasChildNodes();){let t=e.firstChild;t&&e.removeChild(t)}this.removeChild(e)}}cancelStreamedDownload(){this._streamedDownloadInProgress=!1,this._swRegistration&&this._swRegistration.active&&this._swRegistration.active.postMessage({type:`CANCEL_DOWNLOAD`}),window.stop()}async downloadCompressedFiles(){let t=(await import(`./jszip.DC1Salg6.js`).then(t=>/* @__PURE__ */ e(t.default,1))).default,n=new t,r=[];if(this.files.length===1){if(this.streamed)this.handleStreamedDownload();else{if(!(this.files[0]instanceof File)){console.error(`Given object cannot be saved!`);return}Ws.default.saveAs(this.files[0],this.files[0].name),this.closeLoadingIndicatorModal()}this.loadingDownloadFiles=!1,this.closeDialog();return}if(this.streamed)this.handleStreamedDownload(),this.loadingDownloadFiles=!1,this.closeDialog();else{let e=!1;if(this.files.forEach(t=>{if(!(t instanceof File)){console.error(`Given object cannot be saved!`),e=!0;return}let i=t.name;r.indexOf(i)!==-1&&(i=_(i)+`-`+Math.random().toString(36).substring(7)+`.`+ie(i)),r.push(i),n.file(i,t)}),e)return;let t=await n.generateAsync({type:`blob`});Ws.default.saveAs(t,this.filename||`files.zip`),this.closeLoadingIndicatorModal()}this.loadingDownloadFiles=!1,this.closeDialog()}update(e){e.forEach((e,t)=>{switch(t){case`enabledTargets`:this.hasEnabledDestination(this.activeTargets)||(this.activeTargets=this.enabledTargets.split(`,`)[0]);break;case`files`:this.files.length!==0&&(this.openDialog(),this.enabledTargets.includes(`clipboard`)&&this._(`#clipboard-file-picker`)&&(this._(`#clipboard-file-picker`).filesToSave=[...this.files]));break;case`initialFileHandlingState`:this.firstOpen&&(this.nextcloudPath=this.initialFileHandlingState.path)}}),super.update(e)}hasEnabledDestination(e){return this.enabledTargets.split(`,`).includes(e)}async uploadToNextcloud(e){let t=this._(`#nextcloud-file-picker`),n=[...this.files];await t.uploadFiles(n,e)}finishedFileUpload(e){let t=this._i18n;this.sendDestination(),this.closeModal(`#modal-picker`),e.detail>0&&O({summary:t.t(`file-sink.upload-success-title`),body:t.t(`file-sink.upload-success-body`,{name:this.nextcloudName,count:e.detail}),type:`success`,timeout:5})}sendDestination(){let e;e=this.activeTarget===`nextcloud`?{target:this.activeTarget,path:this._(`#nextcloud-file-picker`).directoryPath}:{target:this.activeTarget},this.sendSetPropertyEvent(`initial-file-handling-state`,e)}openModal(e){let t=this._(e);if(!t)return;let n=()=>{t.isOpen()||t.open()};t.modalDialog?n():t.updateComplete.then(n)}closeModal(e){let t=this._(e);t&&t.modalDialog&&t.isOpen()&&t.close()}handleModalClosed(e){if(e.detail.id!==`modal-picker-dialog`)return;this.isDialogOpen=!1;let t=new CustomEvent(`dbp-file-sink-dialog-closed`,{detail:{},bubbles:!0,composed:!0});this.dispatchEvent(t)}preventDefaults(e){e.preventDefault(),e.stopPropagation()}loadWebdavDirectory(){let e=this._(`#nextcloud-file-picker`);e&&e.checkLocalStorage().then(t=>{e.webDavClient!==null&&e.loadDirectory(e.directoryPath)})}openDialog(){if(this.enabledTargets.includes(`nextcloud`)&&this.loadWebdavDirectory(),this.enabledTargets.includes(`clipboard`)&&this._(`#clipboard-file-picker`)._(`#select_all`)&&(this._(`#clipboard-file-picker`)._(`#select_all`).checked=!1),this.openModal(`#modal-picker`),this.initialFileHandlingState.target!==``&&this.initialFileHandlingState.target!==void 0&&this.firstOpen){this.activeTarget=this.initialFileHandlingState.target,this.nextcloudPath=this.initialFileHandlingState.path;let e=this._(`#nextcloud-file-picker`);e&&e.webDavClient!==null&&e.loadDirectory(this.initialFileHandlingState.path),this.firstOpen=!1}this.isDialogOpen=!0}closeDialog(e){if(this.sendDestination(),this.enabledTargets.includes(`clipboard`)){let e=this._(`#clipboard-file-picker`);e&&e.tabulatorTable&&(e.tabulatorTable.deselectRow(),e.numberOfSelectedFiles=0,e._(`#select_all`)&&(e._(`#select_all`).checked=!1))}this.closeModal(`#modal-picker`),this.isDialogOpen=!1}getClipboardHtml(){return this.enabledTargets.includes(`clipboard`)?f`
<dbp-clipboard
id="clipboard-file-picker"
subscribe="clipboard-files:clipboard-files"
show-additional-buttons
mode="file-sink"
lang="${this.lang}"
auth-url="${this.nextcloudAuthUrl}"
enabled-targets="${this.enabledTargets}"
nextcloud-auth-url="${this.nextcloudAuthUrl}"
nextcloud-web-dav-url="${this.nextcloudWebDavUrl}"
nextcloud-name="${this.nextcloudName}"
nextcloud-file-url="${this.nextcloudFileURL}"
@dbp-clipboard-file-picker-file-uploaded="${e=>{this.closeDialog(e)}}"></dbp-clipboard>
`:f``}getNextcloudHtml(){let e=this._i18n;return this.enabledTargets.includes(`nextcloud`)&&this.nextcloudWebDavUrl!==``&&this.nextcloudAuthUrl!==``?f`
<dbp-nextcloud-file-picker
id="nextcloud-file-picker"
class="${k({hidden:this.nextcloudWebDavUrl===``||this.nextcloudAuthUrl===``})}"
directories-only
max-selected-items="1"
select-button-text="${e.t(`file-sink.select-directory`)}"
lang="${this.lang}"
subscribe="html-overrides,auth"
auth-url="${this.nextcloudAuthUrl}"
web-dav-url="${this.nextcloudWebDavUrl}"
nextcloud-name="${this.nextcloudName}"
auth-info="${this.nextcloudAuthInfo}"
directory-path="${this.nextcloudPath}"
nextcloud-file-url="${this.nextcloudFileURL}"
?store-nextcloud-session="${this.nextcloudStoreSession}"
@dbp-nextcloud-file-picker-file-uploaded="${async e=>{try{await this.uploadToNextcloud(e.detail)}catch(e){console.error(e)}}}"
@dbp-nextcloud-file-picker-file-uploaded-finished="${e=>{this.finishedFileUpload(e)}}"></dbp-nextcloud-file-picker>
`:f``}static get styles(){return v`
${h()}
${y()}
${ne()}
${S()}
${ba()}
#zip-download-block {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.block {
margin-bottom: 10px;
}
#clipboard-file-sink {
width: 100%;
height: 100%;
}
.paddle {
position: absolute;
top: 0px;
padding: 0px 5px;
box-sizing: content-box;
height: 100%;
}
.paddle::before {
background-color: var(--dbp-background);
opacity: 0.8;
content: '';
width: 100%;
height: 100%;
position: absolute;
left: 0;
}
.right-paddle {
right: 0px;
}
.left-paddle {
left: 0px;
}
.nav-wrapper {
position: relative;
overflow-x: auto;
border: none;
}
.paddles {
display: none;
}
.modal-nav {
height: 100%;
}
@media only screen and (max-width: 768px) {
.paddles {
display: inherit;
}
}
`}handleLoadingIndicatorModalClosed(){this.loadingDownloadFiles||this.cancelStreamedDownload()}showLoadingIndicatorModal(){this.loadingDownloadFiles=!1;let e=this.renderRoot?.querySelector(`#loading-indicator-modal`);e&&e.open()}closeLoadingIndicatorModal(){let e=this.renderRoot?.querySelector(`#loading-indicator-modal`);e&&(this._downloadStreamingStarted=!0,e.close())}handleSwMessage(e){if(e.data?.type===`STREAMED_DOWNLOAD_STARTED`){if(!this._streamedDownloadInProgress)return;this._streamedDownloadInProgress=!1;let e=this.renderRoot?.querySelector(`#loading-indicator-modal`);e&&(this._downloadStreamingStarted=!0,e.close())}}render(){let e=this._i18n;return f`
<dbp-modal
id="modal-picker"
modal-id="modal-picker-dialog"
class="file-handling-modal ${k({"modal-container-full-size":this.fullsizeModal})}"
full-height-line
title="${this.context}"
lang="${this.lang}"
@dbp-modal-closed="${e=>this.handleModalClosed(e)}">
<div slot="content" class="file-handling-modal-content">
<div class="nav-wrapper modal-nav">
<nav class="modal-nav">
<div
title="${e.t(`file-sink.nav-local`)}"
@click="${()=>{this.activeTarget=`local`}}"
class="${k({active:this.activeTarget===`local`,hidden:!this.hasEnabledDestination(`local`)})}">
<dbp-icon class="nav-icon" name="laptop"></dbp-icon>
<p>${e.t(`file-source.nav-local`)}</p>
</div>
<div
title="${this.nextcloudName}"
@click="${()=>{this.activeTarget=`nextcloud`,this.loadWebdavDirectory()}}"
class="${k({active:this.activeTarget===`nextcloud`,hidden:!this.hasEnabledDestination(`nextcloud`)||this.nextcloudWebDavUrl===``||this.nextcloudAuthUrl===``})}">
<dbp-icon class="nav-icon" name="cloud"></dbp-icon>
<p>${this.nextcloudName}</p>
</div>
<div
title="${e.t(`file-sink.clipboard`)}"
@click="${()=>{this.activeTarget=`clipboard`}}"
class="${k({active:this.activeTarget===`clipboard`,hidden:!this.hasEnabledDestination(`clipboard`)})}">
<dbp-icon class="nav-icon" name="clipboard"></dbp-icon>
<p>${e.t(`file-sink.clipboard`)}</p>
</div>
</nav>
<div class="paddles">
<dbp-icon
class="left-paddle paddle hidden"
name="chevron-left"
class="close-icon"></dbp-icon>
<dbp-icon
class="right-paddle paddle"
name="chevron-right"
class="close-icon"></dbp-icon>
</div>
</div>
<main class="modal-content" id="modal-picker-content">
<div
class="source-main ${k({hidden:this.activeTarget!==`local`})}">
<div id="zip-download-block">
<div class="block">
${e.t(`file-sink.local-intro`,{count:this.files.length})}
</div>
<button
class="button is-primary"
@click="${async()=>{let e=new CustomEvent(`dbp-file-sink-download-started`,{detail:{},bubbles:!0,composed:!0});this.dispatchEvent(e),this.showLoadingIndicatorModal(),await this.downloadCompressedFiles(),this.loadingDownloadFiles=!0}}">
<dbp-icon name="download" aria-hidden="true"></dbp-icon>
${e.t(`file-sink.local-button`,{count:this.files.length})}
</button>
</div>
</div>
<div
class="source-main ${k({hidden:this.activeTarget!==`nextcloud`||this.nextcloudWebDavUrl===``||this.nextcloudAuthUrl===``})}">
${this.getNextcloudHtml()}
</div>
<div
class="source-main ${k({hidden:this.activeTarget!==`clipboard`})}">
${this.getClipboardHtml()}
</div>
</main>
</div>
</dbp-modal>
<dbp-modal
id="loading-indicator-modal"
class="modal modal--loading-indicator"
modal-id="loading-indicator"
title="${e.t(`file-sink.preparing-download`)}"
subscribe="lang"
@dbp-modal-closed=${()=>this.handleLoadingIndicatorModalClosed()}>
<div slot="content">
<dbp-mini-spinner style="font-size: 4em"></dbp-mini-spinner>
</div>
</dbp-modal>
`}},Ks={"grant-permission-dialog":{"available-permissions":`Verfügbare Berechtigungen`,buttons:{"add-person-text":`Neue Person hinzufügen`,"cancel-text":`Schließen`,"delete-text":`Löschen`,"edit-text":`Bearbeiten`,"save-all-text":`Alle speichern`,"save-text":`Speichern`},"delete-confirmation":{"button-abort-text":`Abbrechen`,"button-delete-text":`Löschen`,message:`Möchten Sie die ausgewählten Zuschüsse wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden.`,title:`Löschen bestätigen`},"modal-title":`Berechtigungen verwalten`,"need-login-warning-text":`Sie müssen angemeldet sein, um den Dialog zur Berechtigungserteilung zu nutzen`,notifications:{"cant-remove-last-manager-warning":`[de] You cannot remove the last manage permission from the last manager user.`,"could-not-delete-grant":`Löschen von Berechtigungen fehlgeschlagen`,"could-not-delete-user":`Benutzer konnte nicht gelöscht werden`,"could-not-fetch-user-details":`Benutzerdetails konnten nicht abgerufen werden`,"could-not-get-forms":`Formulare konnten nicht von der API abgerufen werden`,"error-not-authorized":`Nicht autorisiert`,"error-title":`Fehler`,"failed-get-user-details":`Benutzerdetails konnten nicht abgerufen werden`,"failed-to-get-user-details":`Benutzerdetails konnten nicht abgerufen werden`,"info-title":`Info`,"permissions-saved-successfully":`{{n}} Berechtigungen erfolgreich gespeichert`,"save-permissions-error":`Speichern der {{n}} Benutzerberechtigungen fehlgeschlagen`,"save-permissions-unexpected-error":`Beim Speichern von Benutzerberechtigungen ist ein unerwarteter Fehler aufgetreten.`,"set-available-actions-error-text":`Verfügbare Aktionen konnten nicht festgelegt werden`,"success-title":`Erfolg`,"there-is-no-user-to-save":`[de] There is no user to save`,"there-is-nothing-to-save":`Es gibt keine Änderung der Berechtigungen zum Speichern für den Benutzer {{userFullName}}.`,"unknown-error":`Unbekannter Fehler beim Abrufen von Benutzerberechtigungen`,"user-already-added":`Benutzer bereits hinzugefügt`,"user-successfully-deleted":`Alle Berechtigungen von {{userFullName}} erfolgreich gelöscht`,"warning-title":`Warnung`},permissions:{"inherited-permission-title":`[de] Inherited permission, can't be changed`}}},qs={"grant-permission-dialog":{"available-permissions":`Available Permissions`,buttons:{"add-person-text":`Add new person`,"cancel-text":`Close`,"delete-text":`Delete`,"edit-text":`Edit`,"save-all-text":`Save all`,"save-text":`Save`},"delete-confirmation":{"button-abort-text":`Cancel`,"button-delete-text":`Delete`,message:`Are you sure you want to delete the selected grants? This action cannot be undone.`,title:`Confirm deletion`},"modal-title":`Manage permissions`,"need-login-warning-text":`You need to be logged in to use the grant permission modal`,notifications:{"cant-remove-last-manager-warning":`You cannot remove the last manage permission from the last manager user.`,"could-not-delete-grant":`Failed to delete permissions`,"could-not-delete-user":`Failed to delete user`,"could-not-fetch-user-details":`Failed to fetch user details`,"could-not-get-forms":`Could not get forms from the API`,"error-not-authorized":`Not authorized`,"error-title":`Error`,"failed-get-user-details":`Failed to get user details`,"failed-to-get-user-details":`Failed to fetch user details`,"info-title":`Info`,"permissions-saved-successfully":`{{n}} permissions saved successfully`,"save-permissions-error":`Failed to save {{n}} user permissions`,"save-permissions-unexpected-error":`Unexpected error happened during saving grants`,"set-available-actions-error-text":`Failed to set available actions`,"success-title":`Success`,"there-is-no-user-to-save":`There is no user to save`,"there-is-nothing-to-save":`There is no change in permissions to save for user {{userFullName}}`,"unknown-error":`Unknown error while getting user permissions`,"user-already-added":`User already added`,"user-successfully-deleted":`All permissions of {{userFullName}} successfully deleted`,"warning-title":`Warning`},permissions:{"inherited-permission-title":`Inherited permission, can't be changed`}}};function Js(){return g({en:qs,de:Ks},`de`,`en`)}function Ys(){return v`
.modal--permissions {
--dbp-modal-header-height: initial;
--dbp-modal-footer-height: 3em;
--dbp-modal-min-width: 320px;
--dbp-modal-max-width: min(90vw, 1300px);
--dbp-modal-min-height: 300px;
--dbp-modal-max-height: 90vh;
--dbp-modal-width: auto;
}
dbp-modal .header {
display: flex;
margin-bottom: 1em;
}
dbp-modal .header h3 {
font-size: 2em;
line-height: 1.2;
font-weight: bold;
margin: 0 1em 0 0;
overflow-wrap: anywhere;
}
dbp-modal .footer-menu {
margin: 0;
padding: 0;
display: flex;
justify-content: flex-end;
gap: 1em;
padding-top: 1em;
}
.content-inner {
display: flex;
flex-direction: column;
gap: 1em;
margin-top: 1em;
max-width: 1300px;
/*min-width: calc((var(--dbp-action-count) * 40px) + (.5em * (var(--dbp-action-count) - 1)) + 250px + 100px);*/
/*--dbp-container-size: calc((var(--dbp-action-count) * 40px) + (.5em * (var(--dbp-action-count) - 1)) + 250px + 100px);*/
position: relative;
}
.header-row {
position: sticky;
top: 0;
background: var(--dbp-background);
z-index: 99;
}
.header-row,
.user-row {
display: grid;
grid-template-columns: 250px auto 200px;
gap: 0;
padding: 0 1em;
}
.user-row:nth-child(2n + 1) {
background-color: rgba(125, 125, 125, 0.1);
}
.person-select-header {
flex-basis: 250px;
}
.buttons-header {
display: flex;
justify-content: flex-end;
flex-basis: 200px;
align-items: flex-end;
grid-column: 3/4;
}
/*
* For better tab order
* Add person button is second in tab order
* No need to go trough all edit/delete buttons
*/
.body-container {
display: flex;
flex-direction: column-reverse;
gap: 2em;
}
.user-row-container {
display: flex;
flex-direction: column;
gap: 0;
transition: 0.5s margin ease;
}
.person-select-container {
display: flex;
align-items: center;
height: 100%;
flex-basis: 250px;
}
/* for the resource-select dropdown */
.user-row-container:has(dbp-resource-select) {
margin-bottom: 180px;
}
dbp-resource-select {
width: 320px;
height: 30px;
}
.permissions-header,
.permission-group {
display: flex;
align-items: center;
gap: 1em;
flex-wrap: nowrap;
/*flex-wrap: wrap;*/
padding: 1em 0;
/*min-width: calc( ((var(--dbp-action-count) / 2) * 80px) + (1em * ((var(--dbp-action-count) / 2) - 1))); /* 4*80px + (column-count-1) *1em */
/*width: calc( ((var(--dbp-action-count) / 2) * 80px) + (1em * ((var(--dbp-action-count) / 2) - 1))); /* 4*80px + (column-count-1) *1em */
}
.header-row .permission-group {
padding-bottom: 0;
}
.action-buttons {
display: flex;
gap: 1em;
align-items: center;
justify-content: flex-end;
height: 100%;
flex-basis: 200px;
}
.checkbox-label-container {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
font-size: 14px;
width: 80px;
}
.checkbox-label-container label {
line-height: 1;
height: 40px;
display: flex;
align-items: flex-end;
}
.checkbox-container {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
font-size: 14px;
width: 80px;
}
input[type='checkbox'] {
width: 1.5em;
height: 1.5em;
cursor: pointer;
}
input[type='checkbox']:disabled {
cursor: not-allowed;
}
input[type='checkbox']:disabled.inherited-mode {
cursor: help;
box-shadow: 0 0 1px 1px var(--dbp-muted);
background: var(--dbp-muted);
}
.changed {
box-shadow: 0 0 3px 3px var(--dbp-accent);
background: var(--dbp-accent);
}
/* animations */
.user-row {
opacity: 1;
transition: opacity 500ms ease;
}
.delete-animation {
opacity: 0;
}
.modal--confirmation {
--dbp-modal-width: 320px;
--dbp-modal-max-width: 360px;
--dbp-modal-min-height: auto;
}
.modal--confirmation .footer-menu {
padding: 0;
justify-content: flex-end;
display: flex;
gap: 1em;
margin-block: 2em 0;
}
/* responsiveness */
.collapsed {
.content-inner {
background-color: rgba(255, 0, 0, 0.2);
}
.permission-group {
flex-wrap: wrap;
}
.header-row .permissions-header {
display: none;
}
.checkbox-container label {
position: initial !important;
clip: initial !important;
overflow: initial !important;
height: 40px !important;
width: initial !important;
word-wrap: initial !important;
display: flex;
align-items: flex-end;
}
}
.mobile {
.user-row {
grid-template-columns: 1fr;
padding: 1em;
}
}
/* util classes */
.visually-hidden {
position: absolute !important;
clip: rect(1px, 1px, 1px, 1px);
overflow: hidden;
height: 1px;
width: 1px;
word-wrap: normal;
}
.hidden {
display: none !important;
}
`}async function Xs(e){return new Promise(t=>{e._deletionConfirmationResolve=t;let n=e._(`#deletion-confirmation-modal--grant-permission`);n&&n.open()})}function Zs(e){let t=e._(`#deletion-confirmation-modal--grant-permission`);t&&t.close(),e._deletionConfirmationResolve&&=(e._deletionConfirmationResolve(!0),null)}function Qs(e){let t=e._(`#deletion-confirmation-modal--grant-permission`);t&&t.close(),e._deletionConfirmationResolve&&=(e._deletionConfirmationResolve(!1),null)}var $s=class extends w(C(E),Js){constructor(){super(),this.auth={},this.entryPointUrl=``,this.modalTitle=``,this.availableActions=[],this.userList=/* @__PURE__ */ new Map,this.permissionRows=[],this.usersToAdd=/* @__PURE__ */ new Map,this.resourceIdentifier=``,this.resourceIdentifiers=[],this.resourceClassIdentifier=``,this.addPersonButtonRef=a(),this.savePermissionButtonRef=a(),this.permissionModalRef=a(),this.lastManageCheckbox=null,this.lastSavedManagerId=null,this.protectedManagerIds=/* @__PURE__ */ new Set}get#e(){let e=this.addPersonButtonRef.value;if(!e)throw Error(`Add person button is unavailable`);return e}get#t(){let e=this.permissionModalRef.value;if(!e)throw Error(`Permission modal is unavailable`);return e}#n(e){let t=this.userList.get(e);if(!t)throw Error(`Unknown user "${e}"`);return t}#r(e){let t=this.usersToAdd.get(e);if(!t)throw Error(`User "${e}" is not queued for editing`);return t}static get properties(){return{...super.properties,auth:{type:Object},modalTitle:{type:String,attribute:`modal-title`},availableActions:{type:Array},userList:{type:Map},usersToAdd:{type:Map},hasUsersToAdd:{type:Boolean},permissionRows:{type:Array},resourceIdentifier:{type:String,attribute:`resource-identifier`},resourceIdentifiers:{type:Array,attribute:!1},resourceClassIdentifier:{type:String,attribute:`resource-class-identifier`},entryPointUrl:{type:String,attribute:`entry-point-url`},savePermissionButtonIsDisabled:{type:Boolean,attribute:!1},lastManageCheckbox:{type:Object,attribute:!1},lastSavedManagerId:{type:String,attribute:!1}}}getResourceIdentifiers(){let e=Array.isArray(this.resourceIdentifiers)&&this.resourceIdentifiers.length>0?this.resourceIdentifiers:[this.resourceIdentifier];return[...new Set(e.map(e=>e?.trim()).filter(Boolean))]}static get scopedElements(){return{"dbp-icon":l,"dbp-button":s,"dbp-icon-button":n,"dbp-resource-select":ue,"dbp-modal":ae,"dbp-notification":se}}connectedCallback(){super.connectedCallback(),this.addEventListener(`dbp-modal-closed`,this.modalClosedHandler.bind(this))}modalClosedHandler(e){this.closeModal(e)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`dbp-modal-closed`,this.modalClosedHandler)}updated(e){super.updated(e),e.forEach((e,t)=>{switch(t){case`lang`:(!this.modalTitle||!this.hasAttribute(`modal-title`))&&(this.modalTitle=this._i18n.t(`grant-permission-dialog.modal-title`));break;case`userList`:console.log(`this.userList`,this.userList),this.checkSavedManagerCount();break;case`usersToAdd`:console.log(`this.usersToAdd`,this.usersToAdd)}})}checkSavedManagerCount(){let e=/* @__PURE__ */ new Set;for(let t of this.getResourceIdentifiers()){let n=[];for(let[e,r]of this.userList){let i=r?.permissions?.get(`manage`);(i?.grantsByResource?.has(t)||this.getResourceIdentifiers().length===1&&i?.identifier)&&n.push(e)}n.length===1&&e.add(n[0])}this.protectedManagerIds=e,this.lastSavedManagerId=e.size===1?[...e][0]:null}disableLastManageCheckbox(){let e=[...this._a(`.permission-checkbox[name="manage"]`)].filter(e=>e.checked===!0);e.length===1?(this.lastManageCheckbox=e[0],this.lastManageCheckbox.disabled=!0):(this.lastManageCheckbox&&this.lastManageCheckbox instanceof HTMLInputElement&&this.lastManageCheckbox.classList.contains(`edit-mode`)&&(this.lastManageCheckbox.disabled=!1),this.lastManageCheckbox=null)}isLoggedIn(){return this.auth&&this.auth.token}async apiGetAvailableActions(){let e={method:`GET`,headers:{"Content-Type":`application/ld+json`,Authorization:`Bearer `+this.auth.token}};return await fetch(this.entryPointUrl+`/authorization/available-resource-class-actions/${this.resourceClassIdentifier}?perPage=9999`,e)}async setAvailableActions(){this.availableActions=[];let e=!1,t=this._i18n;try{let t=await this.apiGetAvailableActions();if(t.status!==200)e=!0;else{let n=await t.json();n==null?e=!0:this.availableActions=Object.keys(n.itemActions).map(e=>({[e]:{[this.lang]:n.itemActions[e][this.lang]??e}}))}}catch{e=!0}e&&O({summary:t.t(`grant-permission-dialog.notifications.error-title`),body:t.t(`grant-permission-dialog.notifications.set-available-actions-error-text`),type:`danger`,targetNotificationId:`permission-modal-notification`,timeout:5})}async apiGetResourceActionGrants(e=this.resourceIdentifier){let t={method:`GET`,headers:{"Content-Type":`application/ld+json`,Authorization:`Bearer `+this.auth.token}};return await fetch(this.entryPointUrl+`/authorization/resource-action-grants?resourceClass=${encodeURIComponent(this.resourceClassIdentifier)}&resourceIdentifier=${encodeURIComponent(e)}&page=1&perPage=9999`,t)}async apiGetUserDetails(e){let t={method:`GET`,headers:{"Content-Type":`application/ld+json`,Authorization:`Bearer `+this.auth.token}};return await fetch(this.entryPointUrl+`/base/people/${e}`,t)}async apiDeleteResourceActionGrant(e){if(!e)throw Error(`Grant identifier is required`);let t={method:`DELETE`,headers:{"Content-Type":`application/ld+json`,Authorization:`Bearer `+this.auth.token}};return await fetch(this.entryPointUrl+`/authorization/resource-action-grants/${e}`,t)}async apiPostResourceActionGrant(e,t,n=this.resourceIdentifier){let r={resourceIdentifier:n,resourceClass:this.resourceClassIdentifier,action:e,userIdentifier:t},i={method:`POST`,headers:{"Content-Type":`application/ld+json`,Authorization:`Bearer `+this.auth.token},body:JSON.stringify(r)};return await fetch(this.entryPointUrl+`/authorization/resource-action-grants`,i)}async deleteUsersAllGrants(e){let t=this._i18n;if(this.protectedManagerIds.has(e))throw Error(`Cannot delete the last manager`);let n=this.#n(e),r=[];n.permissions.forEach(e=>{e.grantsByResource instanceof Map?e.grantsByResource.forEach(e=>{e.inherited||r.push(e)}):e.identifier&&!e.inherited&&r.push(e)});try{for(let e of r)if((await this.apiDeleteResourceActionGrant(e.identifier)).status!==204)throw Error(`Failed to delete grant`)}catch(e){throw console.log(`Error deleting grant`,e),O({summary:t.t(`grant-permission-dialog.notifications.error-title`),body:t.t(`grant-permission-dialog.notifications.could-not-delete-grant`),type:`danger`,targetNotificationId:`permission-modal-notification`,timeout:0}),e}}async deleteUser(e){let t=this._i18n;try{await this.deleteUsersAllGrants(e);let t=this._(`.user-row[data-user-id="${e}"]`);t.classList.add(`delete-animation`),await new Promise(e=>{t.addEventListener(`transitionend`,e,{once:!0})}),this.removeUserFromQueue(e),this.removeUserFromList(e)&&(t.classList.remove(`delete-animation`),this.requestUpdate())}catch(e){console.log(`delete user error`,e),O({summary:t.t(`grant-permission-dialog.notifications.error-title`),body:t.t(`grant-permission-dialog.notifications.could-not-delete-user`),type:`danger`,targetNotificationId:`permission-modal-notification`,timeout:0})}}async getUserFullName(e){let t=this._i18n;try{let n=await(await this.apiGetUserDetails(e)).json();if(n!==void 0&&n.status!==403)return`${n.givenName} ${n.familyName}`;n.status===500?O({summary:t.t(`grant-permission-dialog.notifications.error-title`),body:t.t(`grant-permission-dialog.notifications.could-not-fetch-user-details`),type:`danger`,targetNotificationId:`permission-modal-notification`,timeout:0}):n.status===403&&O({summary:t.t(`grant-permission-dialog.notifications.error-title`),body:t.t(`grant-permission-dialog.notifications.error-not-authorized`),targetNotificationId:`permission-modal-notification`,type:`danger`,timeout:0})}catch(e){console.log(`getUserFullName failed`,e),O({summary:t.t(`grant-permission-dialog.notifications.error-title`),body:t.t(`grant-permission-dialog.notifications.failed-get-user-details`),type:`danger`,targetNotificationId:`permission-modal-notification`,timeout:0})}}lookupUserFullName(e){if(e)return this.userList.get(e)?.userFullName}_handleUserEditButton(e){this.setButtonState(e,`save`),this.addUserToQueue(e),this.enableUsersAllCheckboxes(e)}async handleUserSaveButton(e){try{await this.saveUserPermissions(e)}catch(e){console.log(e)}finally{this.userList.has(e)&&(this.setButtonState(e,`edit`),this.checkSavedManagerCount(),this._a(`[data-user-id="${e}"]`).forEach(e=>{let t=e;t.classList.remove(`changed`),t.removeAttribute(`data-changed`)}),this.disableUsersAllCheckboxes(e))}}async handleUserDeleteButton(e){let t=this._i18n,n=this.lookupUserFullName(e);await this.deleteUser(e),O({summary:t.t(`grant-permission-dialog.notifications.success-title`),body:t.t(`grant-permission-dialog.notifications.user-successfully-deleted`,{userFullName:n}),type:`info`,targetNotificationId:`permission-modal-notification`,timeout:5})}async setListOfUsersAndPermissions(){let e=this._i18n;try{let t=this.getResourceIdentifiers();if(t.length===0)throw Error(`No resource identifier was provided`);this.userList=/* @__PURE__ */ new Map;let n=/* @__PURE__ */ new Map;for(let r of t){let t=await this.apiGetResourceActionGrants(r);if(t.status===403){O({summary:e.t(`grant-permission-dialog.notifications.error-title`),body:e.t(`grant-permission-dialog.notifications.error-not-authorized`),targetNotificationId:`permission-modal-notification`,type:`danger`,timeout:0});return}if(!t.ok)throw Error(`Failed to load grants for resource ${r}`);let i=await t.json();for(let e of i?.[`hydra:member`]??[])if(e.userIdentifier){if(!this.availableActions.find(t=>Object.keys(t)[0]===e.action))continue;let t=e.userIdentifier,i=e.grantedActions?.length===0,a=n.get(t);a||(a={userIdentifier:t,userFullName:await this.getUserFullName(t),permissions:this.createEmptyUserPermission()},n.set(t,a)),a.permissions.get(e.action).grantsByResource.set(r,{identifier:e.identifier,inherited:i})}}for(let e of n.values())for(let n of e.permissions.values()){let e=[...n.grantsByResource.values()];n.identifier=e.length===t.length?e[0]?.identifier:null,n.inherited=e.length===t.length&&e.every(e=>e.inherited),n.mixed=e.length>0&&e.length<t.length}this.userList=n,this.setAllButtonState(`edit`),this.checkSavedManagerCount()}catch(t){console.log(`setListOfUsersAndPermissions`,t),O({summary:e.t(`grant-permission-dialog.notifications.error-title`),body:e.t(`grant-permission-dialog.notifications.unknown-error`),targetNotificationId:`permission-modal-notification`,type:`danger`,timeout:0})}}getPersonSearchQueryParameters(e,t){return{search:t.trim(),sort:`familyName`}}formatPerson(e,t){let n=t.givenName??``;return t.familyName&&(n+=` ${t.familyName}`),n}renderUserPermissionRow(){if(!this.userList)return;let e=this._i18n;return f`
${oe(Array.from(this.userList),([e])=>e,([t,n])=>f`
<div
class="user-row ${k({"edit-mode":this.usersToAdd.has(t)})}"
data-user-id="${t}">
<div class="person-select-container">
${n.userFullName?f`
<span class="user-name">${n.userFullName}</span>
`:f`
<dbp-resource-select
id="permission-person-select"
subscribe="auth"
lang="${this.lang}"
resource-path="/base/people"
fetch-mode="search"
.getSearchQueryParameters="${this.getPersonSearchQueryParameters}"
.formatResource="${this.formatPerson}"
@change="${e=>{this.handlePersonSelected(e)}}"
entry-point-url="${this.entryPointUrl}"></dbp-resource-select>
`}
</div>
${n.userFullName?this.renderPermissionCheckboxes(n):``}
${n.userFullName?f`
<div class="action-buttons">
${n.buttonState===`edit`?f`
<dbp-button
type="is-secondary"
id="user-edit-button-${t}"
no-spinner-on-click
@click="${()=>{this._handleUserEditButton(t)}}">
<dbp-icon name="pencil"></dbp-icon>
${e.t(`grant-permission-dialog.buttons.edit-text`)}
</dbp-button>
`:``}
${n.buttonState===`save`?f`
<dbp-button
type="is-primary"
id="user-save-button-${t}"
no-spinner-on-click
@click="${()=>{this.handleUserSaveButton(t)}}">
<dbp-icon name="save"></dbp-icon>
${e.t(`grant-permission-dialog.buttons.save-text`)}
</dbp-button>
`:``}
<dbp-button
type="is-secondary"
id="user-delete-button-${t}"
no-spinner-on-click
?disabled=${this.protectedManagerIds.has(t)}
@click="${async()=>{if(!await Xs(this))return;let n=this.lookupUserFullName(t);await this.deleteUser(t),O({summary:e.t(`grant-permission-dialog.notifications.success-title`),body:e.t(`grant-permission-dialog.notifications.user-successfully-deleted`,{userFullName:n}),type:`info`,targetNotificationId:`permission-modal-notification`,timeout:5})}}">
<dbp-icon name="trash"></dbp-icon>
${e.t(`grant-permission-dialog.buttons.delete-text`)}
</dbp-button>
</div>
`:``}
</div>
`)}
`}renderPermissionCheckboxes(e){let t=this._i18n;if(this.availableActions)return f`
<div class="permission-group" role="group" aria-labelledby="permissions-group-label">
<h3 id="permissions-group-label" class="visually-hidden">
${t.t(`grant-permission-dialog.available-permissions`)}
</h3>
${this.availableActions.map(n=>{let r=Object.keys(n)[0],i=n[r][this.lang],a=!1,o=!1,s=`${i}`,c=e.permissions.get(r);return a=c?.desiredGranted??!!c?.identifier,c?.editable&&(o=!0),c?.inherited&&(o=!1,s=t.t(`grant-permission-dialog.permissions.inherited-permission-title`)),f`
<div
class="checkbox-container ${k({"inherited-mode":!!c?.inherited})}">
<label
for="${r}-${e.userIdentifier}"
class="visually-hidden">
${i}
</label>
<input
id="${r}-${e.userIdentifier}"
name="${r}"
class="permission-checkbox ${k({"edit-mode":this.usersToAdd.has(e.userIdentifier),"inherited-mode":!!c?.inherited})}"
title="${s}"
data-user-id="${e.userIdentifier}"
type="checkbox"
@input="${this.handleCheckbox}"
?disabled="${!o}"
.indeterminate="${!!c?.mixed&&c?.desiredGranted===null}"
?checked="${a}" />
</div>
`})}
</div>
`}createEmptyUserPermission(e=!1){let t=/* @__PURE__ */ new Map;return!Array.isArray(this.availableActions)||this.availableActions.length<1||this.availableActions.forEach(n=>{let r=Object.keys(n)[0],i={action:r,identifier:null,editable:e,desiredGranted:null,grantsByResource:/* @__PURE__ */ new Map};t.set(r,i)}),t}async handlePersonSelected(e){let t=this._i18n;try{if(!e.detail?.value)return;let n=e.detail.object;if(!n)throw Error(`No user object returned`);if(n&&this.userList.has(n.identifier)){O({summary:t.t(`grant-permission-dialog.notifications.error-title`),body:t.t(`grant-permission-dialog.notifications.user-already-added`),targetNotificationId:`permission-modal-notification`,type:`danger`,timeout:0});return}let r={userIdentifier:n.identifier,userFullName:`${n.givenName} ${n.familyName}`,permissions:this.createEmptyUserPermission(!0)};this.addUserToQueue(r.userIdentifier,r),this.userList.delete(`emptyPerson`),this.addUserToList(r.userIdentifier,r),this.setButtonState(r.userIdentifier,`edit`),await this.updateComplete,this._handleUserEditButton(r.userIdentifier),this.#e.stop()}catch(e){console.log(`Failed to get user object`,e),O({summary:t.t(`grant-permission-dialog.notifications.error-title`),body:t.t(`grant-permission-dialog.notifications.failed-to-get-user-details`),targetNotificationId:`permission-modal-notification`,type:`danger`,timeout:0})}}handleCheckbox(e){let t=e.target;t.classList.add(`changed`),t.setAttribute(`data-changed`,!0),this.disableLastManageCheckbox(),this.checkSavedManagerCount();let n=t.getAttribute(`data-user-id`),r=t.getAttribute(`name`),i=this.#r(n).permissions.get(r);if(!i)throw Error(`Permission "${r}" does not exist for user "${n}"`);i.desiredGranted=t.checked,i.toSave=!0}enableUsersAllCheckboxes(e){this.#n(e).permissions.forEach(t=>{t.editable=!(t.action===`manage`&&t.identifier&&this.protectedManagerIds.has(e)||t.inherited)})}disableUsersAllCheckboxes(e){this.#n(e).permissions.forEach(e=>{e.editable=!1})}disableAllCheckboxes(){this.userList.forEach(e=>{e.permissions.forEach(e=>{e.editable=!1})})}renderPermissionLabels(){if(!(!this.availableActions||this.userList.size<1))return f`
${this.availableActions.map(e=>{let t=Object.keys(e)[0],n=e[t][this.lang]??t;return f`
<div class="checkbox-label-container">
<span>${n}</span>
</div>
`})}
`}async open(){let e=this._i18n;if(!this.isLoggedIn())O({summary:e.t(`grant-permission-dialog.notifications.error-title`),body:e.t(`grant-permission-dialog.need-login-warning-text`),type:`danger`,timeout:0});else{await this.setAvailableActions(),await this.setListOfUsersAndPermissions(),await this.updateComplete,this.#t.open();let e=this._(`.content-inner`);if(!e)return;new ResizeObserver(t=>{let n=this._(`.person-select-container`),r=Array.from(this._a(`.user-row:first-child .permission-group .checkbox-container`)),i=this._(`.action-buttons`),a=this._(`.user-row:first-child`),o=this._(`.user-row:first-child .permission-group`);if(!a||!o||!n||!i||r.length===0)return;let s=window.getComputedStyle(a),c=parseInt(s.paddingLeft)+parseInt(s.paddingRight),l=window.getComputedStyle(o),u=parseInt(l.gap),d=e.clientWidth,f=r.length,p=r[0].clientWidth*f+u*f-1,m=n.clientWidth+(r[0].clientWidth*f+u*f-1)+i.clientWidth;d<p+c?e.classList.add(`mobile`):e.classList.remove(`mobile`),d<m+c?e.classList.add(`collapsed`):e.classList.remove(`collapsed`)}).observe(e)}}closeModal(e){e&&e.detail&&e.detail.id===`grant-permission-modal`&&(this.userList=/* @__PURE__ */ new Map,this.#e.stop(),this.#t.close())}handleAddNewPerson(){this.#e.start(),this.addUserToList(`emptyPerson`,{userIdentifier:`emptyPerson`,userFullName:void 0,permissions:/* @__PURE__ */ new Map})}addUserToQueue(e,t=null){let n=t===null?this.#n(e):t;this.usersToAdd=new Map(this.usersToAdd).set(e,n)}removeUserFromQueue(e){let t=new Map(this.usersToAdd);t.delete(e),this.usersToAdd=t}addUserToList(e,t){this.userList=new Map(this.userList).set(e,t)}removeUserFromList(e){let t=new Map(this.userList);return t.delete(e)?(this.userList=t,!0):!1}setButtonState(e,t){let n=this.#n(e);this.userList.set(e,{...n,buttonState:t}),this.requestUpdate(`userList`)}setAllButtonState(e){Array.from(this.userList).forEach(([t,n])=>{this.setButtonState(t,e)})}async saveUserPermissions(e){let t=this._i18n;if(this.usersToAdd.size===0){O({summary:t.t(`grant-permission-dialog.notifications.info-title`),body:t.t(`grant-permission-dialog.notifications.there-is-no-user-to-save`),type:`info`,targetNotificationId:`permission-modal-notification`,timeout:5});return}try{let n=0,r=0,i=e?/* @__PURE__ */ new Map([[e,this.#r(e)]]):this.usersToAdd,a=this.getResourceIdentifiers(),o=[],s=[],c=!1;for(let[e,t]of i)t.permissions.forEach(t=>{if(t.toSave){if(t.desiredGranted)for(let n of a)t.grantsByResource?.has(n)||o.push({action:t.action,userIdentifier:e,resourceIdentifier:n});else t.action===`manage`&&this.protectedManagerIds.has(e)?c=!0:t.grantsByResource instanceof Map?t.grantsByResource.forEach(e=>{e.inherited||s.push({identifier:e.identifier})}):t.identifier&&!t.inherited&&s.push({identifier:t.identifier})}});c&&O({summary:`Warning`,body:t.t(`grant-permission-dialog.notifications.cant-remove-last-manager-warning`),type:`warning`,targetNotificationId:`permission-modal-notification`,timeout:5});for(let e of o)(await this.apiPostResourceActionGrant(e.action,e.userIdentifier,e.resourceIdentifier)).status===201?r++:n++;for(let e of s)(await this.apiDeleteResourceActionGrant(e.identifier)).status===204?r++:n++;o.length===0&&s.length===0&&O({summary:t.t(`grant-permission-dialog.notifications.info-title`),body:t.t(`grant-permission-dialog.notifications.there-is-nothing-to-save`,{userFullName:e?this.#r(e).userFullName:``}),type:`info`,targetNotificationId:`permission-modal-notification`,timeout:5}),this.usersToAdd=/* @__PURE__ */ new Map,await this.setListOfUsersAndPermissions(),r>0&&O({summary:t.t(`grant-permission-dialog.notifications.success-title`),body:t.t(`grant-permission-dialog.notifications.permissions-saved-successfully`,{n:r}),type:`success`,targetNotificationId:`permission-modal-notification`,timeout:5}),n>0&&O({summary:t.t(`grant-permission-dialog.notifications.error-title`),body:t.t(`grant-permission-dialog.notifications.save-permissions-error`,{n}),type:`danger`,targetNotificationId:`permission-modal-notification`,timeout:0})}catch(e){console.log(`Save user permissions error:`,e),O({summary:t.t(`grant-permission-dialog.notifications.error-title`),body:t.t(`grant-permission-dialog.notifications.save-permissions-unexpected-error`),type:`danger`,targetNotificationId:`permission-modal-notification`,timeout:0});return}}static get styles(){return[ne(),S(),y(),Ys(),v``]}render(){let e=this._i18n;return console.log(`*** MAIN RENDER ***`),f`
<dbp-modal
id="permission-modal"
sticky-footer
${i(this.permissionModalRef)}
class="modal modal--permissions"
modal-id="grant-permission-modal"
subscribe="lang">
<div slot="title">
<h2 class="modal-title">${this.modalTitle}</h2>
</div>
<div slot="header" class="header">
<div class="modal-notification">
<dbp-notification
id="permission-modal-notification"
inline
lang="${this.lang}"></dbp-notification>
</div>
</div>
<div slot="content">
<div class="content-container">
<div class="content-inner">
<div
class="header-row ${k({hidden:this.userList.size<1})}">
<div class="person-select-header"></div>
<div class="permissions-header">
${this.renderPermissionLabels()}
</div>
</div>
<!-- END .header-row -->
<div class="body-container">
<div class="button-container">
<dbp-button
type="is-secondary"
${i(this.addPersonButtonRef)}
id="add-new-person-button"
@click="${()=>{this.handleAddNewPerson()}}">
<dbp-icon name="plus"></dbp-icon>
<span>
${e.t(`grant-permission-dialog.buttons.add-person-text`)}
</span>
</dbp-button>
</div>
<div class="user-row-container">
${this.renderUserPermissionRow()}
</div>
</div>
</div>
</div>
</div>
<menu slot="footer" class="footer-menu">
<dbp-button
no-spinner-on-click
type="is-secondary"
@click="${()=>{let e=new CustomEvent(`dbp-modal-closed`,{detail:{id:`grant-permission-modal`},bubbles:!0,composed:!0});this.dispatchEvent(e)}}">
${e.t(`grant-permission-dialog.buttons.cancel-text`)}
</dbp-button>
<dbp-button
no-spinner-on-click
${i(this.savePermissionButtonRef)}
id="permission-save-button"
?disabled="${this.usersToAdd.size===0}"
@click="${async()=>{try{await this.saveUserPermissions()}catch(e){console.error(`Error saving user permissions:`,e)}this.setAllButtonState(`edit`),this._a(`input[type="checkbox"][data-user-id]`).forEach(e=>{let t=e;t.classList.remove(`changed`),t.removeAttribute(`data-changed`)}),this.disableAllCheckboxes()}}"
type="is-primary">
${e.t(`grant-permission-dialog.buttons.save-all-text`)}
</dbp-button>
</menu>
</dbp-modal>
<!-- Deletion Confirmation Modal -->
<dbp-modal
id="deletion-confirmation-modal--grant-permission"
class="modal modal--confirmation"
modal-id="deletion-confirmation-modal"
title="${e.t(`grant-permission-dialog.delete-confirmation.title`)}"
subscribe="lang">
<div slot="content">
<p>${e.t(`grant-permission-dialog.delete-confirmation.message`)}</p>
</div>
<menu slot="footer" class="footer-menu">
<dbp-button
type="is-secondary"
no-spinner-on-click
@click="${()=>Qs(this)}">
${e.t(`grant-permission-dialog.delete-confirmation.button-abort-text`)}
</dbp-button>
<dbp-button
type="is-danger"
no-spinner-on-click
@click="${()=>Zs(this)}">
${e.t(`grant-permission-dialog.delete-confirmation.button-delete-text`)}
</dbp-button>
</menu>
</dbp-modal>
`}},ec={"pdf-viewer":{"error-message":`Fehler: Dieses Dokument ist beschädigt.`,"first-page":`Erste Seite`,"last-page":`Letzte Seite`,"next-page":`Nächste Seite`,"page-count":`von {{totalPages}}`,"previous-page":`Vorherige Seite`}},tc={"pdf-viewer":{"error-message":`Error: This document is incorrect.`,"first-page":`First page`,"last-page":`Last page`,"next-page":`Next page`,"page-count":`of {{totalPages}}`,"previous-page":`Previous page`}};function nc(){return g({en:tc,de:ec},`de`,`en`)}
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const rc=te(class extends b{constructor(e){if(super(e),e.type!==x.PROPERTY&&e.type!==x.ATTRIBUTE&&e.type!==x.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!ee(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===p||t===d)return t;let n=e.element,r=e.name;if(e.type===x.PROPERTY){if(t===n[r])return p}else if(e.type===x.BOOLEAN_ATTRIBUTE){if(!!t===n.hasAttribute(r))return p}else if(e.type===x.ATTRIBUTE&&n.getAttribute(r)===t+``)return p;return D(e),t}});var ic=`@dbp-toolkit/pdf-viewer`;const ac=async e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{typeof r.result==`string`?t(r.result):n(/* @__PURE__ */ TypeError(`Failed to read file as a binary string`))},r.onerror=()=>{let e=r.error;n(e)},r.readAsBinaryString(e)});let oc=null;async function sc(){return oc||=(async()=>{let e=await import(`./pdf.CRVzbg0x.js`);return e.GlobalWorkerOptions.workerSrc=m(ic,`pdfjs/pdf.worker.mjs`),e})(),oc}function cc(e,t={}){let n=m(ic,`pdfjs/cmaps/`);t.cMapUrl===void 0&&(t.cMapUrl=n);let r=m(ic,`pdfjs/wasm/`);return t.wasmUrl===void 0&&(t.wasmUrl=r),t.isEvalSupported===void 0&&(t.isEvalSupported=!1),e.getDocument(t)}var lc=class extends w(C(E),nc){constructor(){super(),this.pdfDoc=null,this.currentPage=0,this.totalPages=0,this.isShowPage=!1,this.isPageLoaded=!1,this.showErrorMessage=!1,this.isPageRenderingInProgress=!1,this.canvasRef=a(),this.initialClientWidth=0,this.initialClientHeight=0,this.isFirstRendering=!0,this.autoResize=`cover`,this.textLayer=null,this._onWindowResize=this._onWindowResize.bind(this)}static get scopedElements(){return{"dbp-mini-spinner":o,"dbp-icon":l}}static get properties(){return{...super.properties,autoResize:{type:String,attribute:`auto-resize`},currentPage:{type:Number,attribute:!1},totalPages:{type:Number,attribute:!1},isShowPage:{type:Boolean,attribute:!1},isPageRenderingInProgress:{type:Boolean,attribute:!1},isPageLoaded:{type:Boolean,attribute:!1},showErrorMessage:{type:Boolean,attribute:!1}}}update(e){super.update(e),e.forEach((e,t)=>{t===`autoResize`&&this._onWindowResize()})}_onWindowResize(){this.isFirstRendering=!0,this.showPage(this.currentPage)}disconnectedCallback(){window.removeEventListener(`resize`,this._onWindowResize),super.disconnectedCallback()}connectedCallback(){super.connectedCallback(),window.addEventListener(`resize`,this._onWindowResize)}async onPageNumberChanged(e){let t=e.target,n=parseInt(t.value);n>0&&n<=this.totalPages&&await this.showPage(n)}async showPDF(e,t={},n=!1){this.isPageLoaded=!1,this.showErrorMessage=!1,this.isShowPage=!0;let r=await ac(e);this.pdfDoc!==null&&(await this.pdfDoc.destroy(),this.pdfDoc=null);try{let e=await sc();this.pdfDoc=await cc(e,{data:r}).promise}catch(e){console.error(e),this.showErrorMessage=!0;return}this.totalPages=this.pdfDoc.numPages;let i=t.currentPage||1;await this.showPage(i),this.isPageLoaded=!0,n&&setTimeout(()=>{this._onWindowResize()},100)}async showPage(e){if(this.isPageRenderingInProgress||this.pdfDoc===null)return;this.isPageRenderingInProgress=!0,this.currentPage=e;let t=this.canvasRef.value;try{let n=await this.pdfDoc.getPage(e);if(this.isFirstRendering){this.isFirstRendering=!1;let e=window.getComputedStyle(this._(`#pdf-main-container`)),t=parseFloat(e.borderRightWidth)+parseFloat(e.borderLeftWidth),n=parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth);this.initialClientWidth=this.getBoundingClientRect().width-t,this.initialClientHeight=this.getBoundingClientRect().height-n}let r=n.getViewport({scale:1}),i=this.initialClientWidth,a=this.initialClientHeight-this._(`#pdf-meta`).clientHeight;t.width=i;let o=i/r.width,s=n.getViewport({scale:o});this.autoResize===`contain`&&s.height>a&&(o=a/r.height,s=n.getViewport({scale:o}));let c=window.devicePixelRatio||1;t.height=Math.floor(s.height*c),t.width=Math.floor(s.width*c),t.style.width=Math.floor(s.width)+`px`,t.style.height=Math.floor(s.height)+`px`;let l=c===1?void 0:[c,0,0,c,0,0];this._(`#canvas-wrapper-inner`).style.width=s.width+`px`,this._(`#canvas-wrapper-inner`).style.height=s.height+`px`,this._(`#page-loader`).style.height=s.height+`px`,this._(`#page-loader`).style.lineHeight=s.height+`px`,this._(`#canvas-wrapper`).style.height=s.height+`px`;let u={canvas:t,viewport:s,transform:l};await n.render(u).promise,await this._renderTextLayer(n,s,o)}finally{this.isPageRenderingInProgress=!1}}async _renderTextLayer(e,t,n){this.textLayer&&=(this.textLayer.cancel(),null);let r=this._(`#text-layer`);r.innerHTML=``,r.style.width=t.width+`px`,r.style.height=t.height+`px`,r.style.setProperty(`--scale-factor`,n),r.style.setProperty(`--user-unit`,t.userUnit);let i=await e.getTextContent(),a=await sc();this.textLayer=new a.TextLayer({textContentSource:i,container:r,viewport:t}),await this.textLayer.render(),document.querySelectorAll(`.hiddenCanvasElement`).forEach(e=>e.setAttribute(`style`,`display: none`))}sendCancelEvent(){let e=new CustomEvent(`dbp-pdf-viewer-cancel`,{detail:{},bubbles:!0,composed:!0});this.dispatchEvent(e)}static get styles(){return v`
${ne()}
${S()}
#pdf-meta input[type=number] {
max-width: 50px;
}
#page-loader {
display: flex;
align-items: center;
justify-content: center;
}
#pdf-content,
#pdf-main-container {
box-sizing: border-box;
height: 100%;
background-color: var(--dbp-muted-surface);
}
.pdf-main-container {
align-items: end;
}
#pdf-main-container.loading {
background-color: var(--dbp-background);
padding: 20px;
}
#pdf-main-container {
border: var(--dbp-border);
}
#canvas-wrapper {
box-sizing: border-box;
display: flex;
align-items: center;
flex-direction: column;
}
#canvas-wrapper-inner {
display: block;
position: relative;
background-color: var(--dbp-background);
}
#canvas-wrapper canvas {
position: absolute;
top: 0;
left: 0;
}
.textLayer {
position: absolute;
top: 0;
left: 0;
overflow: hidden;
line-height: 1;
--total-scale-factor: calc(var(--scale-factor) * var(--user-unit));
--scale-round-x: 1px;
--scale-round-y: 1px;
}
.textLayer :is(span, br) {
color: transparent;
position: absolute;
white-space: pre;
cursor: text;
transform-origin: 0% 0%;
--font-height: 0;
--min-font-size: 1;
--text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
--min-font-size-inv: calc(1 / var(--min-font-size));
--scale-x: 1;
--rotate: 0deg;
font-size: calc(var(--text-scale-factor) * var(--font-height));
transform: rotate(var(--rotate)) scaleX(var(--scale-x));
}
.textLayer br {
user-select: none;
}
.textLayer span::selection {
color: transparent;
background: rgba(0, 0, 255, 0.25);
}
.buttons {
display: flex;
flex-wrap: wrap;
width: 100%;
justify-content: center;
align-items: center;
}
.nav-buttons {
display: flex;
justify-content: center;
flex-grow: 1;
flex-wrap: wrap;
}
.buttons .page-info {
align-self: center;
white-space: nowrap;
}
.nav-buttons > * {
margin: 2px;
}
input[type='number'] {
background-color: var(--dbp-background);
border: var(--dbp-border);
color: var(--dbp-content);
padding: 0 0.3em;
}
#pdf-meta {
padding: 0.54em;
border-bottom: var(--dbp-border);
background-color: var(--dbp-background);
}
.button.is-cancel {
color: var(--dbp-danger);
}
.error-message {
text-align: center;
border: 1px solid black;
border-top: 0px;
padding: 15px;
}
dbp-mini-spinner {
margin: auto;
display: block;
width: 17px;
}
`}render(){let e=this._i18n;return f`
<div
id="pdf-main-container"
class="${k({hidden:!this.isShowPage,loading:!this.isPageLoaded})} pdf-main-container">
<dbp-mini-spinner
class="${k({hidden:this.isPageLoaded||this.showErrorMessage})}"></dbp-mini-spinner>
<div
class="error-message ${k({hidden:!this.showErrorMessage||this.isPageLoaded})}">
${e.t(`pdf-viewer.error-message`)}
</div>
<div id="pdf-content" class="${k({hidden:!this.isPageLoaded})} pdf-content">
<div id="pdf-meta">
<div class="buttons ${k({hidden:!this.isPageLoaded})}">
<div class="nav-buttons">
<button
class="button is-icon"
title="${e.t(`pdf-viewer.first-page`)}"
@click="${async()=>{await this.showPage(1)}}"
?disabled="${this.isPageRenderingInProgress||this.currentPage===1}">
<dbp-icon name="angle-double-left"></dbp-icon>
</button>
<button
class="button is-icon"
title="${e.t(`pdf-viewer.previous-page`)}"
@click="${async()=>{this.currentPage>1&&await this.showPage(--this.currentPage)}}"
?disabled="${this.isPageRenderingInProgress||this.currentPage===1}">
<dbp-icon name="chevron-left"></dbp-icon>
</button>
<input
type="number"
min="1"
max="${this.totalPages}"
@input="${this.onPageNumberChanged}"
.value="${rc(this.currentPage)}" />
<div class="page-info">
${e.t(`pdf-viewer.page-count`,{totalPages:this.totalPages})}
</div>
<button
class="button is-icon"
title="${e.t(`pdf-viewer.next-page`)}"
@click="${async()=>{this.currentPage<this.totalPages&&await this.showPage(++this.currentPage)}}"
?disabled="${this.isPageRenderingInProgress||this.currentPage===this.totalPages}">
<dbp-icon name="chevron-right"></dbp-icon>
</button>
<button
class="button is-icon"
title="${e.t(`pdf-viewer.last-page`)}"
@click="${async()=>{await this.showPage(this.totalPages)}}"
?disabled="${this.isPageRenderingInProgress||this.currentPage===this.totalPages}">
<dbp-icon name="angle-double-right"></dbp-icon>
</button>
</div>
</div>
</div>
<div
id="canvas-wrapper"
class="${k({hidden:this.isPageRenderingInProgress})}">
<div id="canvas-wrapper-inner">
<canvas id="pdf-canvas" ${i(this.canvasRef)}></canvas>
<div id="text-layer" class="textLayer"></div>
</div>
</div>
<div class="${k({hidden:!this.isPageRenderingInProgress})}">
<dbp-mini-spinner id="page-loader"></dbp-mini-spinner>
</div>
</div>
</div>
`}};export{Bs as a,pe as c,Vs as i,$s as n,Ls as o,Gs as r,ba as s,lc as t};
//# sourceMappingURL=pdf-viewer.CsTRBfhh.js.map