@maveio/components 0.0.154 → 0.0.155-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +12 -0
  2. package/dist/chunk-2ELUELDT.cjs +1 -0
  3. package/dist/chunk-3MEOYLCV.cjs +20 -0
  4. package/dist/chunk-45FW5DBN.js +1 -0
  5. package/dist/{chunk-2C6BGW6H.js → chunk-4CDE2QCJ.js} +2 -2
  6. package/dist/chunk-4M7XLFOJ.cjs +161 -0
  7. package/dist/chunk-6MCTUE3H.js +37 -0
  8. package/dist/{chunk-YVMWE3I7.js → chunk-6NE3LOKU.js} +3 -3
  9. package/dist/{chunk-WLVMWIKH.cjs → chunk-6NWQAHZT.cjs} +2 -2
  10. package/dist/chunk-7MHSKSE5.js +161 -0
  11. package/dist/{chunk-D3LG3UTO.js → chunk-7WWUNKRI.js} +3 -3
  12. package/dist/{chunk-SAOOZPZZ.cjs → chunk-ALY7UTZA.cjs} +3 -3
  13. package/dist/{chunk-36CSGHYJ.js → chunk-ESQT2PPF.js} +2 -2
  14. package/dist/chunk-F6EKAS27.js +1 -0
  15. package/dist/chunk-FSFJQ67W.js +93 -0
  16. package/dist/{chunk-DH5I55F5.js → chunk-HX6F65VL.js} +1 -1
  17. package/dist/{chunk-WFWUIIE6.js → chunk-IBTJ5OMP.js} +2 -2
  18. package/dist/chunk-J7OISSKU.cjs +1 -0
  19. package/dist/chunk-JBRRVOTV.cjs +37 -0
  20. package/dist/{chunk-2P6HF22Q.cjs → chunk-KTGL4HLA.cjs} +2 -2
  21. package/dist/{chunk-YAVQQEFQ.cjs → chunk-M3UFDMO6.cjs} +3 -3
  22. package/dist/chunk-MC6T46LX.cjs +93 -0
  23. package/dist/chunk-MKZYI5TY.cjs +1 -0
  24. package/dist/chunk-OTDMHX6X.js +20 -0
  25. package/dist/chunk-P6SBZPDR.js +1 -0
  26. package/dist/{chunk-EB4QCWWS.cjs → chunk-RFBU3KXA.cjs} +3 -3
  27. package/dist/{chunk-X3IY737A.cjs → chunk-TVNAG7X4.cjs} +2 -2
  28. package/dist/{chunk-HKHV3KLY.js → chunk-VZKW2VWI.js} +2 -2
  29. package/dist/{chunk-Y7NYUH3P.cjs → chunk-YT56YDUY.cjs} +1 -1
  30. package/dist/{chunk-TI75IJ2E.cjs → chunk-ZODBVQLM.cjs} +1 -1
  31. package/dist/chunk-ZOWJYZSD.js +1 -0
  32. package/dist/components/clip.cjs +1 -1
  33. package/dist/components/clip.js +1 -1
  34. package/dist/components/files.cjs +1 -1
  35. package/dist/components/files.js +1 -1
  36. package/dist/components/img.cjs +1 -1
  37. package/dist/components/img.js +1 -1
  38. package/dist/components/list.cjs +1 -1
  39. package/dist/components/list.js +1 -1
  40. package/dist/components/player.cjs +1 -1
  41. package/dist/components/player.js +1 -1
  42. package/dist/components/pop.cjs +1 -1
  43. package/dist/components/pop.js +1 -1
  44. package/dist/components/text.cjs +1 -1
  45. package/dist/components/text.js +1 -1
  46. package/dist/components/upload.cjs +1 -1
  47. package/dist/components/upload.d.cts +19 -3
  48. package/dist/components/upload.d.ts +19 -3
  49. package/dist/components/upload.js +1 -1
  50. package/dist/embed/api.cjs +1 -1
  51. package/dist/embed/api.d.cts +4 -3
  52. package/dist/embed/api.d.ts +4 -3
  53. package/dist/embed/api.js +1 -1
  54. package/dist/embed/controller.cjs +1 -1
  55. package/dist/embed/controller.js +1 -1
  56. package/dist/embed/socket.cjs +1 -1
  57. package/dist/embed/socket.js +1 -1
  58. package/dist/index.cjs +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/react.cjs +1 -1
  61. package/dist/react.js +1 -1
  62. package/dist/themes/loader.cjs +1 -1
  63. package/dist/themes/loader.js +1 -1
  64. package/dist/utils/localization.cjs +1 -1
  65. package/dist/utils/localization.js +1 -1
  66. package/dist/utils/mave_element.cjs +1 -1
  67. package/dist/utils/mave_element.js +1 -1
  68. package/dist/utils/origin.cjs +1 -1
  69. package/dist/utils/origin.js +1 -1
  70. package/dist/vue.cjs +1 -0
  71. package/dist/vue.d.cts +65 -0
  72. package/dist/vue.d.ts +65 -0
  73. package/dist/vue.js +1 -0
  74. package/package.json +22 -7
  75. package/dist/chunk-2EYY6N7K.js +0 -20
  76. package/dist/chunk-3PLBZPRP.js +0 -1
  77. package/dist/chunk-4GTAVYTC.cjs +0 -93
  78. package/dist/chunk-5OEIKFAN.js +0 -93
  79. package/dist/chunk-6QHPCMNQ.js +0 -104
  80. package/dist/chunk-COWZ7GYF.cjs +0 -1
  81. package/dist/chunk-F2VMRZFU.cjs +0 -20
  82. package/dist/chunk-GMEHYYP4.js +0 -37
  83. package/dist/chunk-LOR3PIH5.cjs +0 -37
  84. package/dist/chunk-MB72HBHH.cjs +0 -1
  85. package/dist/chunk-NV7C4TBM.js +0 -1
  86. package/dist/chunk-TIOUPJWD.js +0 -1
  87. package/dist/chunk-TPP5OQFR.js +0 -1
  88. package/dist/chunk-VW7IKXVI.cjs +0 -1
  89. package/dist/chunk-WEZKG6QZ.cjs +0 -104
  90. package/dist/lottie-player.esm-BBAKIFYQ.js +0 -283
  91. package/dist/lottie-player.esm-OYBEUNQX.cjs +0 -283
