@mux/mux-uploader
Advanced tools
Comparing version 1.0.2 to 1.0.3-canary.0
@@ -1,2 +0,2 @@ | ||
"use strict";var G=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var Le=Object.getOwnPropertyNames;var ke=Object.prototype.hasOwnProperty;var J=(r,o)=>{for(var e in o)G(r,e,{get:o[e],enumerable:!0})},Me=(r,o,e,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of Le(o))!ke.call(r,i)&&i!==e&&G(r,i,{get:()=>o[i],enumerable:!(s=Ae(o,i))||s.enumerable});return r};var Ce=r=>Me(G({},"__esModule",{value:!0}),r);var Q=(r,o,e)=>{if(!o.has(r))throw TypeError("Cannot "+e)};var t=(r,o,e)=>(Q(r,o,"read from private field"),e?e.call(r):o.get(r)),u=(r,o,e)=>{if(o.has(r))throw TypeError("Cannot add the same private member more than once");o instanceof WeakSet?o.add(r):o.set(r,e)},d=(r,o,e,s)=>(Q(r,o,"write to private field"),s?s.call(r,e):o.set(r,e),e);var Pe={};J(Pe,{MuxUploaderDropElement:()=>se,MuxUploaderFileSelectElement:()=>ce,MuxUploaderPauseElement:()=>pe,MuxUploaderProgressElement:()=>ie,MuxUploaderRetryElement:()=>ue,MuxUploaderSrTextElement:()=>Ee,MuxUploaderStatusElement:()=>ae,constants:()=>D,default:()=>Re});module.exports=Ce(Pe);var D={};J(D,{ProgressTypes:()=>x});var x={BAR:"bar",RADIAL:"radial",PERCENTAGE:"percentage"};var L=class{addEventListener(){}removeEventListener(){}dispatchEvent(o){return!0}};if(typeof DocumentFragment=="undefined"){class r extends L{}globalThis.DocumentFragment=r}var R=class extends L{},W=class extends L{},Te={get(r){},define(r,o,e){},getName(r){return null},upgrade(r){},whenDefined(r){return Promise.resolve(R)}},P,q=class{constructor(o,e={}){u(this,P,void 0);d(this,P,e==null?void 0:e.detail)}get detail(){return t(this,P)}initCustomEvent(){}};P=new WeakMap;function we(r,o){return new R}var Z={document:{createElement:we},DocumentFragment,customElements:Te,CustomEvent:q,EventTarget:L,HTMLElement:R,HTMLVideoElement:W},V=typeof window=="undefined"||typeof globalThis.customElements=="undefined",a=V?Z:globalThis,h=V?Z.document:globalThis.document;var me=require("@mux/upchunk");var ee=(r,o)=>{if(!r)return null;let e=r.closest(o);return e||ee(r.getRootNode().host,o)},c=r=>{let o=r.getAttribute("mux-uploader");return o?document.getElementById(o):ee(r,"mux-uploader")};var te=h.createElement("template");te.innerHTML=` | ||
"use strict";var G=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var Le=Object.getOwnPropertyNames;var ke=Object.prototype.hasOwnProperty;var J=(o,t)=>{for(var e in t)G(o,e,{get:t[e],enumerable:!0})},Me=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Le(t))!ke.call(o,i)&&i!==e&&G(o,i,{get:()=>t[i],enumerable:!(r=Ae(t,i))||r.enumerable});return o};var Ce=o=>Me(G({},"__esModule",{value:!0}),o);var Q=(o,t,e)=>{if(!t.has(o))throw TypeError("Cannot "+e)};var s=(o,t,e)=>(Q(o,t,"read from private field"),e?e.call(o):t.get(o)),l=(o,t,e)=>{if(t.has(o))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(o):t.set(o,e)},u=(o,t,e,r)=>(Q(o,t,"write to private field"),r?r.call(o,e):t.set(o,e),e);var Pe={};J(Pe,{MuxUploaderDropElement:()=>se,MuxUploaderFileSelectElement:()=>ce,MuxUploaderPauseElement:()=>pe,MuxUploaderProgressElement:()=>ie,MuxUploaderRetryElement:()=>ue,MuxUploaderSrTextElement:()=>Ee,MuxUploaderStatusElement:()=>ae,constants:()=>D,default:()=>Re});module.exports=Ce(Pe);var D={};J(D,{ProgressTypes:()=>x});var x={BAR:"bar",RADIAL:"radial",PERCENTAGE:"percentage"};var L=class{addEventListener(){}removeEventListener(){}dispatchEvent(t){return!0}};if(typeof DocumentFragment=="undefined"){class o extends L{}globalThis.DocumentFragment=o}var R=class extends L{},W=class extends L{},Te={get(o){},define(o,t,e){},getName(o){return null},upgrade(o){},whenDefined(o){return Promise.resolve(R)}},P,q=class{constructor(t,e={}){l(this,P,void 0);u(this,P,e==null?void 0:e.detail)}get detail(){return s(this,P)}initCustomEvent(){}};P=new WeakMap;function we(o,t){return new R}var Z={document:{createElement:we},DocumentFragment,customElements:Te,CustomEvent:q,EventTarget:L,HTMLElement:R,HTMLVideoElement:W},V=typeof window=="undefined"||typeof globalThis.customElements=="undefined",a=V?Z:globalThis,p=V?Z.document:globalThis.document;var me=require("@mux/upchunk");var ee=(o,t)=>{if(!o)return null;let e=o.closest(t);return e||ee(o.getRootNode().host,t)},h=o=>{let t=o.getAttribute("mux-uploader");return t?document.getElementById(t):ee(o,"mux-uploader")};var te=p.createElement("template");te.innerHTML=` | ||
<style> | ||
@@ -61,3 +61,3 @@ :host { | ||
</div> | ||
`;var j={MUX_UPLOADER:"mux-uploader",OVERLAY_TEXT:"overlay-text"},z,g,k,H=class extends a.HTMLElement{constructor(){super();u(this,z,void 0);u(this,g,void 0);u(this,k,void 0);let e=this.attachShadow({mode:"open"});e.appendChild(te.content.cloneNode(!0)),d(this,z,e.getElementById("overlay-label"))}connectedCallback(){if(d(this,g,c(this)),d(this,k,new AbortController),t(this,g)){let e={signal:t(this,k).signal};t(this,g).addEventListener("file-ready",()=>this.toggleAttribute("file-ready",!0),e),t(this,g).addEventListener("uploadstart",()=>this.toggleAttribute("upload-in-progress",!0),e),t(this,g).addEventListener("success",()=>{this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!0)},e),t(this,g).addEventListener("reset",()=>{this.toggleAttribute("file-ready",!1),this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!1)},e),this.setupDragEvents(e),this.toggleAttribute("upload-in-progress",t(this,g).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",t(this,g).hasAttribute("upload-complete")),this.toggleAttribute("file-ready",t(this,g).hasAttribute("file-ready"))}}disconnectedCallback(){var e;(e=t(this,k))==null||e.abort()}attributeChangedCallback(e,s,i){e===j.OVERLAY_TEXT&&s!==i?t(this,z).innerHTML=i!=null?i:"":e==="active"&&this.hasAttribute("overlay")&&i!=null&&(this._currentDragTarget=this)}static get observedAttributes(){return[j.OVERLAY_TEXT,j.MUX_UPLOADER,"active"]}setupDragEvents(e){this.addEventListener("dragenter",s=>{this._currentDragTarget=s.target,s.preventDefault(),s.stopPropagation(),this.toggleAttribute("active",!0)},e),this.addEventListener("dragleave",s=>{this._currentDragTarget===s.target&&(this._currentDragTarget=void 0,this.toggleAttribute("active",!1))},e),this.addEventListener("dragover",s=>{s.preventDefault(),s.stopPropagation()},e),this.addEventListener("drop",s=>{var A;s.preventDefault(),s.stopPropagation();let{dataTransfer:i}=s,{files:n}=i,l=n[0];((A=t(this,g))!=null?A:this).dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:l})),this.removeAttribute("active")},e)}};z=new WeakMap,g=new WeakMap,k=new WeakMap;a.customElements.get("mux-uploader-drop")||(a.customElements.define("mux-uploader-drop",H),a.MuxUploaderDropElement=H);var se=H;function re(r){return`${Math.floor(r)}%`}var oe=h.createElement("template"),Se="Media upload progress bar";oe.innerHTML=` | ||
`;var j={MUX_UPLOADER:"mux-uploader",OVERLAY_TEXT:"overlay-text"},z,m,k,H=class extends a.HTMLElement{constructor(){super();l(this,z,void 0);l(this,m,void 0);l(this,k,void 0);let e=this.attachShadow({mode:"open"});e.appendChild(te.content.cloneNode(!0)),u(this,z,e.getElementById("overlay-label"))}connectedCallback(){if(u(this,m,h(this)),u(this,k,new AbortController),s(this,m)){let e={signal:s(this,k).signal};s(this,m).addEventListener("file-ready",()=>this.toggleAttribute("file-ready",!0),e),s(this,m).addEventListener("uploadstart",()=>this.toggleAttribute("upload-in-progress",!0),e),s(this,m).addEventListener("success",()=>{this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!0)},e),s(this,m).addEventListener("reset",()=>{this.toggleAttribute("file-ready",!1),this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!1)},e),this.setupDragEvents(e),this.toggleAttribute("upload-in-progress",s(this,m).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",s(this,m).hasAttribute("upload-complete")),this.toggleAttribute("file-ready",s(this,m).hasAttribute("file-ready"))}}disconnectedCallback(){var e;(e=s(this,k))==null||e.abort()}attributeChangedCallback(e,r,i){e===j.OVERLAY_TEXT&&r!==i?s(this,z).innerHTML=i!=null?i:"":e==="active"&&this.hasAttribute("overlay")&&i!=null&&(this._currentDragTarget=this)}static get observedAttributes(){return[j.OVERLAY_TEXT,j.MUX_UPLOADER,"active"]}setupDragEvents(e){this.addEventListener("dragenter",r=>{this._currentDragTarget=r.target,r.preventDefault(),r.stopPropagation(),this.toggleAttribute("active",!0)},e),this.addEventListener("dragleave",r=>{this._currentDragTarget===r.target&&(this._currentDragTarget=void 0,this.toggleAttribute("active",!1))},e),this.addEventListener("dragover",r=>{r.preventDefault(),r.stopPropagation()},e),this.addEventListener("drop",r=>{var A;r.preventDefault(),r.stopPropagation();let{dataTransfer:i}=r,{files:n}=i,y=n[0];((A=s(this,m))!=null?A:this).dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:y})),this.removeAttribute("active")},e)}};z=new WeakMap,m=new WeakMap,k=new WeakMap;a.customElements.get("mux-uploader-drop")||(a.customElements.define("mux-uploader-drop",H),a.MuxUploaderDropElement=H);var se=H;function re(o){return`${Math.floor(o)}%`}var oe=p.createElement("template"),Se="Media upload progress bar";oe.innerHTML=` | ||
<style> | ||
@@ -146,3 +146,3 @@ :host { | ||
</div> | ||
`;var b,M,F=class extends a.HTMLElement{constructor(){var s,i,n,l;super();u(this,b,void 0);u(this,M,void 0);this.onUploadStart=()=>{var e;(e=this.progressBar)==null||e.focus(),this.toggleAttribute("upload-in-progress",!0)};this.onProgress=e=>{var i;let s=e.detail;switch((i=this.progressBar)==null||i.setAttribute("aria-valuenow",`${Math.floor(s)}`),this.getAttribute("type")){case x.BAR:{this.progressBar&&(this.progressBar.style.width=`${s}%`);break}case x.RADIAL:{if(this.svgCircle){let n=this.getCircumference()-s/100*this.getCircumference();this.svgCircle.style.strokeDashoffset=n.toString()}break}case x.PERCENTAGE:{this.uploadPercentage&&(this.uploadPercentage.innerHTML=re(s));break}}};this.onSuccess=()=>{this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!0)};this.onReset=()=>{this.toggleAttribute("upload-in-progress",!1),this.uploadPercentage&&(this.uploadPercentage.innerHTML=""),this.svgCircle&&(this.svgCircle.style.strokeDashoffset=`${this.getCircumference()}`)};this.attachShadow({mode:"open"}).appendChild(oe.content.cloneNode(!0)),this.svgCircle=(s=this.shadowRoot)==null?void 0:s.querySelector("circle"),this.progressBar=(i=this.shadowRoot)==null?void 0:i.getElementById("progress-bar"),this.uploadPercentage=(n=this.shadowRoot)==null?void 0:n.getElementById("percentage-type"),(l=this.progressBar)==null||l.setAttribute("aria-description",Se)}connectedCallback(){if(this.setDefaultType(),d(this,b,c(this)),d(this,M,new AbortController),t(this,b)){let e={signal:t(this,M).signal};t(this,b).addEventListener("uploadstart",this.onUploadStart,e),t(this,b).addEventListener("reset",this.onReset),t(this,b).addEventListener("progress",this.onProgress),t(this,b).addEventListener("success",this.onSuccess),this.toggleAttribute("upload-in-progress",t(this,b).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",t(this,b).hasAttribute("upload-complete"))}}disconnectedCallback(){var e;(e=t(this,M))==null||e.abort()}getRadius(){var e;return Number((e=this.svgCircle)==null?void 0:e.getAttribute("r"))}getCircumference(){return this.getRadius()*2*Math.PI}setDefaultType(){let e=this.getAttribute("type");e||this.setAttribute("type",x.BAR),e===x.RADIAL&&this.svgCircle&&(this.svgCircle.style.strokeDasharray=`${this.getCircumference()} ${this.getCircumference()}`,this.svgCircle.style.strokeDashoffset=`${this.getCircumference()}`)}};b=new WeakMap,M=new WeakMap;a.customElements.get("mux-uploader-progress")||a.customElements.define("mux-uploader-progress",F);var ie=F;var ne=h.createElement("template");ne.innerHTML=` | ||
`;var f,M,F=class extends a.HTMLElement{constructor(){var r,i,n,y;super();l(this,f,void 0);l(this,M,void 0);this.onUploadStart=()=>{var e;(e=this.progressBar)==null||e.focus(),this.toggleAttribute("upload-in-progress",!0)};this.onProgress=e=>{var i;let r=e.detail;switch((i=this.progressBar)==null||i.setAttribute("aria-valuenow",`${Math.floor(r)}`),this.getAttribute("type")){case x.BAR:{this.progressBar&&(this.progressBar.style.width=`${r}%`);break}case x.RADIAL:{if(this.svgCircle){let n=this.getCircumference()-r/100*this.getCircumference();this.svgCircle.style.strokeDashoffset=n.toString()}break}case x.PERCENTAGE:{this.uploadPercentage&&(this.uploadPercentage.innerHTML=re(r));break}}};this.onSuccess=()=>{this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!0)};this.onReset=()=>{this.toggleAttribute("upload-in-progress",!1),this.uploadPercentage&&(this.uploadPercentage.innerHTML=""),this.svgCircle&&(this.svgCircle.style.strokeDashoffset=`${this.getCircumference()}`)};this.attachShadow({mode:"open"}).appendChild(oe.content.cloneNode(!0)),this.svgCircle=(r=this.shadowRoot)==null?void 0:r.querySelector("circle"),this.progressBar=(i=this.shadowRoot)==null?void 0:i.getElementById("progress-bar"),this.uploadPercentage=(n=this.shadowRoot)==null?void 0:n.getElementById("percentage-type"),(y=this.progressBar)==null||y.setAttribute("aria-description",Se)}connectedCallback(){if(this.setDefaultType(),u(this,f,h(this)),u(this,M,new AbortController),s(this,f)){let e={signal:s(this,M).signal};s(this,f).addEventListener("uploadstart",this.onUploadStart,e),s(this,f).addEventListener("reset",this.onReset),s(this,f).addEventListener("progress",this.onProgress),s(this,f).addEventListener("success",this.onSuccess),this.toggleAttribute("upload-in-progress",s(this,f).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",s(this,f).hasAttribute("upload-complete"))}}disconnectedCallback(){var e;(e=s(this,M))==null||e.abort()}getRadius(){var e;return Number((e=this.svgCircle)==null?void 0:e.getAttribute("r"))}getCircumference(){return this.getRadius()*2*Math.PI}setDefaultType(){let e=this.getAttribute("type");e||this.setAttribute("type",x.BAR),e===x.RADIAL&&this.svgCircle&&(this.svgCircle.style.strokeDasharray=`${this.getCircumference()} ${this.getCircumference()}`,this.svgCircle.style.strokeDashoffset=`${this.getCircumference()}`)}};f=new WeakMap,M=new WeakMap;a.customElements.get("mux-uploader-progress")||a.customElements.define("mux-uploader-progress",F);var ie=F;var ne=p.createElement("template");ne.innerHTML=` | ||
<style> | ||
@@ -156,3 +156,3 @@ | ||
<span id="status-message" role="status" aria-live="polite"></span> | ||
`;var m,C,_=class extends a.HTMLElement{constructor(){var s;super();u(this,m,void 0);u(this,C,void 0);this.clearStatusMessage=()=>{this.toggleAttribute("upload-error",!1),this.statusMessage&&(this.statusMessage.innerHTML="")};this.onUploadError=e=>{this.toggleAttribute("upload-error",!0),this.statusMessage&&(this.statusMessage.innerHTML=e.detail.message)};this.onSuccess=()=>{this.toggleAttribute("upload-error",!1);let e="Upload complete!";this.statusMessage&&(this.statusMessage.innerHTML=e),console.info(e)};this.onOffline=()=>{this.toggleAttribute("upload-error",!1);let e="Currently offline. Upload will resume automatically when online.";this.statusMessage&&(this.statusMessage.innerHTML=e)};this.attachShadow({mode:"open"}).appendChild(ne.content.cloneNode(!0)),this.statusMessage=(s=this.shadowRoot)==null?void 0:s.getElementById("status-message")}connectedCallback(){if(d(this,m,c(this)),d(this,C,new AbortController),t(this,m)){let e={signal:t(this,C).signal};t(this,m).addEventListener("reset",this.clearStatusMessage,e),t(this,m).addEventListener("uploaderror",this.onUploadError,e),t(this,m).addEventListener("success",this.onSuccess,e),t(this,m).addEventListener("uploadstart",this.clearStatusMessage,e),t(this,m).addEventListener("offline",this.onOffline,e),t(this,m).addEventListener("online",this.clearStatusMessage,e),this.toggleAttribute("upload-in-progress",t(this,m).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",t(this,m).hasAttribute("upload-complete")),this.toggleAttribute("upload-error",t(this,m).hasAttribute("upload-error"))}}disconnectedCallback(){var e;(e=t(this,C))==null||e.abort()}};m=new WeakMap,C=new WeakMap;a.customElements.get("mux-uploader-status")||a.customElements.define("mux-uploader-status",_);var ae=_;var le=h.createElement("template");le.innerHTML=` | ||
`;var c,C,_=class extends a.HTMLElement{constructor(){var r;super();l(this,c,void 0);l(this,C,void 0);this.clearStatusMessage=()=>{this.toggleAttribute("upload-error",!1),this.statusMessage&&(this.statusMessage.innerHTML="")};this.onUploadError=e=>{this.toggleAttribute("upload-error",!0),this.statusMessage&&(this.statusMessage.innerHTML=e.detail.message)};this.onSuccess=()=>{this.toggleAttribute("upload-error",!1);let e="Upload complete!";this.statusMessage&&(this.statusMessage.innerHTML=e),console.info(e)};this.onOffline=()=>{this.toggleAttribute("upload-error",!1);let e="Currently offline. Upload will resume automatically when online.";this.statusMessage&&(this.statusMessage.innerHTML=e)};this.attachShadow({mode:"open"}).appendChild(ne.content.cloneNode(!0)),this.statusMessage=(r=this.shadowRoot)==null?void 0:r.getElementById("status-message")}connectedCallback(){if(u(this,c,h(this)),u(this,C,new AbortController),s(this,c)){let e={signal:s(this,C).signal};s(this,c).addEventListener("reset",this.clearStatusMessage,e),s(this,c).addEventListener("uploaderror",this.onUploadError,e),s(this,c).addEventListener("success",this.onSuccess,e),s(this,c).addEventListener("uploadstart",this.clearStatusMessage,e),s(this,c).addEventListener("offline",this.onOffline,e),s(this,c).addEventListener("online",this.clearStatusMessage,e),this.toggleAttribute("upload-in-progress",s(this,c).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",s(this,c).hasAttribute("upload-complete")),this.toggleAttribute("upload-error",s(this,c).hasAttribute("upload-error"))}}disconnectedCallback(){var e;(e=s(this,C))==null||e.abort()}};c=new WeakMap,C=new WeakMap;a.customElements.get("mux-uploader-status")||a.customElements.define("mux-uploader-status",_);var ae=_;var le=p.createElement("template");le.innerHTML=` | ||
<style> | ||
@@ -173,3 +173,3 @@ #retry-button { | ||
<span id="retry-button" role="button" tabindex="0">Try again</span> | ||
`;var y,T,O=class extends a.HTMLElement{constructor(){var s;super();u(this,y,void 0);u(this,T,void 0);this.handleKeyup=e=>{let s=["Enter"," "],{key:i}=e;s.includes(i)&&this.triggerReset()};this.triggerReset=()=>{var e;(e=t(this,y))==null||e.dispatchEvent(new CustomEvent("reset"))};this.attachShadow({mode:"open"}).appendChild(le.content.cloneNode(!0)),this.retryButton=(s=this.shadowRoot)==null?void 0:s.getElementById("retry-button")}connectedCallback(){var e,s;if(d(this,y,c(this)),d(this,T,new AbortController),t(this,y)){let i={signal:t(this,T).signal};t(this,y).addEventListener("uploaderror",()=>this.toggleAttribute("upload-error",!0)),t(this,y).addEventListener("reset",()=>this.toggleAttribute("upload-error",!1)),(e=this.retryButton)==null||e.addEventListener("click",this.triggerReset,i),(s=this.retryButton)==null||s.addEventListener("keyup",this.handleKeyup,i),this.toggleAttribute("upload-error",t(this,y).hasAttribute("upload-error"))}}disconnectedCallback(){var e;(e=t(this,T))==null||e.abort()}};y=new WeakMap,T=new WeakMap;a.customElements.get("mux-uploader-retry")||a.customElements.define("mux-uploader-retry",O);var ue=O;var de=h.createElement("template");de.innerHTML=` | ||
`;var E,T,O=class extends a.HTMLElement{constructor(){var r;super();l(this,E,void 0);l(this,T,void 0);this.handleKeyup=e=>{let r=["Enter"," "],{key:i}=e;r.includes(i)&&this.triggerReset()};this.triggerReset=()=>{var e;(e=s(this,E))==null||e.dispatchEvent(new CustomEvent("reset"))};this.attachShadow({mode:"open"}).appendChild(le.content.cloneNode(!0)),this.retryButton=(r=this.shadowRoot)==null?void 0:r.getElementById("retry-button")}connectedCallback(){var e,r;if(u(this,E,h(this)),u(this,T,new AbortController),s(this,E)){let i={signal:s(this,T).signal};s(this,E).addEventListener("uploaderror",()=>this.toggleAttribute("upload-error",!0)),s(this,E).addEventListener("reset",()=>this.toggleAttribute("upload-error",!1)),(e=this.retryButton)==null||e.addEventListener("click",this.triggerReset,i),(r=this.retryButton)==null||r.addEventListener("keyup",this.handleKeyup,i),this.toggleAttribute("upload-error",s(this,E).hasAttribute("upload-error"))}}disconnectedCallback(){var e;(e=s(this,T))==null||e.abort()}};E=new WeakMap,T=new WeakMap;a.customElements.get("mux-uploader-retry")||a.customElements.define("mux-uploader-retry",O);var ue=O;var de=p.createElement("template");de.innerHTML=` | ||
<style> | ||
@@ -212,3 +212,3 @@ #pause-button { | ||
<button id="pause-button">Pause</span> | ||
`;var p,w,I=class extends a.HTMLElement{constructor(){super();u(this,p,void 0);u(this,w,void 0);this.triggerPause=()=>{if(!t(this,p)){console.warn("pausing before a mux-uploader element is associated is unsupported!");return}this.pauseButton.disabled||(t(this,p).paused=!t(this,p).paused)};this.attachShadow({mode:"open"}).appendChild(de.content.cloneNode(!0))}connectedCallback(){if(d(this,p,c(this)),d(this,w,new AbortController),t(this,p)){let e={signal:t(this,w).signal};t(this,p).addEventListener("uploadstart",()=>this.toggleAttribute("upload-in-progress",!0),e),t(this,p).addEventListener("uploaderror",()=>{this.toggleAttribute("upload-error",!0),this.toggleAttribute("upload-complete",!1),this.toggleAttribute("upload-in-progress",!1)}),t(this,p).addEventListener("success",()=>{this.toggleAttribute("upload-complete",!0),this.toggleAttribute("upload-error",!1),this.toggleAttribute("upload-in-progress",!1)}),t(this,p).addEventListener("reset",()=>{this.toggleAttribute("upload-error",!1),this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!1)}),t(this,p).addEventListener("pausedchange",()=>{var i;if(this.pauseButton.disabled=!1,!t(this,p))return;let s=(i=t(this,p).paused)!=null?i:!1;this.pauseButton.innerHTML=s?"Pausing...":"Pause",s&&(this.pauseButton.disabled=!0,t(this,p).addEventListener("chunksuccess",()=>{var n;this.pauseButton.innerHTML=(n=t(this,p))!=null&&n.paused?"Resume":"Pause",this.pauseButton.disabled=!1},{once:!0}))}),this.pauseButton.addEventListener("click",this.triggerPause,e),this.toggleAttribute("upload-in-progress",t(this,p).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",t(this,p).hasAttribute("upload-complete")),this.toggleAttribute("upload-error",t(this,p).hasAttribute("upload-error"))}}disconnectedCallback(){var e;(e=t(this,w))==null||e.abort()}get pauseButton(){var e;return(e=this.shadowRoot)==null?void 0:e.getElementById("pause-button")}};p=new WeakMap,w=new WeakMap;a.customElements.get("mux-uploader-pause")||a.customElements.define("mux-uploader-pause",I);var pe=I;var X=` | ||
`;var d,w,I=class extends a.HTMLElement{constructor(){super();l(this,d,void 0);l(this,w,void 0);this.triggerPause=()=>{if(!s(this,d)){console.warn("pausing before a mux-uploader element is associated is unsupported!");return}this.pauseButton.disabled||(s(this,d).paused=!s(this,d).paused)};this.attachShadow({mode:"open"}).appendChild(de.content.cloneNode(!0))}connectedCallback(){if(u(this,d,h(this)),u(this,w,new AbortController),s(this,d)){let e={signal:s(this,w).signal};s(this,d).addEventListener("uploadstart",()=>this.toggleAttribute("upload-in-progress",!0),e),s(this,d).addEventListener("uploaderror",()=>{this.toggleAttribute("upload-error",!0),this.toggleAttribute("upload-complete",!1),this.toggleAttribute("upload-in-progress",!1)}),s(this,d).addEventListener("success",()=>{this.toggleAttribute("upload-complete",!0),this.toggleAttribute("upload-error",!1),this.toggleAttribute("upload-in-progress",!1)}),s(this,d).addEventListener("reset",()=>{this.toggleAttribute("upload-error",!1),this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!1)}),s(this,d).addEventListener("pausedchange",()=>{var i;if(this.pauseButton.disabled=!1,!s(this,d))return;let r=(i=s(this,d).paused)!=null?i:!1;this.pauseButton.innerHTML=r?"Pausing...":"Pause",r&&(this.pauseButton.disabled=!0,s(this,d).addEventListener("chunksuccess",()=>{var n;this.pauseButton.innerHTML=(n=s(this,d))!=null&&n.paused?"Resume":"Pause",this.pauseButton.disabled=!1},{once:!0}))}),this.pauseButton.addEventListener("click",this.triggerPause,e),this.toggleAttribute("upload-in-progress",s(this,d).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",s(this,d).hasAttribute("upload-complete")),this.toggleAttribute("upload-error",s(this,d).hasAttribute("upload-error"))}}disconnectedCallback(){var e;(e=s(this,w))==null||e.abort()}get pauseButton(){var e;return(e=this.shadowRoot)==null?void 0:e.getElementById("pause-button")}};d=new WeakMap,w=new WeakMap;a.customElements.get("mux-uploader-pause")||a.customElements.define("mux-uploader-pause",I);var pe=I;var X=` | ||
<style> | ||
@@ -243,3 +243,3 @@ #file-select { | ||
<button id="file-select" type="button" part="file-select-button">Upload a video</button> | ||
`,he=h.createElement("template");he.innerHTML=` | ||
`,he=p.createElement("template");he.innerHTML=` | ||
<style> | ||
@@ -256,6 +256,6 @@ :host { display: inline-block; } | ||
</slot> | ||
`;var E,f,S,N=class extends a.HTMLElement{constructor(){var s,i,n;super();u(this,E,void 0);u(this,f,void 0);u(this,S,void 0);this.attachShadow({mode:"open"}).appendChild(he.content.cloneNode(!0)),this.handleFilePickerElClick=this.handleFilePickerElClick.bind(this),this.filePickerEl=(s=this.shadowRoot)==null?void 0:s.querySelector("button"),(n=(i=this.shadowRoot)==null?void 0:i.querySelector("slot"))==null||n.addEventListener("slotchange",l=>{let U=l.currentTarget;this.filePickerEl=U.assignedElements({flatten:!0}).filter(A=>!["STYLE"].includes(A.nodeName))[0]})}connectedCallback(){if(d(this,f,c(this)),d(this,S,new AbortController),t(this,f)){let e={signal:t(this,S).signal};t(this,f).addEventListener("file-ready",()=>{this.toggleAttribute("file-ready",!0)},e),t(this,f).addEventListener("uploadstart",()=>this.toggleAttribute("upload-in-progress",!0),e),t(this,f).addEventListener("success",()=>{this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!0)},e),t(this,f).addEventListener("reset",()=>{this.toggleAttribute("file-ready",!1)},e),this.toggleAttribute("upload-in-progress",t(this,f).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",t(this,f).hasAttribute("upload-complete")),this.toggleAttribute("file-ready",t(this,f).hasAttribute("file-ready"))}}disconnectedCallback(){var e;(e=t(this,S))==null||e.abort()}get filePickerEl(){return t(this,E)}set filePickerEl(e){e!==t(this,E)&&(t(this,E)&&t(this,E).removeEventListener("click",this.handleFilePickerElClick),d(this,E,e),t(this,E)&&t(this,E).addEventListener("click",this.handleFilePickerElClick))}handleFilePickerElClick(){var i,n;let e=this.getAttribute("mux-uploader"),s=e?h.getElementById(e):this.getRootNode().host;(n=(i=s==null?void 0:s.shadowRoot)==null?void 0:i.querySelector("#hidden-file-input"))==null||n.click()}};E=new WeakMap,f=new WeakMap,S=new WeakMap;a.customElements.get("mux-uploader-file-select")||a.customElements.define("mux-uploader-file-select",N);var ce=N;function $(r,o){return r?"":o}var Ue=(r,o)=>{if(o==null||o===!1)return"";let e=o===!0?"":`${o}`;return`${r}="${e}"`};function Y(r){let{noDrop:o,noProgress:e,noStatus:s,noRetry:i,pausable:n,type:l}=r,U=o?"div":'mux-uploader-drop overlay part="drop"',A=$(e,` | ||
`;var b,g,S,N=class extends a.HTMLElement{constructor(){var r,i,n;super();l(this,b,void 0);l(this,g,void 0);l(this,S,void 0);this.attachShadow({mode:"open"}).appendChild(he.content.cloneNode(!0)),this.handleFilePickerElClick=this.handleFilePickerElClick.bind(this),this.filePickerEl=(r=this.shadowRoot)==null?void 0:r.querySelector("button"),(n=(i=this.shadowRoot)==null?void 0:i.querySelector("slot"))==null||n.addEventListener("slotchange",y=>{let U=y.currentTarget;this.filePickerEl=U.assignedElements({flatten:!0}).filter(A=>!["STYLE"].includes(A.nodeName))[0]})}connectedCallback(){if(u(this,g,h(this)),u(this,S,new AbortController),s(this,g)){let e={signal:s(this,S).signal};s(this,g).addEventListener("file-ready",()=>{this.toggleAttribute("file-ready",!0)},e),s(this,g).addEventListener("uploadstart",()=>this.toggleAttribute("upload-in-progress",!0),e),s(this,g).addEventListener("success",()=>{this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!0)},e),s(this,g).addEventListener("reset",()=>{this.toggleAttribute("file-ready",!1)},e),this.toggleAttribute("upload-in-progress",s(this,g).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",s(this,g).hasAttribute("upload-complete")),this.toggleAttribute("file-ready",s(this,g).hasAttribute("file-ready"))}}disconnectedCallback(){var e;(e=s(this,S))==null||e.abort()}get filePickerEl(){return s(this,b)}set filePickerEl(e){e!==s(this,b)&&(s(this,b)&&s(this,b).removeEventListener("click",this.handleFilePickerElClick),u(this,b,e),s(this,b)&&s(this,b).addEventListener("click",this.handleFilePickerElClick))}handleFilePickerElClick(){var i,n;let e=this.getAttribute("mux-uploader"),r=e?p.getElementById(e):this.getRootNode().host;(n=(i=r==null?void 0:r.shadowRoot)==null?void 0:i.querySelector("#hidden-file-input"))==null||n.click()}};b=new WeakMap,g=new WeakMap,S=new WeakMap;a.customElements.get("mux-uploader-file-select")||a.customElements.define("mux-uploader-file-select",N);var ce=N;function $(o,t){return o?"":t}var Ue=(o,t)=>{if(t==null||t===!1)return"";let e=t===!0?"":`${t}`;return`${o}="${e}"`};function Y(o){let{noDrop:t,noProgress:e,noStatus:r,noRetry:i,pausable:n,type:y}=o,U=t?"div":'mux-uploader-drop overlay part="drop"',A=$(e,` | ||
<mux-uploader-progress part="progress progress-percentage" type="percentage"></mux-uploader-progress> | ||
<mux-uploader-progress part="progress progress-bar" ${Ue("type",l)}></mux-uploader-progress> | ||
`),ye=$(s,'<mux-uploader-status part="status"></mux-uploader-status>'),ve=$(i,'<mux-uploader-retry part="retry"></mux-uploader-retry>'),xe=$(!n,'<mux-uploader-pause part="pause"></mux-uploader-pause>');return h.createRange().createContextualFragment(` | ||
<mux-uploader-progress part="progress progress-bar" ${Ue("type",y)}></mux-uploader-progress> | ||
`),ye=$(r,'<mux-uploader-status part="status"></mux-uploader-status>'),ve=$(i,'<mux-uploader-retry part="retry"></mux-uploader-retry>'),xe=$(!n,'<mux-uploader-pause part="pause"></mux-uploader-pause>');return p.createRange().createContextualFragment(` | ||
<${U}> | ||
@@ -274,3 +274,3 @@ ${ye} | ||
</${U}> | ||
`)}var ge=h.createElement("template");ge.innerHTML=` | ||
`)}var ge=p.createElement("template");ge.innerHTML=` | ||
<style> | ||
@@ -293,3 +293,3 @@ :host { | ||
<mux-uploader-sr-text></mux-uploader-sr-text> | ||
`;var B=class extends a.HTMLElement{constructor(){var s;super();this.attachShadow({mode:"open"}).appendChild(ge.content.cloneNode(!0)),this.updateLayout(),(s=this.hiddenFileInput)==null||s.addEventListener("change",()=>{var n,l;let i=(l=(n=this.hiddenFileInput)==null?void 0:n.files)==null?void 0:l[0];this.toggleAttribute("file-ready",!!i),i&&this.dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:i}))})}static get observedAttributes(){return["pausable","type","no-drop","no-progress","no-status","no-retry","max-file-size","use-large-file-workaround"]}connectedCallback(){this.addEventListener("file-ready",this.handleUpload),this.addEventListener("reset",this.resetState)}disconnectedCallback(){this.removeEventListener("file-ready",this.handleUpload,!1),this.removeEventListener("reset",this.resetState)}attributeChangedCallback(){this.updateLayout()}get hiddenFileInput(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("#hidden-file-input")}get endpoint(){var e;return(e=this.getAttribute("endpoint"))!=null?e:this._endpoint}set endpoint(e){e!==this.endpoint&&(typeof e=="string"?this.setAttribute("endpoint",e):e==null&&this.removeAttribute("endpoint"),this._endpoint=e)}get type(){var e;return(e=this.getAttribute("type"))!=null?e:void 0}set type(e){e!=this.type&&(e?this.setAttribute("type",e):this.removeAttribute("type"))}get noDrop(){return this.hasAttribute("no-drop")}set noDrop(e){this.toggleAttribute("no-drop",!!e)}get noProgress(){return this.hasAttribute("no-progress")}set noProgress(e){this.toggleAttribute("no-progress",!!e)}get noStatus(){return this.hasAttribute("no-status")}set noStatus(e){this.toggleAttribute("no-status",!!e)}get noRetry(){return this.hasAttribute("no-retry")}set noRetry(e){this.toggleAttribute("no-retry",!!e)}get pausable(){return this.hasAttribute("pausable")}set pausable(e){this.toggleAttribute("pausable",!!e)}get dynamicChunkSize(){return this.hasAttribute("dynamic-chunk-size")}set dynamicChunkSize(e){e!==this.hasAttribute("dynamic-chunk-size")&&(e?this.setAttribute("dynamic-chunk-size",""):this.removeAttribute("dynamic-chunk-size"))}get useLargeFileWorkaround(){return this.hasAttribute("use-large-file-workaround")}set useLargeFileWorkaround(e){e!=this.useLargeFileWorkaround&&this.toggleAttribute("use-large-file-workaround",!!e)}get maxFileSize(){let e=this.getAttribute("max-file-size");return e!==null?parseInt(e):void 0}set maxFileSize(e){e?this.setAttribute("max-file-size",e.toString()):this.removeAttribute("max-file-size")}get chunkSize(){let e=this.getAttribute("chunk-size");return e!==null?parseInt(e):void 0}set chunkSize(e){e?this.setAttribute("chunk-size",e.toString()):this.removeAttribute("chunk-size")}get upload(){return this._upload}get paused(){var e,s;return(s=(e=this.upload)==null?void 0:e.paused)!=null?s:!1}set paused(e){if(!this.upload){console.warn("Pausing before an upload has begun is unsupported");return}let s=!!e;s!==this.paused&&(s?this.upload.pause():this.upload.resume(),this.toggleAttribute("paused",s),this.dispatchEvent(new CustomEvent("pausedchange",{detail:s})))}updateLayout(){var i,n;let e=(i=this.shadowRoot)==null?void 0:i.querySelector("mux-uploader-drop, div");e&&e.remove();let s=Y(this);(n=this.shadowRoot)==null||n.appendChild(s)}setError(e){this.setAttribute("upload-error",""),this.dispatchEvent(new CustomEvent("uploaderror",{detail:{message:e}}))}resetState(){this.removeAttribute("upload-error"),this.removeAttribute("upload-in-progress"),this.removeAttribute("upload-complete"),this.hiddenFileInput.value=""}handleUpload(e){let s=this.endpoint,i=this.dynamicChunkSize;if(s)this.removeAttribute("upload-error");else{this.setError("No url or endpoint specified -- cannot handleUpload");return}try{let n=me.UpChunk.createUpload({endpoint:s,dynamicChunkSize:i,file:e.detail,maxFileSize:this.maxFileSize,chunkSize:this.chunkSize,useLargeFileWorkaround:this.useLargeFileWorkaround});this._upload=n,this.dispatchEvent(new CustomEvent("uploadstart",{detail:{file:n.file,chunkSize:n.chunkSize}})),this.setAttribute("upload-in-progress",""),n.offline&&this.dispatchEvent(new CustomEvent("offline")),n.on("attempt",l=>{this.dispatchEvent(new CustomEvent("chunkattempt",l))}),n.on("chunkSuccess",l=>{this.dispatchEvent(new CustomEvent("chunksuccess",l))}),n.on("error",l=>{this.setAttribute("upload-error",""),console.error("error handler",l.detail.message),this.dispatchEvent(new CustomEvent("uploaderror",l))}),n.on("progress",l=>{this.dispatchEvent(new CustomEvent("progress",l))}),n.on("success",l=>{this.removeAttribute("upload-in-progress"),this.setAttribute("upload-complete",""),this.dispatchEvent(new CustomEvent("success",l))}),n.on("offline",l=>{this.dispatchEvent(new CustomEvent("offline",l))}),n.on("online",l=>{this.dispatchEvent(new CustomEvent("online",l))})}catch(n){n instanceof Error&&this.setError(n.message)}}};a.customElements.get("mux-uploader")||(a.customElements.define("mux-uploader",B),a.MuxUploaderElement=B);var fe=B;var be=h.createElement("template");be.innerHTML=` | ||
`;var B=class extends a.HTMLElement{static get observedAttributes(){return["pausable","type","no-drop","no-progress","no-status","no-retry","max-file-size","use-large-file-workaround"]}constructor(){var e;super(),this.attachShadow({mode:"open"}).appendChild(ge.content.cloneNode(!0)),this.updateLayout(),(e=this.hiddenFileInput)==null||e.addEventListener("change",()=>{var i,n;let r=(n=(i=this.hiddenFileInput)==null?void 0:i.files)==null?void 0:n[0];this.toggleAttribute("file-ready",!!r),r&&this.dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:r}))})}connectedCallback(){this.addEventListener("file-ready",this.handleUpload),this.addEventListener("reset",this.resetState)}disconnectedCallback(){this.removeEventListener("file-ready",this.handleUpload,!1),this.removeEventListener("reset",this.resetState)}attributeChangedCallback(){this.updateLayout()}get hiddenFileInput(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("#hidden-file-input")}get endpoint(){var t;return(t=this.getAttribute("endpoint"))!=null?t:this._endpoint}set endpoint(t){t!==this.endpoint&&(typeof t=="string"?this.setAttribute("endpoint",t):t==null&&this.removeAttribute("endpoint"),this._endpoint=t)}get type(){var t;return(t=this.getAttribute("type"))!=null?t:void 0}set type(t){t!=this.type&&(t?this.setAttribute("type",t):this.removeAttribute("type"))}get noDrop(){return this.hasAttribute("no-drop")}set noDrop(t){this.toggleAttribute("no-drop",!!t)}get noProgress(){return this.hasAttribute("no-progress")}set noProgress(t){this.toggleAttribute("no-progress",!!t)}get noStatus(){return this.hasAttribute("no-status")}set noStatus(t){this.toggleAttribute("no-status",!!t)}get noRetry(){return this.hasAttribute("no-retry")}set noRetry(t){this.toggleAttribute("no-retry",!!t)}get pausable(){return this.hasAttribute("pausable")}set pausable(t){this.toggleAttribute("pausable",!!t)}get dynamicChunkSize(){return this.hasAttribute("dynamic-chunk-size")}set dynamicChunkSize(t){t!==this.hasAttribute("dynamic-chunk-size")&&(t?this.setAttribute("dynamic-chunk-size",""):this.removeAttribute("dynamic-chunk-size"))}get useLargeFileWorkaround(){return this.hasAttribute("use-large-file-workaround")}set useLargeFileWorkaround(t){t!=this.useLargeFileWorkaround&&this.toggleAttribute("use-large-file-workaround",!!t)}get maxFileSize(){let t=this.getAttribute("max-file-size");return t!==null?parseInt(t):void 0}set maxFileSize(t){t?this.setAttribute("max-file-size",t.toString()):this.removeAttribute("max-file-size")}get chunkSize(){let t=this.getAttribute("chunk-size");return t!==null?parseInt(t):void 0}set chunkSize(t){t?this.setAttribute("chunk-size",t.toString()):this.removeAttribute("chunk-size")}get upload(){return this._upload}get paused(){var t,e;return(e=(t=this.upload)==null?void 0:t.paused)!=null?e:!1}set paused(t){if(!this.upload){console.warn("Pausing before an upload has begun is unsupported");return}let e=!!t;e!==this.paused&&(e?this.upload.pause():this.upload.resume(),this.toggleAttribute("paused",e),this.dispatchEvent(new CustomEvent("pausedchange",{detail:e})))}updateLayout(){var r,i;let t=(r=this.shadowRoot)==null?void 0:r.querySelector("mux-uploader-drop, div");t&&t.remove();let e=Y(this);(i=this.shadowRoot)==null||i.appendChild(e)}setError(t){this.setAttribute("upload-error",""),this.dispatchEvent(new CustomEvent("uploaderror",{detail:{message:t}}))}resetState(){this.removeAttribute("upload-error"),this.removeAttribute("upload-in-progress"),this.removeAttribute("upload-complete"),this.hiddenFileInput.value=""}handleUpload(t){let e=this.endpoint,r=this.dynamicChunkSize;if(e)this.removeAttribute("upload-error");else{this.setError("No url or endpoint specified -- cannot handleUpload");return}try{let i=me.UpChunk.createUpload({endpoint:e,dynamicChunkSize:r,file:t.detail,maxFileSize:this.maxFileSize,chunkSize:this.chunkSize,useLargeFileWorkaround:this.useLargeFileWorkaround});this._upload=i,this.dispatchEvent(new CustomEvent("uploadstart",{detail:{file:i.file,chunkSize:i.chunkSize}})),this.setAttribute("upload-in-progress",""),i.offline&&this.dispatchEvent(new CustomEvent("offline")),i.on("attempt",n=>{this.dispatchEvent(new CustomEvent("chunkattempt",n))}),i.on("chunkSuccess",n=>{this.dispatchEvent(new CustomEvent("chunksuccess",n))}),i.on("error",n=>{this.setAttribute("upload-error",""),console.error("error handler",n.detail.message),this.dispatchEvent(new CustomEvent("uploaderror",n))}),i.on("progress",n=>{this.dispatchEvent(new CustomEvent("progress",n))}),i.on("success",n=>{this.removeAttribute("upload-in-progress"),this.setAttribute("upload-complete",""),this.dispatchEvent(new CustomEvent("success",n))}),i.on("offline",n=>{this.dispatchEvent(new CustomEvent("offline",n))}),i.on("online",n=>{this.dispatchEvent(new CustomEvent("online",n))})}catch(i){i instanceof Error&&this.setError(i.message)}}};a.customElements.get("mux-uploader")||(a.customElements.define("mux-uploader",B),a.MuxUploaderElement=B);var fe=B;var be=p.createElement("template");be.innerHTML=` | ||
<style> | ||
@@ -308,3 +308,3 @@ | ||
<div class="sr-only" id="sr-only" aria-live="polite"></div> | ||
`;var v,K=class extends a.HTMLElement{constructor(){var s;super();u(this,v,void 0);this.attachShadow({mode:"open"}).appendChild(be.content.cloneNode(!0)),this.srOnlyText=(s=this.shadowRoot)==null?void 0:s.getElementById("sr-only")}connectedCallback(){d(this,v,c(this)),t(this,v)&&t(this,v).addEventListener("success",this.updateText.bind(this))}disconnectedCallback(){t(this,v)&&t(this,v).removeEventListener("success",this.updateText.bind(this))}updateText(){this.srOnlyText&&(this.srOnlyText.textContent="Upload complete!")}};v=new WeakMap;a.customElements.get("mux-uploader-sr-text")||a.customElements.define("mux-uploader-sr-text",K);var Ee=K;var Re=fe; | ||
`;var v,K=class extends a.HTMLElement{constructor(){var r;super();l(this,v,void 0);this.attachShadow({mode:"open"}).appendChild(be.content.cloneNode(!0)),this.srOnlyText=(r=this.shadowRoot)==null?void 0:r.getElementById("sr-only")}connectedCallback(){u(this,v,h(this)),s(this,v)&&s(this,v).addEventListener("success",this.updateText.bind(this))}disconnectedCallback(){s(this,v)&&s(this,v).removeEventListener("success",this.updateText.bind(this))}updateText(){this.srOnlyText&&(this.srOnlyText.textContent="Upload complete!")}};v=new WeakMap;a.customElements.get("mux-uploader-sr-text")||a.customElements.define("mux-uploader-sr-text",K);var Ee=K;var Re=fe; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,4 +0,4 @@ | ||
"use strict";(()=>{var Mt=Object.defineProperty;var zt=(e,r)=>{for(var t in r)Mt(e,t,{get:r[t],enumerable:!0})};var Ne=(e,r,t)=>{if(!r.has(e))throw TypeError("Cannot "+t)};var i=(e,r,t)=>(Ne(e,r,"read from private field"),t?t.call(e):r.get(e)),c=(e,r,t)=>{if(r.has(e))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(e):r.set(e,t)},f=(e,r,t,n)=>(Ne(e,r,"write to private field"),n?n.call(e,t):r.set(e,t),t);var we={};zt(we,{ProgressTypes:()=>F});var F={BAR:"bar",RADIAL:"radial",PERCENTAGE:"percentage"};var H=class{addEventListener(){}removeEventListener(){}dispatchEvent(r){return!0}};if(typeof DocumentFragment=="undefined"){class e extends H{}globalThis.DocumentFragment=e}var K=class extends H{},xe=class extends H{},Pt={get(e){},define(e,r,t){},getName(e){return null},upgrade(e){},whenDefined(e){return Promise.resolve(K)}},Y,Ae=class{constructor(r,t={}){c(this,Y,void 0);f(this,Y,t==null?void 0:t.detail)}get detail(){return i(this,Y)}initCustomEvent(){}};Y=new WeakMap;function Ot(e,r){return new K}var je={document:{createElement:Ot},DocumentFragment,customElements:Pt,CustomEvent:Ae,EventTarget:H,HTMLElement:K,HTMLVideoElement:xe},$e=typeof window=="undefined"||typeof globalThis.customElements=="undefined",d=$e?je:globalThis,v=$e?je.document:globalThis.document;var Ut=Object.create,et=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,tt=Object.getOwnPropertyNames,It=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty,Q=(e,r)=>function(){return r||(0,e[tt(e)[0]])((r={exports:{}}).exports,r),r.exports},Ft=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of tt(r))!Dt.call(e,s)&&s!==t&&et(e,s,{get:()=>r[s],enumerable:!(n=Bt(r,s))||n.enumerable});return e},Ht=(e,r,t)=>(t=e!=null?Ut(It(e)):{},Ft(r||!e||!e.__esModule?et(t,"default",{value:e,enumerable:!0}):t,e)),Nt=Q({"node_modules/global/window.js"(e,r){var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t={},r.exports=t}}),jt=Q({"node_modules/is-function/index.js"(e,r){r.exports=n;var t=Object.prototype.toString;function n(s){if(!s)return!1;var o=t.call(s);return o==="[object Function]"||typeof s=="function"&&o!=="[object RegExp]"||typeof window!="undefined"&&(s===window.setTimeout||s===window.alert||s===window.confirm||s===window.prompt)}}}),$t=Q({"node_modules/parse-headers/parse-headers.js"(e,r){var t=function(s){return s.replace(/^\s+|\s+$/g,"")},n=function(s){return Object.prototype.toString.call(s)==="[object Array]"};r.exports=function(s){if(!s)return{};for(var o={},a=t(s).split(` | ||
`),u=0;u<a.length;u++){var p=a[u],y=p.indexOf(":"),E=t(p.slice(0,y)).toLowerCase(),S=t(p.slice(y+1));typeof o[E]=="undefined"?o[E]=S:n(o[E])?o[E].push(S):o[E]=[o[E],S]}return o}}}),Wt=Q({"node_modules/xtend/immutable.js"(e,r){r.exports=n;var t=Object.prototype.hasOwnProperty;function n(){for(var s={},o=0;o<arguments.length;o++){var a=arguments[o];for(var u in a)t.call(a,u)&&(s[u]=a[u])}return s}}}),Xt=Q({"node_modules/xhr/index.js"(e,r){"use strict";var t=Nt(),n=jt(),s=$t(),o=Wt();r.exports=y,r.exports.default=y,y.XMLHttpRequest=t.XMLHttpRequest||ye,y.XDomainRequest="withCredentials"in new y.XMLHttpRequest?y.XMLHttpRequest:t.XDomainRequest,a(["get","put","post","patch","head","delete"],function(l){y[l==="delete"?"del":l]=function(k,C,U){return C=p(k,C,U),C.method=l.toUpperCase(),E(C)}});function a(l,k){for(var C=0;C<l.length;C++)k(l[C])}function u(l){for(var k in l)if(l.hasOwnProperty(k))return!1;return!0}function p(l,k,C){var U=l;return n(k)?(C=k,typeof l=="string"&&(U={uri:l})):U=o(k,{uri:l}),U.callback=C,U}function y(l,k,C){return k=p(l,k,C),E(k)}function E(l){if(typeof l.callback=="undefined")throw new Error("callback argument missing");var k=!1,C=function(D,ae,_t){k||(k=!0,l.callback(D,ae,_t))};function U(){h.readyState===4&&setTimeout(De,0)}function Rt(){var g=void 0;if(h.response?g=h.response:g=h.responseText||S(h),Fe)try{g=JSON.parse(g)}catch{}return g}function Ee(g){return clearTimeout(Se),g instanceof Error||(g=new Error(""+(g||"Unknown XMLHttpRequest Error"))),g.statusCode=0,C(g,He)}function De(){if(!oe){var g;clearTimeout(Se),l.useXDR&&h.status===void 0?g=200:g=h.status===1223?204:h.status;var D=He,ae=null;return g!==0?(D={body:Rt(),statusCode:g,method:V,headers:{},url:ve,rawRequest:h},h.getAllResponseHeaders&&(D.headers=s(h.getAllResponseHeaders()))):ae=new Error("Internal XMLHttpRequest Error"),C(ae,D,D.body)}}var h=l.xhr||null;h||(l.cors||l.useXDR?h=new y.XDomainRequest:h=new y.XMLHttpRequest);var ie,oe,ve=h.url=l.uri||l.url,V=h.method=l.method||"GET",ke=l.body||l.data,M=h.headers=l.headers||{},Ce=!!l.sync,Fe=!1,Se,He={body:void 0,headers:{},statusCode:0,method:V,url:ve,rawRequest:h};if("json"in l&&l.json!==!1&&(Fe=!0,M.accept||M.Accept||(M.Accept="application/json"),V!=="GET"&&V!=="HEAD"&&(M["content-type"]||M["Content-Type"]||(M["Content-Type"]="application/json"),ke=JSON.stringify(l.json===!0?ke:l.json))),h.onreadystatechange=U,h.onload=De,h.onerror=Ee,h.onprogress=function(){},h.onabort=function(){oe=!0},h.ontimeout=Ee,h.open(V,ve,!Ce,l.username,l.password),Ce||(h.withCredentials=!!l.withCredentials),!Ce&&l.timeout>0&&(Se=setTimeout(function(){if(!oe){oe=!0,h.abort("timeout");var g=new Error("XMLHttpRequest timeout");g.code="ETIMEDOUT",Ee(g)}},l.timeout)),h.setRequestHeader)for(ie in M)M.hasOwnProperty(ie)&&h.setRequestHeader(ie,M[ie]);else if(l.headers&&!u(l.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in l&&(h.responseType=l.responseType),"beforeSend"in l&&typeof l.beforeSend=="function"&&l.beforeSend(h),h.send(ke||null),h}function S(l){try{if(l.responseType==="document")return l.responseXML;var k=l.responseXML&&l.responseXML.documentElement.nodeName==="parsererror";if(l.responseType===""&&!k)return l.responseXML}catch{}return null}function ye(){}}});function ze(e,r,...t){if(!e)throw new TypeError(rt(r,t))}function rt(e,r){let t=0;return e.replace(/%[os]/gu,()=>nt(r[t++]))}function nt(e){return typeof e!="object"||e===null?String(e):Object.prototype.toString.call(e)}var We;function qt(e){try{let r=e instanceof Error?e:new Error(nt(e));if(We){We(r);return}if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:r,message:r.message}));else if(typeof process!="undefined"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)}catch{}}var L=typeof window!="undefined"?window:typeof self!="undefined"?self:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:void 0,Xe,z=class{constructor(e,r){this.code=e,this.message=r}warn(...e){var r;try{if(Xe){Xe({...this,args:e});return}let t=((r=new Error().stack)!==null&&r!==void 0?r:"").replace(/^(?:.+?\n){2}/gu,` | ||
`);console.warn(this.message,...e,t)}catch{}}},Gt=new z("W01","Unable to initialize event under dispatching."),Vt=new z("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),Kt=new z("W03","Assigning any truthy value to 'returnValue' property has no effect."),Yt=new z("W04","Unable to preventDefault on non-cancelable events."),Zt=new z("W05","Unable to preventDefault inside passive event listener invocation."),Jt=new z("W06","An event listener wasn't added because it has been added already: %o, %o"),Te=new z("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),qe=new z("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),Mr=new z("W09","Event attribute handler must be a function: %o"),P=class{static get NONE(){return Ge}static get CAPTURING_PHASE(){return Ve}static get AT_TARGET(){return Ke}static get BUBBLING_PHASE(){return Ye}constructor(e,r){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let t=r!=null?r:{};Me.set(this,{type:String(e),bubbles:!!t.bubbles,cancelable:!!t.cancelable,composed:!!t.composed,target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return m(this).type}get target(){return m(this).target}get srcElement(){return m(this).target}get currentTarget(){return m(this).currentTarget}composedPath(){let e=m(this).currentTarget;return e?[e]:[]}get NONE(){return Ge}get CAPTURING_PHASE(){return Ve}get AT_TARGET(){return Ke}get BUBBLING_PHASE(){return Ye}get eventPhase(){return m(this).dispatchFlag?2:0}stopPropagation(){m(this).stopPropagationFlag=!0}get cancelBubble(){return m(this).stopPropagationFlag}set cancelBubble(e){e?m(this).stopPropagationFlag=!0:Vt.warn()}stopImmediatePropagation(){let e=m(this);e.stopPropagationFlag=e.stopImmediatePropagationFlag=!0}get bubbles(){return m(this).bubbles}get cancelable(){return m(this).cancelable}get returnValue(){return!m(this).canceledFlag}set returnValue(e){e?Kt.warn():Ze(m(this))}preventDefault(){Ze(m(this))}get defaultPrevented(){return m(this).canceledFlag}get composed(){return m(this).composed}get isTrusted(){return!1}get timeStamp(){return m(this).timeStamp}initEvent(e,r=!1,t=!1){let n=m(this);if(n.dispatchFlag){Gt.warn();return}Me.set(this,{...n,type:String(e),bubbles:!!r,cancelable:!!t,target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}},Ge=0,Ve=1,Ke=2,Ye=3,Me=new WeakMap;function m(e,r="this"){let t=Me.get(e);return ze(t!=null,"'%s' must be an object that Event constructor created, but got another one: %o",r,e),t}function Ze(e){if(e.inPassiveListenerFlag){Zt.warn();return}if(!e.cancelable){Yt.warn();return}e.canceledFlag=!0}Object.defineProperty(P,"NONE",{enumerable:!0});Object.defineProperty(P,"CAPTURING_PHASE",{enumerable:!0});Object.defineProperty(P,"AT_TARGET",{enumerable:!0});Object.defineProperty(P,"BUBBLING_PHASE",{enumerable:!0});var Le=Object.getOwnPropertyNames(P.prototype);for(let e=0;e<Le.length;++e)Le[e]!=="constructor"&&Object.defineProperty(P.prototype,Le[e],{enumerable:!0});typeof L!="undefined"&&typeof L.Event!="undefined"&&Object.setPrototypeOf(P.prototype,L.Event.prototype);function Qt(e){return L.DOMException?new L.DOMException(e,"InvalidStateError"):(N==null&&(N=class st extends Error{constructor(t){super(t),Error.captureStackTrace&&Error.captureStackTrace(this,st)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(N.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),Qe(N),Qe(N.prototype)),new N(e))}var N,Je={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};function Qe(e){let r=Object.keys(Je);for(let t=0;t<r.length;++t){let n=r[t],s=Je[n];Object.defineProperty(e,n,{get(){return s},configurable:!0,enumerable:!0})}}var ue=class extends P{static wrap(e){return new(ot(e))(e)}constructor(e){super(e.type,{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed}),e.cancelBubble&&super.stopPropagation(),e.defaultPrevented&&super.preventDefault(),it.set(this,{original:e});let r=Object.keys(e);for(let t=0;t<r.length;++t){let n=r[t];n in this||Object.defineProperty(this,n,at(e,n))}}stopPropagation(){super.stopPropagation();let{original:e}=B(this);"stopPropagation"in e&&e.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(e){super.cancelBubble=e;let{original:r}=B(this);"cancelBubble"in r&&(r.cancelBubble=e)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:e}=B(this);"stopImmediatePropagation"in e&&e.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(e){super.returnValue=e;let{original:r}=B(this);"returnValue"in r&&(r.returnValue=e)}preventDefault(){super.preventDefault();let{original:e}=B(this);"preventDefault"in e&&e.preventDefault()}get timeStamp(){let{original:e}=B(this);return"timeStamp"in e?e.timeStamp:super.timeStamp}},it=new WeakMap;function B(e){let r=it.get(e);return ze(r!=null,"'this' is expected an Event object, but got",e),r}var le=new WeakMap;le.set(Object.prototype,ue);typeof L!="undefined"&&typeof L.Event!="undefined"&&le.set(L.Event.prototype,ue);function ot(e){let r=Object.getPrototypeOf(e);if(r==null)return ue;let t=le.get(r);return t==null&&(t=er(ot(r),r),le.set(r,t)),t}function er(e,r){class t extends e{}let n=Object.keys(r);for(let s=0;s<n.length;++s)Object.defineProperty(t.prototype,n[s],at(r,n[s]));return t}function at(e,r){let t=Object.getOwnPropertyDescriptor(e,r);return{get(){let n=B(this).original,s=n[r];return typeof s=="function"?s.bind(n):s},set(n){let s=B(this).original;s[r]=n},configurable:t.configurable,enumerable:t.enumerable}}function tr(e,r,t,n,s,o){return{callback:e,flags:(r?1:0)|(t?2:0)|(n?4:0),signal:s,signalListener:o}}function rr(e){e.flags|=8}function lt(e){return(e.flags&1)===1}function ut(e){return(e.flags&2)===2}function dt(e){return(e.flags&4)===4}function nr(e){return(e.flags&8)===8}function sr({callback:e},r,t){try{typeof e=="function"?e.call(r,t):typeof e.handleEvent=="function"&&e.handleEvent(t)}catch(n){qt(n)}}function ht({listeners:e},r,t){for(let n=0;n<e.length;++n)if(e[n].callback===r&<(e[n])===t)return n;return-1}function ir(e,r,t,n,s,o){let a;o&&(a=pt.bind(null,e,r,t),o.addEventListener("abort",a));let u=tr(r,t,n,s,o,a);return e.cow?(e.cow=!1,e.listeners=[...e.listeners,u]):e.listeners.push(u),u}function pt(e,r,t){let n=ht(e,r,t);return n!==-1?ct(e,n):!1}function ct(e,r,t=!1){let n=e.listeners[r];return rr(n),n.signal&&n.signal.removeEventListener("abort",n.signalListener),e.cow&&!t?(e.cow=!1,e.listeners=e.listeners.filter((s,o)=>o!==r),!1):(e.listeners.splice(r,1),!0)}function or(){return Object.create(null)}function ar(e,r){var t;return(t=e[r])!==null&&t!==void 0?t:e[r]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}var de=class{constructor(){ft.set(this,or())}addEventListener(e,r,t){let n=Re(this),{callback:s,capture:o,once:a,passive:u,signal:p,type:y}=lr(e,r,t);if(s==null||p!=null&&p.aborted)return;let E=ar(n,y),S=ht(E,s,o);if(S!==-1){dr(E.listeners[S],u,a,p);return}ir(E,s,o,u,a,p)}removeEventListener(e,r,t){let n=Re(this),{callback:s,capture:o,type:a}=ur(e,r,t),u=n[a];s!=null&&u&&pt(u,s,o)}dispatchEvent(e){let r=Re(this)[String(e.type)];if(r==null)return!0;let t=e instanceof P?e:ue.wrap(e),n=m(t,"event");if(n.dispatchFlag)throw Qt("This event has been in dispatching.");if(n.dispatchFlag=!0,n.target=n.currentTarget=this,!n.stopPropagationFlag){let{cow:s,listeners:o}=r;r.cow=!0;for(let a=0;a<o.length;++a){let u=o[a];if(!nr(u)&&(dt(u)&&ct(r,a,!s)&&(a-=1),n.inPassiveListenerFlag=ut(u),sr(u,this,t),n.inPassiveListenerFlag=!1,n.stopImmediatePropagationFlag))break}s||(r.cow=!1)}return n.target=null,n.currentTarget=null,n.stopImmediatePropagationFlag=!1,n.stopPropagationFlag=!1,n.dispatchFlag=!1,!n.canceledFlag}},ft=new WeakMap;function Re(e,r="this"){let t=ft.get(e);return ze(t!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",r,e),t}function lr(e,r,t){var n;return gt(r),typeof t=="object"&&t!==null?{type:String(e),callback:r!=null?r:void 0,capture:!!t.capture,passive:!!t.passive,once:!!t.once,signal:(n=t.signal)!==null&&n!==void 0?n:void 0}:{type:String(e),callback:r!=null?r:void 0,capture:!!t,passive:!1,once:!1,signal:void 0}}function ur(e,r,t){return gt(r),typeof t=="object"&&t!==null?{type:String(e),callback:r!=null?r:void 0,capture:!!t.capture}:{type:String(e),callback:r!=null?r:void 0,capture:!!t}}function gt(e){if(!(typeof e=="function"||typeof e=="object"&&e!==null&&typeof e.handleEvent=="function")){if(e==null||typeof e=="object"){qe.warn(e);return}throw new TypeError(rt(qe.message,[e]))}}function dr(e,r,t,n){Jt.warn(lt(e)?"capture":"bubble",e.callback),ut(e)!==r&&Te.warn("passive"),dt(e)!==t&&Te.warn("once"),e.signal!==n&&Te.warn("signal")}var _e=Object.getOwnPropertyNames(de.prototype);for(let e=0;e<_e.length;++e)_e[e]!=="constructor"&&Object.defineProperty(de.prototype,_e[e],{enumerable:!0});typeof L!="undefined"&&typeof L.EventTarget!="undefined"&&Object.setPrototypeOf(de.prototype,L.EventTarget.prototype);var hr=Ht(Xt()),Pe=30720,ee=512e3,te=256,Z=(e,{minChunkSize:r=te,maxChunkSize:t=ee}={})=>e==null||typeof e=="number"&&e>=256&&e%256===0&&e>=r&&e<=t,J=(e,{minChunkSize:r=te,maxChunkSize:t=ee}={})=>new TypeError(`chunkSize ${e} must be a positive number in multiples of 256, between ${r} and ${t}`),pr=class{constructor(e,r={}){this.readableStream=e;var t,n,s;if(!Z(r.defaultChunkSize,r))throw J(r.defaultChunkSize,r);this.defaultChunkSize=(t=r.defaultChunkSize)!=null?t:Pe,this.minChunkSize=(n=r.minChunkSize)!=null?n:te,this.maxChunkSize=(s=r.maxChunkSize)!=null?s:ee}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!Z(e,this))throw J(e,this);this._chunkSize=e}get chunkByteSize(){return this.chunkSize*1024}get error(){return this._error}async*[Symbol.asyncIterator](){let e,r=this.readableStream.getReader();try{for(;;){let{done:t,value:n}=await r.read();if(t){if(e){let o=e;e=void 0,yield o}break}let s=n instanceof Uint8Array?new Blob([n],{type:"application/octet-stream"}):n;for(e=e?new Blob([e,s]):s;e;)if(e.size===this.chunkByteSize){let o=e;e=void 0,yield o;break}else{if(e.size<this.chunkByteSize)break;{let o=e.slice(0,this.chunkByteSize);e=e.slice(this.chunkByteSize),yield o}}}}catch(t){this._error=t}finally{if(e){let t=e;e=void 0,yield t}r.releaseLock();return}}},cr=class{constructor(e,r={}){this.file=e;var t,n,s;if(!Z(r.defaultChunkSize,r))throw J(r.defaultChunkSize,r);this.defaultChunkSize=(t=r.defaultChunkSize)!=null?t:Pe,this.minChunkSize=(n=r.minChunkSize)!=null?n:te,this.maxChunkSize=(s=r.maxChunkSize)!=null?s:ee}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!Z(e,this))throw J(e,this);this._chunkSize=e}get chunkByteSize(){return this.chunkSize*1024}get error(){return this._error}async*[Symbol.asyncIterator](){let e=new FileReader,r=0,t=()=>new Promise(n=>{if(r>=this.file.size){n(void 0);return}let s=Math.min(this.chunkByteSize,this.file.size-r);e.onload=()=>{e.result!==null?n(new Blob([e.result],{type:"application/octet-stream"})):n(void 0)},e.readAsArrayBuffer(this.file.slice(r,r+s))});try{for(;;){let n=await t();if(n)r+=n.size,yield n;else break}}catch(n){this._error=n}}},fr=[200,201,202,204,308],mt=[408,502,503,504],gr=[308],bt=(e,r)=>!!e&&fr.includes(e.statusCode),mr=(e,{retryCodes:r=mt})=>!e||r.includes(e.statusCode),br=(e,r)=>r.attemptCount>=r.attempts||!(bt(e)||mr(e,r)),yr=(e,r)=>{var t;if(!e||!gr.includes(e.statusCode)||!((t=e.headers)!=null&&t.range))return!1;let n=e.headers.range.match(/bytes=(\d+)-(\d+)/);return n?parseInt(n[2],10)!==r.currentChunkEndByte:!1},Oe=class{static createUpload(e){return new Oe(e)}constructor(e){if(this.eventTarget=new de,this.endpoint=e.endpoint,this.file=e.file,this.headers=e.headers||{},this.method=e.method||"PUT",this.attempts=e.attempts||5,this.delayBeforeAttempt=e.delayBeforeAttempt||1,this.retryCodes=e.retryCodes||mt,this.dynamicChunkSize=e.dynamicChunkSize||!1,this.maxFileBytes=(e.maxFileSize||0)*1024,this.chunkCount=0,this.attemptCount=0,this._offline=typeof window!="undefined"&&!window.navigator.onLine,this._paused=!1,this.success=!1,this.nextChunkRangeStart=0,e.useLargeFileWorkaround){let r=t=>{this.chunkedIterable.error&&(console.warn(`Unable to read file of size ${this.file.size} bytes via a ReadableStream. Falling back to in-memory FileReader!`),t.stopImmediatePropagation(),this.chunkedIterable=new cr(this.file,{...e,defaultChunkSize:e.chunkSize}),this.chunkedIterator=this.chunkedIterable[Symbol.asyncIterator](),this.getEndpoint().then(()=>{this.sendChunks()}),this.off("error",r))};this.on("error",r)}this.chunkedIterable=new pr(this.file.stream(),{...e,defaultChunkSize:e.chunkSize}),this.chunkedIterator=this.chunkedIterable[Symbol.asyncIterator](),this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.validateOptions(),this.getEndpoint().then(()=>this.sendChunks()),typeof window!="undefined"&&(window.addEventListener("online",()=>{this.offline&&(this._offline=!1,this.dispatch("online"),this.sendChunks())}),window.addEventListener("offline",()=>{this.offline||(this._offline=!0,this.dispatch("offline"))}))}get maxChunkSize(){var e,r;return(r=(e=this.chunkedIterable)==null?void 0:e.maxChunkSize)!=null?r:ee}get minChunkSize(){var e,r;return(r=(e=this.chunkedIterable)==null?void 0:e.minChunkSize)!=null?r:te}get chunkSize(){var e,r;return(r=(e=this.chunkedIterable)==null?void 0:e.chunkSize)!=null?r:Pe}set chunkSize(e){this.chunkedIterable.chunkSize=e}get chunkByteSize(){return this.chunkedIterable.chunkByteSize}get totalChunkSize(){return Math.ceil(this.file.size/this.chunkByteSize)}on(e,r){this.eventTarget.addEventListener(e,r)}once(e,r){this.eventTarget.addEventListener(e,r,{once:!0})}off(e,r){this.eventTarget.removeEventListener(e,r)}get offline(){return this._offline}get paused(){return this._paused}abort(){var e;this.pause(),(e=this.currentXhr)==null||e.abort()}pause(){this._paused=!0}resume(){this._paused&&(this._paused=!1,this.sendChunks())}get successfulPercentage(){return this.nextChunkRangeStart/this.file.size}dispatch(e,r){let t=new CustomEvent(e,{detail:r});this.eventTarget.dispatchEvent(t)}validateOptions(){if(!this.endpoint||typeof this.endpoint!="function"&&typeof this.endpoint!="string")throw new TypeError("endpoint must be defined as a string or a function that returns a promise");if(!(this.file instanceof File))throw new TypeError("file must be a File object");if(this.headers&&typeof this.headers!="function"&&typeof this.headers!="object")throw new TypeError("headers must be null, an object, or a function that returns an object or a promise");if(!Z(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize}))throw J(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize});if(this.maxChunkSize&&(typeof this.maxChunkSize!="number"||this.maxChunkSize<256||this.maxChunkSize%256!==0||this.maxChunkSize<this.chunkSize||this.maxChunkSize<this.minChunkSize))throw new TypeError(`maxChunkSize must be a positive number in multiples of 256, and larger than or equal to both ${this.minChunkSize} and ${this.chunkSize}`);if(this.minChunkSize&&(typeof this.minChunkSize!="number"||this.minChunkSize<256||this.minChunkSize%256!==0||this.minChunkSize>this.chunkSize||this.minChunkSize>this.maxChunkSize))throw new TypeError(`minChunkSize must be a positive number in multiples of 256, and smaller than ${this.chunkSize} and ${this.maxChunkSize}`);if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error(`file size exceeds maximum (${this.file.size} > ${this.maxFileBytes})`);if(this.attempts&&(typeof this.attempts!="number"||this.attempts<=0))throw new TypeError("retries must be a positive number");if(this.delayBeforeAttempt&&(typeof this.delayBeforeAttempt!="number"||this.delayBeforeAttempt<0))throw new TypeError("delayBeforeAttempt must be a positive number")}getEndpoint(){return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(e=>(this.endpointValue=e,this.endpointValue))}xhrPromise(e){let r=t=>{t.upload.onprogress=n=>{var s;let o=this.totalChunks-this.chunkCount,a=(this.file.size-this.nextChunkRangeStart)/this.file.size/o,p=n.loaded/((s=n.total)!=null?s:this.chunkByteSize)*a;this.dispatch("progress",Math.min((this.successfulPercentage+p)*100,100))}};return new Promise((t,n)=>{this.currentXhr=(0,hr.default)({...e,beforeSend:r},(s,o)=>(this.currentXhr=void 0,s?n(s):t(o)))})}async sendChunk(e){let r=this.nextChunkRangeStart,t=r+e.size-1,s={...await(typeof this.headers=="function"?this.headers():this.headers),"Content-Type":this.file.type,"Content-Range":`bytes ${r}-${t}/${this.file.size}`};return this.dispatch("attempt",{chunkNumber:this.chunkCount,totalChunks:this.totalChunks,chunkSize:this.chunkSize}),this.xhrPromise({headers:s,url:this.endpointValue,method:this.method,body:e})}async sendChunkWithRetries(e){let r=async(a,u)=>{var p;let E=(new Date().getTime()-this.lastChunkStart.getTime())/1e3;if(this.dispatch("chunkSuccess",{chunk:this.chunkCount,chunkSize:this.chunkSize,attempts:this.attemptCount,timeInterval:E,response:a}),this.attemptCount=0,this.chunkCount=((p=this.chunkCount)!=null?p:0)+1,this.nextChunkRangeStart=this.nextChunkRangeStart+this.chunkByteSize,this.dynamicChunkSize){let S=this.chunkSize;E<10?S=Math.min(this.chunkSize*2,this.maxChunkSize):E>30&&(S=Math.max(this.chunkSize/2,this.minChunkSize)),this.chunkSize=Math.ceil(S/256)*256;let ye=(this.file.size-this.nextChunkRangeStart)/this.chunkByteSize;this.totalChunks=Math.ceil(this.chunkCount+ye)}return!0},t=async(a,u)=>(this.dispatch("progress",Math.min(this.successfulPercentage*100,100)),this.dispatch("error",{message:`Server responded with ${a.statusCode}. Stopping upload.`,chunk:this.chunkCount,attempts:this.attemptCount,response:a}),!1),n=async(a,u)=>(this.dispatch("attemptFailure",{message:`An error occured uploading chunk ${this.chunkCount}. ${this.attempts-this.attemptCount} retries left.`,chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount,response:a}),new Promise(p=>{setTimeout(async()=>{if(this._paused||this.offline){this.pendingChunk=e,p(!1);return}let y=await this.sendChunkWithRetries(e);p(y)},this.delayBeforeAttempt*1e3)})),s;try{this.attemptCount=this.attemptCount+1,this.lastChunkStart=new Date,s=await this.sendChunk(e)}catch(a){typeof(a==null?void 0:a.statusCode)=="number"&&(s=a)}let o={retryCodes:this.retryCodes,attemptCount:this.attemptCount,attempts:this.attempts,currentChunkEndByte:this.nextChunkRangeStart+e.size-1};return yr(s,o)?n(s,e):bt(s,o)?r(s,e):br(s,o)?t(s,e):n(s,e)}async sendChunks(){if(this.pendingChunk&&!(this._paused||this.offline)){let e=this.pendingChunk;this.pendingChunk=void 0;let r=await this.sendChunkWithRetries(e);this.success&&r&&this.dispatch("success")}for(;!(this.success||this._paused||this.offline);){let{value:e,done:r}=await this.chunkedIterator.next(),t=!e&&r;if(e&&(t=await this.sendChunkWithRetries(e)),this.chunkedIterable.error){t=!1,this.dispatch("error",{message:`Unable to read file of size ${this.file.size} bytes. Try loading from another browser.`});return}if(this.success=!!r,this.success&&t&&this.dispatch("success"),!t)return}}};var yt=(e,r)=>{if(!e)return null;let t=e.closest(r);return t||yt(e.getRootNode().host,r)},w=e=>{let r=e.getAttribute("mux-uploader");return r?document.getElementById(r):yt(e,"mux-uploader")};var Et=v.createElement("template");Et.innerHTML=` | ||
"use strict";(()=>{var Mt=Object.defineProperty;var zt=(e,t)=>{for(var r in t)Mt(e,r,{get:t[r],enumerable:!0})};var Ne=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var i=(e,t,r)=>(Ne(e,t,"read from private field"),r?r.call(e):t.get(e)),c=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},f=(e,t,r,n)=>(Ne(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var we={};zt(we,{ProgressTypes:()=>F});var F={BAR:"bar",RADIAL:"radial",PERCENTAGE:"percentage"};var H=class{addEventListener(){}removeEventListener(){}dispatchEvent(t){return!0}};if(typeof DocumentFragment=="undefined"){class e extends H{}globalThis.DocumentFragment=e}var K=class extends H{},xe=class extends H{},Pt={get(e){},define(e,t,r){},getName(e){return null},upgrade(e){},whenDefined(e){return Promise.resolve(K)}},Y,Ae=class{constructor(t,r={}){c(this,Y,void 0);f(this,Y,r==null?void 0:r.detail)}get detail(){return i(this,Y)}initCustomEvent(){}};Y=new WeakMap;function Ot(e,t){return new K}var je={document:{createElement:Ot},DocumentFragment,customElements:Pt,CustomEvent:Ae,EventTarget:H,HTMLElement:K,HTMLVideoElement:xe},$e=typeof window=="undefined"||typeof globalThis.customElements=="undefined",d=$e?je:globalThis,v=$e?je.document:globalThis.document;var Ut=Object.create,et=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,tt=Object.getOwnPropertyNames,It=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty,Q=(e,t)=>function(){return t||(0,e[tt(e)[0]])((t={exports:{}}).exports,t),t.exports},Ft=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of tt(t))!Dt.call(e,s)&&s!==r&&et(e,s,{get:()=>t[s],enumerable:!(n=Bt(t,s))||n.enumerable});return e},Ht=(e,t,r)=>(r=e!=null?Ut(It(e)):{},Ft(t||!e||!e.__esModule?et(r,"default",{value:e,enumerable:!0}):r,e)),Nt=Q({"node_modules/global/window.js"(e,t){var r;typeof window!="undefined"?r=window:typeof global!="undefined"?r=global:typeof self!="undefined"?r=self:r={},t.exports=r}}),jt=Q({"node_modules/is-function/index.js"(e,t){t.exports=n;var r=Object.prototype.toString;function n(s){if(!s)return!1;var o=r.call(s);return o==="[object Function]"||typeof s=="function"&&o!=="[object RegExp]"||typeof window!="undefined"&&(s===window.setTimeout||s===window.alert||s===window.confirm||s===window.prompt)}}}),$t=Q({"node_modules/parse-headers/parse-headers.js"(e,t){var r=function(s){return s.replace(/^\s+|\s+$/g,"")},n=function(s){return Object.prototype.toString.call(s)==="[object Array]"};t.exports=function(s){if(!s)return{};for(var o={},l=r(s).split(` | ||
`),u=0;u<l.length;u++){var p=l[u],y=p.indexOf(":"),E=r(p.slice(0,y)).toLowerCase(),S=r(p.slice(y+1));typeof o[E]=="undefined"?o[E]=S:n(o[E])?o[E].push(S):o[E]=[o[E],S]}return o}}}),Wt=Q({"node_modules/xtend/immutable.js"(e,t){t.exports=n;var r=Object.prototype.hasOwnProperty;function n(){for(var s={},o=0;o<arguments.length;o++){var l=arguments[o];for(var u in l)r.call(l,u)&&(s[u]=l[u])}return s}}}),Xt=Q({"node_modules/xhr/index.js"(e,t){"use strict";var r=Nt(),n=jt(),s=$t(),o=Wt();t.exports=y,t.exports.default=y,y.XMLHttpRequest=r.XMLHttpRequest||ye,y.XDomainRequest="withCredentials"in new y.XMLHttpRequest?y.XMLHttpRequest:r.XDomainRequest,l(["get","put","post","patch","head","delete"],function(a){y[a==="delete"?"del":a]=function(k,C,U){return C=p(k,C,U),C.method=a.toUpperCase(),E(C)}});function l(a,k){for(var C=0;C<a.length;C++)k(a[C])}function u(a){for(var k in a)if(a.hasOwnProperty(k))return!1;return!0}function p(a,k,C){var U=a;return n(k)?(C=k,typeof a=="string"&&(U={uri:a})):U=o(k,{uri:a}),U.callback=C,U}function y(a,k,C){return k=p(a,k,C),E(k)}function E(a){if(typeof a.callback=="undefined")throw new Error("callback argument missing");var k=!1,C=function(D,ae,_t){k||(k=!0,a.callback(D,ae,_t))};function U(){h.readyState===4&&setTimeout(De,0)}function Rt(){var g=void 0;if(h.response?g=h.response:g=h.responseText||S(h),Fe)try{g=JSON.parse(g)}catch{}return g}function Ee(g){return clearTimeout(Se),g instanceof Error||(g=new Error(""+(g||"Unknown XMLHttpRequest Error"))),g.statusCode=0,C(g,He)}function De(){if(!oe){var g;clearTimeout(Se),a.useXDR&&h.status===void 0?g=200:g=h.status===1223?204:h.status;var D=He,ae=null;return g!==0?(D={body:Rt(),statusCode:g,method:V,headers:{},url:ve,rawRequest:h},h.getAllResponseHeaders&&(D.headers=s(h.getAllResponseHeaders()))):ae=new Error("Internal XMLHttpRequest Error"),C(ae,D,D.body)}}var h=a.xhr||null;h||(a.cors||a.useXDR?h=new y.XDomainRequest:h=new y.XMLHttpRequest);var ie,oe,ve=h.url=a.uri||a.url,V=h.method=a.method||"GET",ke=a.body||a.data,M=h.headers=a.headers||{},Ce=!!a.sync,Fe=!1,Se,He={body:void 0,headers:{},statusCode:0,method:V,url:ve,rawRequest:h};if("json"in a&&a.json!==!1&&(Fe=!0,M.accept||M.Accept||(M.Accept="application/json"),V!=="GET"&&V!=="HEAD"&&(M["content-type"]||M["Content-Type"]||(M["Content-Type"]="application/json"),ke=JSON.stringify(a.json===!0?ke:a.json))),h.onreadystatechange=U,h.onload=De,h.onerror=Ee,h.onprogress=function(){},h.onabort=function(){oe=!0},h.ontimeout=Ee,h.open(V,ve,!Ce,a.username,a.password),Ce||(h.withCredentials=!!a.withCredentials),!Ce&&a.timeout>0&&(Se=setTimeout(function(){if(!oe){oe=!0,h.abort("timeout");var g=new Error("XMLHttpRequest timeout");g.code="ETIMEDOUT",Ee(g)}},a.timeout)),h.setRequestHeader)for(ie in M)M.hasOwnProperty(ie)&&h.setRequestHeader(ie,M[ie]);else if(a.headers&&!u(a.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in a&&(h.responseType=a.responseType),"beforeSend"in a&&typeof a.beforeSend=="function"&&a.beforeSend(h),h.send(ke||null),h}function S(a){try{if(a.responseType==="document")return a.responseXML;var k=a.responseXML&&a.responseXML.documentElement.nodeName==="parsererror";if(a.responseType===""&&!k)return a.responseXML}catch{}return null}function ye(){}}});function ze(e,t,...r){if(!e)throw new TypeError(rt(t,r))}function rt(e,t){let r=0;return e.replace(/%[os]/gu,()=>nt(t[r++]))}function nt(e){return typeof e!="object"||e===null?String(e):Object.prototype.toString.call(e)}var We;function qt(e){try{let t=e instanceof Error?e:new Error(nt(e));if(We){We(t);return}if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:t,message:t.message}));else if(typeof process!="undefined"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)}catch{}}var L=typeof window!="undefined"?window:typeof self!="undefined"?self:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:void 0,Xe,z=class{constructor(e,t){this.code=e,this.message=t}warn(...e){var t;try{if(Xe){Xe({...this,args:e});return}let r=((t=new Error().stack)!==null&&t!==void 0?t:"").replace(/^(?:.+?\n){2}/gu,` | ||
`);console.warn(this.message,...e,r)}catch{}}},Gt=new z("W01","Unable to initialize event under dispatching."),Vt=new z("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),Kt=new z("W03","Assigning any truthy value to 'returnValue' property has no effect."),Yt=new z("W04","Unable to preventDefault on non-cancelable events."),Zt=new z("W05","Unable to preventDefault inside passive event listener invocation."),Jt=new z("W06","An event listener wasn't added because it has been added already: %o, %o"),Te=new z("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),qe=new z("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),Mr=new z("W09","Event attribute handler must be a function: %o"),P=class{static get NONE(){return Ge}static get CAPTURING_PHASE(){return Ve}static get AT_TARGET(){return Ke}static get BUBBLING_PHASE(){return Ye}constructor(e,t){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let r=t!=null?t:{};Me.set(this,{type:String(e),bubbles:!!r.bubbles,cancelable:!!r.cancelable,composed:!!r.composed,target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return m(this).type}get target(){return m(this).target}get srcElement(){return m(this).target}get currentTarget(){return m(this).currentTarget}composedPath(){let e=m(this).currentTarget;return e?[e]:[]}get NONE(){return Ge}get CAPTURING_PHASE(){return Ve}get AT_TARGET(){return Ke}get BUBBLING_PHASE(){return Ye}get eventPhase(){return m(this).dispatchFlag?2:0}stopPropagation(){m(this).stopPropagationFlag=!0}get cancelBubble(){return m(this).stopPropagationFlag}set cancelBubble(e){e?m(this).stopPropagationFlag=!0:Vt.warn()}stopImmediatePropagation(){let e=m(this);e.stopPropagationFlag=e.stopImmediatePropagationFlag=!0}get bubbles(){return m(this).bubbles}get cancelable(){return m(this).cancelable}get returnValue(){return!m(this).canceledFlag}set returnValue(e){e?Kt.warn():Ze(m(this))}preventDefault(){Ze(m(this))}get defaultPrevented(){return m(this).canceledFlag}get composed(){return m(this).composed}get isTrusted(){return!1}get timeStamp(){return m(this).timeStamp}initEvent(e,t=!1,r=!1){let n=m(this);if(n.dispatchFlag){Gt.warn();return}Me.set(this,{...n,type:String(e),bubbles:!!t,cancelable:!!r,target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}},Ge=0,Ve=1,Ke=2,Ye=3,Me=new WeakMap;function m(e,t="this"){let r=Me.get(e);return ze(r!=null,"'%s' must be an object that Event constructor created, but got another one: %o",t,e),r}function Ze(e){if(e.inPassiveListenerFlag){Zt.warn();return}if(!e.cancelable){Yt.warn();return}e.canceledFlag=!0}Object.defineProperty(P,"NONE",{enumerable:!0});Object.defineProperty(P,"CAPTURING_PHASE",{enumerable:!0});Object.defineProperty(P,"AT_TARGET",{enumerable:!0});Object.defineProperty(P,"BUBBLING_PHASE",{enumerable:!0});var Le=Object.getOwnPropertyNames(P.prototype);for(let e=0;e<Le.length;++e)Le[e]!=="constructor"&&Object.defineProperty(P.prototype,Le[e],{enumerable:!0});typeof L!="undefined"&&typeof L.Event!="undefined"&&Object.setPrototypeOf(P.prototype,L.Event.prototype);function Qt(e){return L.DOMException?new L.DOMException(e,"InvalidStateError"):(N==null&&(N=class st extends Error{constructor(r){super(r),Error.captureStackTrace&&Error.captureStackTrace(this,st)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(N.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),Qe(N),Qe(N.prototype)),new N(e))}var N,Je={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};function Qe(e){let t=Object.keys(Je);for(let r=0;r<t.length;++r){let n=t[r],s=Je[n];Object.defineProperty(e,n,{get(){return s},configurable:!0,enumerable:!0})}}var ue=class extends P{static wrap(e){return new(ot(e))(e)}constructor(e){super(e.type,{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed}),e.cancelBubble&&super.stopPropagation(),e.defaultPrevented&&super.preventDefault(),it.set(this,{original:e});let t=Object.keys(e);for(let r=0;r<t.length;++r){let n=t[r];n in this||Object.defineProperty(this,n,at(e,n))}}stopPropagation(){super.stopPropagation();let{original:e}=B(this);"stopPropagation"in e&&e.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(e){super.cancelBubble=e;let{original:t}=B(this);"cancelBubble"in t&&(t.cancelBubble=e)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:e}=B(this);"stopImmediatePropagation"in e&&e.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(e){super.returnValue=e;let{original:t}=B(this);"returnValue"in t&&(t.returnValue=e)}preventDefault(){super.preventDefault();let{original:e}=B(this);"preventDefault"in e&&e.preventDefault()}get timeStamp(){let{original:e}=B(this);return"timeStamp"in e?e.timeStamp:super.timeStamp}},it=new WeakMap;function B(e){let t=it.get(e);return ze(t!=null,"'this' is expected an Event object, but got",e),t}var le=new WeakMap;le.set(Object.prototype,ue);typeof L!="undefined"&&typeof L.Event!="undefined"&&le.set(L.Event.prototype,ue);function ot(e){let t=Object.getPrototypeOf(e);if(t==null)return ue;let r=le.get(t);return r==null&&(r=er(ot(t),t),le.set(t,r)),r}function er(e,t){class r extends e{}let n=Object.keys(t);for(let s=0;s<n.length;++s)Object.defineProperty(r.prototype,n[s],at(t,n[s]));return r}function at(e,t){let r=Object.getOwnPropertyDescriptor(e,t);return{get(){let n=B(this).original,s=n[t];return typeof s=="function"?s.bind(n):s},set(n){let s=B(this).original;s[t]=n},configurable:r.configurable,enumerable:r.enumerable}}function tr(e,t,r,n,s,o){return{callback:e,flags:(t?1:0)|(r?2:0)|(n?4:0),signal:s,signalListener:o}}function rr(e){e.flags|=8}function lt(e){return(e.flags&1)===1}function ut(e){return(e.flags&2)===2}function dt(e){return(e.flags&4)===4}function nr(e){return(e.flags&8)===8}function sr({callback:e},t,r){try{typeof e=="function"?e.call(t,r):typeof e.handleEvent=="function"&&e.handleEvent(r)}catch(n){qt(n)}}function ht({listeners:e},t,r){for(let n=0;n<e.length;++n)if(e[n].callback===t&<(e[n])===r)return n;return-1}function ir(e,t,r,n,s,o){let l;o&&(l=pt.bind(null,e,t,r),o.addEventListener("abort",l));let u=tr(t,r,n,s,o,l);return e.cow?(e.cow=!1,e.listeners=[...e.listeners,u]):e.listeners.push(u),u}function pt(e,t,r){let n=ht(e,t,r);return n!==-1?ct(e,n):!1}function ct(e,t,r=!1){let n=e.listeners[t];return rr(n),n.signal&&n.signal.removeEventListener("abort",n.signalListener),e.cow&&!r?(e.cow=!1,e.listeners=e.listeners.filter((s,o)=>o!==t),!1):(e.listeners.splice(t,1),!0)}function or(){return Object.create(null)}function ar(e,t){var r;return(r=e[t])!==null&&r!==void 0?r:e[t]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}var de=class{constructor(){ft.set(this,or())}addEventListener(e,t,r){let n=Re(this),{callback:s,capture:o,once:l,passive:u,signal:p,type:y}=lr(e,t,r);if(s==null||p!=null&&p.aborted)return;let E=ar(n,y),S=ht(E,s,o);if(S!==-1){dr(E.listeners[S],u,l,p);return}ir(E,s,o,u,l,p)}removeEventListener(e,t,r){let n=Re(this),{callback:s,capture:o,type:l}=ur(e,t,r),u=n[l];s!=null&&u&&pt(u,s,o)}dispatchEvent(e){let t=Re(this)[String(e.type)];if(t==null)return!0;let r=e instanceof P?e:ue.wrap(e),n=m(r,"event");if(n.dispatchFlag)throw Qt("This event has been in dispatching.");if(n.dispatchFlag=!0,n.target=n.currentTarget=this,!n.stopPropagationFlag){let{cow:s,listeners:o}=t;t.cow=!0;for(let l=0;l<o.length;++l){let u=o[l];if(!nr(u)&&(dt(u)&&ct(t,l,!s)&&(l-=1),n.inPassiveListenerFlag=ut(u),sr(u,this,r),n.inPassiveListenerFlag=!1,n.stopImmediatePropagationFlag))break}s||(t.cow=!1)}return n.target=null,n.currentTarget=null,n.stopImmediatePropagationFlag=!1,n.stopPropagationFlag=!1,n.dispatchFlag=!1,!n.canceledFlag}},ft=new WeakMap;function Re(e,t="this"){let r=ft.get(e);return ze(r!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",t,e),r}function lr(e,t,r){var n;return gt(t),typeof r=="object"&&r!==null?{type:String(e),callback:t!=null?t:void 0,capture:!!r.capture,passive:!!r.passive,once:!!r.once,signal:(n=r.signal)!==null&&n!==void 0?n:void 0}:{type:String(e),callback:t!=null?t:void 0,capture:!!r,passive:!1,once:!1,signal:void 0}}function ur(e,t,r){return gt(t),typeof r=="object"&&r!==null?{type:String(e),callback:t!=null?t:void 0,capture:!!r.capture}:{type:String(e),callback:t!=null?t:void 0,capture:!!r}}function gt(e){if(!(typeof e=="function"||typeof e=="object"&&e!==null&&typeof e.handleEvent=="function")){if(e==null||typeof e=="object"){qe.warn(e);return}throw new TypeError(rt(qe.message,[e]))}}function dr(e,t,r,n){Jt.warn(lt(e)?"capture":"bubble",e.callback),ut(e)!==t&&Te.warn("passive"),dt(e)!==r&&Te.warn("once"),e.signal!==n&&Te.warn("signal")}var _e=Object.getOwnPropertyNames(de.prototype);for(let e=0;e<_e.length;++e)_e[e]!=="constructor"&&Object.defineProperty(de.prototype,_e[e],{enumerable:!0});typeof L!="undefined"&&typeof L.EventTarget!="undefined"&&Object.setPrototypeOf(de.prototype,L.EventTarget.prototype);var hr=Ht(Xt()),Pe=30720,ee=512e3,te=256,Z=(e,{minChunkSize:t=te,maxChunkSize:r=ee}={})=>e==null||typeof e=="number"&&e>=256&&e%256===0&&e>=t&&e<=r,J=(e,{minChunkSize:t=te,maxChunkSize:r=ee}={})=>new TypeError(`chunkSize ${e} must be a positive number in multiples of 256, between ${t} and ${r}`),pr=class{constructor(e,t={}){this.readableStream=e;var r,n,s;if(!Z(t.defaultChunkSize,t))throw J(t.defaultChunkSize,t);this.defaultChunkSize=(r=t.defaultChunkSize)!=null?r:Pe,this.minChunkSize=(n=t.minChunkSize)!=null?n:te,this.maxChunkSize=(s=t.maxChunkSize)!=null?s:ee}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!Z(e,this))throw J(e,this);this._chunkSize=e}get chunkByteSize(){return this.chunkSize*1024}get error(){return this._error}async*[Symbol.asyncIterator](){let e,t=this.readableStream.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r){if(e){let o=e;e=void 0,yield o}break}let s=n instanceof Uint8Array?new Blob([n],{type:"application/octet-stream"}):n;for(e=e?new Blob([e,s]):s;e;)if(e.size===this.chunkByteSize){let o=e;e=void 0,yield o;break}else{if(e.size<this.chunkByteSize)break;{let o=e.slice(0,this.chunkByteSize);e=e.slice(this.chunkByteSize),yield o}}}}catch(r){this._error=r}finally{if(e){let r=e;e=void 0,yield r}t.releaseLock();return}}},cr=class{constructor(e,t={}){this.file=e;var r,n,s;if(!Z(t.defaultChunkSize,t))throw J(t.defaultChunkSize,t);this.defaultChunkSize=(r=t.defaultChunkSize)!=null?r:Pe,this.minChunkSize=(n=t.minChunkSize)!=null?n:te,this.maxChunkSize=(s=t.maxChunkSize)!=null?s:ee}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!Z(e,this))throw J(e,this);this._chunkSize=e}get chunkByteSize(){return this.chunkSize*1024}get error(){return this._error}async*[Symbol.asyncIterator](){let e=new FileReader,t=0,r=()=>new Promise(n=>{if(t>=this.file.size){n(void 0);return}let s=Math.min(this.chunkByteSize,this.file.size-t);e.onload=()=>{e.result!==null?n(new Blob([e.result],{type:"application/octet-stream"})):n(void 0)},e.readAsArrayBuffer(this.file.slice(t,t+s))});try{for(;;){let n=await r();if(n)t+=n.size,yield n;else break}}catch(n){this._error=n}}},fr=[200,201,202,204,308],mt=[408,502,503,504],gr=[308],bt=(e,t)=>!!e&&fr.includes(e.statusCode),mr=(e,{retryCodes:t=mt})=>!e||t.includes(e.statusCode),br=(e,t)=>t.attemptCount>=t.attempts||!(bt(e)||mr(e,t)),yr=(e,t)=>{var r;if(!e||!gr.includes(e.statusCode)||!((r=e.headers)!=null&&r.range))return!1;let n=e.headers.range.match(/bytes=(\d+)-(\d+)/);return n?parseInt(n[2],10)!==t.currentChunkEndByte:!1},Oe=class{static createUpload(e){return new Oe(e)}constructor(e){if(this.eventTarget=new de,this.endpoint=e.endpoint,this.file=e.file,this.headers=e.headers||{},this.method=e.method||"PUT",this.attempts=e.attempts||5,this.delayBeforeAttempt=e.delayBeforeAttempt||1,this.retryCodes=e.retryCodes||mt,this.dynamicChunkSize=e.dynamicChunkSize||!1,this.maxFileBytes=(e.maxFileSize||0)*1024,this.chunkCount=0,this.attemptCount=0,this._offline=typeof window!="undefined"&&!window.navigator.onLine,this._paused=!1,this.success=!1,this.nextChunkRangeStart=0,e.useLargeFileWorkaround){let t=r=>{this.chunkedIterable.error&&(console.warn(`Unable to read file of size ${this.file.size} bytes via a ReadableStream. Falling back to in-memory FileReader!`),r.stopImmediatePropagation(),this.chunkedIterable=new cr(this.file,{...e,defaultChunkSize:e.chunkSize}),this.chunkedIterator=this.chunkedIterable[Symbol.asyncIterator](),this.getEndpoint().then(()=>{this.sendChunks()}),this.off("error",t))};this.on("error",t)}this.chunkedIterable=new pr(this.file.stream(),{...e,defaultChunkSize:e.chunkSize}),this.chunkedIterator=this.chunkedIterable[Symbol.asyncIterator](),this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.validateOptions(),this.getEndpoint().then(()=>this.sendChunks()),typeof window!="undefined"&&(window.addEventListener("online",()=>{this.offline&&(this._offline=!1,this.dispatch("online"),this.sendChunks())}),window.addEventListener("offline",()=>{this.offline||(this._offline=!0,this.dispatch("offline"))}))}get maxChunkSize(){var e,t;return(t=(e=this.chunkedIterable)==null?void 0:e.maxChunkSize)!=null?t:ee}get minChunkSize(){var e,t;return(t=(e=this.chunkedIterable)==null?void 0:e.minChunkSize)!=null?t:te}get chunkSize(){var e,t;return(t=(e=this.chunkedIterable)==null?void 0:e.chunkSize)!=null?t:Pe}set chunkSize(e){this.chunkedIterable.chunkSize=e}get chunkByteSize(){return this.chunkedIterable.chunkByteSize}get totalChunkSize(){return Math.ceil(this.file.size/this.chunkByteSize)}on(e,t){this.eventTarget.addEventListener(e,t)}once(e,t){this.eventTarget.addEventListener(e,t,{once:!0})}off(e,t){this.eventTarget.removeEventListener(e,t)}get offline(){return this._offline}get paused(){return this._paused}abort(){var e;this.pause(),(e=this.currentXhr)==null||e.abort()}pause(){this._paused=!0}resume(){this._paused&&(this._paused=!1,this.sendChunks())}get successfulPercentage(){return this.nextChunkRangeStart/this.file.size}dispatch(e,t){let r=new CustomEvent(e,{detail:t});this.eventTarget.dispatchEvent(r)}validateOptions(){if(!this.endpoint||typeof this.endpoint!="function"&&typeof this.endpoint!="string")throw new TypeError("endpoint must be defined as a string or a function that returns a promise");if(!(this.file instanceof File))throw new TypeError("file must be a File object");if(this.headers&&typeof this.headers!="function"&&typeof this.headers!="object")throw new TypeError("headers must be null, an object, or a function that returns an object or a promise");if(!Z(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize}))throw J(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize});if(this.maxChunkSize&&(typeof this.maxChunkSize!="number"||this.maxChunkSize<256||this.maxChunkSize%256!==0||this.maxChunkSize<this.chunkSize||this.maxChunkSize<this.minChunkSize))throw new TypeError(`maxChunkSize must be a positive number in multiples of 256, and larger than or equal to both ${this.minChunkSize} and ${this.chunkSize}`);if(this.minChunkSize&&(typeof this.minChunkSize!="number"||this.minChunkSize<256||this.minChunkSize%256!==0||this.minChunkSize>this.chunkSize||this.minChunkSize>this.maxChunkSize))throw new TypeError(`minChunkSize must be a positive number in multiples of 256, and smaller than ${this.chunkSize} and ${this.maxChunkSize}`);if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error(`file size exceeds maximum (${this.file.size} > ${this.maxFileBytes})`);if(this.attempts&&(typeof this.attempts!="number"||this.attempts<=0))throw new TypeError("retries must be a positive number");if(this.delayBeforeAttempt&&(typeof this.delayBeforeAttempt!="number"||this.delayBeforeAttempt<0))throw new TypeError("delayBeforeAttempt must be a positive number")}getEndpoint(){return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(e=>(this.endpointValue=e,this.endpointValue))}xhrPromise(e){let t=r=>{r.upload.onprogress=n=>{var s;let o=this.totalChunks-this.chunkCount,l=(this.file.size-this.nextChunkRangeStart)/this.file.size/o,p=n.loaded/((s=n.total)!=null?s:this.chunkByteSize)*l;this.dispatch("progress",Math.min((this.successfulPercentage+p)*100,100))}};return new Promise((r,n)=>{this.currentXhr=(0,hr.default)({...e,beforeSend:t},(s,o)=>(this.currentXhr=void 0,s?n(s):r(o)))})}async sendChunk(e){let t=this.nextChunkRangeStart,r=t+e.size-1,s={...await(typeof this.headers=="function"?this.headers():this.headers),"Content-Type":this.file.type,"Content-Range":`bytes ${t}-${r}/${this.file.size}`};return this.dispatch("attempt",{chunkNumber:this.chunkCount,totalChunks:this.totalChunks,chunkSize:this.chunkSize}),this.xhrPromise({headers:s,url:this.endpointValue,method:this.method,body:e})}async sendChunkWithRetries(e){let t=async(l,u)=>{var p;let E=(new Date().getTime()-this.lastChunkStart.getTime())/1e3;if(this.dispatch("chunkSuccess",{chunk:this.chunkCount,chunkSize:this.chunkSize,attempts:this.attemptCount,timeInterval:E,response:l}),this.attemptCount=0,this.chunkCount=((p=this.chunkCount)!=null?p:0)+1,this.nextChunkRangeStart=this.nextChunkRangeStart+this.chunkByteSize,this.dynamicChunkSize){let S=this.chunkSize;E<10?S=Math.min(this.chunkSize*2,this.maxChunkSize):E>30&&(S=Math.max(this.chunkSize/2,this.minChunkSize)),this.chunkSize=Math.ceil(S/256)*256;let ye=(this.file.size-this.nextChunkRangeStart)/this.chunkByteSize;this.totalChunks=Math.ceil(this.chunkCount+ye)}return!0},r=async(l,u)=>(this.dispatch("progress",Math.min(this.successfulPercentage*100,100)),this.dispatch("error",{message:`Server responded with ${l.statusCode}. Stopping upload.`,chunk:this.chunkCount,attempts:this.attemptCount,response:l}),!1),n=async(l,u)=>(this.dispatch("attemptFailure",{message:`An error occured uploading chunk ${this.chunkCount}. ${this.attempts-this.attemptCount} retries left.`,chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount,response:l}),new Promise(p=>{setTimeout(async()=>{if(this._paused||this.offline){this.pendingChunk=e,p(!1);return}let y=await this.sendChunkWithRetries(e);p(y)},this.delayBeforeAttempt*1e3)})),s;try{this.attemptCount=this.attemptCount+1,this.lastChunkStart=new Date,s=await this.sendChunk(e)}catch(l){typeof(l==null?void 0:l.statusCode)=="number"&&(s=l)}let o={retryCodes:this.retryCodes,attemptCount:this.attemptCount,attempts:this.attempts,currentChunkEndByte:this.nextChunkRangeStart+e.size-1};return yr(s,o)?n(s,e):bt(s,o)?t(s,e):br(s,o)?r(s,e):n(s,e)}async sendChunks(){if(this.pendingChunk&&!(this._paused||this.offline)){let e=this.pendingChunk;this.pendingChunk=void 0;let t=await this.sendChunkWithRetries(e);this.success&&t&&this.dispatch("success")}for(;!(this.success||this._paused||this.offline);){let{value:e,done:t}=await this.chunkedIterator.next(),r=!e&&t;if(e&&(r=await this.sendChunkWithRetries(e)),this.chunkedIterable.error){r=!1,this.dispatch("error",{message:`Unable to read file of size ${this.file.size} bytes. Try loading from another browser.`});return}if(this.success=!!t,this.success&&r&&this.dispatch("success"),!r)return}}};var yt=(e,t)=>{if(!e)return null;let r=e.closest(t);return r||yt(e.getRootNode().host,t)},w=e=>{let t=e.getAttribute("mux-uploader");return t?document.getElementById(t):yt(e,"mux-uploader")};var Et=v.createElement("template");Et.innerHTML=` | ||
<style> | ||
@@ -63,3 +63,3 @@ :host { | ||
</div> | ||
`;var Ue={MUX_UPLOADER:"mux-uploader",OVERLAY_TEXT:"overlay-text"},ne,A,j,re=class extends d.HTMLElement{constructor(){super();c(this,ne,void 0);c(this,A,void 0);c(this,j,void 0);let t=this.attachShadow({mode:"open"});t.appendChild(Et.content.cloneNode(!0)),f(this,ne,t.getElementById("overlay-label"))}connectedCallback(){if(f(this,A,w(this)),f(this,j,new AbortController),i(this,A)){let t={signal:i(this,j).signal};i(this,A).addEventListener("file-ready",()=>this.toggleAttribute("file-ready",!0),t),i(this,A).addEventListener("uploadstart",()=>this.toggleAttribute("upload-in-progress",!0),t),i(this,A).addEventListener("success",()=>{this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!0)},t),i(this,A).addEventListener("reset",()=>{this.toggleAttribute("file-ready",!1),this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!1)},t),this.setupDragEvents(t),this.toggleAttribute("upload-in-progress",i(this,A).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",i(this,A).hasAttribute("upload-complete")),this.toggleAttribute("file-ready",i(this,A).hasAttribute("file-ready"))}}disconnectedCallback(){var t;(t=i(this,j))==null||t.abort()}attributeChangedCallback(t,n,s){t===Ue.OVERLAY_TEXT&&n!==s?i(this,ne).innerHTML=s!=null?s:"":t==="active"&&this.hasAttribute("overlay")&&s!=null&&(this._currentDragTarget=this)}static get observedAttributes(){return[Ue.OVERLAY_TEXT,Ue.MUX_UPLOADER,"active"]}setupDragEvents(t){this.addEventListener("dragenter",n=>{this._currentDragTarget=n.target,n.preventDefault(),n.stopPropagation(),this.toggleAttribute("active",!0)},t),this.addEventListener("dragleave",n=>{this._currentDragTarget===n.target&&(this._currentDragTarget=void 0,this.toggleAttribute("active",!1))},t),this.addEventListener("dragover",n=>{n.preventDefault(),n.stopPropagation()},t),this.addEventListener("drop",n=>{var p;n.preventDefault(),n.stopPropagation();let{dataTransfer:s}=n,{files:o}=s,a=o[0];((p=i(this,A))!=null?p:this).dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:a})),this.removeAttribute("active")},t)}};ne=new WeakMap,A=new WeakMap,j=new WeakMap;d.customElements.get("mux-uploader-drop")||(d.customElements.define("mux-uploader-drop",re),d.MuxUploaderDropElement=re);var Er=re;function vt(e){return`${Math.floor(e)}%`}var kt=v.createElement("template"),vr="Media upload progress bar";kt.innerHTML=` | ||
`;var Ue={MUX_UPLOADER:"mux-uploader",OVERLAY_TEXT:"overlay-text"},ne,A,j,re=class extends d.HTMLElement{constructor(){super();c(this,ne,void 0);c(this,A,void 0);c(this,j,void 0);let r=this.attachShadow({mode:"open"});r.appendChild(Et.content.cloneNode(!0)),f(this,ne,r.getElementById("overlay-label"))}connectedCallback(){if(f(this,A,w(this)),f(this,j,new AbortController),i(this,A)){let r={signal:i(this,j).signal};i(this,A).addEventListener("file-ready",()=>this.toggleAttribute("file-ready",!0),r),i(this,A).addEventListener("uploadstart",()=>this.toggleAttribute("upload-in-progress",!0),r),i(this,A).addEventListener("success",()=>{this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!0)},r),i(this,A).addEventListener("reset",()=>{this.toggleAttribute("file-ready",!1),this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!1)},r),this.setupDragEvents(r),this.toggleAttribute("upload-in-progress",i(this,A).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",i(this,A).hasAttribute("upload-complete")),this.toggleAttribute("file-ready",i(this,A).hasAttribute("file-ready"))}}disconnectedCallback(){var r;(r=i(this,j))==null||r.abort()}attributeChangedCallback(r,n,s){r===Ue.OVERLAY_TEXT&&n!==s?i(this,ne).innerHTML=s!=null?s:"":r==="active"&&this.hasAttribute("overlay")&&s!=null&&(this._currentDragTarget=this)}static get observedAttributes(){return[Ue.OVERLAY_TEXT,Ue.MUX_UPLOADER,"active"]}setupDragEvents(r){this.addEventListener("dragenter",n=>{this._currentDragTarget=n.target,n.preventDefault(),n.stopPropagation(),this.toggleAttribute("active",!0)},r),this.addEventListener("dragleave",n=>{this._currentDragTarget===n.target&&(this._currentDragTarget=void 0,this.toggleAttribute("active",!1))},r),this.addEventListener("dragover",n=>{n.preventDefault(),n.stopPropagation()},r),this.addEventListener("drop",n=>{var p;n.preventDefault(),n.stopPropagation();let{dataTransfer:s}=n,{files:o}=s,l=o[0];((p=i(this,A))!=null?p:this).dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:l})),this.removeAttribute("active")},r)}};ne=new WeakMap,A=new WeakMap,j=new WeakMap;d.customElements.get("mux-uploader-drop")||(d.customElements.define("mux-uploader-drop",re),d.MuxUploaderDropElement=re);var Er=re;function vt(e){return`${Math.floor(e)}%`}var kt=v.createElement("template"),vr="Media upload progress bar";kt.innerHTML=` | ||
<style> | ||
@@ -148,3 +148,3 @@ :host { | ||
</div> | ||
`;var R,$,he=class extends d.HTMLElement{constructor(){var n,s,o,a;super();c(this,R,void 0);c(this,$,void 0);this.onUploadStart=()=>{var t;(t=this.progressBar)==null||t.focus(),this.toggleAttribute("upload-in-progress",!0)};this.onProgress=t=>{var s;let n=t.detail;switch((s=this.progressBar)==null||s.setAttribute("aria-valuenow",`${Math.floor(n)}`),this.getAttribute("type")){case F.BAR:{this.progressBar&&(this.progressBar.style.width=`${n}%`);break}case F.RADIAL:{if(this.svgCircle){let o=this.getCircumference()-n/100*this.getCircumference();this.svgCircle.style.strokeDashoffset=o.toString()}break}case F.PERCENTAGE:{this.uploadPercentage&&(this.uploadPercentage.innerHTML=vt(n));break}}};this.onSuccess=()=>{this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!0)};this.onReset=()=>{this.toggleAttribute("upload-in-progress",!1),this.uploadPercentage&&(this.uploadPercentage.innerHTML=""),this.svgCircle&&(this.svgCircle.style.strokeDashoffset=`${this.getCircumference()}`)};this.attachShadow({mode:"open"}).appendChild(kt.content.cloneNode(!0)),this.svgCircle=(n=this.shadowRoot)==null?void 0:n.querySelector("circle"),this.progressBar=(s=this.shadowRoot)==null?void 0:s.getElementById("progress-bar"),this.uploadPercentage=(o=this.shadowRoot)==null?void 0:o.getElementById("percentage-type"),(a=this.progressBar)==null||a.setAttribute("aria-description",vr)}connectedCallback(){if(this.setDefaultType(),f(this,R,w(this)),f(this,$,new AbortController),i(this,R)){let t={signal:i(this,$).signal};i(this,R).addEventListener("uploadstart",this.onUploadStart,t),i(this,R).addEventListener("reset",this.onReset),i(this,R).addEventListener("progress",this.onProgress),i(this,R).addEventListener("success",this.onSuccess),this.toggleAttribute("upload-in-progress",i(this,R).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",i(this,R).hasAttribute("upload-complete"))}}disconnectedCallback(){var t;(t=i(this,$))==null||t.abort()}getRadius(){var t;return Number((t=this.svgCircle)==null?void 0:t.getAttribute("r"))}getCircumference(){return this.getRadius()*2*Math.PI}setDefaultType(){let t=this.getAttribute("type");t||this.setAttribute("type",F.BAR),t===F.RADIAL&&this.svgCircle&&(this.svgCircle.style.strokeDasharray=`${this.getCircumference()} ${this.getCircumference()}`,this.svgCircle.style.strokeDashoffset=`${this.getCircumference()}`)}};R=new WeakMap,$=new WeakMap;d.customElements.get("mux-uploader-progress")||d.customElements.define("mux-uploader-progress",he);var kr=he;var Ct=v.createElement("template");Ct.innerHTML=` | ||
`;var R,$,he=class extends d.HTMLElement{constructor(){var n,s,o,l;super();c(this,R,void 0);c(this,$,void 0);this.onUploadStart=()=>{var r;(r=this.progressBar)==null||r.focus(),this.toggleAttribute("upload-in-progress",!0)};this.onProgress=r=>{var s;let n=r.detail;switch((s=this.progressBar)==null||s.setAttribute("aria-valuenow",`${Math.floor(n)}`),this.getAttribute("type")){case F.BAR:{this.progressBar&&(this.progressBar.style.width=`${n}%`);break}case F.RADIAL:{if(this.svgCircle){let o=this.getCircumference()-n/100*this.getCircumference();this.svgCircle.style.strokeDashoffset=o.toString()}break}case F.PERCENTAGE:{this.uploadPercentage&&(this.uploadPercentage.innerHTML=vt(n));break}}};this.onSuccess=()=>{this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!0)};this.onReset=()=>{this.toggleAttribute("upload-in-progress",!1),this.uploadPercentage&&(this.uploadPercentage.innerHTML=""),this.svgCircle&&(this.svgCircle.style.strokeDashoffset=`${this.getCircumference()}`)};this.attachShadow({mode:"open"}).appendChild(kt.content.cloneNode(!0)),this.svgCircle=(n=this.shadowRoot)==null?void 0:n.querySelector("circle"),this.progressBar=(s=this.shadowRoot)==null?void 0:s.getElementById("progress-bar"),this.uploadPercentage=(o=this.shadowRoot)==null?void 0:o.getElementById("percentage-type"),(l=this.progressBar)==null||l.setAttribute("aria-description",vr)}connectedCallback(){if(this.setDefaultType(),f(this,R,w(this)),f(this,$,new AbortController),i(this,R)){let r={signal:i(this,$).signal};i(this,R).addEventListener("uploadstart",this.onUploadStart,r),i(this,R).addEventListener("reset",this.onReset),i(this,R).addEventListener("progress",this.onProgress),i(this,R).addEventListener("success",this.onSuccess),this.toggleAttribute("upload-in-progress",i(this,R).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",i(this,R).hasAttribute("upload-complete"))}}disconnectedCallback(){var r;(r=i(this,$))==null||r.abort()}getRadius(){var r;return Number((r=this.svgCircle)==null?void 0:r.getAttribute("r"))}getCircumference(){return this.getRadius()*2*Math.PI}setDefaultType(){let r=this.getAttribute("type");r||this.setAttribute("type",F.BAR),r===F.RADIAL&&this.svgCircle&&(this.svgCircle.style.strokeDasharray=`${this.getCircumference()} ${this.getCircumference()}`,this.svgCircle.style.strokeDashoffset=`${this.getCircumference()}`)}};R=new WeakMap,$=new WeakMap;d.customElements.get("mux-uploader-progress")||d.customElements.define("mux-uploader-progress",he);var kr=he;var Ct=v.createElement("template");Ct.innerHTML=` | ||
<style> | ||
@@ -158,3 +158,3 @@ | ||
<span id="status-message" role="status" aria-live="polite"></span> | ||
`;var x,W,pe=class extends d.HTMLElement{constructor(){var n;super();c(this,x,void 0);c(this,W,void 0);this.clearStatusMessage=()=>{this.toggleAttribute("upload-error",!1),this.statusMessage&&(this.statusMessage.innerHTML="")};this.onUploadError=t=>{this.toggleAttribute("upload-error",!0),this.statusMessage&&(this.statusMessage.innerHTML=t.detail.message)};this.onSuccess=()=>{this.toggleAttribute("upload-error",!1);let t="Upload complete!";this.statusMessage&&(this.statusMessage.innerHTML=t),console.info(t)};this.onOffline=()=>{this.toggleAttribute("upload-error",!1);let t="Currently offline. Upload will resume automatically when online.";this.statusMessage&&(this.statusMessage.innerHTML=t)};this.attachShadow({mode:"open"}).appendChild(Ct.content.cloneNode(!0)),this.statusMessage=(n=this.shadowRoot)==null?void 0:n.getElementById("status-message")}connectedCallback(){if(f(this,x,w(this)),f(this,W,new AbortController),i(this,x)){let t={signal:i(this,W).signal};i(this,x).addEventListener("reset",this.clearStatusMessage,t),i(this,x).addEventListener("uploaderror",this.onUploadError,t),i(this,x).addEventListener("success",this.onSuccess,t),i(this,x).addEventListener("uploadstart",this.clearStatusMessage,t),i(this,x).addEventListener("offline",this.onOffline,t),i(this,x).addEventListener("online",this.clearStatusMessage,t),this.toggleAttribute("upload-in-progress",i(this,x).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",i(this,x).hasAttribute("upload-complete")),this.toggleAttribute("upload-error",i(this,x).hasAttribute("upload-error"))}}disconnectedCallback(){var t;(t=i(this,W))==null||t.abort()}};x=new WeakMap,W=new WeakMap;d.customElements.get("mux-uploader-status")||d.customElements.define("mux-uploader-status",pe);var Cr=pe;var St=v.createElement("template");St.innerHTML=` | ||
`;var x,W,pe=class extends d.HTMLElement{constructor(){var n;super();c(this,x,void 0);c(this,W,void 0);this.clearStatusMessage=()=>{this.toggleAttribute("upload-error",!1),this.statusMessage&&(this.statusMessage.innerHTML="")};this.onUploadError=r=>{this.toggleAttribute("upload-error",!0),this.statusMessage&&(this.statusMessage.innerHTML=r.detail.message)};this.onSuccess=()=>{this.toggleAttribute("upload-error",!1);let r="Upload complete!";this.statusMessage&&(this.statusMessage.innerHTML=r),console.info(r)};this.onOffline=()=>{this.toggleAttribute("upload-error",!1);let r="Currently offline. Upload will resume automatically when online.";this.statusMessage&&(this.statusMessage.innerHTML=r)};this.attachShadow({mode:"open"}).appendChild(Ct.content.cloneNode(!0)),this.statusMessage=(n=this.shadowRoot)==null?void 0:n.getElementById("status-message")}connectedCallback(){if(f(this,x,w(this)),f(this,W,new AbortController),i(this,x)){let r={signal:i(this,W).signal};i(this,x).addEventListener("reset",this.clearStatusMessage,r),i(this,x).addEventListener("uploaderror",this.onUploadError,r),i(this,x).addEventListener("success",this.onSuccess,r),i(this,x).addEventListener("uploadstart",this.clearStatusMessage,r),i(this,x).addEventListener("offline",this.onOffline,r),i(this,x).addEventListener("online",this.clearStatusMessage,r),this.toggleAttribute("upload-in-progress",i(this,x).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",i(this,x).hasAttribute("upload-complete")),this.toggleAttribute("upload-error",i(this,x).hasAttribute("upload-error"))}}disconnectedCallback(){var r;(r=i(this,W))==null||r.abort()}};x=new WeakMap,W=new WeakMap;d.customElements.get("mux-uploader-status")||d.customElements.define("mux-uploader-status",pe);var Cr=pe;var St=v.createElement("template");St.innerHTML=` | ||
<style> | ||
@@ -175,3 +175,3 @@ #retry-button { | ||
<span id="retry-button" role="button" tabindex="0">Try again</span> | ||
`;var O,X,ce=class extends d.HTMLElement{constructor(){var n;super();c(this,O,void 0);c(this,X,void 0);this.handleKeyup=t=>{let n=["Enter"," "],{key:s}=t;n.includes(s)&&this.triggerReset()};this.triggerReset=()=>{var t;(t=i(this,O))==null||t.dispatchEvent(new CustomEvent("reset"))};this.attachShadow({mode:"open"}).appendChild(St.content.cloneNode(!0)),this.retryButton=(n=this.shadowRoot)==null?void 0:n.getElementById("retry-button")}connectedCallback(){var t,n;if(f(this,O,w(this)),f(this,X,new AbortController),i(this,O)){let s={signal:i(this,X).signal};i(this,O).addEventListener("uploaderror",()=>this.toggleAttribute("upload-error",!0)),i(this,O).addEventListener("reset",()=>this.toggleAttribute("upload-error",!1)),(t=this.retryButton)==null||t.addEventListener("click",this.triggerReset,s),(n=this.retryButton)==null||n.addEventListener("keyup",this.handleKeyup,s),this.toggleAttribute("upload-error",i(this,O).hasAttribute("upload-error"))}}disconnectedCallback(){var t;(t=i(this,X))==null||t.abort()}};O=new WeakMap,X=new WeakMap;d.customElements.get("mux-uploader-retry")||d.customElements.define("mux-uploader-retry",ce);var Sr=ce;var wt=v.createElement("template");wt.innerHTML=` | ||
`;var O,X,ce=class extends d.HTMLElement{constructor(){var n;super();c(this,O,void 0);c(this,X,void 0);this.handleKeyup=r=>{let n=["Enter"," "],{key:s}=r;n.includes(s)&&this.triggerReset()};this.triggerReset=()=>{var r;(r=i(this,O))==null||r.dispatchEvent(new CustomEvent("reset"))};this.attachShadow({mode:"open"}).appendChild(St.content.cloneNode(!0)),this.retryButton=(n=this.shadowRoot)==null?void 0:n.getElementById("retry-button")}connectedCallback(){var r,n;if(f(this,O,w(this)),f(this,X,new AbortController),i(this,O)){let s={signal:i(this,X).signal};i(this,O).addEventListener("uploaderror",()=>this.toggleAttribute("upload-error",!0)),i(this,O).addEventListener("reset",()=>this.toggleAttribute("upload-error",!1)),(r=this.retryButton)==null||r.addEventListener("click",this.triggerReset,s),(n=this.retryButton)==null||n.addEventListener("keyup",this.handleKeyup,s),this.toggleAttribute("upload-error",i(this,O).hasAttribute("upload-error"))}}disconnectedCallback(){var r;(r=i(this,X))==null||r.abort()}};O=new WeakMap,X=new WeakMap;d.customElements.get("mux-uploader-retry")||d.customElements.define("mux-uploader-retry",ce);var Sr=ce;var wt=v.createElement("template");wt.innerHTML=` | ||
<style> | ||
@@ -214,3 +214,3 @@ #pause-button { | ||
<button id="pause-button">Pause</span> | ||
`;var b,q,fe=class extends d.HTMLElement{constructor(){super();c(this,b,void 0);c(this,q,void 0);this.triggerPause=()=>{if(!i(this,b)){console.warn("pausing before a mux-uploader element is associated is unsupported!");return}this.pauseButton.disabled||(i(this,b).paused=!i(this,b).paused)};this.attachShadow({mode:"open"}).appendChild(wt.content.cloneNode(!0))}connectedCallback(){if(f(this,b,w(this)),f(this,q,new AbortController),i(this,b)){let t={signal:i(this,q).signal};i(this,b).addEventListener("uploadstart",()=>this.toggleAttribute("upload-in-progress",!0),t),i(this,b).addEventListener("uploaderror",()=>{this.toggleAttribute("upload-error",!0),this.toggleAttribute("upload-complete",!1),this.toggleAttribute("upload-in-progress",!1)}),i(this,b).addEventListener("success",()=>{this.toggleAttribute("upload-complete",!0),this.toggleAttribute("upload-error",!1),this.toggleAttribute("upload-in-progress",!1)}),i(this,b).addEventListener("reset",()=>{this.toggleAttribute("upload-error",!1),this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!1)}),i(this,b).addEventListener("pausedchange",()=>{var s;if(this.pauseButton.disabled=!1,!i(this,b))return;let n=(s=i(this,b).paused)!=null?s:!1;this.pauseButton.innerHTML=n?"Pausing...":"Pause",n&&(this.pauseButton.disabled=!0,i(this,b).addEventListener("chunksuccess",()=>{var o;this.pauseButton.innerHTML=(o=i(this,b))!=null&&o.paused?"Resume":"Pause",this.pauseButton.disabled=!1},{once:!0}))}),this.pauseButton.addEventListener("click",this.triggerPause,t),this.toggleAttribute("upload-in-progress",i(this,b).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",i(this,b).hasAttribute("upload-complete")),this.toggleAttribute("upload-error",i(this,b).hasAttribute("upload-error"))}}disconnectedCallback(){var t;(t=i(this,q))==null||t.abort()}get pauseButton(){var t;return(t=this.shadowRoot)==null?void 0:t.getElementById("pause-button")}};b=new WeakMap,q=new WeakMap;d.customElements.get("mux-uploader-pause")||d.customElements.define("mux-uploader-pause",fe);var wr=fe;var Be=` | ||
`;var b,q,fe=class extends d.HTMLElement{constructor(){super();c(this,b,void 0);c(this,q,void 0);this.triggerPause=()=>{if(!i(this,b)){console.warn("pausing before a mux-uploader element is associated is unsupported!");return}this.pauseButton.disabled||(i(this,b).paused=!i(this,b).paused)};this.attachShadow({mode:"open"}).appendChild(wt.content.cloneNode(!0))}connectedCallback(){if(f(this,b,w(this)),f(this,q,new AbortController),i(this,b)){let r={signal:i(this,q).signal};i(this,b).addEventListener("uploadstart",()=>this.toggleAttribute("upload-in-progress",!0),r),i(this,b).addEventListener("uploaderror",()=>{this.toggleAttribute("upload-error",!0),this.toggleAttribute("upload-complete",!1),this.toggleAttribute("upload-in-progress",!1)}),i(this,b).addEventListener("success",()=>{this.toggleAttribute("upload-complete",!0),this.toggleAttribute("upload-error",!1),this.toggleAttribute("upload-in-progress",!1)}),i(this,b).addEventListener("reset",()=>{this.toggleAttribute("upload-error",!1),this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!1)}),i(this,b).addEventListener("pausedchange",()=>{var s;if(this.pauseButton.disabled=!1,!i(this,b))return;let n=(s=i(this,b).paused)!=null?s:!1;this.pauseButton.innerHTML=n?"Pausing...":"Pause",n&&(this.pauseButton.disabled=!0,i(this,b).addEventListener("chunksuccess",()=>{var o;this.pauseButton.innerHTML=(o=i(this,b))!=null&&o.paused?"Resume":"Pause",this.pauseButton.disabled=!1},{once:!0}))}),this.pauseButton.addEventListener("click",this.triggerPause,r),this.toggleAttribute("upload-in-progress",i(this,b).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",i(this,b).hasAttribute("upload-complete")),this.toggleAttribute("upload-error",i(this,b).hasAttribute("upload-error"))}}disconnectedCallback(){var r;(r=i(this,q))==null||r.abort()}get pauseButton(){var r;return(r=this.shadowRoot)==null?void 0:r.getElementById("pause-button")}};b=new WeakMap,q=new WeakMap;d.customElements.get("mux-uploader-pause")||d.customElements.define("mux-uploader-pause",fe);var wr=fe;var Be=` | ||
<style> | ||
@@ -257,5 +257,5 @@ #file-select { | ||
</slot> | ||
`;var _,T,G,ge=class extends d.HTMLElement{constructor(){var n,s,o;super();c(this,_,void 0);c(this,T,void 0);c(this,G,void 0);this.attachShadow({mode:"open"}).appendChild(xt.content.cloneNode(!0)),this.handleFilePickerElClick=this.handleFilePickerElClick.bind(this),this.filePickerEl=(n=this.shadowRoot)==null?void 0:n.querySelector("button"),(o=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"))==null||o.addEventListener("slotchange",a=>{let u=a.currentTarget;this.filePickerEl=u.assignedElements({flatten:!0}).filter(p=>!["STYLE"].includes(p.nodeName))[0]})}connectedCallback(){if(f(this,T,w(this)),f(this,G,new AbortController),i(this,T)){let t={signal:i(this,G).signal};i(this,T).addEventListener("file-ready",()=>{this.toggleAttribute("file-ready",!0)},t),i(this,T).addEventListener("uploadstart",()=>this.toggleAttribute("upload-in-progress",!0),t),i(this,T).addEventListener("success",()=>{this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!0)},t),i(this,T).addEventListener("reset",()=>{this.toggleAttribute("file-ready",!1)},t),this.toggleAttribute("upload-in-progress",i(this,T).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",i(this,T).hasAttribute("upload-complete")),this.toggleAttribute("file-ready",i(this,T).hasAttribute("file-ready"))}}disconnectedCallback(){var t;(t=i(this,G))==null||t.abort()}get filePickerEl(){return i(this,_)}set filePickerEl(t){t!==i(this,_)&&(i(this,_)&&i(this,_).removeEventListener("click",this.handleFilePickerElClick),f(this,_,t),i(this,_)&&i(this,_).addEventListener("click",this.handleFilePickerElClick))}handleFilePickerElClick(){var s,o;let t=this.getAttribute("mux-uploader"),n=t?v.getElementById(t):this.getRootNode().host;(o=(s=n==null?void 0:n.shadowRoot)==null?void 0:s.querySelector("#hidden-file-input"))==null||o.click()}};_=new WeakMap,T=new WeakMap,G=new WeakMap;d.customElements.get("mux-uploader-file-select")||d.customElements.define("mux-uploader-file-select",ge);var xr=ge;function me(e,r){return e?"":r}var Ar=(e,r)=>{if(r==null||r===!1)return"";let t=r===!0?"":`${r}`;return`${e}="${t}"`};function Ie(e){let{noDrop:r,noProgress:t,noStatus:n,noRetry:s,pausable:o,type:a}=e,u=r?"div":'mux-uploader-drop overlay part="drop"',p=me(t,` | ||
`;var _,T,G,ge=class extends d.HTMLElement{constructor(){var n,s,o;super();c(this,_,void 0);c(this,T,void 0);c(this,G,void 0);this.attachShadow({mode:"open"}).appendChild(xt.content.cloneNode(!0)),this.handleFilePickerElClick=this.handleFilePickerElClick.bind(this),this.filePickerEl=(n=this.shadowRoot)==null?void 0:n.querySelector("button"),(o=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"))==null||o.addEventListener("slotchange",l=>{let u=l.currentTarget;this.filePickerEl=u.assignedElements({flatten:!0}).filter(p=>!["STYLE"].includes(p.nodeName))[0]})}connectedCallback(){if(f(this,T,w(this)),f(this,G,new AbortController),i(this,T)){let r={signal:i(this,G).signal};i(this,T).addEventListener("file-ready",()=>{this.toggleAttribute("file-ready",!0)},r),i(this,T).addEventListener("uploadstart",()=>this.toggleAttribute("upload-in-progress",!0),r),i(this,T).addEventListener("success",()=>{this.toggleAttribute("upload-in-progress",!1),this.toggleAttribute("upload-complete",!0)},r),i(this,T).addEventListener("reset",()=>{this.toggleAttribute("file-ready",!1)},r),this.toggleAttribute("upload-in-progress",i(this,T).hasAttribute("upload-in-progress")),this.toggleAttribute("upload-complete",i(this,T).hasAttribute("upload-complete")),this.toggleAttribute("file-ready",i(this,T).hasAttribute("file-ready"))}}disconnectedCallback(){var r;(r=i(this,G))==null||r.abort()}get filePickerEl(){return i(this,_)}set filePickerEl(r){r!==i(this,_)&&(i(this,_)&&i(this,_).removeEventListener("click",this.handleFilePickerElClick),f(this,_,r),i(this,_)&&i(this,_).addEventListener("click",this.handleFilePickerElClick))}handleFilePickerElClick(){var s,o;let r=this.getAttribute("mux-uploader"),n=r?v.getElementById(r):this.getRootNode().host;(o=(s=n==null?void 0:n.shadowRoot)==null?void 0:s.querySelector("#hidden-file-input"))==null||o.click()}};_=new WeakMap,T=new WeakMap,G=new WeakMap;d.customElements.get("mux-uploader-file-select")||d.customElements.define("mux-uploader-file-select",ge);var xr=ge;function me(e,t){return e?"":t}var Ar=(e,t)=>{if(t==null||t===!1)return"";let r=t===!0?"":`${t}`;return`${e}="${r}"`};function Ie(e){let{noDrop:t,noProgress:r,noStatus:n,noRetry:s,pausable:o,type:l}=e,u=t?"div":'mux-uploader-drop overlay part="drop"',p=me(r,` | ||
<mux-uploader-progress part="progress progress-percentage" type="percentage"></mux-uploader-progress> | ||
<mux-uploader-progress part="progress progress-bar" ${Ar("type",a)}></mux-uploader-progress> | ||
<mux-uploader-progress part="progress progress-bar" ${Ar("type",l)}></mux-uploader-progress> | ||
`),y=me(n,'<mux-uploader-status part="status"></mux-uploader-status>'),E=me(s,'<mux-uploader-retry part="retry"></mux-uploader-retry>'),S=me(!o,'<mux-uploader-pause part="pause"></mux-uploader-pause>');return v.createRange().createContextualFragment(` | ||
@@ -293,3 +293,3 @@ <${u}> | ||
<mux-uploader-sr-text></mux-uploader-sr-text> | ||
`;var se=class extends d.HTMLElement{constructor(){var n;super();this.attachShadow({mode:"open"}).appendChild(At.content.cloneNode(!0)),this.updateLayout(),(n=this.hiddenFileInput)==null||n.addEventListener("change",()=>{var o,a;let s=(a=(o=this.hiddenFileInput)==null?void 0:o.files)==null?void 0:a[0];this.toggleAttribute("file-ready",!!s),s&&this.dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:s}))})}static get observedAttributes(){return["pausable","type","no-drop","no-progress","no-status","no-retry","max-file-size","use-large-file-workaround"]}connectedCallback(){this.addEventListener("file-ready",this.handleUpload),this.addEventListener("reset",this.resetState)}disconnectedCallback(){this.removeEventListener("file-ready",this.handleUpload,!1),this.removeEventListener("reset",this.resetState)}attributeChangedCallback(){this.updateLayout()}get hiddenFileInput(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("#hidden-file-input")}get endpoint(){var t;return(t=this.getAttribute("endpoint"))!=null?t:this._endpoint}set endpoint(t){t!==this.endpoint&&(typeof t=="string"?this.setAttribute("endpoint",t):t==null&&this.removeAttribute("endpoint"),this._endpoint=t)}get type(){var t;return(t=this.getAttribute("type"))!=null?t:void 0}set type(t){t!=this.type&&(t?this.setAttribute("type",t):this.removeAttribute("type"))}get noDrop(){return this.hasAttribute("no-drop")}set noDrop(t){this.toggleAttribute("no-drop",!!t)}get noProgress(){return this.hasAttribute("no-progress")}set noProgress(t){this.toggleAttribute("no-progress",!!t)}get noStatus(){return this.hasAttribute("no-status")}set noStatus(t){this.toggleAttribute("no-status",!!t)}get noRetry(){return this.hasAttribute("no-retry")}set noRetry(t){this.toggleAttribute("no-retry",!!t)}get pausable(){return this.hasAttribute("pausable")}set pausable(t){this.toggleAttribute("pausable",!!t)}get dynamicChunkSize(){return this.hasAttribute("dynamic-chunk-size")}set dynamicChunkSize(t){t!==this.hasAttribute("dynamic-chunk-size")&&(t?this.setAttribute("dynamic-chunk-size",""):this.removeAttribute("dynamic-chunk-size"))}get useLargeFileWorkaround(){return this.hasAttribute("use-large-file-workaround")}set useLargeFileWorkaround(t){t!=this.useLargeFileWorkaround&&this.toggleAttribute("use-large-file-workaround",!!t)}get maxFileSize(){let t=this.getAttribute("max-file-size");return t!==null?parseInt(t):void 0}set maxFileSize(t){t?this.setAttribute("max-file-size",t.toString()):this.removeAttribute("max-file-size")}get chunkSize(){let t=this.getAttribute("chunk-size");return t!==null?parseInt(t):void 0}set chunkSize(t){t?this.setAttribute("chunk-size",t.toString()):this.removeAttribute("chunk-size")}get upload(){return this._upload}get paused(){var t,n;return(n=(t=this.upload)==null?void 0:t.paused)!=null?n:!1}set paused(t){if(!this.upload){console.warn("Pausing before an upload has begun is unsupported");return}let n=!!t;n!==this.paused&&(n?this.upload.pause():this.upload.resume(),this.toggleAttribute("paused",n),this.dispatchEvent(new CustomEvent("pausedchange",{detail:n})))}updateLayout(){var s,o;let t=(s=this.shadowRoot)==null?void 0:s.querySelector("mux-uploader-drop, div");t&&t.remove();let n=Ie(this);(o=this.shadowRoot)==null||o.appendChild(n)}setError(t){this.setAttribute("upload-error",""),this.dispatchEvent(new CustomEvent("uploaderror",{detail:{message:t}}))}resetState(){this.removeAttribute("upload-error"),this.removeAttribute("upload-in-progress"),this.removeAttribute("upload-complete"),this.hiddenFileInput.value=""}handleUpload(t){let n=this.endpoint,s=this.dynamicChunkSize;if(n)this.removeAttribute("upload-error");else{this.setError("No url or endpoint specified -- cannot handleUpload");return}try{let o=Oe.createUpload({endpoint:n,dynamicChunkSize:s,file:t.detail,maxFileSize:this.maxFileSize,chunkSize:this.chunkSize,useLargeFileWorkaround:this.useLargeFileWorkaround});this._upload=o,this.dispatchEvent(new CustomEvent("uploadstart",{detail:{file:o.file,chunkSize:o.chunkSize}})),this.setAttribute("upload-in-progress",""),o.offline&&this.dispatchEvent(new CustomEvent("offline")),o.on("attempt",a=>{this.dispatchEvent(new CustomEvent("chunkattempt",a))}),o.on("chunkSuccess",a=>{this.dispatchEvent(new CustomEvent("chunksuccess",a))}),o.on("error",a=>{this.setAttribute("upload-error",""),console.error("error handler",a.detail.message),this.dispatchEvent(new CustomEvent("uploaderror",a))}),o.on("progress",a=>{this.dispatchEvent(new CustomEvent("progress",a))}),o.on("success",a=>{this.removeAttribute("upload-in-progress"),this.setAttribute("upload-complete",""),this.dispatchEvent(new CustomEvent("success",a))}),o.on("offline",a=>{this.dispatchEvent(new CustomEvent("offline",a))}),o.on("online",a=>{this.dispatchEvent(new CustomEvent("online",a))})}catch(o){o instanceof Error&&this.setError(o.message)}}};d.customElements.get("mux-uploader")||(d.customElements.define("mux-uploader",se),d.MuxUploaderElement=se);var Tt=se;var Lt=v.createElement("template");Lt.innerHTML=` | ||
`;var se=class extends d.HTMLElement{static get observedAttributes(){return["pausable","type","no-drop","no-progress","no-status","no-retry","max-file-size","use-large-file-workaround"]}constructor(){var r;super(),this.attachShadow({mode:"open"}).appendChild(At.content.cloneNode(!0)),this.updateLayout(),(r=this.hiddenFileInput)==null||r.addEventListener("change",()=>{var s,o;let n=(o=(s=this.hiddenFileInput)==null?void 0:s.files)==null?void 0:o[0];this.toggleAttribute("file-ready",!!n),n&&this.dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:n}))})}connectedCallback(){this.addEventListener("file-ready",this.handleUpload),this.addEventListener("reset",this.resetState)}disconnectedCallback(){this.removeEventListener("file-ready",this.handleUpload,!1),this.removeEventListener("reset",this.resetState)}attributeChangedCallback(){this.updateLayout()}get hiddenFileInput(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("#hidden-file-input")}get endpoint(){var t;return(t=this.getAttribute("endpoint"))!=null?t:this._endpoint}set endpoint(t){t!==this.endpoint&&(typeof t=="string"?this.setAttribute("endpoint",t):t==null&&this.removeAttribute("endpoint"),this._endpoint=t)}get type(){var t;return(t=this.getAttribute("type"))!=null?t:void 0}set type(t){t!=this.type&&(t?this.setAttribute("type",t):this.removeAttribute("type"))}get noDrop(){return this.hasAttribute("no-drop")}set noDrop(t){this.toggleAttribute("no-drop",!!t)}get noProgress(){return this.hasAttribute("no-progress")}set noProgress(t){this.toggleAttribute("no-progress",!!t)}get noStatus(){return this.hasAttribute("no-status")}set noStatus(t){this.toggleAttribute("no-status",!!t)}get noRetry(){return this.hasAttribute("no-retry")}set noRetry(t){this.toggleAttribute("no-retry",!!t)}get pausable(){return this.hasAttribute("pausable")}set pausable(t){this.toggleAttribute("pausable",!!t)}get dynamicChunkSize(){return this.hasAttribute("dynamic-chunk-size")}set dynamicChunkSize(t){t!==this.hasAttribute("dynamic-chunk-size")&&(t?this.setAttribute("dynamic-chunk-size",""):this.removeAttribute("dynamic-chunk-size"))}get useLargeFileWorkaround(){return this.hasAttribute("use-large-file-workaround")}set useLargeFileWorkaround(t){t!=this.useLargeFileWorkaround&&this.toggleAttribute("use-large-file-workaround",!!t)}get maxFileSize(){let t=this.getAttribute("max-file-size");return t!==null?parseInt(t):void 0}set maxFileSize(t){t?this.setAttribute("max-file-size",t.toString()):this.removeAttribute("max-file-size")}get chunkSize(){let t=this.getAttribute("chunk-size");return t!==null?parseInt(t):void 0}set chunkSize(t){t?this.setAttribute("chunk-size",t.toString()):this.removeAttribute("chunk-size")}get upload(){return this._upload}get paused(){var t,r;return(r=(t=this.upload)==null?void 0:t.paused)!=null?r:!1}set paused(t){if(!this.upload){console.warn("Pausing before an upload has begun is unsupported");return}let r=!!t;r!==this.paused&&(r?this.upload.pause():this.upload.resume(),this.toggleAttribute("paused",r),this.dispatchEvent(new CustomEvent("pausedchange",{detail:r})))}updateLayout(){var n,s;let t=(n=this.shadowRoot)==null?void 0:n.querySelector("mux-uploader-drop, div");t&&t.remove();let r=Ie(this);(s=this.shadowRoot)==null||s.appendChild(r)}setError(t){this.setAttribute("upload-error",""),this.dispatchEvent(new CustomEvent("uploaderror",{detail:{message:t}}))}resetState(){this.removeAttribute("upload-error"),this.removeAttribute("upload-in-progress"),this.removeAttribute("upload-complete"),this.hiddenFileInput.value=""}handleUpload(t){let r=this.endpoint,n=this.dynamicChunkSize;if(r)this.removeAttribute("upload-error");else{this.setError("No url or endpoint specified -- cannot handleUpload");return}try{let s=Oe.createUpload({endpoint:r,dynamicChunkSize:n,file:t.detail,maxFileSize:this.maxFileSize,chunkSize:this.chunkSize,useLargeFileWorkaround:this.useLargeFileWorkaround});this._upload=s,this.dispatchEvent(new CustomEvent("uploadstart",{detail:{file:s.file,chunkSize:s.chunkSize}})),this.setAttribute("upload-in-progress",""),s.offline&&this.dispatchEvent(new CustomEvent("offline")),s.on("attempt",o=>{this.dispatchEvent(new CustomEvent("chunkattempt",o))}),s.on("chunkSuccess",o=>{this.dispatchEvent(new CustomEvent("chunksuccess",o))}),s.on("error",o=>{this.setAttribute("upload-error",""),console.error("error handler",o.detail.message),this.dispatchEvent(new CustomEvent("uploaderror",o))}),s.on("progress",o=>{this.dispatchEvent(new CustomEvent("progress",o))}),s.on("success",o=>{this.removeAttribute("upload-in-progress"),this.setAttribute("upload-complete",""),this.dispatchEvent(new CustomEvent("success",o))}),s.on("offline",o=>{this.dispatchEvent(new CustomEvent("offline",o))}),s.on("online",o=>{this.dispatchEvent(new CustomEvent("online",o))})}catch(s){s instanceof Error&&this.setError(s.message)}}};d.customElements.get("mux-uploader")||(d.customElements.define("mux-uploader",se),d.MuxUploaderElement=se);var Tt=se;var Lt=v.createElement("template");Lt.innerHTML=` | ||
<style> | ||
@@ -296,0 +296,0 @@ |
{ | ||
"name": "@mux/mux-uploader", | ||
"version": "1.0.2", | ||
"version": "1.0.3-canary.0", | ||
"description": "An uploader elements to be used with Mux Direct Uploads", | ||
@@ -35,5 +35,5 @@ "keywords": [ | ||
"require": "./dist/index.cjs.js", | ||
"default": "./dist/index.cjs.js", | ||
"types@<4.3.5": "./dist/types-ts3.4/index.d.ts", | ||
"types": "./dist/types/index.d.ts" | ||
"types": "./dist/types/index.d.ts", | ||
"default": "./dist/index.cjs.js" | ||
} | ||
@@ -44,3 +44,3 @@ }, | ||
"type": "git", | ||
"url": "https://github.com/muxinc/elements", | ||
"url": "git+https://github.com/muxinc/elements.git", | ||
"directory": "packages/mux-uploader" | ||
@@ -67,5 +67,3 @@ }, | ||
"postbuild:types": "downlevel-dts ./dist/types ./dist/types-ts3.4", | ||
"build": "npm-run-all --parallel 'build:esm --minify' 'build:iife --minify' 'build:cjs --minify' 'build:esm-module --minify'", | ||
"create-release-notes": "create-release-notes ./CHANGELOG.md", | ||
"publish-release": "../../scripts/publish.sh" | ||
"build": "npm-run-all --parallel 'build:esm --minify' 'build:iife --minify' 'build:cjs --minify' 'build:esm-module --minify'" | ||
}, | ||
@@ -79,3 +77,3 @@ "dependencies": { | ||
"@web/dev-server-import-maps": "^0.2.1", | ||
"@web/test-runner": "^0.18.2", | ||
"@web/test-runner": "^0.19.0", | ||
"copyfiles": "^2.4.1", | ||
@@ -89,4 +87,3 @@ "downlevel-dts": "^0.11.0", | ||
"typescript": "^5.5.4" | ||
}, | ||
"gitHead": "5ae58b9de16ae2dcd807276bb6539c1f8cfab800" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
729506
39
3