@maveio/components 0.0.149 → 0.0.151

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 (41) hide show
  1. package/dist/{chunk-3GACH56T.js → chunk-2EYY6N7K.js} +1 -1
  2. package/dist/{chunk-VRW6KUQP.js → chunk-AEGY4JNC.js} +1 -1
  3. package/dist/{chunk-NENQOWTM.cjs → chunk-APKCPW3V.cjs} +2 -2
  4. package/dist/{chunk-XSYWRQWB.js → chunk-DH5I55F5.js} +1 -1
  5. package/dist/{chunk-O4SVRXZ6.cjs → chunk-F2VMRZFU.cjs} +1 -1
  6. package/dist/{chunk-6AXROGQC.js → chunk-FDSTNWZP.js} +1 -1
  7. package/dist/{chunk-KDE6VE72.js → chunk-GMEHYYP4.js} +1 -1
  8. package/dist/{chunk-5UMTSGHI.cjs → chunk-LOR3PIH5.cjs} +1 -1
  9. package/dist/{chunk-ABWSEIH3.js → chunk-LX6MMRGQ.js} +1 -1
  10. package/dist/{chunk-3GVDBAOP.cjs → chunk-QJHVSRHC.cjs} +1 -1
  11. package/dist/{chunk-7LKYLXK5.js → chunk-S6WN4NLN.js} +1 -1
  12. package/dist/{chunk-OZVIXWBD.cjs → chunk-SM4RPLYQ.cjs} +1 -1
  13. package/dist/{chunk-JZVU4QZ4.cjs → chunk-VGWLQHAV.cjs} +2 -2
  14. package/dist/{chunk-DOR5AD7J.js → chunk-WFWUIIE6.js} +1 -1
  15. package/dist/{chunk-P4RYGSTU.cjs → chunk-X3IY737A.cjs} +1 -1
  16. package/dist/{chunk-I6LB6U7R.cjs → chunk-XSVNMS3S.cjs} +1 -1
  17. package/dist/{chunk-KCZRQ4AS.cjs → chunk-Y7NYUH3P.cjs} +1 -1
  18. package/dist/{chunk-GO5AXJUO.js → chunk-ZWTODZDA.js} +1 -1
  19. package/dist/components/clip.cjs +1 -1
  20. package/dist/components/clip.js +1 -1
  21. package/dist/components/files.cjs +1 -1
  22. package/dist/components/files.js +1 -1
  23. package/dist/components/list.cjs +1 -1
  24. package/dist/components/list.js +1 -1
  25. package/dist/components/player.cjs +1 -1
  26. package/dist/components/player.js +1 -1
  27. package/dist/components/pop.cjs +1 -1
  28. package/dist/components/pop.js +1 -1
  29. package/dist/components/text.cjs +1 -1
  30. package/dist/components/text.js +1 -1
  31. package/dist/components/upload.cjs +1 -1
  32. package/dist/components/upload.js +1 -1
  33. package/dist/embed/caption.cjs +1 -1
  34. package/dist/embed/caption.js +1 -1
  35. package/dist/embed/controller.cjs +1 -1
  36. package/dist/embed/controller.js +1 -1
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/react.cjs +1 -1
  40. package/dist/react.js +1 -1
  41. package/package.json +1 -1