package/README.md CHANGED
@@ -69,6 +69,18 @@ function App() {
69
69
  export default App;
70
70
  ```
71
71
 
72
+ or Vue:
73
+
74
+ ```js
75
+ <template>
76
+ <Player embed="{embed id}"></Player>
77
+ </template>
78
+
79
+ <script setup lang="ts">
80
+ import { Player } from '@maveio/components/vue';
81
+ </script>
82
+ ```
83
+
72
84
  ## Usage
73
85
 
74
86
  ### Player
@@ -0,0 +1 @@
1
+ 'use strict';var chunkJ7OISSKU_cjs=require('./chunk-J7OISSKU.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs');var a=["default","synthwave","dolphin"],h={default:()=>import('./themes/default.cjs'),synthwave:()=>import('./themes/synthwave.cjs'),dolphin:()=>import('./themes/dolphin.cjs')};async function p(t){if(!a.includes(t))return;if(!!chunkJ7OISSKU_cjs.a()){let e=`./dist/themes/${t}.js`;return c(e)}let s=h[t];return s?s():void 0}async function c(t){return import(t)}var d=class t{constructor(){this.themes=[];}static async get(n,s){if(t.instance||(t.instance=new t),t.instance.themes.find(e=>e.name===n))return Promise.resolve(t.instance);t.instance.themes.push({name:n}),t.instance.currentTheme=n;try{if(typeof document<"u"&&!a.includes(n)){let e=document.createElement("link");e.rel="stylesheet",e.href=`${s}/${n}.css`,document.head.appendChild(e);}}catch(e){console.log("[mave-player]: theme css not loaded",e);}try{if(s&&!a.includes(n)){let{build:e}=await c(`${s}/${n}.js`);e(n,chunk5NSCV6C2_cjs.i,chunk5NSCV6C2_cjs.c,chunk5NSCV6C2_cjs.h);}else {let e=await p(n);if(e)e.build(n,chunk5NSCV6C2_cjs.i,chunk5NSCV6C2_cjs.c,chunk5NSCV6C2_cjs.h);else {let m=`./${chunkJ7OISSKU_cjs.a()}themes/${n}.js`,{build:u}=await c(m);u(n,chunk5NSCV6C2_cjs.i,chunk5NSCV6C2_cjs.c,chunk5NSCV6C2_cjs.h);}}}catch(e){console.log("[mave-player]: theme not loaded",e);}return Promise.resolve(t.instance)}static async external(n){t.instance||(t.instance=new t);let s=n.split("/").pop()?.replace(".js","")||"";try{if(typeof document<"u"){let e=document.createElement("link");e.rel="stylesheet",e.href=`${n.replace(".js","")}.css`,document.head.appendChild(e);}}catch(e){console.log("[mave-player]: theme css not loaded",e);}if(t.instance.themes.find(e=>e.name===s))return Promise.resolve(t.instance);t.instance.themes.push({name:s}),t.instance.currentTheme=s;try{let{build:e}=await c(n);e(s,chunk5NSCV6C2_cjs.i,chunk5NSCV6C2_cjs.c,chunk5NSCV6C2_cjs.h);}catch(e){console.log("[mave-player]: theme not loaded",e);}return Promise.resolve(t.instance)}static getTheme(){return t.instance?t.instance.currentTheme:""}};exports.a=d;
@@ -0,0 +1,20 @@
1
+ 'use strict';var chunkYT56YDUY_cjs=require('./chunk-YT56YDUY.cjs'),chunkMKZYI5TY_cjs=require('./chunk-MKZYI5TY.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunkIPA5Q26W_cjs=require('./chunk-IPA5Q26W.cjs');var t,l,C,x,b,v,y,z,L,T,U,f=class extends chunkMKZYI5TY_cjs.a{constructor(){super(...arguments);chunkIPA5Q26W_cjs.e(this,t);this.embedController=new chunkYT56YDUY_cjs.b(this);}get embed(){return this._embed}set embed(e){this._embed!==e&&(this._embed=e,this.requestUpdate("embed"),this.embedController.embed=this.embed);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}render(){return chunk5NSCV6C2_cjs.c`
2
+ ${this.embedController.render({pending:this.renderPending,complete:e=>{if(this._data=e,!e)return;let n=chunkIPA5Q26W_cjs.f(this,t,T).call(this),i=chunkIPA5Q26W_cjs.f(this,t,U).call(this),o=this._slottedChildren.map(d=>{function m(){let r;return d.nodeName==="TEMPLATE"?r=d.content.cloneNode(true):r=d.cloneNode(true),r}if(d.getAttribute("name")=="mave-files-video"){if(!n)return;let r=m(),a=Number(this._data.created_at),h=a&&a<1e12?a*1e3:a;Number.isFinite(h)&&chunkIPA5Q26W_cjs.f(this,t,l).call(this,r,'[slot="date"]',new Date(h).toLocaleDateString().replaceAll("/","-"));let p=this._data.video.duration;p&&chunkIPA5Q26W_cjs.f(this,t,l).call(this,r,'[slot="duration"]',this.durationToTime(p));let u=this._data.video.filetype;u&&chunkIPA5Q26W_cjs.f(this,t,l).call(this,r,'[slot="filetype"]',u);let _=n.file_size||this._data.video.size;_&&chunkIPA5Q26W_cjs.f(this,t,l).call(this,r,'[slot="size"]',chunkIPA5Q26W_cjs.f(this,t,v).call(this,_));let M=chunkIPA5Q26W_cjs.f(this,t,z).call(this,n),S=n.container||"mp4",g=chunkIPA5Q26W_cjs.f(this,t,b).call(this,M,`${this._data.name}.${S}`);return g.setAttribute("aria-label","Download video"),g.appendChild(r),chunk5NSCV6C2_cjs.c`${g}`}if(i&&this._data.video.audio&&d.getAttribute("name")=="mave-files-audio"){let r=m(),a=i.container||"mp3";chunkIPA5Q26W_cjs.f(this,t,l).call(this,r,'[slot="filetype"]',a);let h=i.file_size;h&&chunkIPA5Q26W_cjs.f(this,t,l).call(this,r,'[slot="size"]',chunkIPA5Q26W_cjs.f(this,t,v).call(this,h));let p=chunkIPA5Q26W_cjs.f(this,t,L).call(this,i),u=chunkIPA5Q26W_cjs.f(this,t,b).call(this,p,`${this._data.name}.${a}`);return u.setAttribute("aria-label","Download audio"),u.appendChild(r),chunk5NSCV6C2_cjs.c`${u}`}let w=this._data.subtitles.find(r=>r.language==this._data.video.language);if(w&&d.getAttribute("name")=="mave-files-subtitles"){let r=m();chunkIPA5Q26W_cjs.f(this,t,l).call(this,r,'[slot="filetype"]',"vtt");let a=chunkIPA5Q26W_cjs.f(this,t,b).call(this,w.path,`${this._data.name}.vtt`);return a.setAttribute("aria-label","Download subtitles"),a.appendChild(r),chunk5NSCV6C2_cjs.c`${a}`}});return chunk5NSCV6C2_cjs.c`${this._stylesheets} ${o}`}})}
3
+ `}renderPending(){return chunk5NSCV6C2_cjs.c`<slot style="display: none"></slot>`}};t=new WeakSet,l=function(e,n,i){let o=e.querySelector(n);o&&(o.textContent=i,o.removeAttribute("slot"));},C=function(e,n){let i=window.URL.createObjectURL(e),o=document.createElement("a");o.style.display="none",o.href=i,o.download=n,this.appendChild(o),o.click(),window.URL.revokeObjectURL(i),this.removeChild(o);},x=function(e,n){return fetch(e).then(i=>{if(!i.ok)throw new Error("Network response was not ok");return i.blob()}).then(i=>chunkIPA5Q26W_cjs.f(this,t,C).call(this,i,n)).catch(i=>console.error("Something went wrong:",i))},b=function(e,n){let i=document.createElement("a");i.classList.add("link"),i.setAttribute("href",e),i.setAttribute("download",n),i.setAttribute("target","new");let o=false;return i.addEventListener("click",d=>{d.preventDefault(),!o&&(o=true,i.style.cursor="wait",i.style.opacity="0.5",chunkIPA5Q26W_cjs.f(this,t,x).call(this,e,n).then(()=>{o=false,i.style.cursor="pointer",i.style.opacity="1";}));}),i},v=function(e){let n=e/1e6;return n>=10?`${n.toFixed(0)} MB`:`${n.toFixed(1)} MB`},y=function(e){let n=this._data?.video?.version&&this._data.video.version>0?`v${this._data.video.version}/`:"";return `${this.cdn_root}/${this.embedId}/${n}${e}`},z=function(e){let n=e?.codec||"h264",i=e?.size||"hd",o=e?.container||"mp4";return chunkIPA5Q26W_cjs.f(this,t,y).call(this,`${n}_${i}.${o}`)},L=function(e){let n=e?.container||"mp3";return chunkIPA5Q26W_cjs.f(this,t,y).call(this,`audio.${n}`)},T=function(){let e=this._data?.video?.renditions||[];if(!e.length)return;let n=e.filter(o=>o.container==="mp4"&&o.codec==="h264"&&(!o.type||o.type==="video")),i=["hd","fhd","sd","qhd","uhd"];for(let o of i){let d=n.find(m=>m.size===o);if(d)return d}return n[0]||e.find(o=>o.type==="video")},U=function(){let e=this._data?.video?.renditions||[];if(e.length)return e.find(n=>n.type==="audio"||n.container==="mp3"||n.codec==="mp3")},f.styles=chunk5NSCV6C2_cjs.h`
4
+ :host {
5
+ display: block;
6
+ --link-color: #006fc6;
7
+ --link-decoration: underline;
8
+ --link-decoration-thickness: 1px;
9
+ --link-decoration-offset: 1px;
10
+ --link-cursor: pointer;
11
+ }
12
+
13
+ a {
14
+ text-decoration: var(--link-decoration);
15
+ text-decoration-thickness: var(--link-decoration-thickness);
16
+ text-underline-offset: var(--link-decoration-thickness);
17
+ color: var(--link-color);
18
+ cursor: var(--link-cursor);
19
+ }
20
+ `,chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a({type:String})],f.prototype,"embed",1);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-files")||window.customElements.define("mave-files",f));exports.a=f;
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-HMISRRKC.js';import {i,c as c$1}from'./chunk-A4GZBQEB.js';import {a as a$1}from'./chunk-JBV2AYRP.js';import {c}from'./chunk-NDDFZTBA.js';var s=class extends i{constructor(){super(...arguments);this.EVENT_TYPES={CLICK:"user_click"};}get embed(){return this._embed}set embed(t){this._embed=t;}get embedId(){return this._embed?.substring(5,this._embed?.length)}get spaceId(){return this.embed?.substring(0,5)}get cdn_root(){return a$1.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}get _stylesheets(){if(typeof document>"u")return c$1``;let t=document.querySelectorAll('style, link[rel="stylesheet"]');return c$1`${Array.from(t).map(e=>e.cloneNode(true))}`}durationToTime(t){let e=Math.floor(t),n=Math.floor(e/3600),i=Math.floor(e%3600/60),o=e%60;return n>0?`${n}:${i.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`:`${i}:${o.toString().padStart(2,"0")}`}emit(t,e){this.dispatchEvent(new CustomEvent(`mave:${t}`,{detail:{...e,eventType:t}})),this.dispatchEvent(new CustomEvent("mave:*",{detail:{...e,eventType:t}}));}};c([a({type:String})],s.prototype,"embed",1);export{s as a};
@@ -1,4 +1,4 @@
1
- import {a}from'./chunk-3PLBZPRP.js';import {h,c}from'./chunk-A4GZBQEB.js';var e=class extends a{get poster(){return `${this.cdn_root}/${this.embedId}/poster.webp`}render(){return c`<img src=${this.poster} />`}};e.styles=h`
1
+ import {a}from'./chunk-45FW5DBN.js';import {h,c}from'./chunk-A4GZBQEB.js';var e=class extends a{get poster(){return `${this.cdn_root}/${this.embedId}/poster.webp`}render(){return c`<img src=${this.poster} />`}};e.styles=h`
2
2
  :host {
3
3
  display: block;
4
4
  }
@@ -7,4 +7,4 @@ import {a}from'./chunk-3PLBZPRP.js';import {h,c}from'./chunk-A4GZBQEB.js';var e=
7
7
  width: 100%;
8
8
  max-height: 100vh;
9
9
  }
10
- `;window&&window.customElements&&(window.customElements.get("mave-img")||window.customElements.define("mave-img",e));export{e as a};
10
+ `;typeof window<"u"&&window.customElements&&(window.customElements.get("mave-img")||window.customElements.define("mave-img",e));export{e as a};
@@ -0,0 +1,161 @@
1
+ 'use strict';var chunkMC6T46LX_cjs=require('./chunk-MC6T46LX.cjs'),chunkKTGL4HLA_cjs=require('./chunk-KTGL4HLA.cjs'),chunkQ22T22LT_cjs=require('./chunk-Q22T22LT.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunk5STN56TL_cjs=require('./chunk-5STN56TL.cjs'),chunkIPA5Q26W_cjs=require('./chunk-IPA5Q26W.cjs');var Ot=chunkIPA5Q26W_cjs.a((no,Pt)=>{Pt.exports=function(t,r){if(r=r.split(":")[0],t=+t,!t)return false;switch(r){case "http":case "ws":return t!==80;case "https":case "wss":return t!==443;case "ftp":return t!==21;case "gopher":return t!==70;case "file":return false}return t!==0};});var jt=chunkIPA5Q26W_cjs.a(Te=>{var Xr=Object.prototype.hasOwnProperty,Yr;function kt(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function Rt(e){try{return encodeURIComponent(e)}catch{return null}}function Zr(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var o=kt(n[1]),s=kt(n[2]);o===null||s===null||o in r||(r[o]=s);}return r}function Vr(e,t){t=t||"";var r=[],n,o;typeof t!="string"&&(t="?");for(o in e)if(Xr.call(e,o)){if(n=e[o],!n&&(n===null||n===Yr||isNaN(n))&&(n=""),o=Rt(o),n=Rt(n),o===null||n===null)continue;r.push(o+"="+n);}return r.length?t+r.join("&"):""}Te.stringify=Vr;Te.parse=Zr;});var Nt=chunkIPA5Q26W_cjs.a((io,It)=>{var Lt=Ot(),be=jt(),Jr=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,At=/[\n\r\t]/g,Qr=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Tt=/:\d+$/,en=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,tn=/^[a-zA-Z]:/;function Fe(e){return (e||"").toString().replace(Jr,"")}var De=[["#","hash"],["?","query"],function(t,r){return T(r.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Ct={hash:1,query:1};function Dt(e){var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t={};var r=t.location||{};e=e||r;var n={},o=typeof e,s;if(e.protocol==="blob:")n=new D(unescape(e.pathname),{});else if(o==="string"){n=new D(e,{});for(s in Ct)delete n[s];}else if(o==="object"){for(s in e)s in Ct||(n[s]=e[s]);n.slashes===void 0&&(n.slashes=Qr.test(e.href));}return n}function T(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function Ft(e,t){e=Fe(e),e=e.replace(At,""),t=t||{};var r=en.exec(e),n=r[1]?r[1].toLowerCase():"",o=!!r[2],s=!!r[3],u=0,c;return o?s?(c=r[2]+r[3]+r[4],u=r[2].length+r[3].length):(c=r[2]+r[4],u=r[2].length):s?(c=r[3]+r[4],u=r[3].length):c=r[4],n==="file:"?u>=2&&(c=c.slice(2)):T(n)?c=r[4]:n?o&&(c=c.slice(2)):u>=2&&T(t.protocol)&&(c=r[4]),{protocol:n,slashes:o||T(n),slashesCount:u,rest:c}}function rn(e,t){if(e==="")return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],s=false,u=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),u++):u&&(n===0&&(s=true),r.splice(n,1),u--);return s&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function D(e,t,r){if(e=Fe(e),e=e.replace(At,""),!(this instanceof D))return new D(e,t,r);var n,o,s,u,c,h,m=De.slice(),v=typeof t,y=this,C=0;for(v!=="object"&&v!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=be.parse),t=Dt(t),o=Ft(e||"",t),n=!o.protocol&&!o.slashes,y.slashes=o.slashes||n&&t.slashes,y.protocol=o.protocol||t.protocol||"",e=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||tn.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!T(y.protocol)))&&(m[3]=[/(.*)/,"pathname"]);C<m.length;C++){if(u=m[C],typeof u=="function"){e=u(e,y);continue}s=u[0],h=u[1],s!==s?y[h]=e:typeof s=="string"?(c=s==="@"?e.lastIndexOf(s):e.indexOf(s),~c&&(typeof u[2]=="number"?(y[h]=e.slice(0,c),e=e.slice(c+u[2])):(y[h]=e.slice(c),e=e.slice(0,c)))):(c=s.exec(e))&&(y[h]=c[1],e=e.slice(0,c.index)),y[h]=y[h]||n&&u[3]&&t[h]||"",u[4]&&(y[h]=y[h].toLowerCase());}r&&(y.query=r(y.query)),n&&t.slashes&&y.pathname.charAt(0)!=="/"&&(y.pathname!==""||t.pathname!=="")&&(y.pathname=rn(y.pathname,t.pathname)),y.pathname.charAt(0)!=="/"&&T(y.protocol)&&(y.pathname="/"+y.pathname),Lt(y.port,y.protocol)||(y.host=y.hostname,y.port=""),y.username=y.password="",y.auth&&(c=y.auth.indexOf(":"),~c?(y.username=y.auth.slice(0,c),y.username=encodeURIComponent(decodeURIComponent(y.username)),y.password=y.auth.slice(c+1),y.password=encodeURIComponent(decodeURIComponent(y.password))):y.username=encodeURIComponent(decodeURIComponent(y.auth)),y.auth=y.password?y.username+":"+y.password:y.username),y.origin=y.protocol!=="file:"&&T(y.protocol)&&y.host?y.protocol+"//"+y.host:"null",y.href=y.toString();}function nn(e,t,r){var n=this;switch(e){case "query":typeof t=="string"&&t.length&&(t=(r||be.parse)(t)),n[e]=t;break;case "port":n[e]=t,Lt(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case "hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case "host":n[e]=t,Tt.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case "protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case "pathname":case "hash":if(t){var o=e==="pathname"?"/":"#";n[e]=t.charAt(0)!==o?o+t:t;}else n[e]=t;break;case "username":case "password":n[e]=encodeURIComponent(t);break;case "auth":var s=t.indexOf(":");~s?(n.username=t.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t));}for(var u=0;u<De.length;u++){var c=De[u];c[4]&&(n[c[1]]=n[c[1]].toLowerCase());}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&T(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function on(e){(!e||typeof e!="function")&&(e=be.stringify);var t,r=this,n=r.host,o=r.protocol;o&&o.charAt(o.length-1)!==":"&&(o+=":");var s=o+(r.protocol&&r.slashes||T(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):r.protocol!=="file:"&&T(r.protocol)&&!n&&r.pathname!=="/"&&(s+="@"),(n[n.length-1]===":"||Tt.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,t=typeof r.query=="object"?e(r.query):r.query,t&&(s+=t.charAt(0)!=="?"?"?"+t:t),r.hash&&(s+=r.hash),s}D.prototype={set:nn,toString:on};D.extractProtocol=Ft;D.location=Dt;D.trimLeft=Fe;D.qs=be;It.exports=D;});function Z(e){"@babel/helpers - typeof";return Z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Z(e)}function _r(e,t,r){return Object.defineProperty(e,"prototype",{writable:false}),e}function xr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Er(e,t,r){return t=fe(t),Ur(e,Re()?Reflect.construct(t,r||[],fe(e).constructor):t.apply(e,r))}function Ur(e,t){if(t&&(Z(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pr(e)}function Pr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Or(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}}),Object.defineProperty(e,"prototype",{writable:false}),t&&ue(e,t);}function ke(e){var t=typeof Map=="function"?new Map:void 0;return ke=function(n){if(n===null||!Rr(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,o);}function o(){return kr(n,arguments,fe(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:false,writable:true,configurable:true}}),ue(o,n)},ke(e)}function kr(e,t,r){if(Re())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var o=new(e.bind.apply(e,n));return r&&ue(o,r.prototype),o}function Re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (Re=function(){return !!e})()}function Rr(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function ue(e,t){return ue=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ue(e,t)}function fe(e){return fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},fe(e)}var jr=function(e){function t(r){var n,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(xr(this,t),n=Er(this,t,[r]),n.originalRequest=s,n.originalResponse=u,n.causingError=o,o!=null&&(r+=", caused by ".concat(o.toString())),s!=null){var c=s.getHeader("X-Request-ID")||"n/a",h=s.getMethod(),m=s.getURL(),v=u?u.getStatus():"n/a",y=u?u.getBody()||"":"n/a";r+=", originated from request (method: ".concat(h,", url: ").concat(m,", response code: ").concat(v,", response text: ").concat(y,", request id: ").concat(c,")");}return n.message=r,n}return Or(t,e),_r(t)}(ke(Error)),V=jr;function B(e){}function ce(e){"@babel/helpers - typeof";return ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ce(e)}function Lr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function it(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Tr(n.key),n);}}function Ar(e,t,r){return t&&it(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Tr(e){var t=Dr(e,"string");return ce(t)=="symbol"?t:t+""}function Dr(e,t){if(ce(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ce(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var at=function(){function e(){Lr(this,e);}return Ar(e,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(r){return Promise.resolve([])}},{key:"removeUpload",value:function(r){return Promise.resolve()}},{key:"addUpload",value:function(r,n){return Promise.resolve(null)}}])}();var pt="3.7.5",Fr=pt,Ir=typeof atob=="function",Nr=typeof btoa=="function",Q=typeof Buffer=="function",st=typeof TextDecoder=="function"?new TextDecoder:void 0,lt=typeof TextEncoder=="function"?new TextEncoder:void 0,Br="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",pe=Array.prototype.slice.call(Br),ge=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(pe),Hr=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,E=String.fromCharCode.bind(String),ut=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),ht=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),dt=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),yt=e=>{let t,r,n,o,s="",u=e.length%3;for(let c=0;c<e.length;){if((r=e.charCodeAt(c++))>255||(n=e.charCodeAt(c++))>255||(o=e.charCodeAt(c++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|o,s+=pe[t>>18&63]+pe[t>>12&63]+pe[t>>6&63]+pe[t&63];}return u?s.slice(0,u-3)+"===".substring(u):s},Le=Nr?e=>btoa(e):Q?e=>Buffer.from(e,"binary").toString("base64"):yt,je=Q?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,o=e.length;n<o;n+=4096)r.push(E.apply(null,e.subarray(n,n+4096)));return Le(r.join(""))},ve=(e,t=false)=>t?ht(je(e)):je(e),qr=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?E(192|t>>>6)+E(128|t&63):E(224|t>>>12&15)+E(128|t>>>6&63)+E(128|t&63)}else {var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return E(240|t>>>18&7)+E(128|t>>>12&63)+E(128|t>>>6&63)+E(128|t&63)}},zr=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,mt=e=>e.replace(zr,qr),ft=Q?e=>Buffer.from(e,"utf8").toString("base64"):lt?e=>je(lt.encode(e)):e=>Le(mt(e)),J=(e,t=false)=>t?ht(ft(e)):ft(e),ct=e=>J(e,true),Mr=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Gr=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return E((r>>>10)+55296)+E((r&1023)+56320);case 3:return E((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return E((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},gt=e=>e.replace(Mr,Gr),vt=e=>{if(e=e.replace(/\s+/g,""),!Hr.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,o;for(let s=0;s<e.length;)t=ge[e.charAt(s++)]<<18|ge[e.charAt(s++)]<<12|(n=ge[e.charAt(s++)])<<6|(o=ge[e.charAt(s++)]),r+=n===64?E(t>>16&255):o===64?E(t>>16&255,t>>8&255):E(t>>16&255,t>>8&255,t&255);return r},Ae=Ir?e=>atob(dt(e)):Q?e=>Buffer.from(e,"base64").toString("binary"):vt,bt=Q?e=>ut(Buffer.from(e,"base64")):e=>ut(Ae(e).split("").map(t=>t.charCodeAt(0))),_t=e=>bt(wt(e)),$r=Q?e=>Buffer.from(e,"base64").toString("utf8"):st?e=>st.decode(bt(e)):e=>gt(Ae(e)),wt=e=>dt(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Ce=e=>$r(wt(e)),Kr=e=>{if(typeof e!="string")return false;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return !/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},St=e=>({value:e,enumerable:false,writable:true,configurable:true}),xt=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,St(r));e("fromBase64",function(){return Ce(this)}),e("toBase64",function(t){return J(this,t)}),e("toBase64URI",function(){return J(this,true)}),e("toBase64URL",function(){return J(this,true)}),e("toUint8Array",function(){return _t(this)});},Et=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,St(r));e("toBase64",function(t){return ve(this,t)}),e("toBase64URI",function(){return ve(this,true)}),e("toBase64URL",function(){return ve(this,true)});},Wr=()=>{xt(),Et();},Ut={version:pt,VERSION:Fr,atob:Ae,atobPolyfill:vt,btoa:Le,btoaPolyfill:yt,fromBase64:Ce,toBase64:J,encode:J,encodeURI:ct,encodeURL:ct,utob:mt,btou:gt,decode:Ce,isValid:Kr,fromUint8Array:ve,toUint8Array:_t,extendString:xt,extendUint8Array:Et,extendBuiltins:Wr};var Vt=chunkIPA5Q26W_cjs.b(Nt());function Ie(){return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,r=e==="x"?t:t&3|8;return r.toString(16)})}function Ne(){Ne=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(l,i,a){l[i]=a.value;},s=typeof Symbol=="function"?Symbol:{},u=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",h=s.toStringTag||"@@toStringTag";function m(l,i,a){return Object.defineProperty(l,i,{value:a,enumerable:true,configurable:true,writable:true}),l[i]}try{m({},"");}catch{m=function(a,f,d){return a[f]=d};}function v(l,i,a,f){var d=i&&i.prototype instanceof F?i:F,p=Object.create(d.prototype),g=new M(f||[]);return o(p,"_invoke",{value:Ue(l,a,g)}),p}function y(l,i,a){try{return {type:"normal",arg:l.call(i,a)}}catch(f){return {type:"throw",arg:f}}}t.wrap=v;var C="suspendedStart",oe="suspendedYield",H="executing",A="completed",w={};function F(){}function k(){}function S(){}var L={};m(L,u,function(){return this});var q=Object.getPrototypeOf,I=q&&q(q(G([])));I&&I!==r&&n.call(I,u)&&(L=I);var R=S.prototype=F.prototype=Object.create(L);function ie(l){["next","throw","return"].forEach(function(i){m(l,i,function(a){return this._invoke(i,a)});});}function N(l,i){function a(d,p,g,b){var _=y(l[d],l,p);if(_.type!=="throw"){var P=_.arg,x=P.value;return x&&W(x)=="object"&&n.call(x,"__await")?i.resolve(x.__await).then(function(O){a("next",O,g,b);},function(O){a("throw",O,g,b);}):i.resolve(x).then(function(O){P.value=O,g(P);},function(O){return a("throw",O,g,b)})}b(_.arg);}var f;o(this,"_invoke",{value:function(p,g){function b(){return new i(function(_,P){a(p,g,_,P);})}return f=f?f.then(b,b):b()}});}function Ue(l,i,a){var f=C;return function(d,p){if(f===H)throw Error("Generator is already running");if(f===A){if(d==="throw")throw p;return {value:e,done:true}}for(a.method=d,a.arg=p;;){var g=a.delegate;if(g){var b=ae(g,a);if(b){if(b===w)continue;return b}}if(a.method==="next")a.sent=a._sent=a.arg;else if(a.method==="throw"){if(f===C)throw f=A,a.arg;a.dispatchException(a.arg);}else a.method==="return"&&a.abrupt("return",a.arg);f=H;var _=y(l,i,a);if(_.type==="normal"){if(f=a.done?A:oe,_.arg===w)continue;return {value:_.arg,done:a.done}}_.type==="throw"&&(f=A,a.method="throw",a.arg=_.arg);}}}function ae(l,i){var a=i.method,f=l.iterator[a];if(f===e)return i.delegate=null,a==="throw"&&l.iterator.return&&(i.method="return",i.arg=e,ae(l,i),i.method==="throw")||a!=="return"&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+a+"' method")),w;var d=y(f,l.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,w;var p=d.arg;return p?p.done?(i[l.resultName]=p.value,i.next=l.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,w):p:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,w)}function Pe(l){var i={tryLoc:l[0]};1 in l&&(i.catchLoc=l[1]),2 in l&&(i.finallyLoc=l[2],i.afterLoc=l[3]),this.tryEntries.push(i);}function z(l){var i=l.completion||{};i.type="normal",delete i.arg,l.completion=i;}function M(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Pe,this),this.reset(true);}function G(l){if(l||l===""){var i=l[u];if(i)return i.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var a=-1,f=function d(){for(;++a<l.length;)if(n.call(l,a))return d.value=l[a],d.done=false,d;return d.value=e,d.done=true,d};return f.next=f}}throw new TypeError(W(l)+" is not iterable")}return k.prototype=S,o(R,"constructor",{value:S,configurable:true}),o(S,"constructor",{value:k,configurable:true}),k.displayName=m(S,h,"GeneratorFunction"),t.isGeneratorFunction=function(l){var i=typeof l=="function"&&l.constructor;return !!i&&(i===k||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,S):(l.__proto__=S,m(l,h,"GeneratorFunction")),l.prototype=Object.create(R),l},t.awrap=function(l){return {__await:l}},ie(N.prototype),m(N.prototype,c,function(){return this}),t.AsyncIterator=N,t.async=function(l,i,a,f,d){d===void 0&&(d=Promise);var p=new N(v(l,i,a,f),d);return t.isGeneratorFunction(i)?p:p.next().then(function(g){return g.done?g.value:p.next()})},ie(R),m(R,h,"Generator"),m(R,u,function(){return this}),m(R,"toString",function(){return "[object Generator]"}),t.keys=function(l){var i=Object(l),a=[];for(var f in i)a.push(f);return a.reverse(),function d(){for(;a.length;){var p=a.pop();if(p in i)return d.value=p,d.done=false,d}return d.done=true,d}},t.values=G,M.prototype={constructor:M,reset:function(i){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=false,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(z),!i)for(var a in this)a.charAt(0)==="t"&&n.call(this,a)&&!isNaN(+a.slice(1))&&(this[a]=e);},stop:function(){this.done=true;var i=this.tryEntries[0].completion;if(i.type==="throw")throw i.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var a=this;function f(P,x){return g.type="throw",g.arg=i,a.next=P,x&&(a.method="next",a.arg=e),!!x}for(var d=this.tryEntries.length-1;d>=0;--d){var p=this.tryEntries[d],g=p.completion;if(p.tryLoc==="root")return f("end");if(p.tryLoc<=this.prev){var b=n.call(p,"catchLoc"),_=n.call(p,"finallyLoc");if(b&&_){if(this.prev<p.catchLoc)return f(p.catchLoc,true);if(this.prev<p.finallyLoc)return f(p.finallyLoc)}else if(b){if(this.prev<p.catchLoc)return f(p.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<p.finallyLoc)return f(p.finallyLoc)}}}},abrupt:function(i,a){for(var f=this.tryEntries.length-1;f>=0;--f){var d=this.tryEntries[f];if(d.tryLoc<=this.prev&&n.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var p=d;break}}p&&(i==="break"||i==="continue")&&p.tryLoc<=a&&a<=p.finallyLoc&&(p=null);var g=p?p.completion:{};return g.type=i,g.arg=a,p?(this.method="next",this.next=p.finallyLoc,w):this.complete(g)},complete:function(i,a){if(i.type==="throw")throw i.arg;return i.type==="break"||i.type==="continue"?this.next=i.arg:i.type==="return"?(this.rval=this.arg=i.arg,this.method="return",this.next="end"):i.type==="normal"&&a&&(this.next=a),w},finish:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var f=this.tryEntries[a];if(f.finallyLoc===i)return this.complete(f.completion,f.afterLoc),z(f),w}},catch:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var f=this.tryEntries[a];if(f.tryLoc===i){var d=f.completion;if(d.type==="throw"){var p=d.arg;z(f);}return p}}throw Error("illegal catch attempt")},delegateYield:function(i,a,f){return this.delegate={iterator:G(i),resultName:a,nextLoc:f},this.method==="next"&&(this.arg=e),w}},t}function Bt(e,t,r,n,o,s,u){try{var c=e[s](u),h=c.value;}catch(m){r(m);return}c.done?t(h):Promise.resolve(h).then(n,o);}function an(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var s=e.apply(t,r);function u(h){Bt(s,n,o,u,c,"next",h);}function c(h){Bt(s,n,o,u,c,"throw",h);}u(void 0);})}}function Xt(e,t){return un(e)||ln(e,t)||Yt(e,t)||sn()}function sn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ln(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,s,u,c=[],h=true,m=false;try{if(s=(r=r.call(e)).next,t===0);else for(;!(h=(n=s.call(r)).done)&&(c.push(n.value),c.length!==t);h=!0);}catch(v){m=true,o=v;}finally{try{if(!h&&r.return!=null&&(u=r.return(),Object(u)!==u))return}finally{if(m)throw o}}return c}}function un(e){if(Array.isArray(e))return e}function W(e){"@babel/helpers - typeof";return W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},W(e)}function fn(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Yt(e))||t){r&&(e=r);var n=0,o=function(){};return {s:o,n:function(){return n>=e.length?{done:true}:{done:false,value:e[n++]}},e:function(m){throw m},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=true,u=false,c;return {s:function(){r=r.call(e);},n:function(){var m=r.next();return s=m.done,m},e:function(m){u=true,c=m;},f:function(){try{!s&&r.return!=null&&r.return();}finally{if(u)throw c}}}}function Yt(e,t){if(e){if(typeof e=="string")return Ht(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ht(e,t)}}function Ht(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function qt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n);}return r}function ee(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qt(Object(r),true).forEach(function(n){cn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function cn(e,t,r){return t=Zt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function pn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Zt(n.key),n);}}function hn(e,t,r){return t&&zt(e.prototype,t),r&&zt(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Zt(e){var t=dn(e,"string");return W(t)=="symbol"?t:t+""}function dn(e,t){if(W(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(W(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var Be="tus-v1",_e="ietf-draft-03",yn={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:false,headers:{},addRequestId:false,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:Qt,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:true,removeFingerprintOnSuccess:false,uploadLengthDeferred:false,uploadDataDuringCreation:false,urlStorage:null,fileReader:null,httpStack:null,protocol:Be},Jt=function(){function e(t,r){pn(this,e),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=t,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=false,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null;}return hn(e,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey;}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![Be,_e].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var o=this.options.retryDelays;if(o!=null&&Object.prototype.toString.call(o)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var s=0,u=["uploadUrl","uploadSize","uploadLengthDeferred"];s<u.length;s++){var c=u[s];if(this.options[c]){this._emitError(new Error("tus: cannot use the ".concat(c," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(h){return r._fingerprint=h,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(h){if(r._source=h,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload();}).catch(function(h){r._emitError(h);});}},{key:"_startParallelUpload",value:function(){var r,n=this,o=this._size,s=0;this._parallelUploads=[];var u=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,c=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:gn(this._source.size,u);this._parallelUploadUrls&&c.forEach(function(v,y){v.uploadUrl=n._parallelUploadUrls[y]||null;}),this._parallelUploadUrls=new Array(c.length);var h=c.map(function(v,y){var C=0;return n._source.slice(v.start,v.end).then(function(oe){var H=oe.value;return new Promise(function(A,w){var F=ee(ee({},n.options),{},{uploadUrl:v.uploadUrl||null,storeFingerprintForResuming:false,removeFingerprintOnSuccess:false,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:ee(ee({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:A,onError:w,onProgress:function(L){s=s-C+L,C=L,n._emitProgress(s,o);},onUploadUrlAvailable:function(){n._parallelUploadUrls[y]=k.url,n._parallelUploadUrls.filter(function(L){return !!L}).length===c.length&&n._saveUploadInUrlStorage();}}),k=new e(H,F);k.start(),n._parallelUploads.push(k);})})}),m;Promise.all(h).then(function(){m=n._openRequest("POST",n.options.endpoint),m.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var v=Mt(n.options.metadata);return v!==""&&m.setHeader("Upload-Metadata",v),n._sendRequest(m,null)}).then(function(v){if(!te(v.getStatus(),200)){n._emitHttpError(m,v,"tus: unexpected response while creating upload");return}var y=v.getHeader("Location");if(y==null){n._emitHttpError(m,v,"tus: invalid or missing Location header");return}n.url=Wt(n.options.endpoint,y),B("Created upload at ".concat(n.url)),n._emitSuccess(v);}).catch(function(v){n._emitError(v);});}},{key:"_startSingleUpload",value:function(){if(this._aborted=false,this.url!=null){B("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){B("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}this._createUpload();}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=fn(this._parallelUploads),s;try{for(o.s();!(s=o.n()).done;){var u=s.value;u.abort(r);}}catch(c){o.e(c);}finally{o.f();}}return this._req!==null&&this._req.abort(),this._aborted=true,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():e.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,o,s){this._emitError(new V(o,s,r,n));}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var o=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(o&&(this._retryAttempt=0),Kt(r,this._retryAttempt,this.options)){var s=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start();},s);return}}if(typeof this.options.onError=="function")this.options.onError(r);else throw r}}},{key:"_emitSuccess",value:function(r){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:r});}},{key:"_emitProgress",value:function(r,n){typeof this.options.onProgress=="function"&&this.options.onProgress(r,n);}},{key:"_emitChunkComplete",value:function(r,n,o){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,o);}},{key:"_createUpload",value:function(){var r=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length","1"):n.setHeader("Upload-Length","".concat(this._size));var o=Mt(this.options.metadata);o!==""&&n.setHeader("Upload-Metadata",o);var s;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,s=this._addChunkToRequest(n)):(this.options.protocol===_e&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(u){if(!te(u.getStatus(),200)){r._emitHttpError(n,u,"tus: unexpected response while creating upload");return}var c=u.getHeader("Location");if(c==null){r._emitHttpError(n,u,"tus: invalid or missing Location header");return}if(r.url=Wt(r.options.endpoint,c),B("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(u),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,u):(r._offset=0,r._performUpload());});}).catch(function(u){r._emitHttpError(n,null,"tus: failed to create upload",u);});}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(s){var u=s.getStatus();if(!te(u,200)){if(u===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(te(u,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,s,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var c=Number.parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(c)){r._emitHttpError(n,s,"tus: invalid or missing offset value");return}var h=Number.parseInt(s.getHeader("Upload-Length"),10);if(Number.isNaN(h)&&!r.options.uploadLengthDeferred&&r.options.protocol===Be){r._emitHttpError(n,s,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(c===h){r._emitProgress(h,h),r._emitSuccess(s);return}r._offset=c,r._performUpload();});}).catch(function(s){r._emitHttpError(n,null,"tus: failed to resume upload",s);});}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var o=this._addChunkToRequest(n);o.then(function(s){if(!te(s.getStatus(),200)){r._emitHttpError(n,s,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,s);}).catch(function(s){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),s);});}}},{key:"_addChunkToRequest",value:function(r){var n=this,o=this._offset,s=this._offset+this.options.chunkSize;return r.setProgressHandler(function(u){n._emitProgress(o+u,n._size);}),r.setHeader("Content-Type","application/offset+octet-stream"),(s===Number.POSITIVE_INFINITY||s>this._size)&&!this.options.uploadLengthDeferred&&(s=this._size),this._source.slice(o,s).then(function(u){var c=u.value,h=u.done,m=c!=null&&c.size?c.size:0;n.options.uploadLengthDeferred&&h&&(n._size=n._offset+m,r.setHeader("Upload-Length","".concat(n._size)));var v=n._offset+m;return !n.options.uploadLengthDeferred&&h&&v!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(v," bytes"))):c===null?n._sendRequest(r):(n.options.protocol===_e&&r.setHeader("Upload-Complete",h?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,c))})}},{key:"_handleUploadResponse",value:function(r,n){var o=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(o)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(o,this._size),this._emitChunkComplete(o-this._offset,o,this._size),this._offset=o,o===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload();}},{key:"_openRequest",value:function(r,n){var o=Gt(r,n,this.options);return this._req=o,o}},{key:"_removeFromUrlStorage",value:function(){var r=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){r._emitError(n);}),this._urlStorageKey=null);}},{key:"_saveUploadInUrlStorage",value:function(){var r=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(o){r._urlStorageKey=o;})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return $t(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=Gt("DELETE",r,n);return $t(o,null,n).then(function(s){if(s.getStatus()!==204)throw new V("tus: unexpected response while terminating upload",null,o,s)}).catch(function(s){if(s instanceof V||(s=new V("tus: failed to terminate upload",s,o,null)),!Kt(s,0,n))throw s;var u=n.retryDelays[0],c=n.retryDelays.slice(1),h=ee(ee({},n),{},{retryDelays:c});return new Promise(function(m){return setTimeout(m,u)}).then(function(){return e.terminate(r,h)})})}}])}();function Mt(e){return Object.entries(e).map(function(t){var r=Xt(t,2),n=r[0],o=r[1];return "".concat(n," ").concat(Ut.encode(String(o)))}).join(",")}function te(e,t){return e>=t&&e<t+100}function Gt(e,t,r){var n=r.httpStack.createRequest(e,t);r.protocol===_e?n.setHeader("Upload-Draft-Interop-Version","5"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},s=0,u=Object.entries(o);s<u.length;s++){var c=Xt(u[s],2),h=c[0],m=c[1];n.setHeader(h,m);}if(r.addRequestId){var v=Ie();n.setHeader("X-Request-ID",v);}return n}function $t(e,t,r){return He.apply(this,arguments)}function He(){return He=an(Ne().mark(function e(t,r,n){var o;return Ne().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(typeof n.onBeforeRequest!="function"){u.next=3;break}return u.next=3,n.onBeforeRequest(t);case 3:return u.next=5,t.send(r);case 5:if(o=u.sent,typeof n.onAfterResponse!="function"){u.next=9;break}return u.next=9,n.onAfterResponse(t,o);case 9:return u.abrupt("return",o);case 10:case "end":return u.stop()}},e)})),He.apply(this,arguments)}function mn(){var e=true;return typeof navigator<"u"&&navigator.onLine===false&&(e=false),e}function Kt(e,t,r){return r.retryDelays==null||t>=r.retryDelays.length||e.originalRequest==null?false:r&&typeof r.onShouldRetry=="function"?r.onShouldRetry(e,t,r):Qt(e)}function Qt(e){var t=e.originalResponse?e.originalResponse.getStatus():0;return (!te(t,400)||t===409||t===423)&&mn()}function Wt(e,t){return new Vt.default(t,e).toString()}function gn(e,t){for(var r=Math.floor(e/t),n=[],o=0;o<t;o++)n.push({start:r*o,end:r*(o+1)});return n[t-1].end=e,n}Jt.defaultOptions=yn;var we=Jt;var vn=function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"},Se=vn;function qe(e){return new Promise(function(t,r){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var o=n.response;t(o);},n.onerror=function(o){r(o);},n.open("GET",e),n.send();})}var bn=function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")},er=bn;function ze(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){var o=new Uint8Array(n.result);t({value:o});},n.onerror=function(o){r(o);},n.readAsArrayBuffer(e);})}function he(e){"@babel/helpers - typeof";return he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},he(e)}function _n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Sn(n.key),n);}}function wn(e,t,r){return t&&tr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Sn(e){var t=xn(e,"string");return he(t)=="symbol"?t:t+""}function xn(e,t){if(he(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(he(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var Me=function(){function e(t){_n(this,e),this._file=t,this.size=t.size;}return wn(e,[{key:"slice",value:function(r,n){if(er())return ze(this._file.slice(r,n));var o=this._file.slice(r,n),s=n>=this.size;return Promise.resolve({value:o,done:s})}},{key:"close",value:function(){}}])}();function de(e){"@babel/helpers - typeof";return de=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},de(e)}function En(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Pn(n.key),n);}}function Un(e,t,r){return t&&rr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Pn(e){var t=On(e,"string");return de(t)=="symbol"?t:t+""}function On(e,t){if(de(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(de(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}function nr(e){return e===void 0?0:e.size!==void 0?e.size:e.length}function kn(e,t){if(e.concat)return e.concat(t);if(e instanceof Blob)return new Blob([e,t],{type:e.type});if(e.set){var r=new e.constructor(e.length+t.length);return r.set(e),r.set(t,e.length),r}throw new Error("Unknown data type")}var or=function(){function e(t){En(this,e),this._buffer=void 0,this._bufferOffset=0,this._reader=t,this._done=false;}return Un(e,[{key:"slice",value:function(r,n){return r<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(r,n)}},{key:"_readUntilEnoughDataOrDone",value:function(r,n){var o=this,s=n<=this._bufferOffset+nr(this._buffer);if(this._done||s){var u=this._getDataFromBuffer(r,n),c=u==null?this._done:false;return Promise.resolve({value:u,done:c})}return this._reader.read().then(function(h){var m=h.value,v=h.done;return v?o._done=true:o._buffer===void 0?o._buffer=m:o._buffer=kn(o._buffer,m),o._readUntilEnoughDataOrDone(r,n)})}},{key:"_getDataFromBuffer",value:function(r,n){r>this._bufferOffset&&(this._buffer=this._buffer.slice(r-this._bufferOffset),this._bufferOffset=r);var o=nr(this._buffer)===0;return this._done&&o?null:this._buffer.slice(0,n-r)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel();}}])}();function X(e){"@babel/helpers - typeof";return X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},X(e)}function Ge(){Ge=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(l,i,a){l[i]=a.value;},s=typeof Symbol=="function"?Symbol:{},u=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",h=s.toStringTag||"@@toStringTag";function m(l,i,a){return Object.defineProperty(l,i,{value:a,enumerable:true,configurable:true,writable:true}),l[i]}try{m({},"");}catch{m=function(a,f,d){return a[f]=d};}function v(l,i,a,f){var d=i&&i.prototype instanceof F?i:F,p=Object.create(d.prototype),g=new M(f||[]);return o(p,"_invoke",{value:Ue(l,a,g)}),p}function y(l,i,a){try{return {type:"normal",arg:l.call(i,a)}}catch(f){return {type:"throw",arg:f}}}t.wrap=v;var C="suspendedStart",oe="suspendedYield",H="executing",A="completed",w={};function F(){}function k(){}function S(){}var L={};m(L,u,function(){return this});var q=Object.getPrototypeOf,I=q&&q(q(G([])));I&&I!==r&&n.call(I,u)&&(L=I);var R=S.prototype=F.prototype=Object.create(L);function ie(l){["next","throw","return"].forEach(function(i){m(l,i,function(a){return this._invoke(i,a)});});}function N(l,i){function a(d,p,g,b){var _=y(l[d],l,p);if(_.type!=="throw"){var P=_.arg,x=P.value;return x&&X(x)=="object"&&n.call(x,"__await")?i.resolve(x.__await).then(function(O){a("next",O,g,b);},function(O){a("throw",O,g,b);}):i.resolve(x).then(function(O){P.value=O,g(P);},function(O){return a("throw",O,g,b)})}b(_.arg);}var f;o(this,"_invoke",{value:function(p,g){function b(){return new i(function(_,P){a(p,g,_,P);})}return f=f?f.then(b,b):b()}});}function Ue(l,i,a){var f=C;return function(d,p){if(f===H)throw Error("Generator is already running");if(f===A){if(d==="throw")throw p;return {value:e,done:true}}for(a.method=d,a.arg=p;;){var g=a.delegate;if(g){var b=ae(g,a);if(b){if(b===w)continue;return b}}if(a.method==="next")a.sent=a._sent=a.arg;else if(a.method==="throw"){if(f===C)throw f=A,a.arg;a.dispatchException(a.arg);}else a.method==="return"&&a.abrupt("return",a.arg);f=H;var _=y(l,i,a);if(_.type==="normal"){if(f=a.done?A:oe,_.arg===w)continue;return {value:_.arg,done:a.done}}_.type==="throw"&&(f=A,a.method="throw",a.arg=_.arg);}}}function ae(l,i){var a=i.method,f=l.iterator[a];if(f===e)return i.delegate=null,a==="throw"&&l.iterator.return&&(i.method="return",i.arg=e,ae(l,i),i.method==="throw")||a!=="return"&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+a+"' method")),w;var d=y(f,l.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,w;var p=d.arg;return p?p.done?(i[l.resultName]=p.value,i.next=l.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,w):p:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,w)}function Pe(l){var i={tryLoc:l[0]};1 in l&&(i.catchLoc=l[1]),2 in l&&(i.finallyLoc=l[2],i.afterLoc=l[3]),this.tryEntries.push(i);}function z(l){var i=l.completion||{};i.type="normal",delete i.arg,l.completion=i;}function M(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Pe,this),this.reset(true);}function G(l){if(l||l===""){var i=l[u];if(i)return i.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var a=-1,f=function d(){for(;++a<l.length;)if(n.call(l,a))return d.value=l[a],d.done=false,d;return d.value=e,d.done=true,d};return f.next=f}}throw new TypeError(X(l)+" is not iterable")}return k.prototype=S,o(R,"constructor",{value:S,configurable:true}),o(S,"constructor",{value:k,configurable:true}),k.displayName=m(S,h,"GeneratorFunction"),t.isGeneratorFunction=function(l){var i=typeof l=="function"&&l.constructor;return !!i&&(i===k||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,S):(l.__proto__=S,m(l,h,"GeneratorFunction")),l.prototype=Object.create(R),l},t.awrap=function(l){return {__await:l}},ie(N.prototype),m(N.prototype,c,function(){return this}),t.AsyncIterator=N,t.async=function(l,i,a,f,d){d===void 0&&(d=Promise);var p=new N(v(l,i,a,f),d);return t.isGeneratorFunction(i)?p:p.next().then(function(g){return g.done?g.value:p.next()})},ie(R),m(R,h,"Generator"),m(R,u,function(){return this}),m(R,"toString",function(){return "[object Generator]"}),t.keys=function(l){var i=Object(l),a=[];for(var f in i)a.push(f);return a.reverse(),function d(){for(;a.length;){var p=a.pop();if(p in i)return d.value=p,d.done=false,d}return d.done=true,d}},t.values=G,M.prototype={constructor:M,reset:function(i){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=false,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(z),!i)for(var a in this)a.charAt(0)==="t"&&n.call(this,a)&&!isNaN(+a.slice(1))&&(this[a]=e);},stop:function(){this.done=true;var i=this.tryEntries[0].completion;if(i.type==="throw")throw i.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var a=this;function f(P,x){return g.type="throw",g.arg=i,a.next=P,x&&(a.method="next",a.arg=e),!!x}for(var d=this.tryEntries.length-1;d>=0;--d){var p=this.tryEntries[d],g=p.completion;if(p.tryLoc==="root")return f("end");if(p.tryLoc<=this.prev){var b=n.call(p,"catchLoc"),_=n.call(p,"finallyLoc");if(b&&_){if(this.prev<p.catchLoc)return f(p.catchLoc,true);if(this.prev<p.finallyLoc)return f(p.finallyLoc)}else if(b){if(this.prev<p.catchLoc)return f(p.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<p.finallyLoc)return f(p.finallyLoc)}}}},abrupt:function(i,a){for(var f=this.tryEntries.length-1;f>=0;--f){var d=this.tryEntries[f];if(d.tryLoc<=this.prev&&n.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var p=d;break}}p&&(i==="break"||i==="continue")&&p.tryLoc<=a&&a<=p.finallyLoc&&(p=null);var g=p?p.completion:{};return g.type=i,g.arg=a,p?(this.method="next",this.next=p.finallyLoc,w):this.complete(g)},complete:function(i,a){if(i.type==="throw")throw i.arg;return i.type==="break"||i.type==="continue"?this.next=i.arg:i.type==="return"?(this.rval=this.arg=i.arg,this.method="return",this.next="end"):i.type==="normal"&&a&&(this.next=a),w},finish:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var f=this.tryEntries[a];if(f.finallyLoc===i)return this.complete(f.completion,f.afterLoc),z(f),w}},catch:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var f=this.tryEntries[a];if(f.tryLoc===i){var d=f.completion;if(d.type==="throw"){var p=d.arg;z(f);}return p}}throw Error("illegal catch attempt")},delegateYield:function(i,a,f){return this.delegate={iterator:G(i),resultName:a,nextLoc:f},this.method==="next"&&(this.arg=e),w}},t}function ir(e,t,r,n,o,s,u){try{var c=e[s](u),h=c.value;}catch(m){r(m);return}c.done?t(h):Promise.resolve(h).then(n,o);}function Rn(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var s=e.apply(t,r);function u(h){ir(s,n,o,u,c,"next",h);}function c(h){ir(s,n,o,u,c,"throw",h);}u(void 0);})}}function jn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ar(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Ln(n.key),n);}}function Cn(e,t,r){return t&&ar(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Ln(e){var t=An(e,"string");return X(t)=="symbol"?t:t+""}function An(e,t){if(X(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(X(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var sr=function(){function e(){jn(this,e);}return Cn(e,[{key:"openFile",value:function(){var t=Rn(Ge().mark(function n(o,s){var u;return Ge().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(Se()&&o&&typeof o.uri<"u")){h.next=11;break}return h.prev=1,h.next=4,qe(o.uri);case 4:return u=h.sent,h.abrupt("return",new Me(u));case 8:throw h.prev=8,h.t0=h.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(h.t0));case 11:if(!(typeof o.slice=="function"&&typeof o.size<"u")){h.next=13;break}return h.abrupt("return",Promise.resolve(new Me(o)));case 13:if(typeof o.read!="function"){h.next=18;break}if(s=Number(s),Number.isFinite(s)){h.next=17;break}return h.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return h.abrupt("return",Promise.resolve(new or(o,s)));case 18:return h.abrupt("return",Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));case 19:case "end":return h.stop()}},n,null,[[1,8]])}));function r(n,o){return t.apply(this,arguments)}return r}()}])}();function $e(e,t){return Se()?Promise.resolve(Tn(e,t)):Promise.resolve(["tus-br",e.name,e.type,e.size,e.lastModified,t.endpoint].join("-"))}function Tn(e,t){var r=e.exif?Dn(JSON.stringify(e.exif)):"noexif";return ["tus-rn",e.name||"noname",e.size||"nosize",r,t.endpoint].join("/")}function Dn(e){var t=0;if(e.length===0)return t;for(var r=0;r<e.length;r++){var n=e.charCodeAt(r);t=(t<<5)-t+n,t&=t;}return t}function ye(e){"@babel/helpers - typeof";return ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ye(e)}function Ke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Fn(n.key),n);}}function We(e,t,r){return t&&lr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Fn(e){var t=In(e,"string");return ye(t)=="symbol"?t:t+""}function In(e,t){if(ye(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ye(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var ur=function(){function e(){Ke(this,e);}return We(e,[{key:"createRequest",value:function(r,n){return new Nn(r,n)}},{key:"getName",value:function(){return "XHRHttpStack"}}])}();var Nn=function(){function e(t,r){Ke(this,e),this._xhr=new XMLHttpRequest,this._xhr.open(t,r,true),this._method=t,this._url=r,this._headers={};}return We(e,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._xhr.setRequestHeader(r,n),this._headers[r]=n;}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(n){n.lengthComputable&&r(n.loaded);});}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(o,s){r._xhr.onload=function(){o(new Bn(r._xhr));},r._xhr.onerror=function(u){s(u);},r._xhr.send(n);})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}(),Bn=function(){function e(t){Ke(this,e),this._xhr=t;}return We(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(r){return this._xhr.getResponseHeader(r)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}();function me(e){"@babel/helpers - typeof";return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},me(e)}function Hn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,zn(n.key),n);}}function qn(e,t,r){return t&&fr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function zn(e){var t=Mn(e,"string");return me(t)=="symbol"?t:t+""}function Mn(e,t){if(me(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(me(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var Ye=false;try{Ye="localStorage"in window,xe="tusSupport",Xe=localStorage.getItem(xe),localStorage.setItem(xe,Xe),Xe===null&&localStorage.removeItem(xe);}catch(e){if(e.code===e.SECURITY_ERR||e.code===e.QUOTA_EXCEEDED_ERR)Ye=false;else throw e}var xe,Xe,cr=Ye,pr=function(){function e(){Hn(this,e);}return qn(e,[{key:"findAllUploads",value:function(){var r=this._findEntries("tus::");return Promise.resolve(r)}},{key:"findUploadsByFingerprint",value:function(r){var n=this._findEntries("tus::".concat(r,"::"));return Promise.resolve(n)}},{key:"removeUpload",value:function(r){return localStorage.removeItem(r),Promise.resolve()}},{key:"addUpload",value:function(r,n){var o=Math.round(Math.random()*1e12),s="tus::".concat(r,"::").concat(o);return localStorage.setItem(s,JSON.stringify(n)),Promise.resolve(s)}},{key:"_findEntries",value:function(r){for(var n=[],o=0;o<localStorage.length;o++){var s=localStorage.key(o);if(s.indexOf(r)===0)try{var u=JSON.parse(localStorage.getItem(s));u.urlStorageKey=s,n.push(u);}catch{}}return n}}])}();function ne(e){"@babel/helpers - typeof";return ne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ne(e)}function Gn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,gr(n.key),n);}}function $n(e,t,r){return r&&hr(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Kn(e,t,r){return t=Ee(t),Wn(e,mr()?Reflect.construct(t,r||[],Ee(e).constructor):t.apply(e,r))}function Wn(e,t){if(t&&(ne(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xn(e)}function Xn(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (mr=function(){return !!e})()}function Ee(e){return Ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ee(e)}function Yn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}}),Object.defineProperty(e,"prototype",{writable:false}),t&&Ze(e,t);}function Ze(e,t){return Ze=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ze(e,t)}function dr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n);}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dr(Object(r),true).forEach(function(n){Zn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function Zn(e,t,r){return t=gr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function gr(e){var t=Vn(e,"string");return ne(t)=="symbol"?t:t+""}function Vn(e,t){if(ne(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ne(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (t==="string"?String:Number)(e)}var yr=re(re({},we.defaultOptions),{},{httpStack:new ur,fileReader:new sr,urlStorage:cr?new pr:new at,fingerprint:$e}),vr=function(e){function t(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Gn(this,t),n=re(re({},yr),n),Kn(this,t,[r,n])}return Yn(t,e),$n(t,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=re(re({},yr),o),we.terminate(n,o)}}])}(we);exports.a=class U extends chunk5NSCV6C2_cjs.i{constructor(){super(...arguments);this.disableCompletion=false;this._progress=0;this._completed=false;this._dragging=false;this.languageController=new chunkMC6T46LX_cjs.d(this);this.lastState="initial";this.lastProgress=-1;this.handleActionClick=r=>{this.findActionTarget(r)&&(r.preventDefault(),this.openFileDialog());};this.handleActionKeyDown=r=>{if(r.key!=="Enter"&&r.key!==" ")return;this.findActionTarget(r)&&(r.preventDefault(),this.openFileDialog());};this.blockSubmit=r=>{r.preventDefault();};this.handleDragEnter=r=>{r.preventDefault(),this._dragging=true;};this.handleDragOver=r=>{r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect="copy"),this._dragging=true;};this.handleDragLeave=r=>{r.preventDefault();let n=r.currentTarget,o=r.relatedTarget;if(!n){this._dragging=false;return}(!o||!(o instanceof Node)||!n.contains(o))&&(this._dragging=false);};}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleActionClick),this.addEventListener("keydown",this.handleActionKeyDown),this.languageController.locale=this.locale||"en",this.embedChannel=chunkKTGL4HLA_cjs.a.connect(this.token),this.embedChannel.upload_id&&(this._upload_id=this.embedChannel.upload_id),this.embedChannel.channel.on("initiate",({upload_id:r})=>{this._upload_id=r,this.embedChannel.upload_id=r;}),this.embedChannel.channel.on("completed",this.completed.bind(this)),this.embedChannel.channel.on("rendition",this.rendition.bind(this)),this.embedChannel.channel.on("error",this.error.bind(this));}requestUpdate(r,n){super.requestUpdate(r,n),r==="locale"&&(this.languageController.locale=this.locale);}reset(){this._progress=0,this._completed=false,this.embedChannel.channel.push("reset",{});}disconnectedCallback(){this.removeEventListener("click",this.handleActionClick),this.removeEventListener("keydown",this.handleActionKeyDown),super.disconnectedCallback();}handleDrop(r){if(r.preventDefault(),this._dragging=false,r.dataTransfer&&r.dataTransfer.items){for(let n of r.dataTransfer.items)if(n.kind==="file"){let o=n.getAsFile();o&&(o.type.startsWith("video/")||o.type.startsWith("audio/"))&&(this._progress=1,this.upload(o));}}else if(r.dataTransfer&&r.dataTransfer.files)for(let n of r.dataTransfer.files)(n.type.startsWith("video/")||n.type.startsWith("audio/"))&&(this._progress=1,this.upload(n));}handleForm(r){this._progress=1;let n=r.target;if(n.files)for(let o of n.files)(o.type.startsWith("video/")||o.type.startsWith("audio/"))&&this.upload(o);}upload(r){this.dispatchEvent(new CustomEvent("upload",{bubbles:true,composed:true,detail:{file:r}}));let n=new vr(r,{endpoint:chunk5STN56TL_cjs.a.upload.endpoint,retryDelays:[0,3e3,5e3,1e4,2e4,6e4,6e4],metadata:{title:r.name,filetype:r.type,token:this.token,upload_id:this._upload_id},onError:o=>{console.log(o),this.dispatchEvent(new CustomEvent("failed",{bubbles:true,composed:true,detail:o}));},onProgress:(o,s)=>{let u=Math.round(o/s*100);u>this._progress&&(this._progress=u),this.dispatchEvent(new CustomEvent("progress",{bubbles:true,composed:true,detail:{progress:u}}));},onSuccess:()=>{this._progress=100,this.dispatchEvent(new CustomEvent("processing",{bubbles:true,composed:true}));},removeFingerprintOnSuccess:true});n.findPreviousUploads().then(o=>{o.length&&n.resumeFromPreviousUpload(o[0]),n.start();});}completed(r){this.disableCompletion||(this._completed=true),this.dispatchEvent(new CustomEvent("completed",{bubbles:true,composed:true,detail:r}));}rendition(r){this.dispatchEvent(new CustomEvent("rendition",{bubbles:true,composed:true,detail:r}));}error(r){console.warn(`[mave-upload] ${r.message}`),this.dispatchEvent(new CustomEvent("error",{bubbles:true,detail:r}));}render(){switch(this.currentState){case "uploading":return this.renderUploading();case "processing":return this.renderProcessing();case "done":return this.renderDone();default:return this.renderInitial()}}styleOpacity(){return this.languageController.loaded?this._upload_id?{}:{pointerEvents:"none",opacity:"0.5"}:{pointerEvents:"none",opacity:"0"}}styleFont(){return this.font?{fontFamily:this.font}:{fontFamily:"system-ui"}}get currentState(){return this._completed?"done":this._progress>=100&&this._progress>0?"processing":this._progress>0?"uploading":"initial"}openFileDialog(){this.fileInput&&!this.fileInput.disabled&&this.fileInput.click();}findActionTarget(r){for(let n of r.composedPath())if(n instanceof HTMLElement&&n.hasAttribute("data-mave-upload-select"))return n;return null}updated(r){super.updated(r);let n=this._progress||0,o=this.currentState;this.setAttribute("state",o),this.setAttribute("progress",`${n}`),this.toggleAttribute("drag-over",this._dragging),this.toggleAttribute("ready",!!this._upload_id&&this.languageController.loaded);let s=o!==this.lastState,u=n!==this.lastProgress,c=r.has("_dragging");(s||u||c)&&this.dispatchEvent(new CustomEvent("statechange",{bubbles:true,composed:true,detail:{state:o,progress:n,dragging:this._dragging}})),this.lastState=o,this.lastProgress=n;}renderInitial(){let r=this.color?this.color:"#1997FF",n=this.radius?this.radius:"16px";return chunk5NSCV6C2_cjs.c`<form
4
+ class="state state--initial"
5
+ style=${chunkQ22T22LT_cjs.a({...this.styleOpacity(),...this.styleFont()})}
6
+ @submit=${this.blockSubmit}
7
+ @dragenter=${this.handleDragEnter}
8
+ @dragover=${this.handleDragOver}
9
+ @dragleave=${this.handleDragLeave}
10
+ @drop=${this.handleDrop}
11
+ >
12
+ <slot name="initial">
13
+ <div class="upload-default-title">${chunkMC6T46LX_cjs.b("drop video here")}</div>
14
+ <div class="upload-default-subtitle">${chunkMC6T46LX_cjs.b("or browse your files")}</div>
15
+ <button
16
+ type="button"
17
+ data-mave-upload-select
18
+ class="upload-default-button"
19
+ style=${chunkQ22T22LT_cjs.a({background:r,borderRadius:n})}
20
+ >
21
+ ${chunkMC6T46LX_cjs.b("select file")}
22
+ </button>
23
+ </slot>
24
+ <input
25
+ id="mave-upload-input"
26
+ .disabled=${!this._upload_id}
27
+ type="file"
28
+ accept="video/*, audio/*"
29
+ @change=${this.handleForm}
30
+ hidden
31
+ />
32
+ </form>`}renderUploading(){let r=Math.max(0,Math.min(100,this._progress||0));return chunk5NSCV6C2_cjs.c`<div class="state state--uploading" style=${chunkQ22T22LT_cjs.a(this.styleFont())}>
33
+ <slot name="uploading">
34
+ <div class="upload-default-progress" role="status">
35
+ <div
36
+ class="upload-default-progress-bar"
37
+ role="progressbar"
38
+ aria-valuemin="0"
39
+ aria-valuemax="100"
40
+ aria-valuenow=${r}
41
+ >
42
+ <div class="upload-default-progress-value" style="width: ${r}%;"></div>
43
+ </div>
44
+ <div class="upload-default-progress-label">${chunkMC6T46LX_cjs.b("uploading...")}</div>
45
+ </div>
46
+ </slot>
47
+ </div>`}renderProcessing(){return chunk5NSCV6C2_cjs.c`<div class="state state--processing" style=${chunkQ22T22LT_cjs.a(this.styleFont())}>
48
+ <slot name="processing">
49
+ <div class="upload-default-status" role="status">${chunkMC6T46LX_cjs.b("just a minute...")}</div>
50
+ </slot>
51
+ </div>`}renderDone(){return chunk5NSCV6C2_cjs.c`<div class="state state--done" style=${chunkQ22T22LT_cjs.a(this.styleFont())}>
52
+ <slot name="done">
53
+ <div class="upload-default-status" role="status">${chunkMC6T46LX_cjs.b("done")}</div>
54
+ </slot>
55
+ </div>`}};exports.a.styles=chunk5NSCV6C2_cjs.h`
56
+ :host {
57
+ all: initial;
58
+ display: block;
59
+ width: 100%;
60
+ aspect-ratio: 16 / 9;
61
+ position: relative;
62
+ }
63
+
64
+ .state {
65
+ display: flex;
66
+ flex-direction: column;
67
+ justify-content: center;
68
+ align-items: center;
69
+ background: white;
70
+ width: 100%;
71
+ height: 100%;
72
+ }
73
+
74
+ .state--initial {
75
+ transition: box-shadow 160ms ease;
76
+ gap: 12px;
77
+ }
78
+
79
+ .upload-default-title {
80
+ font-size: 32px;
81
+ padding-bottom: 2px;
82
+ font-weight: 300;
83
+ opacity: 0.9;
84
+ text-align: center;
85
+ }
86
+
87
+ .upload-default-subtitle {
88
+ opacity: 0.5;
89
+ padding-bottom: 16px;
90
+ text-align: center;
91
+ }
92
+
93
+ .upload-default-button {
94
+ position: relative;
95
+ width: 150px;
96
+ height: 40px;
97
+ overflow: hidden;
98
+ color: white;
99
+ display: flex;
100
+ justify-content: center;
101
+ align-items: center;
102
+ cursor: pointer;
103
+ border: none;
104
+ font: inherit;
105
+ text-transform: none;
106
+ background: #1997ff;
107
+ border-radius: 16px;
108
+ transition: opacity 160ms ease;
109
+ }
110
+
111
+ .upload-default-button:hover,
112
+ .upload-default-button:focus {
113
+ opacity: 0.9;
114
+ outline: none;
115
+ }
116
+
117
+ .upload-default-button:disabled {
118
+ opacity: 0.5;
119
+ cursor: not-allowed;
120
+ }
121
+
122
+ .upload-default-progress {
123
+ width: 70%;
124
+ max-width: 380px;
125
+ display: flex;
126
+ flex-direction: column;
127
+ gap: 16px;
128
+ align-items: center;
129
+ }
130
+
131
+ .upload-default-progress-bar {
132
+ width: 100%;
133
+ height: 4px;
134
+ border-radius: 999px;
135
+ background: #e6e6e6;
136
+ overflow: hidden;
137
+ }
138
+
139
+ .upload-default-progress-value {
140
+ height: 100%;
141
+ background: #1997ff;
142
+ transition: width 200ms cubic-bezier(0, 0, 0.2, 1);
143
+ }
144
+
145
+ .upload-default-progress-label {
146
+ opacity: 0.6;
147
+ }
148
+
149
+ .upload-default-status {
150
+ opacity: 0.6;
151
+ padding-bottom: 24px;
152
+ text-align: center;
153
+ }
154
+ `,chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"token",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"locale",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"color",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"font",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"radius",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a({type:Boolean})],exports.a.prototype,"disableCompletion",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_progress",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_upload_id",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_completed",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_dragging",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c("#mave-upload-input")],exports.a.prototype,"fileInput",2),exports.a=chunkIPA5Q26W_cjs.c([chunkMC6T46LX_cjs.a()],exports.a);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-upload")||window.customElements.define("mave-upload",exports.a));/*! Bundled license information:
155
+
156
+ tus-js-client/lib.esm/upload.js:
157
+ (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *)
158
+
159
+ tus-js-client/lib.esm/browser/fileReader.js:
160
+ (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *)
161
+ */
@@ -0,0 +1,37 @@
1
+ import {a as a$2}from'./chunk-3R7TX6NC.js';import {b as b$2,a as a$1,c as c$2}from'./chunk-CUGRXOA2.js';import {a as a$3}from'./chunk-MK4VIJT3.js';import {b as b$4}from'./chunk-HX6F65VL.js';import {a,b as b$3}from'./chunk-HMISRRKC.js';import {h,i as i$1,c as c$3}from'./chunk-A4GZBQEB.js';import {a as a$4}from'./chunk-JBV2AYRP.js';import {b as b$1,c as c$1,e,f,d}from'./chunk-NDDFZTBA.js';var b=b$1(b$2(),1);var i,v,c,u,y,M,p,I,S,T,r=class extends i$1{constructor(){super(...arguments);e(this,i);this.autoplay="lazy";this.quality="auto";this.fallback="placeholder";this._queue=[];this._failedPlay=false;this._intersectionObserver=new a$1(this,{callback:f(this,i,S).bind(this)});this.embedController=new b$4(this);}get embed(){return this._embedId}set embed(t){this._embedId!=t&&(this._embedId=t,this.requestUpdate("embed"),this.embedController.embed=this.embed);}set loop(t){this._loop=(t===""||t=="true"||t==true)??false;}get loop(){return this._loop}get poster(){return this.embedController.embedFile(`${this.fallback}.jpg`)}set poster(t){if(t){let s=this._poster;this._poster=t,this.requestUpdate("poster",s);}}get token(){return this._token}set token(t){this._token!=t&&(this._token=t,this.requestUpdate("token"),this.embedController.token=this._token);}get sources(){let t=this.autoplay==="scroll"?["clip_keyframes"]:["video","clip"],s=this._embed.video.renditions.filter(e=>(this.quality=="auto"?e.size!=="uhd":d(this,i,c).indexOf(e.size)<=d(this,i,c).indexOf(this.quality))&&e.container==="mp4"&&d(this,i,u).includes(e.codec)&&(!e.type||t.includes(e.type))).sort((e,o)=>e.size===o.size?d(this,i,u).indexOf(e.codec)-d(this,i,u).indexOf(o.codec):d(this,i,c).indexOf(o.size)-d(this,i,c).indexOf(e.size)).map(e=>{let o=d(this,i,M).find(g=>g.size===e.size)?.media,m=`${e.codec}_${e.size}${e.type&&e.type!="video"?`_${e.type}`:""}.mp4`;return {media:o,src:this.embedController.embedFile(m),codec:d(this,i,y)[e.codec]??e.codec}}),d$1=this._embed.video.renditions.filter(e=>d(this,i,c).indexOf(e.size)<=d(this,i,c).indexOf("fhd")&&e.container==="mp4"&&d(this,i,u).includes(e.codec)&&(!e.type||t.includes(e.type))).sort((e,o)=>d(this,i,c).indexOf(o.size)-d(this,i,c).indexOf(e.size));if(d$1.length>0){let e=d$1[0],o=`${e.codec}_${e.size}${e.type&&e.type!="video"?`_${e.type}`:""}.mp4`,m={media:void 0,src:this.embedController.embedFile(o),codec:d(this,i,y)[e.codec]??e.codec};s.push(m);}return s}connectedCallback(){super.connectedCallback(),typeof document<"u"&&this.autoplay==="scroll"&&document.addEventListener("scroll",f(this,i,v).bind(this));}disconnectedCallback(){super.disconnectedCallback(),typeof document<"u"&&this.autoplay==="scroll"&&document.removeEventListener("scroll",f(this,i,v).bind(this)),this._metricsInstance?.demonitor();}set muted(t){this._videoElement?this._videoElement.muted=t:this._queue.push(()=>this._videoElement.muted=t);}get muted(){return this._videoElement?.muted||false}get paused(){return this._videoElement?.paused||true}get duration(){return new Promise((t,s)=>{if(this._videoElement&&!isNaN(this._videoElement.duration))return t(this._videoElement.duration);let d=()=>{this._videoElement?.addEventListener("loadedmetadata",()=>{this._videoElement&&t(this._videoElement.duration);}),this._videoElement?.addEventListener("error",e=>{s(new Error("Failed to load video metadata."));});};this._videoElement?d():this.addEventListener("mave:video_element_ready",()=>{d();});})}set currentTime(t){this._videoElement?this._videoElement.currentTime=t:this._queue.push(()=>this._videoElement.currentTime=t);}get currentTime(){return this._videoElement?this._videoElement?.currentTime:0}play(){this._videoElement?f(this,i,p).call(this):this._queue.push(()=>f(this,i,p).call(this));}pause(){this._videoElement?this._videoElement.pause():this._queue.push(()=>this._videoElement?.pause());}render(){return c$3`
2
+ ${this.embedController.render({complete:t=>{if(this._embed=t,!!t)return c$3`
3
+ <video
4
+ @click=${f(this,i,T)}
5
+ preload="metadata"
6
+ style=${a$2(this._failedPlay||this.autoplay==="off"?"cursor: pointer":void 0)}
7
+ muted
8
+ playsinline
9
+ poster=${a$2(this._failedPlay?this.poster:void 0)}
10
+ ${c$2(f(this,i,I))}
11
+ ?autoplay=${this.autoplay==="always"}
12
+ ?loop=${this.loop||true}
13
+ >
14
+ ${this.sources.map(s=>c$3`
15
+ <source
16
+ media=${a$2(s.media?`(min-width: ${s.media}px)`:void 0)}
17
+ src=${s.src}
18
+ type=${`video/mp4; ${s.codec}`}
19
+ />
20
+ `)}
21
+ </video>
22
+ `}})}
23
+ `}};i=new WeakSet,v=function(){if(typeof window>"u")return;let{height:t,top:s,bottom:d}=this.getBoundingClientRect(),e=window.innerHeight;if(this._videoElement){this._videoElement.duration||this._videoElement.load();let o=0;if(s<e&&d>0){let m=t+e;o=(e-s)/m*this._videoElement.duration;}o>=0&&o<=this._videoElement.duration&&(this._videoElement.currentTime=o);}},c=function(){return ["sd","hd","fhd","qhd","uhd"]},u=function(){let t=navigator.userAgent,s=/Edg/.test(t)&&/Mac OS/.test(t),d=/Safari/.test(t)&&!/Chrome/.test(t),e=/Mac OS/.test(t),o=/iPhone|iPad/.test(t);return e&&(d||s)||o?["hevc","h264"]:["av1","h264"]},y=function(){return {av1:"av01.0.08M.08.0.110.01.01.01.0,opus",hevc:"hevc.01.00.78,mp4a.40.2",h264:"avc1.64.00.28,mp4a.40.2"}},M=function(){return [{size:"qhd",media:1280},{size:"fhd",media:1080},{size:"hd",media:720},{size:"sd",media:640}]},p=function(){this._metricsInstance?.monitor(),this._videoElement&&(this._videoElement.muted=true,this._videoElement.play().catch(t=>{this._failedPlay=true;}));},I=function(t){if(this._videoElement||(this._videoElement=t,this.dispatchEvent(new CustomEvent("mave:video_element_ready",{detail:this._videoElement,bubbles:true,composed:true}))),this._intersectionObserver.observe(this._videoElement),this._videoElement&&this._embed){a$3.forEach(d=>{this._videoElement?.addEventListener(d,e=>{!this._canPlay&&this.autoplay==="scroll"&&d==="canplay"&&(this._canPlay=true,f(this,i,v).call(this)),this.dispatchEvent(new CustomEvent(d,{detail:e,bubbles:true,composed:true}));});});let s={component:"clip",video_id:this._embed.video.id,space_id:this._embed.space_id};b.Metrics.config={socketPath:a$4.metrics.socket,apiKey:this._embed.metrics_key},a$4.metrics.enabled&&(this._metricsInstance=new b.Metrics(this._videoElement,this.embed,s));}this._queue.length&&(this._queue.forEach(s=>s()),this._queue=[]);},S=function(t){for(let{isIntersecting:s}of t){if(this.autoplay==="always")return;s&&(this.autoplay==="lazy"||this.autoplay==="true")?this._videoElement?.paused&&f(this,i,p).call(this):this._videoElement?.paused||this._videoElement?.pause();}},T=function(){(this.autoplay==="off"||this._failedPlay)&&(this._videoElement?.paused?f(this,i,p).call(this):this._videoElement?.pause());},r.styles=h`
24
+ :host {
25
+ display: block;
26
+ position: relative;
27
+ overflow: hidden;
28
+ }
29
+
30
+ video {
31
+ all: initial;
32
+ display: block;
33
+ width: 100%;
34
+ height: 100%;
35
+ object-fit: cover;
36
+ }
37
+ `,c$1([a()],r.prototype,"embed",1),c$1([a()],r.prototype,"autoplay",2),c$1([a()],r.prototype,"quality",2),c$1([a()],r.prototype,"fallback",2),c$1([a()],r.prototype,"loop",1),c$1([a()],r.prototype,"poster",1),c$1([a()],r.prototype,"token",1),c$1([b$3()],r.prototype,"_failedPlay",2);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-clip")||window.customElements.define("mave-clip",r));export{r as a};
@@ -1,4 +1,4 @@
1
- import {a as a$2}from'./chunk-36CSGHYJ.js';import {a as a$1}from'./chunk-MS5NFI3Q.js';import {c as c$1,a}from'./chunk-HMISRRKC.js';import {h,i as i$1,c as c$2}from'./chunk-A4GZBQEB.js';import {c}from'./chunk-NDDFZTBA.js';var i=class extends i$1{get backdrop(){return this._backdropColor||"black"}set backdrop(t){this._backdropColor!=t&&(this._backdropColor=t);}get backdropFilter(){return this._backdropFilter}set backdropFilter(t){this._backdropFilter!=t&&(this._backdropFilter=t);}get styles(){let t={"--backdrop":this.backdrop,"--backdrop-filter":this.backdropFilter};return a$1(t)}open(t){if(this._player=t,t.aspect_ratio){let[o,d]=t.aspect_ratio.split("/");this.style.setProperty("--frame-ratio-w",o),this.style.setProperty("--frame-ratio-h",d);}this.style.display="block";let n=o=>{this._frame.appendChild(t),setTimeout(()=>{this._dialog.showModal();},25),this._dialog.addEventListener("close",d=>{d.preventDefault(),this.close();},{once:true}),o(this);};return new Promise(o=>{if(this._dialog)n(o);else {let d=setInterval(()=>{this._dialog&&(n(o),clearInterval(d));},100);return}})}possibleClose(t){t.target!=this._player&&this.close();}close(){this._dialog.close(),this._backdrop.addEventListener("transitionend",()=>{this._frame.innerHTML="",this.dispatchEvent(new Event("closed",{bubbles:true}));},{once:true});}render(){return c$2`
1
+ import {a as a$2}from'./chunk-ESQT2PPF.js';import {a as a$1}from'./chunk-MS5NFI3Q.js';import {c as c$1,a}from'./chunk-HMISRRKC.js';import {h,i,c as c$2}from'./chunk-A4GZBQEB.js';import {c}from'./chunk-NDDFZTBA.js';var n=class extends i{get backdrop(){return this._backdropColor||"black"}set backdrop(t){this._backdropColor!=t&&(this._backdropColor=t);}get backdropFilter(){return this._backdropFilter}set backdropFilter(t){this._backdropFilter!=t&&(this._backdropFilter=t);}get styles(){let t={"--backdrop":this.backdrop,"--backdrop-filter":this.backdropFilter};return a$1(t)}open(t){if(this._player=t,t.aspect_ratio){let[i,s]=t.aspect_ratio.split("/");this.style.setProperty("--frame-ratio-w",i),this.style.setProperty("--frame-ratio-h",s);}this.style.display="block";let o=i=>{this._frame.appendChild(t),setTimeout(()=>{this._dialog.showModal();},25),this._dialog.addEventListener("close",s=>{s.preventDefault(),this.close();},{once:true}),i(this);};return new Promise(i=>{if(this._dialog)o(i);else {let s=setInterval(()=>{this._dialog&&(o(i),clearInterval(s));},100);return}})}possibleClose(t){t.target!=this._player&&this.close();}close(){this._dialog.close(),this._backdrop.addEventListener("transitionend",()=>{this._frame.innerHTML="",this.dispatchEvent(new Event("closed",{bubbles:true}));},{once:true});}render(){return c$2`
2
2
  <dialog style=${this.styles}>
3
3
  <div class="backdrop"></div>
4
4
  <div class="content" @click=${this.possibleClose}>
@@ -27,7 +27,7 @@ import {a as a$2}from'./chunk-36CSGHYJ.js';import {a as a$1}from'./chunk-MS5NFI3
27
27
  </svg>
28
28
  </div>
29
29
  </dialog>
30
- `}};i.styles=h`
30
+ `}};n.styles=h`
31
31
  :host {
32
32
  all: initial;
33
33
  --backdrop: black;
@@ -151,4 +151,4 @@ import {a as a$2}from'./chunk-36CSGHYJ.js';import {a as a$1}from'./chunk-MS5NFI3
151
151
  background-position: center center;
152
152
  background-repeat: no-repeat;
153
153
  }
154
- `,c([c$1("dialog")],i.prototype,"_dialog",2),c([c$1(".content")],i.prototype,"_content",2),c([c$1(".frame")],i.prototype,"_frame",2),c([c$1(".backdrop")],i.prototype,"_backdrop",2),c([a()],i.prototype,"backdrop",1),c([a({attribute:"backdrop-filter"})],i.prototype,"backdropFilter",1);window&&window.customElements&&(window.customElements.get("mave-pop")||window.customElements.define("mave-pop",i));function k(l){let t={};if(!l)return t;for(let n=0;n<l.attributes.length;n++){let o=l.attributes[n];t[o.name]=o.value;}return t}var w=l=>{function t(s){let e,r,a=document.querySelector(`mave-pop[embed="${s}"]`);if(a)return r=k(a.querySelector("mave-player")),e=a,{pop:e,attributes:r};let p=document.querySelector("mave-pop:not([embed])");return p?(r=k(p.querySelector("mave-player")),e=p,{pop:e,attributes:r}):(e=new i,document.body.appendChild(e),{pop:e})}function n(s,e){let r=new a$2;if(e)for(let a in e)r.setAttribute(a,e[a]);return r.embed=s,r}function o(s){s.querySelectorAll("[x-mave-pop]").forEach(e=>{let r=e.getAttribute("x-mave-pop")||e.getAttribute("embed");if(!r)return;let{pop:a,attributes:p}=t(r);n(r,p),e.addEventListener("click",E=>{E.preventDefault();let _=document.querySelectorAll("mave-player");if(!Array.from(_).find(m=>m.popped)){let m=n(r,p);a.open(m).then(()=>{m.play();}),a.addEventListener("closed",()=>{m.pause();});}});});}o(l),new MutationObserver(s=>{for(let e of s)e.type==="childList"&&e.addedNodes.forEach(r=>{r instanceof HTMLElement&&o(r);});}).observe(document.body,{childList:true,subtree:true});};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{w(document);}):setTimeout(()=>w(document),500);export{i as a,w as b};
154
+ `,c([c$1("dialog")],n.prototype,"_dialog",2),c([c$1(".content")],n.prototype,"_content",2),c([c$1(".frame")],n.prototype,"_frame",2),c([c$1(".backdrop")],n.prototype,"_backdrop",2),c([a()],n.prototype,"backdrop",1),c([a({attribute:"backdrop-filter"})],n.prototype,"backdropFilter",1);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-pop")||window.customElements.define("mave-pop",n));function E(l){let t={};if(!l)return t;for(let o=0;o<l.attributes.length;o++){let i=l.attributes[o];t[i.name]=i.value;}return t}var x=()=>typeof document<"u"?document:void 0,_=l=>{let t=x();if(!t)return;let o=t;function i(c){let e,r,a=o.querySelector(`mave-pop[embed="${c}"]`);if(a)return r=E(a.querySelector("mave-player")),e=a,{pop:e,attributes:r};let p=o.querySelector("mave-pop:not([embed])");return p?(r=E(p.querySelector("mave-player")),e=p,{pop:e,attributes:r}):(e=new n,o.body.appendChild(e),{pop:e})}function s(c,e){let r=new a$2;if(e)for(let a in e)r.setAttribute(a,e[a]);return r.embed=c,r}function g(c){c.querySelectorAll("[x-mave-pop]").forEach(e=>{let r=e.getAttribute("x-mave-pop")||e.getAttribute("embed");if(!r)return;let{pop:a,attributes:p}=i(r);s(r,p),e.addEventListener("click",L=>{L.preventDefault();let M=o.querySelectorAll("mave-player");if(!Array.from(M).find(m=>m.popped)){let m=s(r,p);a.open(m).then(()=>{m.play();}),a.addEventListener("closed",()=>{m.pause();});}});});}g(l),new MutationObserver(c=>{for(let e of c)e.type==="childList"&&e.addedNodes.forEach(r=>{r instanceof HTMLElement&&g(r);});}).observe(o.body,{childList:true,subtree:true});},f=x();f&&(f.readyState==="loading"?f.addEventListener("DOMContentLoaded",()=>{_(f);}):setTimeout(()=>_(f),500));export{n as a,_ as b};
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkVW7IKXVI_cjs=require('./chunk-VW7IKXVI.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs');var e=class extends chunkVW7IKXVI_cjs.a{get poster(){return `${this.cdn_root}/${this.embedId}/poster.webp`}render(){return chunk5NSCV6C2_cjs.c`<img src=${this.poster} />`}};e.styles=chunk5NSCV6C2_cjs.h`
1
+ 'use strict';var chunkMKZYI5TY_cjs=require('./chunk-MKZYI5TY.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs');var e=class extends chunkMKZYI5TY_cjs.a{get poster(){return `${this.cdn_root}/${this.embedId}/poster.webp`}render(){return chunk5NSCV6C2_cjs.c`<img src=${this.poster} />`}};e.styles=chunk5NSCV6C2_cjs.h`
2
2
  :host {
3
3
  display: block;
4
4
  }
@@ -7,4 +7,4 @@
7
7
  width: 100%;
8
8
  max-height: 100vh;
9
9
  }
10
- `;window&&window.customElements&&(window.customElements.get("mave-img")||window.customElements.define("mave-img",e));exports.a=e;
10
+ `;typeof window<"u"&&window.customElements&&(window.customElements.get("mave-img")||window.customElements.define("mave-img",e));exports.a=e;