@@ -1 +1 @@
1
- import {a as a$2}from'./chunk-TPP5OQFR.js';import {a as a$1}from'./chunk-LCTGZL3L.js';import {a as a$3}from'./chunk-JBV2AYRP.js';var c=(t=>(t[t.Collection=0]="Collection",t[t.Embed=1]="Embed",t))(c||{}),a=class{constructor(e,t=1){this.caching=true;this.loading=true;this.host=e,this.type=t,this.loading=true,this.task=new a$1(this.host,async()=>{try{if(this.type==1&&!this.embed)return;if(this.type==0&&!this.token){console.warn("No token attr provided for mave-list");return}let i=await(await fetch(this.manifest_url)).json();return this.loading=!1,this.type==1?(this._embedData=i,this.version=this._embedData.video?.version||0,this._embedData):i}catch(s){throw console.log(s),new Error(`Failed to fetch "${this.embed}"`)}},()=>[this.embed]);}get manifest_url(){if(this.type==1)return this.embedFile("manifest.json");{let e=new URL(`${a$2}/collection/${this.token}`);return this.embed&&this.embed?.length>1&&e.searchParams.append("embed",this.embed),e.toString()}}set embed(e){this._embed!=e&&(this._embed=e,this.loading=true,this.host.requestUpdate());}get embed(){return this._embed}set token(e){this._token!=e&&(this._token=e,this.host.requestUpdate());}get token(){return this._token}get spaceId(){return this.embed?.substring(0,5)}get embedId(){return this.embed?.substring(5,this.embed?.length)}get version(){return this._version?`/v${this._version}/`:"/"}set version(e){this._version!=e&&(this._version=e,this.host.requestUpdate());}get cdnRoot(){return a$3.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}refresh(){return this.loading=true,this.task?.run()}embedFile(e,t=new URLSearchParams){let s=new URL(`${this.cdnRoot}/${this.embedId}${e=="manifest"?"/":this.version}${e}`);if(e.includes("?")){let[i,h]=e.split("?");new URLSearchParams(h).forEach((d,m)=>{t.append(m,d);});}if(this.token&&t.append("token",this.token),e=="manifest"&&(t.has("e")&&t.delete("e"),t.append("e",new Date().getTime().toString())),e!=="manifest"&&this._embedData?.created_at){let i=this.caching?new Date(this._embedData.created_at):new Date;t.has("e")||t.append("e",i.getTime().toString());}return s.search=t.toString(),s.toString()}render(e){return this.task?.render(e)}};export{c as a,a as b};
1
+ import {a as a$2}from'./chunk-TPP5OQFR.js';import {a as a$1}from'./chunk-LCTGZL3L.js';import {a as a$3}from'./chunk-JBV2AYRP.js';var c=(t=>(t[t.Collection=0]="Collection",t[t.Embed=1]="Embed",t))(c||{}),a=class{constructor(e,t=1){this.caching=true;this.loading=true;this.host=e,this.type=t,this.loading=true,this.task=new a$1(this.host,async()=>{try{if(this.type==1&&!this.embed)return;if(this.type==0&&!this.token){console.warn("No token attr provided for mave-list");return}let i=await(await fetch(this.manifest_url)).json();return this.loading=!1,this.type==1?(this._embedData=i,this.version=this._embedData.video?.version||0,this._embedData):i}catch(s){throw console.log(s),new Error(`Failed to fetch "${this.embed}"`)}},()=>[this.embed]);}get manifest_url(){if(this.type==1)return this.embedFile("manifest.json");{let e=new URL(`${a$2}/collection/${this.token}`);return this.embed&&this.embed?.length>1&&e.searchParams.append("embed",this.embed),e.toString()}}set embed(e){this._embed!=e&&(this._embed=e,this.loading=true,this.host.requestUpdate());}get embed(){return this._embed}set token(e){this._token!=e&&(this._token=e,this.host.requestUpdate());}get token(){return this._token}get spaceId(){return this.embed?.substring(0,5)}get embedId(){return this.embed?.substring(5,this.embed?.length)}get version(){return this._version?`/v${this._version}/`:"/"}set version(e){this._version!=e&&(this._version=e,this.host.requestUpdate());}get cdnRoot(){return a$3.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}refresh(){return this.loading=true,this.task?.run()}embedFile(e,t=new URLSearchParams){let s=new URL(`${this.cdnRoot}/${this.embedId}${e=="manifest.json"?"/":this.version}${e}`);if(e.includes("?")){let[i,h]=e.split("?");new URLSearchParams(h).forEach((d,m)=>{t.append(m,d);});}return this.token&&t.append("token",this.token),e=="manifest.json"&&(t.has("e")&&t.delete("e"),t.append("e",new Date().getTime().toString())),e!=="manifest.json"&&!this.caching&&(t.has("e")||t.append("e",new Date().getTime().toString())),s.search=t.toString(),s.toString()}render(e){return this.task?.render(e)}};export{c as a,a as b};
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkKCZRQ4AS_cjs=require('./chunk-KCZRQ4AS.cjs'),chunkVW7IKXVI_cjs=require('./chunk-VW7IKXVI.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunkIPA5Q26W_cjs=require('./chunk-IPA5Q26W.cjs');var i,d,E,A,h,c=class extends chunkVW7IKXVI_cjs.a{constructor(){super(...arguments);chunkIPA5Q26W_cjs.e(this,i);this.embedController=new chunkKCZRQ4AS_cjs.b(this);}get embed(){return this._embed}set embed(o){this._embed!==o&&(this._embed=o,this.requestUpdate("embed"),this.embedController.embed=this.embed);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}render(){return chunk5NSCV6C2_cjs.c`
1
+ 'use strict';var chunkY7NYUH3P_cjs=require('./chunk-Y7NYUH3P.cjs'),chunkVW7IKXVI_cjs=require('./chunk-VW7IKXVI.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunkIPA5Q26W_cjs=require('./chunk-IPA5Q26W.cjs');var i,d,E,A,h,c=class extends chunkVW7IKXVI_cjs.a{constructor(){super(...arguments);chunkIPA5Q26W_cjs.e(this,i);this.embedController=new chunkY7NYUH3P_cjs.b(this);}get embed(){return this._embed}set embed(o){this._embed!==o&&(this._embed=o,this.requestUpdate("embed"),this.embedController.embed=this.embed);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}render(){return chunk5NSCV6C2_cjs.c`
2
2
  ${this.embedController.render({pending:this.renderPending,complete:o=>{if(this._data=o,!o)return;let r=this._slottedChildren.map(t=>{function e(){let n;return t.nodeName==="TEMPLATE"?n=t.content.cloneNode(true):n=t.cloneNode(true),n}if(t.getAttribute("name")=="mave-files-video"){let n=e(),a=new Date(this._data.created_at);a&&chunkIPA5Q26W_cjs.f(this,i,d).call(this,n,'[slot="date"]',a.toLocaleDateString().replaceAll("/","-"));let p=this._data.video.duration;p&&chunkIPA5Q26W_cjs.f(this,i,d).call(this,n,'[slot="duration"]',this.durationToTime(p));let f=this._data.video.filetype;f&&chunkIPA5Q26W_cjs.f(this,i,d).call(this,n,'[slot="filetype"]',f);let b=this._data.video.size,C=b/1e6;b&&chunkIPA5Q26W_cjs.f(this,i,d).call(this,n,'[slot="size"]',`${C.toFixed(1)} MB`);let u=chunkIPA5Q26W_cjs.f(this,i,h).call(this,`${this.cdn_root}/${this.embedId}/h264_hd.mp4`,`${this._data.name}.mp4`);return u.setAttribute("aria-label","Download video"),u.appendChild(n),chunk5NSCV6C2_cjs.c`${u}`}if(this._data.video.audio&&t.getAttribute("name")=="mave-files-audio"){let n=e();chunkIPA5Q26W_cjs.f(this,i,d).call(this,n,'[slot="filetype"]',"mp3");let a=chunkIPA5Q26W_cjs.f(this,i,h).call(this,`${this.cdn_root}/${this.embedId}/audio.mp3`,`${this._data.name}.mp3`);return a.setAttribute("aria-label","Download audio"),a.appendChild(n),chunk5NSCV6C2_cjs.c`${a}`}let m=this._data.subtitles.find(n=>n.language==this._data.video.language);if(m&&t.getAttribute("name")=="mave-files-subtitles"){let n=e();chunkIPA5Q26W_cjs.f(this,i,d).call(this,n,'[slot="filetype"]',"vtt");let a=chunkIPA5Q26W_cjs.f(this,i,h).call(this,m.path,`${this._data.name}.vtt`);return a.setAttribute("aria-label","Download subtitles"),a.appendChild(n),chunk5NSCV6C2_cjs.c`${a}`}});return chunk5NSCV6C2_cjs.c`${this._stylesheets} ${r}`}})}
3
3
  `}renderPending(){return chunk5NSCV6C2_cjs.c`<slot style="display: none"></slot>`}};i=new WeakSet,d=function(o,r,t){let e=o.querySelector(r);e&&(e.textContent=t,e.removeAttribute("slot"));},E=function(o,r){let t=window.URL.createObjectURL(o),e=document.createElement("a");e.style.display="none",e.href=t,e.download=r,this.appendChild(e),e.click(),window.URL.revokeObjectURL(t),this.removeChild(e);},A=function(o,r){return fetch(o).then(t=>{if(!t.ok)throw new Error("Network response was not ok");return t.blob()}).then(t=>chunkIPA5Q26W_cjs.f(this,i,E).call(this,t,r)).catch(t=>console.error("Something went wrong:",t))},h=function(o,r){let t=document.createElement("a");t.classList.add("link"),t.setAttribute("href",o),t.setAttribute("download",r),t.setAttribute("target","new");let e=false;return t.addEventListener("click",m=>{m.preventDefault(),!e&&(e=true,t.style.cursor="wait",t.style.opacity="0.5",chunkIPA5Q26W_cjs.f(this,i,A).call(this,o,r).then(()=>{e=false,t.style.cursor="pointer",t.style.opacity="1";}));}),t},c.styles=chunk5NSCV6C2_cjs.h`
4
4
  :host {
@@ -1,4 +1,4 @@
1
- import {a as a$2}from'./chunk-VRW6KUQP.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-AEGY4JNC.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`
2
2
  <dialog style=${this.styles}>
3
3
  <div class="backdrop"></div>
4
4
  <div class="content" @click=${this.possibleClose}>
@@ -1,4 +1,4 @@
1
- import {a as a$2}from'./chunk-3R7TX6NC.js';import {b as b$2,a as a$1,c as c$1}from'./chunk-CUGRXOA2.js';import {a as a$3}from'./chunk-MK4VIJT3.js';import {b as b$4}from'./chunk-XSYWRQWB.js';import {a,b as b$3}from'./chunk-HMISRRKC.js';import {h as h$1,i as i$1,c as c$2}from'./chunk-A4GZBQEB.js';import {a as a$4}from'./chunk-JBV2AYRP.js';import {b as b$1,c,e,f,d}from'./chunk-NDDFZTBA.js';var b=b$1(b$2(),1);var i,v,h,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,h).indexOf(e.size)<=d(this,i,h).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,h).indexOf(o.size)-d(this,i,h).indexOf(e.size)).map(e=>{let o=d(this,i,M).find(g=>g.size===e.size)?.media,c=`${e.codec}_${e.size}${e.type&&e.type!="video"?`_${e.type}`:""}.mp4`;return {media:o,src:this.embedController.embedFile(c),codec:d(this,i,y)[e.codec]}}),d$1=this._embed.video.renditions.filter(e=>d(this,i,h).indexOf(e.size)<=d(this,i,h).indexOf("fhd")&&e.container==="mp4"&&d(this,i,u).includes(e.codec)&&(!e.type||t.includes(e.type))).sort((e,o)=>d(this,i,h).indexOf(o.size)-d(this,i,h).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`,c={media:void 0,src:this.embedController.embedFile(o),codec:d(this,i,y)[e.codec]};s.push(c);}return s}connectedCallback(){super.connectedCallback(),this.autoplay==="scroll"&&document.addEventListener("scroll",f(this,i,v).bind(this));}disconnectedCallback(){super.disconnectedCallback(),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$2`
1
+ import {a as a$2}from'./chunk-3R7TX6NC.js';import {b as b$2,a as a$1,c as c$1}from'./chunk-CUGRXOA2.js';import {a as a$3}from'./chunk-MK4VIJT3.js';import {b as b$4}from'./chunk-DH5I55F5.js';import {a,b as b$3}from'./chunk-HMISRRKC.js';import {h as h$1,i as i$1,c as c$2}from'./chunk-A4GZBQEB.js';import {a as a$4}from'./chunk-JBV2AYRP.js';import {b as b$1,c,e,f,d}from'./chunk-NDDFZTBA.js';var b=b$1(b$2(),1);var i,v,h,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,h).indexOf(e.size)<=d(this,i,h).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,h).indexOf(o.size)-d(this,i,h).indexOf(e.size)).map(e=>{let o=d(this,i,M).find(g=>g.size===e.size)?.media,c=`${e.codec}_${e.size}${e.type&&e.type!="video"?`_${e.type}`:""}.mp4`;return {media:o,src:this.embedController.embedFile(c),codec:d(this,i,y)[e.codec]}}),d$1=this._embed.video.renditions.filter(e=>d(this,i,h).indexOf(e.size)<=d(this,i,h).indexOf("fhd")&&e.container==="mp4"&&d(this,i,u).includes(e.codec)&&(!e.type||t.includes(e.type))).sort((e,o)=>d(this,i,h).indexOf(o.size)-d(this,i,h).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`,c={media:void 0,src:this.embedController.embedFile(o),codec:d(this,i,y)[e.codec]};s.push(c);}return s}connectedCallback(){super.connectedCallback(),this.autoplay==="scroll"&&document.addEventListener("scroll",f(this,i,v).bind(this));}disconnectedCallback(){super.disconnectedCallback(),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$2`
2
2
  ${this.embedController.render({complete:t=>{if(this._embed=t,!!t)return c$2`
3
3
  <video
4
4
  @click=${f(this,i,T)}
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkH57FX4I6_cjs=require('./chunk-H57FX4I6.cjs'),chunk5KQJTT3P_cjs=require('./chunk-5KQJTT3P.cjs'),chunkSDKTBB4N_cjs=require('./chunk-SDKTBB4N.cjs'),chunkKCZRQ4AS_cjs=require('./chunk-KCZRQ4AS.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 b=chunkIPA5Q26W_cjs.b(chunk5KQJTT3P_cjs.b(),1);var i,v,h,u,y,M,p,I,S,T,r=class extends chunk5NSCV6C2_cjs.i{constructor(){super(...arguments);chunkIPA5Q26W_cjs.e(this,i);this.autoplay="lazy";this.quality="auto";this.fallback="placeholder";this._queue=[];this._failedPlay=false;this._intersectionObserver=new chunk5KQJTT3P_cjs.a(this,{callback:chunkIPA5Q26W_cjs.f(this,i,S).bind(this)});this.embedController=new chunkKCZRQ4AS_cjs.b(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":chunkIPA5Q26W_cjs.d(this,i,h).indexOf(e.size)<=chunkIPA5Q26W_cjs.d(this,i,h).indexOf(this.quality))&&e.container==="mp4"&&chunkIPA5Q26W_cjs.d(this,i,u).includes(e.codec)&&(!e.type||t.includes(e.type))).sort((e,o)=>e.size===o.size?chunkIPA5Q26W_cjs.d(this,i,u).indexOf(e.codec)-chunkIPA5Q26W_cjs.d(this,i,u).indexOf(o.codec):chunkIPA5Q26W_cjs.d(this,i,h).indexOf(o.size)-chunkIPA5Q26W_cjs.d(this,i,h).indexOf(e.size)).map(e=>{let o=chunkIPA5Q26W_cjs.d(this,i,M).find(g=>g.size===e.size)?.media,c=`${e.codec}_${e.size}${e.type&&e.type!="video"?`_${e.type}`:""}.mp4`;return {media:o,src:this.embedController.embedFile(c),codec:chunkIPA5Q26W_cjs.d(this,i,y)[e.codec]}}),d=this._embed.video.renditions.filter(e=>chunkIPA5Q26W_cjs.d(this,i,h).indexOf(e.size)<=chunkIPA5Q26W_cjs.d(this,i,h).indexOf("fhd")&&e.container==="mp4"&&chunkIPA5Q26W_cjs.d(this,i,u).includes(e.codec)&&(!e.type||t.includes(e.type))).sort((e,o)=>chunkIPA5Q26W_cjs.d(this,i,h).indexOf(o.size)-chunkIPA5Q26W_cjs.d(this,i,h).indexOf(e.size));if(d.length>0){let e=d[0],o=`${e.codec}_${e.size}${e.type&&e.type!="video"?`_${e.type}`:""}.mp4`,c={media:void 0,src:this.embedController.embedFile(o),codec:chunkIPA5Q26W_cjs.d(this,i,y)[e.codec]};s.push(c);}return s}connectedCallback(){super.connectedCallback(),this.autoplay==="scroll"&&document.addEventListener("scroll",chunkIPA5Q26W_cjs.f(this,i,v).bind(this));}disconnectedCallback(){super.disconnectedCallback(),this.autoplay==="scroll"&&document.removeEventListener("scroll",chunkIPA5Q26W_cjs.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?chunkIPA5Q26W_cjs.f(this,i,p).call(this):this._queue.push(()=>chunkIPA5Q26W_cjs.f(this,i,p).call(this));}pause(){this._videoElement?this._videoElement.pause():this._queue.push(()=>this._videoElement?.pause());}render(){return chunk5NSCV6C2_cjs.c`
1
+ 'use strict';var chunkH57FX4I6_cjs=require('./chunk-H57FX4I6.cjs'),chunk5KQJTT3P_cjs=require('./chunk-5KQJTT3P.cjs'),chunkSDKTBB4N_cjs=require('./chunk-SDKTBB4N.cjs'),chunkY7NYUH3P_cjs=require('./chunk-Y7NYUH3P.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 b=chunkIPA5Q26W_cjs.b(chunk5KQJTT3P_cjs.b(),1);var i,v,h,u,y,M,p,I,S,T,r=class extends chunk5NSCV6C2_cjs.i{constructor(){super(...arguments);chunkIPA5Q26W_cjs.e(this,i);this.autoplay="lazy";this.quality="auto";this.fallback="placeholder";this._queue=[];this._failedPlay=false;this._intersectionObserver=new chunk5KQJTT3P_cjs.a(this,{callback:chunkIPA5Q26W_cjs.f(this,i,S).bind(this)});this.embedController=new chunkY7NYUH3P_cjs.b(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":chunkIPA5Q26W_cjs.d(this,i,h).indexOf(e.size)<=chunkIPA5Q26W_cjs.d(this,i,h).indexOf(this.quality))&&e.container==="mp4"&&chunkIPA5Q26W_cjs.d(this,i,u).includes(e.codec)&&(!e.type||t.includes(e.type))).sort((e,o)=>e.size===o.size?chunkIPA5Q26W_cjs.d(this,i,u).indexOf(e.codec)-chunkIPA5Q26W_cjs.d(this,i,u).indexOf(o.codec):chunkIPA5Q26W_cjs.d(this,i,h).indexOf(o.size)-chunkIPA5Q26W_cjs.d(this,i,h).indexOf(e.size)).map(e=>{let o=chunkIPA5Q26W_cjs.d(this,i,M).find(g=>g.size===e.size)?.media,c=`${e.codec}_${e.size}${e.type&&e.type!="video"?`_${e.type}`:""}.mp4`;return {media:o,src:this.embedController.embedFile(c),codec:chunkIPA5Q26W_cjs.d(this,i,y)[e.codec]}}),d=this._embed.video.renditions.filter(e=>chunkIPA5Q26W_cjs.d(this,i,h).indexOf(e.size)<=chunkIPA5Q26W_cjs.d(this,i,h).indexOf("fhd")&&e.container==="mp4"&&chunkIPA5Q26W_cjs.d(this,i,u).includes(e.codec)&&(!e.type||t.includes(e.type))).sort((e,o)=>chunkIPA5Q26W_cjs.d(this,i,h).indexOf(o.size)-chunkIPA5Q26W_cjs.d(this,i,h).indexOf(e.size));if(d.length>0){let e=d[0],o=`${e.codec}_${e.size}${e.type&&e.type!="video"?`_${e.type}`:""}.mp4`,c={media:void 0,src:this.embedController.embedFile(o),codec:chunkIPA5Q26W_cjs.d(this,i,y)[e.codec]};s.push(c);}return s}connectedCallback(){super.connectedCallback(),this.autoplay==="scroll"&&document.addEventListener("scroll",chunkIPA5Q26W_cjs.f(this,i,v).bind(this));}disconnectedCallback(){super.disconnectedCallback(),this.autoplay==="scroll"&&document.removeEventListener("scroll",chunkIPA5Q26W_cjs.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?chunkIPA5Q26W_cjs.f(this,i,p).call(this):this._queue.push(()=>chunkIPA5Q26W_cjs.f(this,i,p).call(this));}pause(){this._videoElement?this._videoElement.pause():this._queue.push(()=>this._videoElement?.pause());}render(){return chunk5NSCV6C2_cjs.c`
2
2
  ${this.embedController.render({complete:t=>{if(this._embed=t,!!t)return chunk5NSCV6C2_cjs.c`
3
3
  <video
4
4
  @click=${chunkIPA5Q26W_cjs.f(this,i,T)}
@@ -1,4 +1,4 @@
1
- import {b as b$1}from'./chunk-6AXROGQC.js';import {b}from'./chunk-XSYWRQWB.js';import {a as a$1}from'./chunk-3PLBZPRP.js';import {a}from'./chunk-HMISRRKC.js';import {h as h$1,c as c$1,f as f$2}from'./chunk-A4GZBQEB.js';import {c,e,f as f$1}from'./chunk-NDDFZTBA.js';var n,E,f,h,u=class extends a$1{constructor(){super(...arguments);e(this,n);this.order="newest";this.embedController=new b(this,0);}connectedCallback(){super.connectedCallback(),this.embedController.token=this.token;}requestUpdate(t,o){super.requestUpdate(t,o),t==="embed"&&(this.embedController.token=this.token);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}updated(){this.shadowRoot&&b$1(this.shadowRoot);}refresh(){return this.embedController.refresh()}containsEmbed(t){return this._collection?.videos?.some(o=>o.id===t)}getNextForEmbed(t){let o=f$1(this,n,E).call(this),e=o.findIndex(i=>i.id===t);if(e!==-1)return o[e+1]}render(){return c$1`
1
+ import {b as b$1}from'./chunk-FDSTNWZP.js';import {b}from'./chunk-DH5I55F5.js';import {a as a$1}from'./chunk-3PLBZPRP.js';import {a}from'./chunk-HMISRRKC.js';import {h as h$1,c as c$1,f as f$2}from'./chunk-A4GZBQEB.js';import {c,e,f as f$1}from'./chunk-NDDFZTBA.js';var n,E,f,h,u=class extends a$1{constructor(){super(...arguments);e(this,n);this.order="newest";this.embedController=new b(this,0);}connectedCallback(){super.connectedCallback(),this.embedController.token=this.token;}requestUpdate(t,o){super.requestUpdate(t,o),t==="embed"&&(this.embedController.token=this.token);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}updated(){this.shadowRoot&&b$1(this.shadowRoot);}refresh(){return this.embedController.refresh()}containsEmbed(t){return this._collection?.videos?.some(o=>o.id===t)}getNextForEmbed(t){let o=f$1(this,n,E).call(this),e=o.findIndex(i=>i.id===t);if(e!==-1)return o[e+1]}render(){return c$1`
2
2
  ${this.embedController.render({pending:this.renderPending,error:t=>c$1`<p>${t instanceof Error?t.message:f$2}</p>`,complete:t=>{if(this._collection=t,!t)return this.renderPending();if(t.error)return console.warn(t.error);let o=this._slottedChildren.map(e=>{function i(){let s;return e.nodeName==="TEMPLATE"?s=e.content.cloneNode(true):s=e.cloneNode(true),s}if(e.getAttribute("name")=="list-title"){let s=i();return s.textContent=this._collection?.name,c$1`${s}`}if(e.getAttribute("name")=="mave-list-root"&&this.embedController.embed){let s=i(),r=s.querySelector('[slot="root-link"]');return r&&(r.addEventListener("click",a=>{a.preventDefault(),this.emit(this.EVENT_TYPES.CLICK,{action:"back",embedId:""}),this.embedController.embed="";}),r.removeAttribute("slot")),c$1`${s}`}if(e.getAttribute("name")=="mave-list-folder"){let s=this._collection.collections?.map(r=>{let a=i(),l=a.querySelector('[slot="folder-link"]');return [e,l].forEach(d=>{d&&(d.addEventListener("click",p=>{p.preventDefault(),this.emit(this.EVENT_TYPES.CLICK,{action:"show_collection",collectionId:r.id}),this.embedController.embed=r.id;}),d.removeAttribute("slot"));}),f$1(this,n,h).call(this,a,'[slot="folder-title"]',r.name),typeof r.video_count=="number"&&f$1(this,n,h).call(this,a,'[slot="folder-count"]',r.video_count.toString()),c$1`${a}`});return c$1`${s}`}if(e.getAttribute("name")=="mave-list-item"||!["mave-list-folder","mave-list-item","mave-list-root","list-title"].includes(e.hasAttribute("name")?e.getAttribute("name"):"")&&e.nodeName=="TEMPLATE"){let s=f$1(this,n,E).call(this).map((r,a)=>{let l=i(),d=a+1;f$1(this,n,h).call(this,l,'[slot="item-title"]',r.name),f$1(this,n,h).call(this,l,'[slot="item-position"]',d.toString()),f$1(this,n,h).call(this,l,'[slot="item-duration"]',this.durationToTime(r.duration)),f$1(this,n,f).call(this,l,"mave-clip",r.id),f$1(this,n,f).call(this,l,"mave-player",r.id),f$1(this,n,f).call(this,l,"mave-img",r.id);let p=l.querySelector("mave-clip"),T=l.querySelector('[slot="item-title"]'),A=l.querySelector("mave-img");return [p,T,A,l].forEach(S=>{S?.addEventListener("click",$=>{this.emit(this.EVENT_TYPES.CLICK,{action:"show_embed",embedId:r.id,position:d});});}),c$1`${l}`});return c$1`${s}`}}).filter(e=>e);return c$1`${this._stylesheets} ${o}`}})}
3
3
  `}renderPending(){return c$1`<slot style="display: none"></slot>`}};n=new WeakSet,E=function(){if(!this._collection)return [];let t=this._collection.videos;return this.order=="newest"&&(t=this._collection.videos?.sort((o,e)=>e.created-o.created)),this.order=="oldest"&&(t=this._collection.videos?.sort((o,e)=>o.created-e.created)),this.order=="az"&&(t=this._collection.videos?.sort((o,e)=>o.name.localeCompare(e.name))),this.order=="za"&&(t=this._collection.videos?.sort((o,e)=>e.name.localeCompare(o.name))),t},f=function(t,o,e){let i=t.querySelector(o);i&&(i.setAttribute("embed",e),i.removeAttribute("slot"));},h=function(t,o,e){let i=t.querySelector(o);i&&(i.textContent=e,i.removeAttribute("slot"));},u.styles=h$1`
4
4
  :host {
@@ -1 +1 @@
1
- 'use strict';var chunkLG2O4WV2_cjs=require('./chunk-LG2O4WV2.cjs'),chunk5STN56TL_cjs=require('./chunk-5STN56TL.cjs');var p=class{constructor(e,d){this.host=e,this.embed=d,this.task=new chunkLG2O4WV2_cjs.a(this.host,async()=>{try{let o=this.embedFile("subtitle.json"),c=await fetch(o);if(c.status!==200)throw new Error;let u=await c.json(),l=u.segments.flatMap(t=>t.words).map(t=>({start:t.start,end:t.end,word:t.word.trim()})),r=[],n={start:0,end:0,text:"",words:[]};l.forEach(t=>{let{start:a,end:i,word:s}=t;n.start===0&&(n.start=a),n.end=i,n.words.push(t),n.text+=(n.text?" ":"")+s,/[.!?]$/.test(s)&&(r.push({...n}),n={start:0,end:0,text:"",words:[]});}),n.words.length>0&&r.push({...n});let h=[],f=1,w=5;if(r.length>0){let t={start:r[0].start,end:r[0].end,text:r[0].text,words:r[0].words},a=1;for(let i=1;i<r.length;i++){let s=r[i],b=r[i-1],S=s.start??0,k=b.end??0;S-k<=f&&a<w?(t.end=s.end,t.text+=" "+s.text,t.words=[...t.words,...s.words],a++):(h.push({...t}),t={start:s.start,end:s.end,text:s.text,words:s.words},a=1);}t.words.length>0&&h.push(t);}return {text:u.text,segments:h}}catch{throw console.warn(`Failed to fetch language file for "${this.embed}"`),new Error}},()=>[this.embed]);}set embed(e){this._embed!=e&&(this._embed=e,this.host.requestUpdate());}get embed(){return this._embed}set token(e){this._token!=e&&(this._token=e,this.host.requestUpdate());}get token(){return this._token}get spaceId(){return this.embed.substring(0,5)}get embedId(){return this.embed.substring(5,this.embed.length)}get version(){return this._version?`/v${this._version}/`:"/"}set version(e){this._version!=e&&(this._version=e,this.host.requestUpdate());}get cdnRoot(){return chunk5STN56TL_cjs.a.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}embedFile(e,d=new URLSearchParams){let o=new URL(`${this.cdnRoot}/${this.embedId}${e=="manifest"?"/":this.version}${e}`);return this.token&&d.append("token",this.token),o.search=d.toString(),o.toString()}render(e){return this.task?.render(e)}};exports.a=p;
1
+ 'use strict';var chunkLG2O4WV2_cjs=require('./chunk-LG2O4WV2.cjs'),chunk5STN56TL_cjs=require('./chunk-5STN56TL.cjs');var p=class{constructor(e,d){this.host=e,this.embed=d,this.task=new chunkLG2O4WV2_cjs.a(this.host,async()=>{try{let i=this.embedFile("subtitle.json"),c=await fetch(i);if(c.status!==200)throw new Error;let u=await c.json(),f=u.segments.flatMap(t=>t.words).map(t=>({start:t.start,end:t.end,word:t.word.trim()})),r=[],n={start:0,end:0,text:"",words:[]};f.forEach(t=>{let{start:a,end:o,word:s}=t;n.start===0&&(n.start=a),n.end=o,n.words.push(t),n.text+=(n.text?" ":"")+s,/[.!?]$/.test(s)&&(r.push({...n}),n={start:0,end:0,text:"",words:[]});}),n.words.length>0&&r.push({...n});let h=[],l=1,w=5;if(r.length>0){let t={start:r[0].start,end:r[0].end,text:r[0].text,words:r[0].words},a=1;for(let o=1;o<r.length;o++){let s=r[o],b=r[o-1],S=s.start??0,k=b.end??0;S-k<=l&&a<w?(t.end=s.end,t.text+=" "+s.text,t.words=[...t.words,...s.words],a++):(h.push({...t}),t={start:s.start,end:s.end,text:s.text,words:s.words},a=1);}t.words.length>0&&h.push(t);}return {text:u.text,segments:h}}catch{throw console.warn(`Failed to fetch language file for "${this.embed}"`),new Error}},()=>[this.embed]);}set embed(e){this._embed!=e&&(this._embed=e,this.host.requestUpdate());}get embed(){return this._embed}set token(e){this._token!=e&&(this._token=e,this.host.requestUpdate());}get token(){return this._token}get spaceId(){return this.embed.substring(0,5)}get embedId(){return this.embed.substring(5,this.embed.length)}get version(){return this._version?`/v${this._version}/`:"/"}set version(e){this._version!=e&&(this._version=e,this.host.requestUpdate());}get cdnRoot(){return chunk5STN56TL_cjs.a.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}embedFile(e,d=new URLSearchParams){let i=new URL(`${this.cdnRoot}/${this.embedId}${e=="manifest.json"?"/":this.version}${e}`);return this.token&&d.append("token",this.token),i.search=d.toString(),i.toString()}render(e){return this.task?.render(e)}};exports.a=p;
@@ -1,6 +1,6 @@
1
1
  import {a as a$2,d,b as b$2}from'./chunk-5OEIKFAN.js';import {a as a$3}from'./chunk-ZXCHPIGV.js';import {a as a$5}from'./chunk-MS5NFI3Q.js';import {a as a$1,b as b$1}from'./chunk-HMISRRKC.js';import {h,i,c as c$1}from'./chunk-A4GZBQEB.js';import {a as a$4}from'./chunk-JBV2AYRP.js';import {a,b,c}from'./chunk-NDDFZTBA.js';var Pt=a((ro,Et)=>{Et.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 Rt=a(Te=>{var Wr=Object.prototype.hasOwnProperty,Xr;function Ot(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function kt(e){try{return encodeURIComponent(e)}catch{return null}}function Yr(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var o=Ot(n[1]),s=Ot(n[2]);o===null||s===null||o in r||(r[o]=s);}return r}function Zr(e,t){t=t||"";var r=[],n,o;typeof t!="string"&&(t="?");for(o in e)if(Wr.call(e,o)){if(n=e[o],!n&&(n===null||n===Xr||isNaN(n))&&(n=""),o=kt(o),n=kt(n),o===null||n===null)continue;r.push(o+"="+n);}return r.length?t+r.join("&"):""}Te.stringify=Zr;Te.parse=Yr;});var It=a((oo,Ft)=>{var Ct=Pt(),ge=Rt(),Vr=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Lt=/[\n\r\t]/g,Jr=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Tt=/:\d+$/,Qr=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,en=/^[a-zA-Z]:/;function De(e){return (e||"").toString().replace(Vr,"")}var Ae=[["#","hash"],["?","query"],function(t,r){return A(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]],jt={hash:1,query:1};function At(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 jt)delete n[s];}else if(o==="object"){for(s in e)s in jt||(n[s]=e[s]);n.slashes===void 0&&(n.slashes=Jr.test(e.href));}return n}function A(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function Dt(e,t){e=De(e),e=e.replace(Lt,""),t=t||{};var r=Qr.exec(e),n=r[1]?r[1].toLowerCase():"",o=!!r[2],s=!!r[3],l=0,p;return o?s?(p=r[2]+r[3]+r[4],l=r[2].length+r[3].length):(p=r[2]+r[4],l=r[2].length):s?(p=r[3]+r[4],l=r[3].length):p=r[4],n==="file:"?l>=2&&(p=p.slice(2)):A(n)?p=r[4]:n?o&&(p=p.slice(2)):l>=2&&A(t.protocol)&&(p=r[4]),{protocol:n,slashes:o||A(n),slashesCount:l,rest:p}}function tn(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,l=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),l++):l&&(n===0&&(s=true),r.splice(n,1),l--);return s&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function D(e,t,r){if(e=De(e),e=e.replace(Lt,""),!(this instanceof D))return new D(e,t,r);var n,o,s,l,p,h,m=Ae.slice(),g=typeof t,y=this,j=0;for(g!=="object"&&g!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=ge.parse),t=At(t),o=Dt(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||en.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!A(y.protocol)))&&(m[3]=[/(.*)/,"pathname"]);j<m.length;j++){if(l=m[j],typeof l=="function"){e=l(e,y);continue}s=l[0],h=l[1],s!==s?y[h]=e:typeof s=="string"?(p=s==="@"?e.lastIndexOf(s):e.indexOf(s),~p&&(typeof l[2]=="number"?(y[h]=e.slice(0,p),e=e.slice(p+l[2])):(y[h]=e.slice(p),e=e.slice(0,p)))):(p=s.exec(e))&&(y[h]=p[1],e=e.slice(0,p.index)),y[h]=y[h]||n&&l[3]&&t[h]||"",l[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=tn(y.pathname,t.pathname)),y.pathname.charAt(0)!=="/"&&A(y.protocol)&&(y.pathname="/"+y.pathname),Ct(y.port,y.protocol)||(y.host=y.hostname,y.port=""),y.username=y.password="",y.auth&&(p=y.auth.indexOf(":"),~p?(y.username=y.auth.slice(0,p),y.username=encodeURIComponent(decodeURIComponent(y.username)),y.password=y.auth.slice(p+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:"&&A(y.protocol)&&y.host?y.protocol+"//"+y.host:"null",y.href=y.toString();}function rn(e,t,r){var n=this;switch(e){case "query":typeof t=="string"&&t.length&&(t=(r||ge.parse)(t)),n[e]=t;break;case "port":n[e]=t,Ct(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 l=0;l<Ae.length;l++){var p=Ae[l];p[4]&&(n[p[1]]=n[p[1]].toLowerCase());}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&A(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function nn(e){(!e||typeof e!="function")&&(e=ge.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||A(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):r.protocol!=="file:"&&A(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:rn,toString:nn};D.extractProtocol=Dt;D.location=At;D.trimLeft=De;D.qs=ge;Ft.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 br(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 Sr(e,t,r){return t=ue(t),Ur(e,ke()?Reflect.construct(t,r||[],ue(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 Er(e)}function Er(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pr(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&&se(e,t);}function Oe(e){var t=typeof Map=="function"?new Map:void 0;return Oe=function(n){if(n===null||!kr(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 Or(n,arguments,ue(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:false,writable:true,configurable:true}}),se(o,n)},Oe(e)}function Or(e,t,r){if(ke())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var o=new(e.bind.apply(e,n));return r&&se(o,r.prototype),o}function ke(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (ke=function(){return !!e})()}function kr(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function se(e,t){return se=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},se(e,t)}function ue(e){return ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ue(e)}var Rr=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,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(xr(this,t),n=Sr(this,t,[r]),n.originalRequest=s,n.originalResponse=l,n.causingError=o,o!=null&&(r+=", caused by ".concat(o.toString())),s!=null){var p=s.getHeader("X-Request-ID")||"n/a",h=s.getMethod(),m=s.getURL(),g=l?l.getStatus():"n/a",y=l?l.getBody()||"":"n/a";r+=", originated from request (method: ".concat(h,", url: ").concat(m,", response code: ").concat(g,", response text: ").concat(y,", request id: ").concat(p,")");}return n.message=r,n}return Pr(t,e),br(t)}(Oe(Error)),V=Rr;function z(e){}function le(e){"@babel/helpers - typeof";return le=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},le(e)}function Cr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ot(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 Lr(e,t,r){return t&&ot(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Tr(e){var t=Ar(e,"string");return le(t)=="symbol"?t:t+""}function Ar(e,t){if(le(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(le(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var it=function(){function e(){Cr(this,e);}return Lr(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 ct="3.7.5",Dr=ct,Fr=typeof atob=="function",Ir=typeof btoa=="function",Q=typeof Buffer=="function",at=typeof TextDecoder=="function"?new TextDecoder:void 0,st=typeof TextEncoder=="function"?new TextEncoder:void 0,Nr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",fe=Array.prototype.slice.call(Nr),me=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(fe),Br=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,U=String.fromCharCode.bind(String),ut=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),pt=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),ht=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),dt=e=>{let t,r,n,o,s="",l=e.length%3;for(let p=0;p<e.length;){if((r=e.charCodeAt(p++))>255||(n=e.charCodeAt(p++))>255||(o=e.charCodeAt(p++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|o,s+=fe[t>>18&63]+fe[t>>12&63]+fe[t>>6&63]+fe[t&63];}return l?s.slice(0,l-3)+"===".substring(l):s},Ce=Ir?e=>btoa(e):Q?e=>Buffer.from(e,"binary").toString("base64"):dt,Re=Q?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,o=e.length;n<o;n+=4096)r.push(U.apply(null,e.subarray(n,n+4096)));return Ce(r.join(""))},ve=(e,t=false)=>t?pt(Re(e)):Re(e),zr=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?U(192|t>>>6)+U(128|t&63):U(224|t>>>12&15)+U(128|t>>>6&63)+U(128|t&63)}else {var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return U(240|t>>>18&7)+U(128|t>>>12&63)+U(128|t>>>6&63)+U(128|t&63)}},Hr=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,yt=e=>e.replace(Hr,zr),lt=Q?e=>Buffer.from(e,"utf8").toString("base64"):st?e=>Re(st.encode(e)):e=>Ce(yt(e)),J=(e,t=false)=>t?pt(lt(e)):lt(e),ft=e=>J(e,true),qr=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Mr=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 U((r>>>10)+55296)+U((r&1023)+56320);case 3:return U((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return U((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},mt=e=>e.replace(qr,Mr),vt=e=>{if(e=e.replace(/\s+/g,""),!Br.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=me[e.charAt(s++)]<<18|me[e.charAt(s++)]<<12|(n=me[e.charAt(s++)])<<6|(o=me[e.charAt(s++)]),r+=n===64?U(t>>16&255):o===64?U(t>>16&255,t>>8&255):U(t>>16&255,t>>8&255,t&255);return r},Le=Fr?e=>atob(ht(e)):Q?e=>Buffer.from(e,"base64").toString("binary"):vt,gt=Q?e=>ut(Buffer.from(e,"base64")):e=>ut(Le(e).split("").map(t=>t.charCodeAt(0))),bt=e=>gt(_t(e)),Gr=Q?e=>Buffer.from(e,"base64").toString("utf8"):at?e=>at.decode(gt(e)):e=>mt(Le(e)),_t=e=>ht(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),je=e=>Gr(_t(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)},wt=e=>({value:e,enumerable:false,writable:true,configurable:true}),xt=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,wt(r));e("fromBase64",function(){return je(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 bt(this)});},St=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,wt(r));e("toBase64",function(t){return ve(this,t)}),e("toBase64URI",function(){return ve(this,true)}),e("toBase64URL",function(){return ve(this,true)});},$r=()=>{xt(),St();},Ut={version:ct,VERSION:Dr,atob:Le,atobPolyfill:vt,btoa:Ce,btoaPolyfill:dt,fromBase64:je,toBase64:J,encode:J,encodeURI:ft,encodeURL:ft,utob:yt,btou:mt,decode:je,isValid:Kr,fromUint8Array:ve,toUint8Array:bt,extendString:xt,extendUint8Array:St,extendBuiltins:$r};var Zt=b(It());function Fe(){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 Ie(){Ie=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(u,i,a){u[i]=a.value;},s=typeof Symbol=="function"?Symbol:{},l=s.iterator||"@@iterator",p=s.asyncIterator||"@@asyncIterator",h=s.toStringTag||"@@toStringTag";function m(u,i,a){return Object.defineProperty(u,i,{value:a,enumerable:true,configurable:true,writable:true}),u[i]}try{m({},"");}catch{m=function(a,f,d){return a[f]=d};}function g(u,i,a,f){var d=i&&i.prototype instanceof F?i:F,c=Object.create(d.prototype),v=new G(f||[]);return o(c,"_invoke",{value:Ue(u,a,v)}),c}function y(u,i,a){try{return {type:"normal",arg:u.call(i,a)}}catch(f){return {type:"throw",arg:f}}}t.wrap=g;var j="suspendedStart",oe="suspendedYield",H="executing",L="completed",w={};function F(){}function k(){}function x(){}var C={};m(C,l,function(){return this});var q=Object.getPrototypeOf,I=q&&q(q(K([])));I&&I!==r&&n.call(I,l)&&(C=I);var R=x.prototype=F.prototype=Object.create(C);function ie(u){["next","throw","return"].forEach(function(i){m(u,i,function(a){return this._invoke(i,a)});});}function N(u,i){function a(d,c,v,b){var _=y(u[d],u,c);if(_.type!=="throw"){var E=_.arg,S=E.value;return S&&X(S)=="object"&&n.call(S,"__await")?i.resolve(S.__await).then(function(P){a("next",P,v,b);},function(P){a("throw",P,v,b);}):i.resolve(S).then(function(P){E.value=P,v(E);},function(P){return a("throw",P,v,b)})}b(_.arg);}var f;o(this,"_invoke",{value:function(c,v){function b(){return new i(function(_,E){a(c,v,_,E);})}return f=f?f.then(b,b):b()}});}function Ue(u,i,a){var f=j;return function(d,c){if(f===H)throw Error("Generator is already running");if(f===L){if(d==="throw")throw c;return {value:e,done:true}}for(a.method=d,a.arg=c;;){var v=a.delegate;if(v){var b=ae(v,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===j)throw f=L,a.arg;a.dispatchException(a.arg);}else a.method==="return"&&a.abrupt("return",a.arg);f=H;var _=y(u,i,a);if(_.type==="normal"){if(f=a.done?L:oe,_.arg===w)continue;return {value:_.arg,done:a.done}}_.type==="throw"&&(f=L,a.method="throw",a.arg=_.arg);}}}function ae(u,i){var a=i.method,f=u.iterator[a];if(f===e)return i.delegate=null,a==="throw"&&u.iterator.return&&(i.method="return",i.arg=e,ae(u,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,u.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,w;var c=d.arg;return c?c.done?(i[u.resultName]=c.value,i.next=u.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,w):c:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,w)}function Ee(u){var i={tryLoc:u[0]};1 in u&&(i.catchLoc=u[1]),2 in u&&(i.finallyLoc=u[2],i.afterLoc=u[3]),this.tryEntries.push(i);}function M(u){var i=u.completion||{};i.type="normal",delete i.arg,u.completion=i;}function G(u){this.tryEntries=[{tryLoc:"root"}],u.forEach(Ee,this),this.reset(true);}function K(u){if(u||u===""){var i=u[l];if(i)return i.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length)){var a=-1,f=function d(){for(;++a<u.length;)if(n.call(u,a))return d.value=u[a],d.done=false,d;return d.value=e,d.done=true,d};return f.next=f}}throw new TypeError(X(u)+" is not iterable")}return k.prototype=x,o(R,"constructor",{value:x,configurable:true}),o(x,"constructor",{value:k,configurable:true}),k.displayName=m(x,h,"GeneratorFunction"),t.isGeneratorFunction=function(u){var i=typeof u=="function"&&u.constructor;return !!i&&(i===k||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(u){return Object.setPrototypeOf?Object.setPrototypeOf(u,x):(u.__proto__=x,m(u,h,"GeneratorFunction")),u.prototype=Object.create(R),u},t.awrap=function(u){return {__await:u}},ie(N.prototype),m(N.prototype,p,function(){return this}),t.AsyncIterator=N,t.async=function(u,i,a,f,d){d===void 0&&(d=Promise);var c=new N(g(u,i,a,f),d);return t.isGeneratorFunction(i)?c:c.next().then(function(v){return v.done?v.value:c.next()})},ie(R),m(R,h,"Generator"),m(R,l,function(){return this}),m(R,"toString",function(){return "[object Generator]"}),t.keys=function(u){var i=Object(u),a=[];for(var f in i)a.push(f);return a.reverse(),function d(){for(;a.length;){var c=a.pop();if(c in i)return d.value=c,d.done=false,d}return d.done=true,d}},t.values=K,G.prototype={constructor:G,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(M),!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(E,S){return v.type="throw",v.arg=i,a.next=E,S&&(a.method="next",a.arg=e),!!S}for(var d=this.tryEntries.length-1;d>=0;--d){var c=this.tryEntries[d],v=c.completion;if(c.tryLoc==="root")return f("end");if(c.tryLoc<=this.prev){var b=n.call(c,"catchLoc"),_=n.call(c,"finallyLoc");if(b&&_){if(this.prev<c.catchLoc)return f(c.catchLoc,true);if(this.prev<c.finallyLoc)return f(c.finallyLoc)}else if(b){if(this.prev<c.catchLoc)return f(c.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return f(c.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 c=d;break}}c&&(i==="break"||i==="continue")&&c.tryLoc<=a&&a<=c.finallyLoc&&(c=null);var v=c?c.completion:{};return v.type=i,v.arg=a,c?(this.method="next",this.next=c.finallyLoc,w):this.complete(v)},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),M(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 c=d.arg;M(f);}return c}}throw Error("illegal catch attempt")},delegateYield:function(i,a,f){return this.delegate={iterator:K(i),resultName:a,nextLoc:f},this.method==="next"&&(this.arg=e),w}},t}function Nt(e,t,r,n,o,s,l){try{var p=e[s](l),h=p.value;}catch(m){r(m);return}p.done?t(h):Promise.resolve(h).then(n,o);}function on(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var s=e.apply(t,r);function l(h){Nt(s,n,o,l,p,"next",h);}function p(h){Nt(s,n,o,l,p,"throw",h);}l(void 0);})}}function Wt(e,t){return un(e)||sn(e,t)||Xt(e,t)||an()}function an(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sn(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,s,l,p=[],h=true,m=false;try{if(s=(r=r.call(e)).next,t===0);else for(;!(h=(n=s.call(r)).done)&&(p.push(n.value),p.length!==t);h=!0);}catch(g){m=true,o=g;}finally{try{if(!h&&r.return!=null&&(l=r.return(),Object(l)!==l))return}finally{if(m)throw o}}return p}}function un(e){if(Array.isArray(e))return e}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 ln(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Xt(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,l=false,p;return {s:function(){r=r.call(e);},n:function(){var m=r.next();return s=m.done,m},e:function(m){l=true,p=m;},f:function(){try{!s&&r.return!=null&&r.return();}finally{if(l)throw p}}}}function Xt(e,t){if(e){if(typeof e=="string")return Bt(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 Bt(e,t)}}function Bt(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 zt(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?zt(Object(r),true).forEach(function(n){fn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function fn(e,t,r){return t=Yt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function cn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ht(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,Yt(n.key),n);}}function pn(e,t,r){return t&&Ht(e.prototype,t),r&&Ht(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Yt(e){var t=hn(e,"string");return X(t)=="symbol"?t:t+""}function hn(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 Ne="tus-v1",be="ietf-draft-03",dn={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:Jt,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:Ne},Vt=function(){function e(t,r){cn(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 pn(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(![Ne,be].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,l=["uploadUrl","uploadSize","uploadLengthDeferred"];s<l.length;s++){var p=l[s];if(this.options[p]){this._emitError(new Error("tus: cannot use the ".concat(p," 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 l=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,p=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:mn(this._source.size,l);this._parallelUploadUrls&&p.forEach(function(g,y){g.uploadUrl=n._parallelUploadUrls[y]||null;}),this._parallelUploadUrls=new Array(p.length);var h=p.map(function(g,y){var j=0;return n._source.slice(g.start,g.end).then(function(oe){var H=oe.value;return new Promise(function(L,w){var F=ee(ee({},n.options),{},{uploadUrl:g.uploadUrl||null,storeFingerprintForResuming:false,removeFingerprintOnSuccess:false,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:ee(ee({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:L,onError:w,onProgress:function(C){s=s-j+C,j=C,n._emitProgress(s,o);},onUploadUrlAvailable:function(){n._parallelUploadUrls[y]=k.url,n._parallelUploadUrls.filter(function(C){return !!C}).length===p.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 g=qt(n.options.metadata);return g!==""&&m.setHeader("Upload-Metadata",g),n._sendRequest(m,null)}).then(function(g){if(!te(g.getStatus(),200)){n._emitHttpError(m,g,"tus: unexpected response while creating upload");return}var y=g.getHeader("Location");if(y==null){n._emitHttpError(m,g,"tus: invalid or missing Location header");return}n.url=$t(n.options.endpoint,y),z("Created upload at ".concat(n.url)),n._emitSuccess(g);}).catch(function(g){n._emitError(g);});}},{key:"_startSingleUpload",value:function(){if(this._aborted=false,this.url!=null){z("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){z("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=ln(this._parallelUploads),s;try{for(o.s();!(s=o.n()).done;){var l=s.value;l.abort(r);}}catch(p){o.e(p);}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=qt(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===be&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(l){if(!te(l.getStatus(),200)){r._emitHttpError(n,l,"tus: unexpected response while creating upload");return}var p=l.getHeader("Location");if(p==null){r._emitHttpError(n,l,"tus: invalid or missing Location header");return}if(r.url=$t(r.options.endpoint,p),z("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(l),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,l):(r._offset=0,r._performUpload());});}).catch(function(l){r._emitHttpError(n,null,"tus: failed to create upload",l);});}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(s){var l=s.getStatus();if(!te(l,200)){if(l===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(te(l,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 p=Number.parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(p)){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===Ne){r._emitHttpError(n,s,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(p===h){r._emitProgress(h,h),r._emitSuccess(s);return}r._offset=p,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(l){n._emitProgress(o+l,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(l){var p=l.value,h=l.done,m=p!=null&&p.size?p.size:0;n.options.uploadLengthDeferred&&h&&(n._size=n._offset+m,r.setHeader("Upload-Length","".concat(n._size)));var g=n._offset+m;return !n.options.uploadLengthDeferred&&h&&g!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(g," bytes"))):p===null?n._sendRequest(r):(n.options.protocol===be&&r.setHeader("Upload-Complete",h?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,p))})}},{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=Mt(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 Gt(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=Mt("DELETE",r,n);return Gt(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 l=n.retryDelays[0],p=n.retryDelays.slice(1),h=ee(ee({},n),{},{retryDelays:p});return new Promise(function(m){return setTimeout(m,l)}).then(function(){return e.terminate(r,h)})})}}])}();function qt(e){return Object.entries(e).map(function(t){var r=Wt(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 Mt(e,t,r){var n=r.httpStack.createRequest(e,t);r.protocol===be?n.setHeader("Upload-Draft-Interop-Version","5"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},s=0,l=Object.entries(o);s<l.length;s++){var p=Wt(l[s],2),h=p[0],m=p[1];n.setHeader(h,m);}if(r.addRequestId){var g=Fe();n.setHeader("X-Request-ID",g);}return n}function Gt(e,t,r){return Be.apply(this,arguments)}function Be(){return Be=on(Ie().mark(function e(t,r,n){var o;return Ie().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(typeof n.onBeforeRequest!="function"){l.next=3;break}return l.next=3,n.onBeforeRequest(t);case 3:return l.next=5,t.send(r);case 5:if(o=l.sent,typeof n.onAfterResponse!="function"){l.next=9;break}return l.next=9,n.onAfterResponse(t,o);case 9:return l.abrupt("return",o);case 10:case "end":return l.stop()}},e)})),Be.apply(this,arguments)}function yn(){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):Jt(e)}function Jt(e){var t=e.originalResponse?e.originalResponse.getStatus():0;return (!te(t,400)||t===409||t===423)&&yn()}function $t(e,t){return new Zt.default(t,e).toString()}function mn(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}Vt.defaultOptions=dn;var _e=Vt;var vn=function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"},we=vn;function ze(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 gn=function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")},Qt=gn;function He(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 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 bn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function er(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,wn(n.key),n);}}function _n(e,t,r){return t&&er(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function wn(e){var t=xn(e,"string");return ce(t)=="symbol"?t:t+""}function xn(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 qe=function(){function e(t){bn(this,e),this._file=t,this.size=t.size;}return _n(e,[{key:"slice",value:function(r,n){if(Qt())return He(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 pe(e){"@babel/helpers - typeof";return pe=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},pe(e)}function Sn(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,En(n.key),n);}}function Un(e,t,r){return t&&tr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function En(e){var t=Pn(e,"string");return pe(t)=="symbol"?t:t+""}function Pn(e,t){if(pe(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(pe(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}function rr(e){return e===void 0?0:e.size!==void 0?e.size:e.length}function On(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 nr=function(){function e(t){Sn(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+rr(this._buffer);if(this._done||s){var l=this._getDataFromBuffer(r,n),p=l==null?this._done:false;return Promise.resolve({value:l,done:p})}return this._reader.read().then(function(h){var m=h.value,g=h.done;return g?o._done=true:o._buffer===void 0?o._buffer=m:o._buffer=On(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=rr(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 Y(e){"@babel/helpers - typeof";return Y=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},Y(e)}function Me(){Me=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(u,i,a){u[i]=a.value;},s=typeof Symbol=="function"?Symbol:{},l=s.iterator||"@@iterator",p=s.asyncIterator||"@@asyncIterator",h=s.toStringTag||"@@toStringTag";function m(u,i,a){return Object.defineProperty(u,i,{value:a,enumerable:true,configurable:true,writable:true}),u[i]}try{m({},"");}catch{m=function(a,f,d){return a[f]=d};}function g(u,i,a,f){var d=i&&i.prototype instanceof F?i:F,c=Object.create(d.prototype),v=new G(f||[]);return o(c,"_invoke",{value:Ue(u,a,v)}),c}function y(u,i,a){try{return {type:"normal",arg:u.call(i,a)}}catch(f){return {type:"throw",arg:f}}}t.wrap=g;var j="suspendedStart",oe="suspendedYield",H="executing",L="completed",w={};function F(){}function k(){}function x(){}var C={};m(C,l,function(){return this});var q=Object.getPrototypeOf,I=q&&q(q(K([])));I&&I!==r&&n.call(I,l)&&(C=I);var R=x.prototype=F.prototype=Object.create(C);function ie(u){["next","throw","return"].forEach(function(i){m(u,i,function(a){return this._invoke(i,a)});});}function N(u,i){function a(d,c,v,b){var _=y(u[d],u,c);if(_.type!=="throw"){var E=_.arg,S=E.value;return S&&Y(S)=="object"&&n.call(S,"__await")?i.resolve(S.__await).then(function(P){a("next",P,v,b);},function(P){a("throw",P,v,b);}):i.resolve(S).then(function(P){E.value=P,v(E);},function(P){return a("throw",P,v,b)})}b(_.arg);}var f;o(this,"_invoke",{value:function(c,v){function b(){return new i(function(_,E){a(c,v,_,E);})}return f=f?f.then(b,b):b()}});}function Ue(u,i,a){var f=j;return function(d,c){if(f===H)throw Error("Generator is already running");if(f===L){if(d==="throw")throw c;return {value:e,done:true}}for(a.method=d,a.arg=c;;){var v=a.delegate;if(v){var b=ae(v,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===j)throw f=L,a.arg;a.dispatchException(a.arg);}else a.method==="return"&&a.abrupt("return",a.arg);f=H;var _=y(u,i,a);if(_.type==="normal"){if(f=a.done?L:oe,_.arg===w)continue;return {value:_.arg,done:a.done}}_.type==="throw"&&(f=L,a.method="throw",a.arg=_.arg);}}}function ae(u,i){var a=i.method,f=u.iterator[a];if(f===e)return i.delegate=null,a==="throw"&&u.iterator.return&&(i.method="return",i.arg=e,ae(u,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,u.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,w;var c=d.arg;return c?c.done?(i[u.resultName]=c.value,i.next=u.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,w):c:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,w)}function Ee(u){var i={tryLoc:u[0]};1 in u&&(i.catchLoc=u[1]),2 in u&&(i.finallyLoc=u[2],i.afterLoc=u[3]),this.tryEntries.push(i);}function M(u){var i=u.completion||{};i.type="normal",delete i.arg,u.completion=i;}function G(u){this.tryEntries=[{tryLoc:"root"}],u.forEach(Ee,this),this.reset(true);}function K(u){if(u||u===""){var i=u[l];if(i)return i.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length)){var a=-1,f=function d(){for(;++a<u.length;)if(n.call(u,a))return d.value=u[a],d.done=false,d;return d.value=e,d.done=true,d};return f.next=f}}throw new TypeError(Y(u)+" is not iterable")}return k.prototype=x,o(R,"constructor",{value:x,configurable:true}),o(x,"constructor",{value:k,configurable:true}),k.displayName=m(x,h,"GeneratorFunction"),t.isGeneratorFunction=function(u){var i=typeof u=="function"&&u.constructor;return !!i&&(i===k||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(u){return Object.setPrototypeOf?Object.setPrototypeOf(u,x):(u.__proto__=x,m(u,h,"GeneratorFunction")),u.prototype=Object.create(R),u},t.awrap=function(u){return {__await:u}},ie(N.prototype),m(N.prototype,p,function(){return this}),t.AsyncIterator=N,t.async=function(u,i,a,f,d){d===void 0&&(d=Promise);var c=new N(g(u,i,a,f),d);return t.isGeneratorFunction(i)?c:c.next().then(function(v){return v.done?v.value:c.next()})},ie(R),m(R,h,"Generator"),m(R,l,function(){return this}),m(R,"toString",function(){return "[object Generator]"}),t.keys=function(u){var i=Object(u),a=[];for(var f in i)a.push(f);return a.reverse(),function d(){for(;a.length;){var c=a.pop();if(c in i)return d.value=c,d.done=false,d}return d.done=true,d}},t.values=K,G.prototype={constructor:G,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(M),!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(E,S){return v.type="throw",v.arg=i,a.next=E,S&&(a.method="next",a.arg=e),!!S}for(var d=this.tryEntries.length-1;d>=0;--d){var c=this.tryEntries[d],v=c.completion;if(c.tryLoc==="root")return f("end");if(c.tryLoc<=this.prev){var b=n.call(c,"catchLoc"),_=n.call(c,"finallyLoc");if(b&&_){if(this.prev<c.catchLoc)return f(c.catchLoc,true);if(this.prev<c.finallyLoc)return f(c.finallyLoc)}else if(b){if(this.prev<c.catchLoc)return f(c.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return f(c.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 c=d;break}}c&&(i==="break"||i==="continue")&&c.tryLoc<=a&&a<=c.finallyLoc&&(c=null);var v=c?c.completion:{};return v.type=i,v.arg=a,c?(this.method="next",this.next=c.finallyLoc,w):this.complete(v)},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),M(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 c=d.arg;M(f);}return c}}throw Error("illegal catch attempt")},delegateYield:function(i,a,f){return this.delegate={iterator:K(i),resultName:a,nextLoc:f},this.method==="next"&&(this.arg=e),w}},t}function or(e,t,r,n,o,s,l){try{var p=e[s](l),h=p.value;}catch(m){r(m);return}p.done?t(h):Promise.resolve(h).then(n,o);}function kn(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var s=e.apply(t,r);function l(h){or(s,n,o,l,p,"next",h);}function p(h){or(s,n,o,l,p,"throw",h);}l(void 0);})}}function Rn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ir(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,Cn(n.key),n);}}function jn(e,t,r){return t&&ir(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Cn(e){var t=Ln(e,"string");return Y(t)=="symbol"?t:t+""}function Ln(e,t){if(Y(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Y(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var ar=function(){function e(){Rn(this,e);}return jn(e,[{key:"openFile",value:function(){var t=kn(Me().mark(function n(o,s){var l;return Me().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(we()&&o&&typeof o.uri<"u")){h.next=11;break}return h.prev=1,h.next=4,ze(o.uri);case 4:return l=h.sent,h.abrupt("return",new qe(l));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 qe(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 nr(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 Ge(e,t){return we()?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?An(JSON.stringify(e.exif)):"noexif";return ["tus-rn",e.name||"noname",e.size||"nosize",r,t.endpoint].join("/")}function An(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 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 Ke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sr(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,Dn(n.key),n);}}function $e(e,t,r){return t&&sr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Dn(e){var t=Fn(e,"string");return he(t)=="symbol"?t:t+""}function Fn(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 ur=function(){function e(){Ke(this,e);}return $e(e,[{key:"createRequest",value:function(r,n){return new In(r,n)}},{key:"getName",value:function(){return "XHRHttpStack"}}])}();var In=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 $e(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 Nn(r._xhr));},r._xhr.onerror=function(l){s(l);},r._xhr.send(n);})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}(),Nn=function(){function e(t){Ke(this,e),this._xhr=t;}return $e(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 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 Bn(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,Hn(n.key),n);}}function zn(e,t,r){return t&&lr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Hn(e){var t=qn(e,"string");return de(t)=="symbol"?t:t+""}function qn(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)}var Xe=false;try{Xe="localStorage"in window,xe="tusSupport",We=localStorage.getItem(xe),localStorage.setItem(xe,We),We===null&&localStorage.removeItem(xe);}catch(e){if(e.code===e.SECURITY_ERR||e.code===e.QUOTA_EXCEEDED_ERR)Xe=false;else throw e}var xe,We,fr=Xe,cr=function(){function e(){Bn(this,e);}return zn(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 l=JSON.parse(localStorage.getItem(s));l.urlStorageKey=s,n.push(l);}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 Mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pr(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,mr(n.key),n);}}function Gn(e,t,r){return r&&pr(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Kn(e,t,r){return t=Se(t),$n(e,yr()?Reflect.construct(t,r||[],Se(e).constructor):t.apply(e,r))}function $n(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 Wn(e)}function Wn(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (yr=function(){return !!e})()}function Se(e){return Se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Se(e)}function Xn(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&&Ye(e,t);}function Ye(e,t){return Ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ye(e,t)}function hr(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?hr(Object(r),true).forEach(function(n){Yn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function Yn(e,t,r){return t=mr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function mr(e){var t=Zn(e,"string");return ne(t)=="symbol"?t:t+""}function Zn(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 dr=re(re({},_e.defaultOptions),{},{httpStack:new ur,fileReader:new ar,urlStorage:fr?new cr:new it,fingerprint:Ge}),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 Mn(this,t),n=re(re({},dr),n),Kn(this,t,[r,n])}return Xn(t,e),Gn(t,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=re(re({},dr),o),_e.terminate(n,o)}}])}(_e);var O=class extends i{constructor(){super(...arguments);this.disableCompletion=false;this._completed=false;this.languageController=new d(this);}connectedCallback(){super.connectedCallback(),window.customElements.get("lottie-player")||import('./lottie-player.esm-BBAKIFYQ.js'),this.languageController.locale=this.locale||"en",this.embedChannel=a$3.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(){super.disconnectedCallback();}handleDrop(r){if(r.preventDefault(),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){let n=new vr(r,{endpoint:a$4.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);},onProgress:(o,s)=>{let l=Math.round(o/s*100);l>this._progress&&(this._progress=l);},onSuccess:()=>{this._progress=100;},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(){return c$1` ${this._progress?this.renderProgress():this.renderUpload()} `}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"}}renderUpload(){return c$1`<form
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=true,l=false,p;return {s:function(){r=r.call(e);},n:function(){var m=r.next();return s=m.done,m},e:function(m){l=true,p=m;},f:function(){try{!s&&r.return!=null&&r.return();}finally{if(l)throw p}}}}function Xt(e,t){if(e){if(typeof e=="string")return Bt(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 Bt(e,t)}}function Bt(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 zt(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?zt(Object(r),true).forEach(function(n){fn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function fn(e,t,r){return t=Yt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function cn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ht(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,Yt(n.key),n);}}function pn(e,t,r){return t&&Ht(e.prototype,t),r&&Ht(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Yt(e){var t=hn(e,"string");return X(t)=="symbol"?t:t+""}function hn(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 Ne="tus-v1",be="ietf-draft-03",dn={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:Jt,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:Ne},Vt=function(){function e(t,r){cn(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 pn(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(![Ne,be].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,l=["uploadUrl","uploadSize","uploadLengthDeferred"];s<l.length;s++){var p=l[s];if(this.options[p]){this._emitError(new Error("tus: cannot use the ".concat(p," 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 l=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,p=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:mn(this._source.size,l);this._parallelUploadUrls&&p.forEach(function(g,y){g.uploadUrl=n._parallelUploadUrls[y]||null;}),this._parallelUploadUrls=new Array(p.length);var h=p.map(function(g,y){var j=0;return n._source.slice(g.start,g.end).then(function(oe){var H=oe.value;return new Promise(function(L,w){var F=ee(ee({},n.options),{},{uploadUrl:g.uploadUrl||null,storeFingerprintForResuming:false,removeFingerprintOnSuccess:false,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:ee(ee({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:L,onError:w,onProgress:function(C){s=s-j+C,j=C,n._emitProgress(s,o);},onUploadUrlAvailable:function(){n._parallelUploadUrls[y]=k.url,n._parallelUploadUrls.filter(function(C){return !!C}).length===p.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 g=qt(n.options.metadata);return g!==""&&m.setHeader("Upload-Metadata",g),n._sendRequest(m,null)}).then(function(g){if(!te(g.getStatus(),200)){n._emitHttpError(m,g,"tus: unexpected response while creating upload");return}var y=g.getHeader("Location");if(y==null){n._emitHttpError(m,g,"tus: invalid or missing Location header");return}n.url=$t(n.options.endpoint,y),z("Created upload at ".concat(n.url)),n._emitSuccess(g);}).catch(function(g){n._emitError(g);});}},{key:"_startSingleUpload",value:function(){if(this._aborted=false,this.url!=null){z("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){z("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=ln(this._parallelUploads),s;try{for(o.s();!(s=o.n()).done;){var l=s.value;l.abort(r);}}catch(p){o.e(p);}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=qt(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===be&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(l){if(!te(l.getStatus(),200)){r._emitHttpError(n,l,"tus: unexpected response while creating upload");return}var p=l.getHeader("Location");if(p==null){r._emitHttpError(n,l,"tus: invalid or missing Location header");return}if(r.url=$t(r.options.endpoint,p),z("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(l),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,l):(r._offset=0,r._performUpload());});}).catch(function(l){r._emitHttpError(n,null,"tus: failed to create upload",l);});}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(s){var l=s.getStatus();if(!te(l,200)){if(l===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(te(l,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 p=Number.parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(p)){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===Ne){r._emitHttpError(n,s,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(p===h){r._emitProgress(h,h),r._emitSuccess(s);return}r._offset=p,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(l){n._emitProgress(o+l,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(l){var p=l.value,h=l.done,m=p!=null&&p.size?p.size:0;n.options.uploadLengthDeferred&&h&&(n._size=n._offset+m,r.setHeader("Upload-Length","".concat(n._size)));var g=n._offset+m;return !n.options.uploadLengthDeferred&&h&&g!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(g," bytes"))):p===null?n._sendRequest(r):(n.options.protocol===be&&r.setHeader("Upload-Complete",h?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,p))})}},{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=Mt(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 Gt(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=Mt("DELETE",r,n);return Gt(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 l=n.retryDelays[0],p=n.retryDelays.slice(1),h=ee(ee({},n),{},{retryDelays:p});return new Promise(function(m){return setTimeout(m,l)}).then(function(){return e.terminate(r,h)})})}}])}();function qt(e){return Object.entries(e).map(function(t){var r=Wt(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 Mt(e,t,r){var n=r.httpStack.createRequest(e,t);r.protocol===be?n.setHeader("Upload-Draft-Interop-Version","5"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},s=0,l=Object.entries(o);s<l.length;s++){var p=Wt(l[s],2),h=p[0],m=p[1];n.setHeader(h,m);}if(r.addRequestId){var g=Fe();n.setHeader("X-Request-ID",g);}return n}function Gt(e,t,r){return Be.apply(this,arguments)}function Be(){return Be=on(Ie().mark(function e(t,r,n){var o;return Ie().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(typeof n.onBeforeRequest!="function"){l.next=3;break}return l.next=3,n.onBeforeRequest(t);case 3:return l.next=5,t.send(r);case 5:if(o=l.sent,typeof n.onAfterResponse!="function"){l.next=9;break}return l.next=9,n.onAfterResponse(t,o);case 9:return l.abrupt("return",o);case 10:case "end":return l.stop()}},e)})),Be.apply(this,arguments)}function yn(){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):Jt(e)}function Jt(e){var t=e.originalResponse?e.originalResponse.getStatus():0;return (!te(t,400)||t===409||t===423)&&yn()}function $t(e,t){return new Zt.default(t,e).toString()}function mn(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}Vt.defaultOptions=dn;var _e=Vt;var vn=function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"},we=vn;function ze(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 gn=function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")},Qt=gn;function He(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 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 bn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function er(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,wn(n.key),n);}}function _n(e,t,r){return t&&er(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function wn(e){var t=xn(e,"string");return ce(t)=="symbol"?t:t+""}function xn(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 qe=function(){function e(t){bn(this,e),this._file=t,this.size=t.size;}return _n(e,[{key:"slice",value:function(r,n){if(Qt())return He(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 pe(e){"@babel/helpers - typeof";return pe=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},pe(e)}function Sn(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,En(n.key),n);}}function Un(e,t,r){return t&&tr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function En(e){var t=Pn(e,"string");return pe(t)=="symbol"?t:t+""}function Pn(e,t){if(pe(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(pe(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}function rr(e){return e===void 0?0:e.size!==void 0?e.size:e.length}function On(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 nr=function(){function e(t){Sn(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+rr(this._buffer);if(this._done||s){var l=this._getDataFromBuffer(r,n),p=l==null?this._done:false;return Promise.resolve({value:l,done:p})}return this._reader.read().then(function(h){var m=h.value,g=h.done;return g?o._done=true:o._buffer===void 0?o._buffer=m:o._buffer=On(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=rr(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 Y(e){"@babel/helpers - typeof";return Y=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},Y(e)}function Me(){Me=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(u,i,a){u[i]=a.value;},s=typeof Symbol=="function"?Symbol:{},l=s.iterator||"@@iterator",p=s.asyncIterator||"@@asyncIterator",h=s.toStringTag||"@@toStringTag";function m(u,i,a){return Object.defineProperty(u,i,{value:a,enumerable:true,configurable:true,writable:true}),u[i]}try{m({},"");}catch{m=function(a,f,d){return a[f]=d};}function g(u,i,a,f){var d=i&&i.prototype instanceof F?i:F,c=Object.create(d.prototype),v=new G(f||[]);return o(c,"_invoke",{value:Ue(u,a,v)}),c}function y(u,i,a){try{return {type:"normal",arg:u.call(i,a)}}catch(f){return {type:"throw",arg:f}}}t.wrap=g;var j="suspendedStart",oe="suspendedYield",H="executing",L="completed",w={};function F(){}function k(){}function x(){}var C={};m(C,l,function(){return this});var q=Object.getPrototypeOf,I=q&&q(q(K([])));I&&I!==r&&n.call(I,l)&&(C=I);var R=x.prototype=F.prototype=Object.create(C);function ie(u){["next","throw","return"].forEach(function(i){m(u,i,function(a){return this._invoke(i,a)});});}function N(u,i){function a(d,c,v,b){var _=y(u[d],u,c);if(_.type!=="throw"){var E=_.arg,S=E.value;return S&&Y(S)=="object"&&n.call(S,"__await")?i.resolve(S.__await).then(function(P){a("next",P,v,b);},function(P){a("throw",P,v,b);}):i.resolve(S).then(function(P){E.value=P,v(E);},function(P){return a("throw",P,v,b)})}b(_.arg);}var f;o(this,"_invoke",{value:function(c,v){function b(){return new i(function(_,E){a(c,v,_,E);})}return f=f?f.then(b,b):b()}});}function Ue(u,i,a){var f=j;return function(d,c){if(f===H)throw Error("Generator is already running");if(f===L){if(d==="throw")throw c;return {value:e,done:true}}for(a.method=d,a.arg=c;;){var v=a.delegate;if(v){var b=ae(v,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===j)throw f=L,a.arg;a.dispatchException(a.arg);}else a.method==="return"&&a.abrupt("return",a.arg);f=H;var _=y(u,i,a);if(_.type==="normal"){if(f=a.done?L:oe,_.arg===w)continue;return {value:_.arg,done:a.done}}_.type==="throw"&&(f=L,a.method="throw",a.arg=_.arg);}}}function ae(u,i){var a=i.method,f=u.iterator[a];if(f===e)return i.delegate=null,a==="throw"&&u.iterator.return&&(i.method="return",i.arg=e,ae(u,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,u.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,w;var c=d.arg;return c?c.done?(i[u.resultName]=c.value,i.next=u.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,w):c:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,w)}function Ee(u){var i={tryLoc:u[0]};1 in u&&(i.catchLoc=u[1]),2 in u&&(i.finallyLoc=u[2],i.afterLoc=u[3]),this.tryEntries.push(i);}function M(u){var i=u.completion||{};i.type="normal",delete i.arg,u.completion=i;}function G(u){this.tryEntries=[{tryLoc:"root"}],u.forEach(Ee,this),this.reset(true);}function K(u){if(u||u===""){var i=u[l];if(i)return i.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length)){var a=-1,f=function d(){for(;++a<u.length;)if(n.call(u,a))return d.value=u[a],d.done=false,d;return d.value=e,d.done=true,d};return f.next=f}}throw new TypeError(Y(u)+" is not iterable")}return k.prototype=x,o(R,"constructor",{value:x,configurable:true}),o(x,"constructor",{value:k,configurable:true}),k.displayName=m(x,h,"GeneratorFunction"),t.isGeneratorFunction=function(u){var i=typeof u=="function"&&u.constructor;return !!i&&(i===k||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(u){return Object.setPrototypeOf?Object.setPrototypeOf(u,x):(u.__proto__=x,m(u,h,"GeneratorFunction")),u.prototype=Object.create(R),u},t.awrap=function(u){return {__await:u}},ie(N.prototype),m(N.prototype,p,function(){return this}),t.AsyncIterator=N,t.async=function(u,i,a,f,d){d===void 0&&(d=Promise);var c=new N(g(u,i,a,f),d);return t.isGeneratorFunction(i)?c:c.next().then(function(v){return v.done?v.value:c.next()})},ie(R),m(R,h,"Generator"),m(R,l,function(){return this}),m(R,"toString",function(){return "[object Generator]"}),t.keys=function(u){var i=Object(u),a=[];for(var f in i)a.push(f);return a.reverse(),function d(){for(;a.length;){var c=a.pop();if(c in i)return d.value=c,d.done=false,d}return d.done=true,d}},t.values=K,G.prototype={constructor:G,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(M),!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(E,S){return v.type="throw",v.arg=i,a.next=E,S&&(a.method="next",a.arg=e),!!S}for(var d=this.tryEntries.length-1;d>=0;--d){var c=this.tryEntries[d],v=c.completion;if(c.tryLoc==="root")return f("end");if(c.tryLoc<=this.prev){var b=n.call(c,"catchLoc"),_=n.call(c,"finallyLoc");if(b&&_){if(this.prev<c.catchLoc)return f(c.catchLoc,true);if(this.prev<c.finallyLoc)return f(c.finallyLoc)}else if(b){if(this.prev<c.catchLoc)return f(c.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return f(c.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 c=d;break}}c&&(i==="break"||i==="continue")&&c.tryLoc<=a&&a<=c.finallyLoc&&(c=null);var v=c?c.completion:{};return v.type=i,v.arg=a,c?(this.method="next",this.next=c.finallyLoc,w):this.complete(v)},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),M(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 c=d.arg;M(f);}return c}}throw Error("illegal catch attempt")},delegateYield:function(i,a,f){return this.delegate={iterator:K(i),resultName:a,nextLoc:f},this.method==="next"&&(this.arg=e),w}},t}function or(e,t,r,n,o,s,l){try{var p=e[s](l),h=p.value;}catch(m){r(m);return}p.done?t(h):Promise.resolve(h).then(n,o);}function kn(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var s=e.apply(t,r);function l(h){or(s,n,o,l,p,"next",h);}function p(h){or(s,n,o,l,p,"throw",h);}l(void 0);})}}function Rn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ir(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,Cn(n.key),n);}}function jn(e,t,r){return t&&ir(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Cn(e){var t=Ln(e,"string");return Y(t)=="symbol"?t:t+""}function Ln(e,t){if(Y(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Y(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var ar=function(){function e(){Rn(this,e);}return jn(e,[{key:"openFile",value:function(){var t=kn(Me().mark(function n(o,s){var l;return Me().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(we()&&o&&typeof o.uri<"u")){h.next=11;break}return h.prev=1,h.next=4,ze(o.uri);case 4:return l=h.sent,h.abrupt("return",new qe(l));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 qe(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 nr(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 Ge(e,t){return we()?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?An(JSON.stringify(e.exif)):"noexif";return ["tus-rn",e.name||"noname",e.size||"nosize",r,t.endpoint].join("/")}function An(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 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 Ke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sr(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,Dn(n.key),n);}}function $e(e,t,r){return t&&sr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Dn(e){var t=Fn(e,"string");return he(t)=="symbol"?t:t+""}function Fn(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 ur=function(){function e(){Ke(this,e);}return $e(e,[{key:"createRequest",value:function(r,n){return new In(r,n)}},{key:"getName",value:function(){return "XHRHttpStack"}}])}();var In=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 $e(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 Nn(r._xhr));},r._xhr.onerror=function(l){s(l);},r._xhr.send(n);})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}(),Nn=function(){function e(t){Ke(this,e),this._xhr=t;}return $e(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 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 Bn(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,Hn(n.key),n);}}function zn(e,t,r){return t&&lr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Hn(e){var t=qn(e,"string");return de(t)=="symbol"?t:t+""}function qn(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)}var Xe=false;try{Xe="localStorage"in window,xe="tusSupport",We=localStorage.getItem(xe),localStorage.setItem(xe,We),We===null&&localStorage.removeItem(xe);}catch(e){if(e.code===e.SECURITY_ERR||e.code===e.QUOTA_EXCEEDED_ERR)Xe=false;else throw e}var xe,We,fr=Xe,cr=function(){function e(){Bn(this,e);}return zn(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 l=JSON.parse(localStorage.getItem(s));l.urlStorageKey=s,n.push(l);}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 Mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pr(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,mr(n.key),n);}}function Gn(e,t,r){return r&&pr(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Kn(e,t,r){return t=Se(t),$n(e,yr()?Reflect.construct(t,r||[],Se(e).constructor):t.apply(e,r))}function $n(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 Wn(e)}function Wn(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (yr=function(){return !!e})()}function Se(e){return Se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Se(e)}function Xn(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&&Ye(e,t);}function Ye(e,t){return Ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ye(e,t)}function hr(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?hr(Object(r),true).forEach(function(n){Yn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function Yn(e,t,r){return t=mr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function mr(e){var t=Zn(e,"string");return ne(t)=="symbol"?t:t+""}function Zn(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 dr=re(re({},_e.defaultOptions),{},{httpStack:new ur,fileReader:new ar,urlStorage:fr?new cr:new it,fingerprint:Ge}),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 Mn(this,t),n=re(re({},dr),n),Kn(this,t,[r,n])}return Xn(t,e),Gn(t,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=re(re({},dr),o),_e.terminate(n,o)}}])}(_e);var O=class extends i{constructor(){super(...arguments);this.disableCompletion=false;this._completed=false;this.languageController=new d(this);}connectedCallback(){super.connectedCallback(),window.customElements.get("lottie-player")||import('./lottie-player.esm-BBAKIFYQ.js'),this.languageController.locale=this.locale||"en",this.embedChannel=a$3.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(){super.disconnectedCallback();}handleDrop(r){if(r.preventDefault(),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:a$4.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 l=Math.round(o/s*100);l>this._progress&&(this._progress=l),this.dispatchEvent(new CustomEvent("progress",{bubbles:true,composed:true,detail:{progress:l}}));},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(){return c$1` ${this._progress?this.renderProgress():this.renderUpload()} `}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"}}renderUpload(){return c$1`<form
4
4
  class="state"
5
5
  style=${a$5({...this.styleOpacity(),...this.styleFont()})}
6
6
  @dragover=${r=>r.preventDefault()}