Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mux/mux-uploader

Package Overview
Dependencies
Maintainers
44
Versions
542
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mux/mux-uploader - npm Package Compare versions

Comparing version 0.1.0-canary.0-556dabf to 0.1.0-canary.1-04bc498

11

dist/mux-uploader.js

@@ -1,4 +0,4 @@

(()=>{var Ot=Object.create;var st=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var It=Object.getOwnPropertyNames;var jt=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty;var _t=f=>st(f,"__esModule",{value:!0});var Ft=(f,o)=>()=>(o||f((o={exports:{}}).exports,o),o.exports);var Ht=(f,o,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of It(o))!Dt.call(f,r)&&r!=="default"&&st(f,r,{get:()=>o[r],enumerable:!(a=Bt(o,r))||a.enumerable});return f},Ut=f=>Ht(_t(st(f!=null?Ot(jt(f)):{},"default",f&&f.__esModule&&"default"in f?{get:()=>f.default,enumerable:!0}:{value:f,enumerable:!0})),f);var xt=Ft((Y,it)=>{(function(f,o){typeof Y=="object"&&typeof it=="object"?it.exports=o():typeof define=="function"&&define.amd?define([],o):typeof Y=="object"?Y.UpChunk=o():f.UpChunk=o()})(Y,function(){return function(f){var o={};function a(r){if(o[r])return o[r].exports;var i=o[r]={i:r,l:!1,exports:{}};return f[r].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=f,a.c=o,a.d=function(r,i,h){a.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:h})},a.r=function(r){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},a.t=function(r,i){if(1&i&&(r=a(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var h=Object.create(null);if(a.r(h),Object.defineProperty(h,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var b in r)a.d(h,b,function(w){return r[w]}.bind(null,b));return h},a.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return a.d(i,"a",i),i},a.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},a.p="",a(a.s=1)}([function(f,o){var a;a=function(){return this}();try{a=a||new Function("return this")()}catch{typeof window=="object"&&(a=window)}f.exports=a},function(f,o,a){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(d){for(var t,u=1,v=arguments.length;u<v;u++)for(var T in t=arguments[u])Object.prototype.hasOwnProperty.call(t,T)&&(d[T]=t[T]);return d}).apply(this,arguments)};o.__esModule=!0,o.createUpload=o.UpChunk=void 0;var i=a(2),h=a(4),b=[200,201,202,204,308],w=[408,502,503,504],y=function(){function d(t){var u=this;this.endpoint=t.endpoint,this.file=t.file,this.headers=t.headers||{},this.method=t.method||"PUT",this.chunkSize=t.chunkSize||30720,this.attempts=t.attempts||5,this.delayBeforeAttempt=t.delayBeforeAttempt||1,this.maxFileBytes=1024*(t.maxFileSize||0),this.chunkCount=0,this.chunkByteSize=1024*this.chunkSize,this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.attemptCount=0,this.offline=!1,this.paused=!1,this.success=!1,this.reader=new FileReader,this.eventTarget=new i.EventTarget,this.validateOptions(),this.getEndpoint().then(function(){return u.sendChunks()}),typeof window!="undefined"&&(window.addEventListener("online",function(){u.offline&&(u.offline=!1,u.dispatch("online"),u.sendChunks())}),window.addEventListener("offline",function(){u.offline=!0,u.dispatch("offline")}))}return d.prototype.on=function(t,u){this.eventTarget.addEventListener(t,u)},d.prototype.abort=function(){var t;this.pause(),(t=this.currentXhr)===null||t===void 0||t.abort()},d.prototype.pause=function(){this.paused=!0},d.prototype.resume=function(){this.paused&&(this.paused=!1,this.sendChunks())},d.prototype.dispatch=function(t,u){var v=new CustomEvent(t,{detail:u});this.eventTarget.dispatchEvent(v)},d.prototype.validateOptions=function(){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!="object")throw new TypeError("headers must be null or an object");if(this.chunkSize&&(typeof this.chunkSize!="number"||this.chunkSize<=0||this.chunkSize%256!=0))throw new TypeError("chunkSize must be a positive number in multiples of 256");if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error("file size exceeds maximum (".concat(this.file.size," > ").concat(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")},d.prototype.getEndpoint=function(){var t=this;return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(function(u){return t.endpointValue=u,t.endpointValue})},d.prototype.getChunk=function(){var t=this;return new Promise(function(u){var v=t.totalChunks===1?t.file.size:t.chunkByteSize,T=v*t.chunkCount;t.reader.onload=function(){t.reader.result!==null&&(t.chunk=new Blob([t.reader.result],{type:"application/octet-stream"})),u()},t.reader.readAsArrayBuffer(t.file.slice(T,T+v))})},d.prototype.xhrPromise=function(t){var u=this,v=function(T){T.upload.onprogress=function(O){var k,E=100/u.totalChunks,A=E*u.file.size,c=E*u.chunkCount,_=O.loaded/((k=O.total)!==null&&k!==void 0?k:A)*E;u.dispatch("progress",Math.min(c+_,100))}};return new Promise(function(T,O){u.currentXhr=(0,h.default)(r(r({},t),{beforeSend:v}),function(k,E){return u.currentXhr=void 0,k?O(k):T(E)})})},d.prototype.sendChunk=function(){var t=this.chunkCount*this.chunkByteSize,u=t+this.chunk.size-1,v=r(r({},this.headers),{"Content-Type":this.file.type,"Content-Range":"bytes ".concat(t,"-").concat(u,"/").concat(this.file.size)});return this.dispatch("attempt",{chunkNumber:this.chunkCount,chunkSize:this.chunk.size}),this.xhrPromise({headers:v,url:this.endpointValue,method:this.method,body:this.chunk})},d.prototype.manageRetries=function(){var t=this;if(this.attemptCount<this.attempts)return setTimeout(function(){return t.sendChunks()},1e3*this.delayBeforeAttempt),void this.dispatch("attemptFailure",{message:"An error occured uploading chunk ".concat(this.chunkCount,". ").concat(this.attempts-this.attemptCount," retries left."),chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount});this.dispatch("error",{message:"An error occured uploading chunk ".concat(this.chunkCount,". No more retries, stopping upload"),chunk:this.chunkCount,attempts:this.attemptCount})},d.prototype.sendChunks=function(){var t=this;this.paused||this.offline||this.success||this.getChunk().then(function(){return t.attemptCount=t.attemptCount+1,t.sendChunk()}).then(function(u){if(b.includes(u.statusCode)){t.dispatch("chunkSuccess",{chunk:t.chunkCount,attempts:t.attemptCount,response:u}),t.attemptCount=0,t.chunkCount=t.chunkCount+1,t.chunkCount<t.totalChunks?t.sendChunks():(t.success=!0,t.dispatch("success"));var v=100*(t.chunkCount/t.totalChunks*t.file.size)/t.file.size;t.dispatch("progress",v)}else if(w.includes(u.statusCode)){if(t.paused||t.offline)return;t.manageRetries()}else{if(t.paused||t.offline)return;t.dispatch("error",{message:"Server responded with ".concat(u.statusCode,". Stopping upload."),chunkNumber:t.chunkCount,attempts:t.attemptCount})}}).catch(function(u){t.paused||t.offline||t.manageRetries()})},d}();o.UpChunk=y,o.createUpload=function(d){return new y(d)}},function(f,o,a){"use strict";(function(r,i){function h(e,n,...s){if(!e)throw new TypeError(b(n,s))}function b(e,n){let s=0;return e.replace(/%[os]/gu,()=>w(n[s++]))}function w(e){return typeof e!="object"||e===null?String(e):Object.prototype.toString.call(e)}let y;Object.defineProperty(o,"__esModule",{value:!0});let d=typeof window!="undefined"?window:typeof self!="undefined"?self:i!==void 0?i:typeof globalThis!="undefined"?globalThis:void 0,t;class u{constructor(n,s){this.code=n,this.message=s}warn(...n){var s;try{if(t)return void t({...this,args:n});let l=((s=new Error().stack)!==null&&s!==void 0?s:"").replace(/^(?:.+?\n){2}/gu,`
`);console.warn(this.message,...n,l)}catch{}}}let v=new u("W01","Unable to initialize event under dispatching."),T=new u("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),O=new u("W03","Assigning any truthy value to 'returnValue' property has no effect."),k=new u("W04","Unable to preventDefault on non-cancelable events."),E=new u("W05","Unable to preventDefault inside passive event listener invocation."),A=new u("W06","An event listener wasn't added because it has been added already: %o, %o"),c=new u("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),_=new u("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),z=new u("W09","Event attribute handler must be a function: %o");class M{static get NONE(){return q}static get CAPTURING_PHASE(){return B}static get AT_TARGET(){return V}static get BUBBLING_PHASE(){return J}constructor(n,s){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let l=s!=null?s:{};X.set(this,{type:String(n),bubbles:Boolean(l.bubbles),cancelable:Boolean(l.cancelable),composed:Boolean(l.composed),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return g(this).type}get target(){return g(this).target}get srcElement(){return g(this).target}get currentTarget(){return g(this).currentTarget}composedPath(){let n=g(this).currentTarget;return n?[n]:[]}get NONE(){return q}get CAPTURING_PHASE(){return B}get AT_TARGET(){return V}get BUBBLING_PHASE(){return J}get eventPhase(){return g(this).dispatchFlag?2:0}stopPropagation(){g(this).stopPropagationFlag=!0}get cancelBubble(){return g(this).stopPropagationFlag}set cancelBubble(n){n?g(this).stopPropagationFlag=!0:T.warn()}stopImmediatePropagation(){let n=g(this);n.stopPropagationFlag=n.stopImmediatePropagationFlag=!0}get bubbles(){return g(this).bubbles}get cancelable(){return g(this).cancelable}get returnValue(){return!g(this).canceledFlag}set returnValue(n){n?O.warn():x(g(this))}preventDefault(){x(g(this))}get defaultPrevented(){return g(this).canceledFlag}get composed(){return g(this).composed}get isTrusted(){return!1}get timeStamp(){return g(this).timeStamp}initEvent(n,s=!1,l=!1){let p=g(this);p.dispatchFlag?v.warn():X.set(this,{...p,type:String(n),bubbles:Boolean(s),cancelable:Boolean(l),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}}let q=0,B=1,V=2,J=3,X=new WeakMap;function g(e,n="this"){let s=X.get(e);return h(s!=null,"'%s' must be an object that Event constructor created, but got another one: %o",n,e),s}function x(e){e.inPassiveListenerFlag?E.warn():e.cancelable?e.canceledFlag=!0:k.warn()}Object.defineProperty(M,"NONE",{enumerable:!0}),Object.defineProperty(M,"CAPTURING_PHASE",{enumerable:!0}),Object.defineProperty(M,"AT_TARGET",{enumerable:!0}),Object.defineProperty(M,"BUBBLING_PHASE",{enumerable:!0});let I=Object.getOwnPropertyNames(M.prototype);for(let e=0;e<I.length;++e)I[e]!=="constructor"&&Object.defineProperty(M.prototype,I[e],{enumerable:!0});let U;d!==void 0&&d.Event!==void 0&&Object.setPrototypeOf(M.prototype,d.Event.prototype);let ut={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 lt(e){let n=Object.keys(ut);for(let s=0;s<n.length;++s){let l=n[s],p=ut[l];Object.defineProperty(e,l,{get:()=>p,configurable:!0,enumerable:!0})}}class K extends M{static wrap(n){return new(function s(l){let p=Object.getPrototypeOf(l);if(p==null)return K;let m=Z.get(p);return m==null&&(m=function(C,P){class L extends C{}let R=Object.keys(P);for(let S=0;S<R.length;++S)Object.defineProperty(L.prototype,R[S],pt(P,R[S]));return L}(s(p),p),Z.set(p,m)),m}(n))(n)}constructor(n){super(n.type,{bubbles:n.bubbles,cancelable:n.cancelable,composed:n.composed}),n.cancelBubble&&super.stopPropagation(),n.defaultPrevented&&super.preventDefault(),ct.set(this,{original:n});let s=Object.keys(n);for(let l=0;l<s.length;++l){let p=s[l];p in this||Object.defineProperty(this,p,pt(n,p))}}stopPropagation(){super.stopPropagation();let{original:n}=H(this);"stopPropagation"in n&&n.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(n){super.cancelBubble=n;let{original:s}=H(this);"cancelBubble"in s&&(s.cancelBubble=n)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:n}=H(this);"stopImmediatePropagation"in n&&n.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(n){super.returnValue=n;let{original:s}=H(this);"returnValue"in s&&(s.returnValue=n)}preventDefault(){super.preventDefault();let{original:n}=H(this);"preventDefault"in n&&n.preventDefault()}get timeStamp(){let{original:n}=H(this);return"timeStamp"in n?n.timeStamp:super.timeStamp}}let ct=new WeakMap;function H(e){let n=ct.get(e);return h(n!=null,"'this' is expected an Event object, but got",e),n}let Z=new WeakMap;function pt(e,n){let s=Object.getOwnPropertyDescriptor(e,n);return{get(){let l=H(this).original,p=l[n];return typeof p=="function"?p.bind(l):p},set(l){H(this).original[n]=l},configurable:s.configurable,enumerable:s.enumerable}}function dt(e){return(1&e.flags)==1}function ht(e){return(2&e.flags)==2}function ft(e){return(4&e.flags)==4}function Mt(e){return(8&e.flags)==8}function St({callback:e},n,s){try{typeof e=="function"?e.call(n,s):typeof e.handleEvent=="function"&&e.handleEvent(s)}catch(l){(function(p){try{let m=p instanceof Error?p:new Error(w(p));if(y)return void y(m);if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:m,message:m.message}));else if(r!==void 0&&typeof r.emit=="function")return void r.emit("uncaughtException",m);console.error(m)}catch{}})(l)}}function gt({listeners:e},n,s){for(let l=0;l<e.length;++l)if(e[l].callback===n&&dt(e[l])===s)return l;return-1}function bt(e,n,s,l,p,m){let C;m&&(C=rt.bind(null,e,n,s),m.addEventListener("abort",C));let P=function(L,R,S,j,tt,D){return{callback:L,flags:(R?1:0)|(S?2:0)|(j?4:0),signal:tt,signalListener:D}}(n,s,l,p,m,C);return e.cow?(e.cow=!1,e.listeners=[...e.listeners,P]):e.listeners.push(P),P}function rt(e,n,s){let l=gt(e,n,s);return l!==-1&&mt(e,l)}function mt(e,n,s=!1){let l=e.listeners[n];return function(p){p.flags|=8}(l),l.signal&&l.signal.removeEventListener("abort",l.signalListener),e.cow&&!s?(e.cow=!1,e.listeners=e.listeners.filter((p,m)=>m!==n),!1):(e.listeners.splice(n,1),!0)}function yt(e,n){var s;return(s=e[n])!==null&&s!==void 0?s:e[n]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}Z.set(Object.prototype,K),d!==void 0&&d.Event!==void 0&&Z.set(d.Event.prototype,K);class G{constructor(){vt.set(this,Object.create(null))}addEventListener(n,s,l){let p=W(this),{callback:m,capture:C,once:P,passive:L,signal:R,type:S}=function(D,N,F){var Q;return Et(N),typeof F=="object"&&F!==null?{type:String(D),callback:N!=null?N:void 0,capture:Boolean(F.capture),passive:Boolean(F.passive),once:Boolean(F.once),signal:(Q=F.signal)!==null&&Q!==void 0?Q:void 0}:{type:String(D),callback:N!=null?N:void 0,capture:Boolean(F),passive:!1,once:!1,signal:void 0}}(n,s,l);if(m==null||(R==null?void 0:R.aborted))return;let j=yt(p,S),tt=gt(j,m,C);tt===-1?bt(j,m,C,L,P,R):function(D,N,F,Q){A.warn(dt(D)?"capture":"bubble",D.callback),ht(D)!==N&&c.warn("passive"),ft(D)!==F&&c.warn("once"),D.signal!==Q&&c.warn("signal")}(j.listeners[tt],L,P,R)}removeEventListener(n,s,l){let p=W(this),{callback:m,capture:C,type:P}=function(R,S,j){return Et(S),typeof j=="object"&&j!==null?{type:String(R),callback:S!=null?S:void 0,capture:Boolean(j.capture)}:{type:String(R),callback:S!=null?S:void 0,capture:Boolean(j)}}(n,s,l),L=p[P];m!=null&&L&&rt(L,m,C)}dispatchEvent(n){let s=W(this)[String(n.type)];if(s==null)return!0;let l=n instanceof M?n:K.wrap(n),p=g(l,"event");if(p.dispatchFlag)throw m="This event has been in dispatching.",d.DOMException?new d.DOMException(m,"InvalidStateError"):(U==null&&(U=class Rt extends Error{constructor(P){super(P),Error.captureStackTrace&&Error.captureStackTrace(this,Rt)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(U.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),lt(U),lt(U.prototype)),new U(m));var m;if(p.dispatchFlag=!0,p.target=p.currentTarget=this,!p.stopPropagationFlag){let{cow:C,listeners:P}=s;s.cow=!0;for(let L=0;L<P.length;++L){let R=P[L];if(!Mt(R)&&(ft(R)&&mt(s,L,!C)&&(L-=1),p.inPassiveListenerFlag=ht(R),St(R,this,l),p.inPassiveListenerFlag=!1,p.stopImmediatePropagationFlag))break}C||(s.cow=!1)}return p.target=null,p.currentTarget=null,p.stopImmediatePropagationFlag=!1,p.stopPropagationFlag=!1,p.dispatchFlag=!1,!p.canceledFlag}}let vt=new WeakMap;function W(e,n="this"){let s=vt.get(e);return h(s!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",n,e),s}function Et(e){if(typeof e!="function"&&(typeof e!="object"||e===null||typeof e.handleEvent!="function")){if(e!=null&&typeof e!="object")throw new TypeError(b(_.message,[e]));_.warn(e)}}let ot=Object.getOwnPropertyNames(G.prototype);for(let e=0;e<ot.length;++e)ot[e]!=="constructor"&&Object.defineProperty(G.prototype,ot[e],{enumerable:!0});function wt(e,n){var s,l;return(l=(s=W(e,"target")[n])===null||s===void 0?void 0:s.attrCallback)!==null&&l!==void 0?l:null}function Tt(e,n,s){s!=null&&typeof s!="function"&&z.warn(s),typeof s=="function"||typeof s=="object"&&s!==null?function(l,p,m){let C=yt(W(l,"target"),String(p));C.attrCallback=m,C.attrListener==null&&(C.attrListener=bt(C,function(P){return function(L){let R=P.attrCallback;typeof R=="function"&&R.call(this,L)}}(C),!1,!1,!1,void 0))}(e,n,s):function(l,p){let m=W(l,"target")[String(p)];m&&m.attrListener&&(rt(m,m.attrListener.callback,!1),m.attrCallback=m.attrListener=void 0)}(e,n)}function kt(e,n,s){Object.defineProperty(e,"on"+n,{get(){return wt(this,n)},set(l){Tt(this,n,l)},configurable:!0,enumerable:!0})}d!==void 0&&d.EventTarget!==void 0&&Object.setPrototypeOf(G.prototype,d.EventTarget.prototype),o.Event=M,o.EventTarget=G,o.default=G,o.defineCustomEventTarget=function(...e){class n extends G{}for(let s=0;s<e.length;++s)kt(n.prototype,e[s]);return n},o.defineEventAttribute=kt,o.getEventAttributeValue=wt,o.setErrorHandler=function(e){h(typeof e=="function"||e===void 0,"The error handler must be a function or undefined, but got %o.",e),y=e},o.setEventAttributeValue=Tt,o.setWarningHandler=function(e){h(typeof e=="function"||e===void 0,"The warning handler must be a function or undefined, but got %o.",e),t=e}}).call(this,a(3),a(0))},function(f,o){var a,r,i=f.exports={};function h(){throw new Error("setTimeout has not been defined")}function b(){throw new Error("clearTimeout has not been defined")}function w(E){if(a===setTimeout)return setTimeout(E,0);if((a===h||!a)&&setTimeout)return a=setTimeout,setTimeout(E,0);try{return a(E,0)}catch{try{return a.call(null,E,0)}catch{return a.call(this,E,0)}}}(function(){try{a=typeof setTimeout=="function"?setTimeout:h}catch{a=h}try{r=typeof clearTimeout=="function"?clearTimeout:b}catch{r=b}})();var y,d=[],t=!1,u=-1;function v(){t&&y&&(t=!1,y.length?d=y.concat(d):u=-1,d.length&&T())}function T(){if(!t){var E=w(v);t=!0;for(var A=d.length;A;){for(y=d,d=[];++u<A;)y&&y[u].run();u=-1,A=d.length}y=null,t=!1,function(c){if(r===clearTimeout)return clearTimeout(c);if((r===b||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(c);try{r(c)}catch{try{return r.call(null,c)}catch{return r.call(this,c)}}}(E)}}function O(E,A){this.fun=E,this.array=A}function k(){}i.nextTick=function(E){var A=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)A[c-1]=arguments[c];d.push(new O(E,A)),d.length!==1||t||w(T)},O.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=k,i.addListener=k,i.once=k,i.off=k,i.removeListener=k,i.removeAllListeners=k,i.emit=k,i.prependListener=k,i.prependOnceListener=k,i.listeners=function(E){return[]},i.binding=function(E){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(E){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(f,o,a){"use strict";var r=a(5),i=a(6),h=a(7),b=a(8);function w(t,u,v){var T=t;return i(u)?(v=u,typeof t=="string"&&(T={uri:t})):T=b(u,{uri:t}),T.callback=v,T}function y(t,u,v){return d(u=w(t,u,v))}function d(t){if(t.callback===void 0)throw new Error("callback argument missing");var u=!1,v=function(g,x,I){u||(u=!0,t.callback(g,x,I))};function T(){var g=void 0;if(g=c.response?c.response:c.responseText||function(x){try{if(x.responseType==="document")return x.responseXML;var I=x.responseXML&&x.responseXML.documentElement.nodeName==="parsererror";if(x.responseType===""&&!I)return x.responseXML}catch{}return null}(c),J)try{g=JSON.parse(g)}catch{}return g}function O(g){return clearTimeout(_),g instanceof Error||(g=new Error(""+(g||"Unknown XMLHttpRequest Error"))),g.statusCode=0,v(g,X)}function k(){if(!A){var g;clearTimeout(_),g=t.useXDR&&c.status===void 0?200:c.status===1223?204:c.status;var x=X,I=null;return g!==0?(x={body:T(),statusCode:g,method:M,headers:{},url:z,rawRequest:c},c.getAllResponseHeaders&&(x.headers=h(c.getAllResponseHeaders()))):I=new Error("Internal XMLHttpRequest Error"),v(I,x,x.body)}}var E,A,c=t.xhr||null;c||(c=t.cors||t.useXDR?new y.XDomainRequest:new y.XMLHttpRequest);var _,z=c.url=t.uri||t.url,M=c.method=t.method||"GET",q=t.body||t.data,B=c.headers=t.headers||{},V=!!t.sync,J=!1,X={body:void 0,headers:{},statusCode:0,method:M,url:z,rawRequest:c};if("json"in t&&t.json!==!1&&(J=!0,B.accept||B.Accept||(B.Accept="application/json"),M!=="GET"&&M!=="HEAD"&&(B["content-type"]||B["Content-Type"]||(B["Content-Type"]="application/json"),q=JSON.stringify(t.json===!0?q:t.json))),c.onreadystatechange=function(){c.readyState===4&&setTimeout(k,0)},c.onload=k,c.onerror=O,c.onprogress=function(){},c.onabort=function(){A=!0},c.ontimeout=O,c.open(M,z,!V,t.username,t.password),V||(c.withCredentials=!!t.withCredentials),!V&&t.timeout>0&&(_=setTimeout(function(){if(!A){A=!0,c.abort("timeout");var g=new Error("XMLHttpRequest timeout");g.code="ETIMEDOUT",O(g)}},t.timeout)),c.setRequestHeader)for(E in B)B.hasOwnProperty(E)&&c.setRequestHeader(E,B[E]);else if(t.headers&&!function(g){for(var x in g)if(g.hasOwnProperty(x))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(c.responseType=t.responseType),"beforeSend"in t&&typeof t.beforeSend=="function"&&t.beforeSend(c),c.send(q||null),c}f.exports=y,f.exports.default=y,y.XMLHttpRequest=r.XMLHttpRequest||function(){},y.XDomainRequest="withCredentials"in new y.XMLHttpRequest?y.XMLHttpRequest:r.XDomainRequest,function(t,u){for(var v=0;v<t.length;v++)u(t[v])}(["get","put","post","patch","head","delete"],function(t){y[t==="delete"?"del":t]=function(u,v,T){return(v=w(u,v,T)).method=t.toUpperCase(),d(v)}})},function(f,o,a){(function(r){var i;i=typeof window!="undefined"?window:r!==void 0?r:typeof self!="undefined"?self:{},f.exports=i}).call(this,a(0))},function(f,o){f.exports=function(r){if(!r)return!1;var i=a.call(r);return i==="[object Function]"||typeof r=="function"&&i!=="[object RegExp]"||typeof window!="undefined"&&(r===window.setTimeout||r===window.alert||r===window.confirm||r===window.prompt)};var a=Object.prototype.toString},function(f,o){var a=function(r){return r.replace(/^\s+|\s+$/g,"")};f.exports=function(r){if(!r)return{};for(var i,h={},b=a(r).split(`
`),w=0;w<b.length;w++){var y=b[w],d=y.indexOf(":"),t=a(y.slice(0,d)).toLowerCase(),u=a(y.slice(d+1));h[t]===void 0?h[t]=u:(i=h[t],Object.prototype.toString.call(i)==="[object Array]"?h[t].push(u):h[t]=[h[t],u])}return h}},function(f,o){f.exports=function(){for(var r={},i=0;i<arguments.length;i++){var h=arguments[i];for(var b in h)a.call(h,b)&&(r[b]=h[b])}return r};var a=Object.prototype.hasOwnProperty}])})});var At=Ut(xt());var Ct=document.createElement("template");Ct.innerHTML=`
(()=>{var Ot=Object.create;var st=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,jt=Object.prototype.hasOwnProperty;var _t=f=>st(f,"__esModule",{value:!0});var Ut=(f,o)=>()=>(o||f((o={exports:{}}).exports,o),o.exports);var Ft=(f,o,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of Dt(o))!jt.call(f,r)&&r!=="default"&&st(f,r,{get:()=>o[r],enumerable:!(a=Bt(o,r))||a.enumerable});return f},Ht=f=>Ft(_t(st(f!=null?Ot(It(f)):{},"default",f&&f.__esModule&&"default"in f?{get:()=>f.default,enumerable:!0}:{value:f,enumerable:!0})),f);var xt=Ut((Y,it)=>{(function(f,o){typeof Y=="object"&&typeof it=="object"?it.exports=o():typeof define=="function"&&define.amd?define([],o):typeof Y=="object"?Y.UpChunk=o():f.UpChunk=o()})(Y,function(){return function(f){var o={};function a(r){if(o[r])return o[r].exports;var i=o[r]={i:r,l:!1,exports:{}};return f[r].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=f,a.c=o,a.d=function(r,i,h){a.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:h})},a.r=function(r){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},a.t=function(r,i){if(1&i&&(r=a(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var h=Object.create(null);if(a.r(h),Object.defineProperty(h,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var b in r)a.d(h,b,function(w){return r[w]}.bind(null,b));return h},a.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return a.d(i,"a",i),i},a.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},a.p="",a(a.s=1)}([function(f,o){var a;a=function(){return this}();try{a=a||new Function("return this")()}catch{typeof window=="object"&&(a=window)}f.exports=a},function(f,o,a){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(d){for(var t,u=1,v=arguments.length;u<v;u++)for(var T in t=arguments[u])Object.prototype.hasOwnProperty.call(t,T)&&(d[T]=t[T]);return d}).apply(this,arguments)};o.__esModule=!0,o.createUpload=o.UpChunk=void 0;var i=a(2),h=a(4),b=[200,201,202,204,308],w=[408,502,503,504],y=function(){function d(t){var u=this;this.endpoint=t.endpoint,this.file=t.file,this.headers=t.headers||{},this.method=t.method||"PUT",this.chunkSize=t.chunkSize||30720,this.attempts=t.attempts||5,this.delayBeforeAttempt=t.delayBeforeAttempt||1,this.maxFileBytes=1024*(t.maxFileSize||0),this.chunkCount=0,this.chunkByteSize=1024*this.chunkSize,this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.attemptCount=0,this.offline=!1,this.paused=!1,this.success=!1,this.reader=new FileReader,this.eventTarget=new i.EventTarget,this.validateOptions(),this.getEndpoint().then(function(){return u.sendChunks()}),typeof window!="undefined"&&(window.addEventListener("online",function(){u.offline&&(u.offline=!1,u.dispatch("online"),u.sendChunks())}),window.addEventListener("offline",function(){u.offline=!0,u.dispatch("offline")}))}return d.prototype.on=function(t,u){this.eventTarget.addEventListener(t,u)},d.prototype.abort=function(){var t;this.pause(),(t=this.currentXhr)===null||t===void 0||t.abort()},d.prototype.pause=function(){this.paused=!0},d.prototype.resume=function(){this.paused&&(this.paused=!1,this.sendChunks())},d.prototype.dispatch=function(t,u){var v=new CustomEvent(t,{detail:u});this.eventTarget.dispatchEvent(v)},d.prototype.validateOptions=function(){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!="object")throw new TypeError("headers must be null or an object");if(this.chunkSize&&(typeof this.chunkSize!="number"||this.chunkSize<=0||this.chunkSize%256!=0))throw new TypeError("chunkSize must be a positive number in multiples of 256");if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error("file size exceeds maximum (".concat(this.file.size," > ").concat(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")},d.prototype.getEndpoint=function(){var t=this;return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(function(u){return t.endpointValue=u,t.endpointValue})},d.prototype.getChunk=function(){var t=this;return new Promise(function(u){var v=t.totalChunks===1?t.file.size:t.chunkByteSize,T=v*t.chunkCount;t.reader.onload=function(){t.reader.result!==null&&(t.chunk=new Blob([t.reader.result],{type:"application/octet-stream"})),u()},t.reader.readAsArrayBuffer(t.file.slice(T,T+v))})},d.prototype.xhrPromise=function(t){var u=this,v=function(T){T.upload.onprogress=function(O){var k,E=100/u.totalChunks,A=E*u.file.size,c=E*u.chunkCount,_=O.loaded/((k=O.total)!==null&&k!==void 0?k:A)*E;u.dispatch("progress",Math.min(c+_,100))}};return new Promise(function(T,O){u.currentXhr=(0,h.default)(r(r({},t),{beforeSend:v}),function(k,E){return u.currentXhr=void 0,k?O(k):T(E)})})},d.prototype.sendChunk=function(){var t=this.chunkCount*this.chunkByteSize,u=t+this.chunk.size-1,v=r(r({},this.headers),{"Content-Type":this.file.type,"Content-Range":"bytes ".concat(t,"-").concat(u,"/").concat(this.file.size)});return this.dispatch("attempt",{chunkNumber:this.chunkCount,chunkSize:this.chunk.size}),this.xhrPromise({headers:v,url:this.endpointValue,method:this.method,body:this.chunk})},d.prototype.manageRetries=function(){var t=this;if(this.attemptCount<this.attempts)return setTimeout(function(){return t.sendChunks()},1e3*this.delayBeforeAttempt),void this.dispatch("attemptFailure",{message:"An error occured uploading chunk ".concat(this.chunkCount,". ").concat(this.attempts-this.attemptCount," retries left."),chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount});this.dispatch("error",{message:"An error occured uploading chunk ".concat(this.chunkCount,". No more retries, stopping upload"),chunk:this.chunkCount,attempts:this.attemptCount})},d.prototype.sendChunks=function(){var t=this;this.paused||this.offline||this.success||this.getChunk().then(function(){return t.attemptCount=t.attemptCount+1,t.sendChunk()}).then(function(u){if(b.includes(u.statusCode)){t.dispatch("chunkSuccess",{chunk:t.chunkCount,attempts:t.attemptCount,response:u}),t.attemptCount=0,t.chunkCount=t.chunkCount+1,t.chunkCount<t.totalChunks?t.sendChunks():(t.success=!0,t.dispatch("success"));var v=100*(t.chunkCount/t.totalChunks*t.file.size)/t.file.size;t.dispatch("progress",v)}else if(w.includes(u.statusCode)){if(t.paused||t.offline)return;t.manageRetries()}else{if(t.paused||t.offline)return;t.dispatch("error",{message:"Server responded with ".concat(u.statusCode,". Stopping upload."),chunkNumber:t.chunkCount,attempts:t.attemptCount})}}).catch(function(u){t.paused||t.offline||t.manageRetries()})},d}();o.UpChunk=y,o.createUpload=function(d){return new y(d)}},function(f,o,a){"use strict";(function(r,i){function h(e,n,...s){if(!e)throw new TypeError(b(n,s))}function b(e,n){let s=0;return e.replace(/%[os]/gu,()=>w(n[s++]))}function w(e){return typeof e!="object"||e===null?String(e):Object.prototype.toString.call(e)}let y;Object.defineProperty(o,"__esModule",{value:!0});let d=typeof window!="undefined"?window:typeof self!="undefined"?self:i!==void 0?i:typeof globalThis!="undefined"?globalThis:void 0,t;class u{constructor(n,s){this.code=n,this.message=s}warn(...n){var s;try{if(t)return void t({...this,args:n});let l=((s=new Error().stack)!==null&&s!==void 0?s:"").replace(/^(?:.+?\n){2}/gu,`
`);console.warn(this.message,...n,l)}catch{}}}let v=new u("W01","Unable to initialize event under dispatching."),T=new u("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),O=new u("W03","Assigning any truthy value to 'returnValue' property has no effect."),k=new u("W04","Unable to preventDefault on non-cancelable events."),E=new u("W05","Unable to preventDefault inside passive event listener invocation."),A=new u("W06","An event listener wasn't added because it has been added already: %o, %o"),c=new u("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),_=new u("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),z=new u("W09","Event attribute handler must be a function: %o");class S{static get NONE(){return q}static get CAPTURING_PHASE(){return B}static get AT_TARGET(){return V}static get BUBBLING_PHASE(){return J}constructor(n,s){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let l=s!=null?s:{};X.set(this,{type:String(n),bubbles:Boolean(l.bubbles),cancelable:Boolean(l.cancelable),composed:Boolean(l.composed),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return g(this).type}get target(){return g(this).target}get srcElement(){return g(this).target}get currentTarget(){return g(this).currentTarget}composedPath(){let n=g(this).currentTarget;return n?[n]:[]}get NONE(){return q}get CAPTURING_PHASE(){return B}get AT_TARGET(){return V}get BUBBLING_PHASE(){return J}get eventPhase(){return g(this).dispatchFlag?2:0}stopPropagation(){g(this).stopPropagationFlag=!0}get cancelBubble(){return g(this).stopPropagationFlag}set cancelBubble(n){n?g(this).stopPropagationFlag=!0:T.warn()}stopImmediatePropagation(){let n=g(this);n.stopPropagationFlag=n.stopImmediatePropagationFlag=!0}get bubbles(){return g(this).bubbles}get cancelable(){return g(this).cancelable}get returnValue(){return!g(this).canceledFlag}set returnValue(n){n?O.warn():x(g(this))}preventDefault(){x(g(this))}get defaultPrevented(){return g(this).canceledFlag}get composed(){return g(this).composed}get isTrusted(){return!1}get timeStamp(){return g(this).timeStamp}initEvent(n,s=!1,l=!1){let p=g(this);p.dispatchFlag?v.warn():X.set(this,{...p,type:String(n),bubbles:Boolean(s),cancelable:Boolean(l),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}}let q=0,B=1,V=2,J=3,X=new WeakMap;function g(e,n="this"){let s=X.get(e);return h(s!=null,"'%s' must be an object that Event constructor created, but got another one: %o",n,e),s}function x(e){e.inPassiveListenerFlag?E.warn():e.cancelable?e.canceledFlag=!0:k.warn()}Object.defineProperty(S,"NONE",{enumerable:!0}),Object.defineProperty(S,"CAPTURING_PHASE",{enumerable:!0}),Object.defineProperty(S,"AT_TARGET",{enumerable:!0}),Object.defineProperty(S,"BUBBLING_PHASE",{enumerable:!0});let D=Object.getOwnPropertyNames(S.prototype);for(let e=0;e<D.length;++e)D[e]!=="constructor"&&Object.defineProperty(S.prototype,D[e],{enumerable:!0});let H;d!==void 0&&d.Event!==void 0&&Object.setPrototypeOf(S.prototype,d.Event.prototype);let ut={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 lt(e){let n=Object.keys(ut);for(let s=0;s<n.length;++s){let l=n[s],p=ut[l];Object.defineProperty(e,l,{get:()=>p,configurable:!0,enumerable:!0})}}class K extends S{static wrap(n){return new(function s(l){let p=Object.getPrototypeOf(l);if(p==null)return K;let m=Z.get(p);return m==null&&(m=function(C,P){class L extends C{}let R=Object.keys(P);for(let M=0;M<R.length;++M)Object.defineProperty(L.prototype,R[M],pt(P,R[M]));return L}(s(p),p),Z.set(p,m)),m}(n))(n)}constructor(n){super(n.type,{bubbles:n.bubbles,cancelable:n.cancelable,composed:n.composed}),n.cancelBubble&&super.stopPropagation(),n.defaultPrevented&&super.preventDefault(),ct.set(this,{original:n});let s=Object.keys(n);for(let l=0;l<s.length;++l){let p=s[l];p in this||Object.defineProperty(this,p,pt(n,p))}}stopPropagation(){super.stopPropagation();let{original:n}=F(this);"stopPropagation"in n&&n.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(n){super.cancelBubble=n;let{original:s}=F(this);"cancelBubble"in s&&(s.cancelBubble=n)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:n}=F(this);"stopImmediatePropagation"in n&&n.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(n){super.returnValue=n;let{original:s}=F(this);"returnValue"in s&&(s.returnValue=n)}preventDefault(){super.preventDefault();let{original:n}=F(this);"preventDefault"in n&&n.preventDefault()}get timeStamp(){let{original:n}=F(this);return"timeStamp"in n?n.timeStamp:super.timeStamp}}let ct=new WeakMap;function F(e){let n=ct.get(e);return h(n!=null,"'this' is expected an Event object, but got",e),n}let Z=new WeakMap;function pt(e,n){let s=Object.getOwnPropertyDescriptor(e,n);return{get(){let l=F(this).original,p=l[n];return typeof p=="function"?p.bind(l):p},set(l){F(this).original[n]=l},configurable:s.configurable,enumerable:s.enumerable}}function dt(e){return(1&e.flags)==1}function ht(e){return(2&e.flags)==2}function ft(e){return(4&e.flags)==4}function St(e){return(8&e.flags)==8}function Mt({callback:e},n,s){try{typeof e=="function"?e.call(n,s):typeof e.handleEvent=="function"&&e.handleEvent(s)}catch(l){(function(p){try{let m=p instanceof Error?p:new Error(w(p));if(y)return void y(m);if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:m,message:m.message}));else if(r!==void 0&&typeof r.emit=="function")return void r.emit("uncaughtException",m);console.error(m)}catch{}})(l)}}function gt({listeners:e},n,s){for(let l=0;l<e.length;++l)if(e[l].callback===n&&dt(e[l])===s)return l;return-1}function bt(e,n,s,l,p,m){let C;m&&(C=rt.bind(null,e,n,s),m.addEventListener("abort",C));let P=function(L,R,M,I,tt,j){return{callback:L,flags:(R?1:0)|(M?2:0)|(I?4:0),signal:tt,signalListener:j}}(n,s,l,p,m,C);return e.cow?(e.cow=!1,e.listeners=[...e.listeners,P]):e.listeners.push(P),P}function rt(e,n,s){let l=gt(e,n,s);return l!==-1&&mt(e,l)}function mt(e,n,s=!1){let l=e.listeners[n];return function(p){p.flags|=8}(l),l.signal&&l.signal.removeEventListener("abort",l.signalListener),e.cow&&!s?(e.cow=!1,e.listeners=e.listeners.filter((p,m)=>m!==n),!1):(e.listeners.splice(n,1),!0)}function yt(e,n){var s;return(s=e[n])!==null&&s!==void 0?s:e[n]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}Z.set(Object.prototype,K),d!==void 0&&d.Event!==void 0&&Z.set(d.Event.prototype,K);class G{constructor(){vt.set(this,Object.create(null))}addEventListener(n,s,l){let p=W(this),{callback:m,capture:C,once:P,passive:L,signal:R,type:M}=function(j,N,U){var Q;return Et(N),typeof U=="object"&&U!==null?{type:String(j),callback:N!=null?N:void 0,capture:Boolean(U.capture),passive:Boolean(U.passive),once:Boolean(U.once),signal:(Q=U.signal)!==null&&Q!==void 0?Q:void 0}:{type:String(j),callback:N!=null?N:void 0,capture:Boolean(U),passive:!1,once:!1,signal:void 0}}(n,s,l);if(m==null||(R==null?void 0:R.aborted))return;let I=yt(p,M),tt=gt(I,m,C);tt===-1?bt(I,m,C,L,P,R):function(j,N,U,Q){A.warn(dt(j)?"capture":"bubble",j.callback),ht(j)!==N&&c.warn("passive"),ft(j)!==U&&c.warn("once"),j.signal!==Q&&c.warn("signal")}(I.listeners[tt],L,P,R)}removeEventListener(n,s,l){let p=W(this),{callback:m,capture:C,type:P}=function(R,M,I){return Et(M),typeof I=="object"&&I!==null?{type:String(R),callback:M!=null?M:void 0,capture:Boolean(I.capture)}:{type:String(R),callback:M!=null?M:void 0,capture:Boolean(I)}}(n,s,l),L=p[P];m!=null&&L&&rt(L,m,C)}dispatchEvent(n){let s=W(this)[String(n.type)];if(s==null)return!0;let l=n instanceof S?n:K.wrap(n),p=g(l,"event");if(p.dispatchFlag)throw m="This event has been in dispatching.",d.DOMException?new d.DOMException(m,"InvalidStateError"):(H==null&&(H=class Rt extends Error{constructor(P){super(P),Error.captureStackTrace&&Error.captureStackTrace(this,Rt)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(H.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),lt(H),lt(H.prototype)),new H(m));var m;if(p.dispatchFlag=!0,p.target=p.currentTarget=this,!p.stopPropagationFlag){let{cow:C,listeners:P}=s;s.cow=!0;for(let L=0;L<P.length;++L){let R=P[L];if(!St(R)&&(ft(R)&&mt(s,L,!C)&&(L-=1),p.inPassiveListenerFlag=ht(R),Mt(R,this,l),p.inPassiveListenerFlag=!1,p.stopImmediatePropagationFlag))break}C||(s.cow=!1)}return p.target=null,p.currentTarget=null,p.stopImmediatePropagationFlag=!1,p.stopPropagationFlag=!1,p.dispatchFlag=!1,!p.canceledFlag}}let vt=new WeakMap;function W(e,n="this"){let s=vt.get(e);return h(s!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",n,e),s}function Et(e){if(typeof e!="function"&&(typeof e!="object"||e===null||typeof e.handleEvent!="function")){if(e!=null&&typeof e!="object")throw new TypeError(b(_.message,[e]));_.warn(e)}}let ot=Object.getOwnPropertyNames(G.prototype);for(let e=0;e<ot.length;++e)ot[e]!=="constructor"&&Object.defineProperty(G.prototype,ot[e],{enumerable:!0});function wt(e,n){var s,l;return(l=(s=W(e,"target")[n])===null||s===void 0?void 0:s.attrCallback)!==null&&l!==void 0?l:null}function Tt(e,n,s){s!=null&&typeof s!="function"&&z.warn(s),typeof s=="function"||typeof s=="object"&&s!==null?function(l,p,m){let C=yt(W(l,"target"),String(p));C.attrCallback=m,C.attrListener==null&&(C.attrListener=bt(C,function(P){return function(L){let R=P.attrCallback;typeof R=="function"&&R.call(this,L)}}(C),!1,!1,!1,void 0))}(e,n,s):function(l,p){let m=W(l,"target")[String(p)];m&&m.attrListener&&(rt(m,m.attrListener.callback,!1),m.attrCallback=m.attrListener=void 0)}(e,n)}function kt(e,n,s){Object.defineProperty(e,"on"+n,{get(){return wt(this,n)},set(l){Tt(this,n,l)},configurable:!0,enumerable:!0})}d!==void 0&&d.EventTarget!==void 0&&Object.setPrototypeOf(G.prototype,d.EventTarget.prototype),o.Event=S,o.EventTarget=G,o.default=G,o.defineCustomEventTarget=function(...e){class n extends G{}for(let s=0;s<e.length;++s)kt(n.prototype,e[s]);return n},o.defineEventAttribute=kt,o.getEventAttributeValue=wt,o.setErrorHandler=function(e){h(typeof e=="function"||e===void 0,"The error handler must be a function or undefined, but got %o.",e),y=e},o.setEventAttributeValue=Tt,o.setWarningHandler=function(e){h(typeof e=="function"||e===void 0,"The warning handler must be a function or undefined, but got %o.",e),t=e}}).call(this,a(3),a(0))},function(f,o){var a,r,i=f.exports={};function h(){throw new Error("setTimeout has not been defined")}function b(){throw new Error("clearTimeout has not been defined")}function w(E){if(a===setTimeout)return setTimeout(E,0);if((a===h||!a)&&setTimeout)return a=setTimeout,setTimeout(E,0);try{return a(E,0)}catch{try{return a.call(null,E,0)}catch{return a.call(this,E,0)}}}(function(){try{a=typeof setTimeout=="function"?setTimeout:h}catch{a=h}try{r=typeof clearTimeout=="function"?clearTimeout:b}catch{r=b}})();var y,d=[],t=!1,u=-1;function v(){t&&y&&(t=!1,y.length?d=y.concat(d):u=-1,d.length&&T())}function T(){if(!t){var E=w(v);t=!0;for(var A=d.length;A;){for(y=d,d=[];++u<A;)y&&y[u].run();u=-1,A=d.length}y=null,t=!1,function(c){if(r===clearTimeout)return clearTimeout(c);if((r===b||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(c);try{r(c)}catch{try{return r.call(null,c)}catch{return r.call(this,c)}}}(E)}}function O(E,A){this.fun=E,this.array=A}function k(){}i.nextTick=function(E){var A=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)A[c-1]=arguments[c];d.push(new O(E,A)),d.length!==1||t||w(T)},O.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=k,i.addListener=k,i.once=k,i.off=k,i.removeListener=k,i.removeAllListeners=k,i.emit=k,i.prependListener=k,i.prependOnceListener=k,i.listeners=function(E){return[]},i.binding=function(E){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(E){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(f,o,a){"use strict";var r=a(5),i=a(6),h=a(7),b=a(8);function w(t,u,v){var T=t;return i(u)?(v=u,typeof t=="string"&&(T={uri:t})):T=b(u,{uri:t}),T.callback=v,T}function y(t,u,v){return d(u=w(t,u,v))}function d(t){if(t.callback===void 0)throw new Error("callback argument missing");var u=!1,v=function(g,x,D){u||(u=!0,t.callback(g,x,D))};function T(){var g=void 0;if(g=c.response?c.response:c.responseText||function(x){try{if(x.responseType==="document")return x.responseXML;var D=x.responseXML&&x.responseXML.documentElement.nodeName==="parsererror";if(x.responseType===""&&!D)return x.responseXML}catch{}return null}(c),J)try{g=JSON.parse(g)}catch{}return g}function O(g){return clearTimeout(_),g instanceof Error||(g=new Error(""+(g||"Unknown XMLHttpRequest Error"))),g.statusCode=0,v(g,X)}function k(){if(!A){var g;clearTimeout(_),g=t.useXDR&&c.status===void 0?200:c.status===1223?204:c.status;var x=X,D=null;return g!==0?(x={body:T(),statusCode:g,method:S,headers:{},url:z,rawRequest:c},c.getAllResponseHeaders&&(x.headers=h(c.getAllResponseHeaders()))):D=new Error("Internal XMLHttpRequest Error"),v(D,x,x.body)}}var E,A,c=t.xhr||null;c||(c=t.cors||t.useXDR?new y.XDomainRequest:new y.XMLHttpRequest);var _,z=c.url=t.uri||t.url,S=c.method=t.method||"GET",q=t.body||t.data,B=c.headers=t.headers||{},V=!!t.sync,J=!1,X={body:void 0,headers:{},statusCode:0,method:S,url:z,rawRequest:c};if("json"in t&&t.json!==!1&&(J=!0,B.accept||B.Accept||(B.Accept="application/json"),S!=="GET"&&S!=="HEAD"&&(B["content-type"]||B["Content-Type"]||(B["Content-Type"]="application/json"),q=JSON.stringify(t.json===!0?q:t.json))),c.onreadystatechange=function(){c.readyState===4&&setTimeout(k,0)},c.onload=k,c.onerror=O,c.onprogress=function(){},c.onabort=function(){A=!0},c.ontimeout=O,c.open(S,z,!V,t.username,t.password),V||(c.withCredentials=!!t.withCredentials),!V&&t.timeout>0&&(_=setTimeout(function(){if(!A){A=!0,c.abort("timeout");var g=new Error("XMLHttpRequest timeout");g.code="ETIMEDOUT",O(g)}},t.timeout)),c.setRequestHeader)for(E in B)B.hasOwnProperty(E)&&c.setRequestHeader(E,B[E]);else if(t.headers&&!function(g){for(var x in g)if(g.hasOwnProperty(x))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(c.responseType=t.responseType),"beforeSend"in t&&typeof t.beforeSend=="function"&&t.beforeSend(c),c.send(q||null),c}f.exports=y,f.exports.default=y,y.XMLHttpRequest=r.XMLHttpRequest||function(){},y.XDomainRequest="withCredentials"in new y.XMLHttpRequest?y.XMLHttpRequest:r.XDomainRequest,function(t,u){for(var v=0;v<t.length;v++)u(t[v])}(["get","put","post","patch","head","delete"],function(t){y[t==="delete"?"del":t]=function(u,v,T){return(v=w(u,v,T)).method=t.toUpperCase(),d(v)}})},function(f,o,a){(function(r){var i;i=typeof window!="undefined"?window:r!==void 0?r:typeof self!="undefined"?self:{},f.exports=i}).call(this,a(0))},function(f,o){f.exports=function(r){if(!r)return!1;var i=a.call(r);return i==="[object Function]"||typeof r=="function"&&i!=="[object RegExp]"||typeof window!="undefined"&&(r===window.setTimeout||r===window.alert||r===window.confirm||r===window.prompt)};var a=Object.prototype.toString},function(f,o){var a=function(r){return r.replace(/^\s+|\s+$/g,"")};f.exports=function(r){if(!r)return{};for(var i,h={},b=a(r).split(`
`),w=0;w<b.length;w++){var y=b[w],d=y.indexOf(":"),t=a(y.slice(0,d)).toLowerCase(),u=a(y.slice(d+1));h[t]===void 0?h[t]=u:(i=h[t],Object.prototype.toString.call(i)==="[object Array]"?h[t].push(u):h[t]=[h[t],u])}return h}},function(f,o){f.exports=function(){for(var r={},i=0;i<arguments.length;i++){var h=arguments[i];for(var b in h)a.call(h,b)&&(r[b]=h[b])}return r};var a=Object.prototype.hasOwnProperty}])})});var At=Ht(xt());var Ct=document.createElement("template");Ct.innerHTML=`
<style>

@@ -74,3 +74,3 @@ /* These styles simulate a user passing these via props. Until

</div>
`;var at=class extends HTMLElement{constructor(){super();let o=this.attachShadow({mode:"open"});o.appendChild(Ct.content.cloneNode(!0)),this.overlay=o.getElementById("overlay"),this.overlayText=o.getElementById("overlay-text")}connectedCallback(){this.setupDragEvents()}attributeChangedCallback(){this.shadowRoot.getElementById("overlay-text").innerHTML=this.getAttribute("text")}static get observedAttributes(){return["text","mux-uploader"]}get muxUploader(){let o=this.getAttribute("mux-uploader");return o?document.getElementById(o):null}setupDragEvents(){this.addEventListener("dragenter",o=>{o.preventDefault(),o.stopPropagation(),this.setAttribute("active","")}),this.addEventListener("dragleave",o=>{this.removeAttribute("active")}),this.addEventListener("dragover",o=>{o.preventDefault(),o.stopPropagation()}),this.addEventListener("drop",o=>{var b;o.preventDefault(),o.stopPropagation();let{dataTransfer:a}=o,{files:r}=a,i=r[0];((b=this.muxUploader)!=null?b:this).dispatchEvent(new CustomEvent("mux-drop",{composed:!0,bubbles:!0,detail:i})),this.removeAttribute("active")})}};globalThis.customElements.get("mux-uploader-drop")||(globalThis.customElements.define("mux-uploader-drop",at),globalThis.MuxUploaderDropElement=at);var Nt=`
`;var at=class extends HTMLElement{constructor(){super();let o=this.attachShadow({mode:"open"});o.appendChild(Ct.content.cloneNode(!0)),this.overlay=o.getElementById("overlay"),this.overlayText=o.getElementById("overlay-text")}connectedCallback(){this.setupDragEvents()}attributeChangedCallback(){this.shadowRoot.getElementById("overlay-text").innerHTML=this.getAttribute("text")}static get observedAttributes(){return["text","mux-uploader"]}get muxUploader(){let o=this.getAttribute("mux-uploader");return o?document.getElementById(o):null}setupDragEvents(){this.addEventListener("dragenter",o=>{o.preventDefault(),o.stopPropagation(),this.setAttribute("active","")}),this.addEventListener("dragleave",o=>{this.removeAttribute("active")}),this.addEventListener("dragover",o=>{o.preventDefault(),o.stopPropagation()}),this.addEventListener("drop",o=>{var b;o.preventDefault(),o.stopPropagation();let{dataTransfer:a}=o,{files:r}=a,i=r[0];((b=this.muxUploader)!=null?b:this).dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:i})),this.removeAttribute("active")})}};globalThis.customElements.get("mux-uploader-drop")||(globalThis.customElements.define("mux-uploader-drop",at),globalThis.MuxUploaderDropElement=at);var Nt=`
:host {

@@ -255,2 +255,3 @@ font-family: var(--uploader-font-family, Arial);

<input type="file" />
<!--TO-DO: Slots not receiving events or not having the right visual behaviour as the original elements. (TD).-->
<slot name="custom-button"><button type="button">Upload video</button></slot>

@@ -279,3 +280,3 @@ <slot name="custom-progress"><p class="upload-status" id="upload-status"></p></slot>

</slot>
`;var et={BAR:"bar",RADIAL:"radial"},zt=f=>{var o;return Number((o=f.svgCircle)==null?void 0:o.getAttribute("r"))},$=f=>zt(f)*2*Math.PI,qt="Media upload progress bar",Lt=["Enter"," "],nt=class extends HTMLElement{constructor(){super();var r,i,h,b,w,y,d,t,u;let o=this.attachShadow({mode:"open"}),a=Pt.content.cloneNode(!0);o.appendChild(a),this.hiddenFileInput=(r=this.shadowRoot)==null?void 0:r.querySelector('input[type="file"]'),this.filePickerButton=(i=this.shadowRoot)==null?void 0:i.querySelector("button"),this.svgCircle=(h=this.shadowRoot)==null?void 0:h.querySelector("circle"),this.progressBar=(b=this.shadowRoot)==null?void 0:b.getElementById("progress-bar"),this.uploadPercentage=(w=this.shadowRoot)==null?void 0:w.getElementById("upload-status"),this.statusMessage=(y=this.shadowRoot)==null?void 0:y.getElementById("status-message"),this.retryButton=(d=this.shadowRoot)==null?void 0:d.getElementById("retry-button"),this.srOnlyText=(t=this.shadowRoot)==null?void 0:t.getElementById("sr-only"),this._dropHandler=this.handleUpload.bind(this),(u=this.progressBar)==null||u.setAttribute("aria-description",qt)}connectedCallback(){var o;if(this.setDefaultType(),this.setupFilePickerButton(),this.setupRetry(),this.setupDropHandler(),this.hasAttribute("disable-drop")){let a=(o=this.shadowRoot)==null?void 0:o.querySelector("mux-uploader-drop");a==null||a.setAttribute("disable-drop","")}}disconnectedCallback(){this.removeEventListener("mux-drop",this._dropHandler,!1)}get url(){return this.getAttribute("url")}set url(o){this.setAttribute("url",o)}setDefaultType(){let o=this.getAttribute("type");o||this.setAttribute("type",et.BAR),o===et.RADIAL&&this.svgCircle&&(this.svgCircle.style.strokeDasharray=`${$(this)} ${$(this)}`,this.svgCircle.style.strokeDashoffset=`${$(this)}`)}setupRetry(){var a;(a=this.retryButton)==null||a.addEventListener("click",()=>{this.resetState()});let o=r=>{let{key:i}=r;if(!Lt.includes(i)){this.removeEventListener("keyup",o);return}this.resetState()};this.addEventListener("keydown",r=>{let{metaKey:i,altKey:h,key:b}=r;if(i||h||!Lt.includes(b)){this.removeEventListener("keyup",o);return}this.addEventListener("keyup",o)})}setupDropHandler(){this.addEventListener("mux-drop",this._dropHandler)}resetState(){this.removeAttribute("upload-error"),this.removeAttribute("upload-in-progress"),this.statusMessage&&(this.statusMessage.innerHTML=""),this.uploadPercentage&&(this.uploadPercentage.innerHTML="")}setupFilePickerButton(){var o,a,r,i;(a=(o=this.shadowRoot)==null?void 0:o.querySelector("slot[name=custom-button]"))==null||a.addEventListener("slotchange",()=>{var h;this.filePickerButton=(h=this.shadowRoot)==null?void 0:h.querySelector("slot[name=custom-button]")}),(r=this.filePickerButton)==null||r.addEventListener("click",()=>{var h;(h=this.hiddenFileInput)==null||h.click()}),(i=this.hiddenFileInput)==null||i.addEventListener("change",h=>{var w,y;let b=(y=(w=this.hiddenFileInput)==null?void 0:w.files)==null?void 0:y[0];b&&this.dispatchEvent(new CustomEvent("mux-drop",{composed:!0,bubbles:!0,detail:b}))})}setProgress(o){var a;switch(this.uploadPercentage&&(this.uploadPercentage.innerHTML=`${Math.floor(o)}%`),(a=this.progressBar)==null||a.setAttribute("aria-valuenow",`${Math.floor(o)}`),this.getAttribute("type")){case et.BAR:this.progressBar&&(this.progressBar.style.width=`${o}%`);case et.RADIAL:if(this.svgCircle){let r=$(this)-o/100*$(this);this.svgCircle.style.strokeDashoffset=r.toString()}}}handleUpload(o){var h;let a=this.url,r="No url attribute specified -- cannot handleUpload";a?this.statusMessage&&(this.statusMessage.innerHTML=""):(this.statusMessage&&(this.statusMessage.innerHTML=r),console.error(r)),this.statusMessage&&(this.removeAttribute("upload-error"),this.statusMessage.innerHTML=""),this.setAttribute("upload-in-progress",""),(h=this.progressBar)==null||h.focus();let i=At.createUpload({endpoint:a||"https://storage.googleapis.com/video-storage-us-east1-uploads/B6vYEZ9utvayi7tJlcwjG4ckho8W5100QHse5OEIyOqg?Expires=1654714562&GoogleAccessId=direct-uploads-writer-prod%40mux-cloud.iam.gserviceaccount.com&Signature=ZQLdkP8u432oNZ5WtQwPB22qR%2B03BWd0DOdEFohak0dNG2fzJpE9RLCyAb8uJo3N8YH62UecxJs%2FefKFETicJd978Dldh3E4yTJQLWFR%2B%2FpCrYdS6EQRG7D08Vb9yz82jRJRgJ37cnJgNCzUFUx8AFX%2FG0o8BA3Wcm2AkdcLRWhvt2tj5wTzbxm8ZBflhYckJs7kNaiKEfIXk0UzNBPRJPGzyjzKUyyU1Keu0rERepH7BM8wJeGiw7KrD1TkqeMcA2NSpht4COKXYp3aNrryLGYfx%2B362U3KR0TaRalskKdqODbhBtTlLbFRALog3mGFq3CVJ2CG5Vztq6rXa00VRQ%3D%3D&upload_id=ADPycdsGqgIsU8tBAiu2k4Gt5hPa4QUaURD71neXpjQMfoQUeFGVDvE3qyAN7kzAVUcbSfK6tDhHwpSNiQMSvW41tPiTxw",file:o.detail});i.on("error",b=>{let w="An error has occurred";this.setAttribute("upload-error",""),this.statusMessage&&(this.statusMessage.innerHTML=w),console.error(b.detail.message)}),i.on("progress",b=>{this.setProgress(b.detail)}),i.on("success",()=>{let b="Upload complete!";this.statusMessage&&(this.statusMessage.innerHTML=b),this.srOnlyText&&(this.srOnlyText.innerHTML=b),console.info(b)})}};globalThis.customElements.get("mux-uploader")||(globalThis.customElements.define("mux-uploader",nt),globalThis.MuxUploaderElement=nt);var Wt=nt;})();
`;var et={BAR:"bar",RADIAL:"radial"},zt=f=>{var o;return Number((o=f.svgCircle)==null?void 0:o.getAttribute("r"))},$=f=>zt(f)*2*Math.PI,qt="Media upload progress bar",Lt=["Enter"," "],nt=class extends HTMLElement{constructor(){super();var r,i,h,b,w,y,d,t,u;let o=this.attachShadow({mode:"open"}),a=Pt.content.cloneNode(!0);o.appendChild(a),this.hiddenFileInput=(r=this.shadowRoot)==null?void 0:r.querySelector('input[type="file"]'),this.filePickerButton=(i=this.shadowRoot)==null?void 0:i.querySelector("button"),this.svgCircle=(h=this.shadowRoot)==null?void 0:h.querySelector("circle"),this.progressBar=(b=this.shadowRoot)==null?void 0:b.getElementById("progress-bar"),this.uploadPercentage=(w=this.shadowRoot)==null?void 0:w.getElementById("upload-status"),this.statusMessage=(y=this.shadowRoot)==null?void 0:y.getElementById("status-message"),this.retryButton=(d=this.shadowRoot)==null?void 0:d.getElementById("retry-button"),this.srOnlyText=(t=this.shadowRoot)==null?void 0:t.getElementById("sr-only"),(u=this.progressBar)==null||u.setAttribute("aria-description",qt)}connectedCallback(){var o;if(this.setDefaultType(),this.setupFilePickerButton(),this.setupRetry(),this.setupDropHandler(),this.hasAttribute("disable-drop")){let a=(o=this.shadowRoot)==null?void 0:o.querySelector("mux-uploader-drop");a==null||a.setAttribute("disable-drop","")}}disconnectedCallback(){this.removeEventListener("file-ready",this.handleUpload,!1)}get url(){return this.getAttribute("url")}set url(o){this.setAttribute("url",o)}setDefaultType(){let o=this.getAttribute("type");o||this.setAttribute("type",et.BAR),o===et.RADIAL&&this.svgCircle&&(this.svgCircle.style.strokeDasharray=`${$(this)} ${$(this)}`,this.svgCircle.style.strokeDashoffset=`${$(this)}`)}setupRetry(){var a;(a=this.retryButton)==null||a.addEventListener("click",()=>{this.resetState()});let o=r=>{let{key:i}=r;if(!Lt.includes(i)){this.removeEventListener("keyup",o);return}this.resetState()};this.addEventListener("keydown",r=>{let{metaKey:i,altKey:h,key:b}=r;if(i||h||!Lt.includes(b)){this.removeEventListener("keyup",o);return}this.addEventListener("keyup",o)})}setupDropHandler(){this.addEventListener("file-ready",this.handleUpload)}resetState(){this.removeAttribute("upload-error"),this.removeAttribute("upload-in-progress"),this.statusMessage&&(this.statusMessage.innerHTML=""),this.uploadPercentage&&(this.uploadPercentage.innerHTML="")}setupFilePickerButton(){var o,a,r,i;(a=(o=this.shadowRoot)==null?void 0:o.querySelector("slot[name=custom-button]"))==null||a.addEventListener("slotchange",()=>{var h;this.filePickerButton=(h=this.shadowRoot)==null?void 0:h.querySelector("slot[name=custom-button]")}),(r=this.filePickerButton)==null||r.addEventListener("click",()=>{var h;(h=this.hiddenFileInput)==null||h.click()}),(i=this.hiddenFileInput)==null||i.addEventListener("change",h=>{var w,y;let b=(y=(w=this.hiddenFileInput)==null?void 0:w.files)==null?void 0:y[0];b&&this.dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:b}))})}setProgress(o){var a;switch(this.uploadPercentage&&(this.uploadPercentage.innerHTML=`${Math.floor(o)}%`),(a=this.progressBar)==null||a.setAttribute("aria-valuenow",`${Math.floor(o)}`),this.getAttribute("type")){case et.BAR:this.progressBar&&(this.progressBar.style.width=`${o}%`);case et.RADIAL:if(this.svgCircle){let r=$(this)-o/100*$(this);this.svgCircle.style.strokeDashoffset=r.toString()}}}handleUpload(o){var h;let a=this.url,r="No url attribute specified -- cannot handleUpload";a?this.statusMessage&&(this.statusMessage.innerHTML=""):(this.statusMessage&&(this.statusMessage.innerHTML=r),console.error(r)),this.statusMessage&&(this.removeAttribute("upload-error"),this.statusMessage.innerHTML=""),this.setAttribute("upload-in-progress",""),(h=this.progressBar)==null||h.focus();let i=At.createUpload({endpoint:a||"https://storage.googleapis.com/video-storage-us-east1-uploads/B6vYEZ9utvayi7tJlcwjG4ckho8W5100QHse5OEIyOqg?Expires=1654714562&GoogleAccessId=direct-uploads-writer-prod%40mux-cloud.iam.gserviceaccount.com&Signature=ZQLdkP8u432oNZ5WtQwPB22qR%2B03BWd0DOdEFohak0dNG2fzJpE9RLCyAb8uJo3N8YH62UecxJs%2FefKFETicJd978Dldh3E4yTJQLWFR%2B%2FpCrYdS6EQRG7D08Vb9yz82jRJRgJ37cnJgNCzUFUx8AFX%2FG0o8BA3Wcm2AkdcLRWhvt2tj5wTzbxm8ZBflhYckJs7kNaiKEfIXk0UzNBPRJPGzyjzKUyyU1Keu0rERepH7BM8wJeGiw7KrD1TkqeMcA2NSpht4COKXYp3aNrryLGYfx%2B362U3KR0TaRalskKdqODbhBtTlLbFRALog3mGFq3CVJ2CG5Vztq6rXa00VRQ%3D%3D&upload_id=ADPycdsGqgIsU8tBAiu2k4Gt5hPa4QUaURD71neXpjQMfoQUeFGVDvE3qyAN7kzAVUcbSfK6tDhHwpSNiQMSvW41tPiTxw",file:o.detail});i.on("error",b=>{let w="An error has occurred";this.setAttribute("upload-error",""),this.statusMessage&&(this.statusMessage.innerHTML=w),console.error(b.detail.message)}),i.on("progress",b=>{this.setProgress(b.detail)}),i.on("success",()=>{let b="Upload complete!";this.statusMessage&&(this.statusMessage.innerHTML=b),this.srOnlyText&&(this.srOnlyText.innerHTML=b),console.info(b)})}};globalThis.customElements.get("mux-uploader")||(globalThis.customElements.define("mux-uploader",nt),globalThis.MuxUploaderElement=nt);var Wt=nt;})();
//# sourceMappingURL=mux-uploader.js.map

@@ -11,3 +11,2 @@ import './mux-uploader-drop';

srOnlyText: HTMLElement | null | undefined;
_dropHandler: Function;
constructor();

@@ -14,0 +13,0 @@ connectedCallback(): void;

@@ -11,3 +11,2 @@ import './mux-uploader-drop';

srOnlyText: HTMLElement | null | undefined;
_dropHandler: Function;
constructor();

@@ -14,0 +13,0 @@ connectedCallback(): void;

{
"name": "@mux/mux-uploader",
"version": "0.1.0-canary.0-556dabf",
"version": "0.1.0-canary.1-04bc498",
"description": "An uploader elements to be used with Mux Direct Uploads",

@@ -5,0 +5,0 @@ "main": "./dist/index.cjs",

@@ -62,11 +62,34 @@ <p align="center">

<body>
<p></p>
<!-- Upload button by itself with default drag an drop scoped to the space it takes up. Displays upload progress in text as percentage.-->
<mux-uploader url="authenticated-url" type="bar" status></mux-uploader>
<mux-uploader
url="authenticated-url"
id="uploader"
></mux-player>
<!-- Upload button by itself with drag an drop disabled. Does not display text percentage.-->
<mux-uploader url="authenticated-url" type="bar" disable-drop></mux-uploader>
<!-- Upload button with access to additional drag and drop features via slots i.e. fullscreen drag and drop with text overlay (work-in-progress).-->
<mux-uploader url="authenticated-url">
<mux-uploader-drop slot="dropzone" text="Upload to stream.new" fullscreen overlay></mux-uploader-drop>
</mux-uploader>
</body>
```
## Drag and Drop
The `mux-uploader`, whether you use `mux-uploader-drop` and its additional features or not i.e. fullscreen and text overlay, has basic drag and drop functionality available to it by default. If you'd rather shop your own drag and drop solution, you can disable the default drag and drop on `mux-uploader` and dispatch a custom `file-ready` event when you need to upload. `mux-uploader` will handle the upload upon receiving the event.
```html
<script>
const muxUploader = document.querySelector('mux-uploader');
// Dispatch custom event to trigger upload
muxUploader.dispatchEvent(
new CustomEvent('file-ready', {
composed: true,
bubbles: true,
detail: file,
})
);
</script>
```
### Attributes

@@ -79,15 +102,15 @@

| `url` | `string` | The authenticated URL that your file will be uploaded to. Check out the [direct uploads docs](https://docs.mux.com/guides/video/upload-files-directly#1-create-an-authenticated-mux-url) for how to create one. Required. | `undefined` |
| `id` | `string` | An ID that allows `mux-uploader-drop` to locate `mux-uploader`. Required. | N/A |
| `id` | `string` | An ID that allows `mux-uploader-drop` to locate `mux-uploader`. Not necessary unless the unlikely scenario you need to nest `mux-uploader` inside `mux-uploader-drop`. | N/A |
| `type` | `"bar"` | Specifies the visual type of progress bar. A radial type is in-progress. | "bar" |
| `upload-in-progress` | `boolean` | The thumbnail token for signing the `poster` URL. | false |
| `upload-error` | `boolean` | The storyboard token for signing the storyboard URL. | false |
| `status` | `boolean` | This is an arbitrary title for your video that will be passed in as metadata into Mux Data. Adding a title will give you useful context in your Mux Data dashboard. (optional, but encouraged) | false |
| `upload-in-progress` | `boolean` | Toggles visual status of progress bar while upload is in progress. Can be targeted with CSS if you want to control styles while in progress i.e. mux-uploader[upload-in-progress]. | false |
| `upload-error` | `boolean` | Toggles visual status of progress bar when upload encounters an error. Can be targeted with CSS if you want to control styles when an error occurs i.e. mux-uploader[upload-error]. | false |
| `status` | `boolean` | Toggles text status visibility of progress bar. The text that is displayed is a percentage by default. If you prefer just the progress bar with no text upload status, don't include this attribute. | false |
#### `mux-uploader-drop`
| Attribute | Type | Description | Default |
| --------------- | ---------- | ------------------------------------------------------ | ------- |
| `fullscreen` | `boolean` | Toggles fullscreen drag and drop (work-in-progress). | false |
| `overlay` | `boolean` | Toggles fullscreen overlay on dragover. | false |
| `disable-drop ` | `booleann` | Toggles off drag and drop which is enabled by default. | false |
| Attribute | Type | Description | Default |
| --------------- | --------- | ------------------------------------------------------ | ------- |
| `fullscreen` | `boolean` | Toggles fullscreen drag and drop (work-in-progress). | false |
| `overlay` | `boolean` | Toggles fullscreen overlay on dragover. | false |
| `disable-drop ` | `boolean` | Toggles off drag and drop which is enabled by default. | false |

@@ -102,3 +125,3 @@ ### Methods

`mus-uploader` can be styled with CSS variables.
`mux-uploader` can be styled with CSS variables.

@@ -105,0 +128,0 @@ #### Elements

@@ -188,2 +188,3 @@ import * as UpChunk from '@mux/upchunk';

<input type="file" />
<!--TO-DO: Slots not receiving events or not having the right visual behaviour as the original elements. (TD).-->
<slot name="custom-button"><button type="button">Upload video</button></slot>

@@ -237,3 +238,2 @@ <slot name="custom-progress"><p class="upload-status" id="upload-status"></p></slot>

srOnlyText: HTMLElement | null | undefined;
_dropHandler: Function;

@@ -256,4 +256,2 @@ constructor() {

this._dropHandler = this.handleUpload.bind(this);
this.progressBar?.setAttribute('aria-description', ariaDescription);

@@ -281,3 +279,3 @@ }

//@ts-ignore
this.removeEventListener('mux-drop', this._dropHandler, false);
this.removeEventListener('file-ready', this.handleUpload, false);
}

@@ -344,3 +342,3 @@

//@ts-ignore
this.addEventListener('mux-drop', this._dropHandler);
this.addEventListener('file-ready', this.handleUpload);
}

@@ -356,2 +354,3 @@

setupFilePickerButton() {
// TO-DO: Troubleshoot click event when user clicks custom button. Currently not getting the slotted element. (TD).
this.shadowRoot?.querySelector('slot[name=custom-button]')?.addEventListener('slotchange', () => {

@@ -374,3 +373,3 @@ this.filePickerButton = this.shadowRoot?.querySelector('slot[name=custom-button]');

this.dispatchEvent(
new CustomEvent('mux-drop', {
new CustomEvent('file-ready', {
composed: true,

@@ -377,0 +376,0 @@ bubbles: true,

@@ -158,3 +158,3 @@ const template = document.createElement('template');

uploaderController.dispatchEvent(
new CustomEvent('mux-drop', {
new CustomEvent('file-ready', {
composed: true,

@@ -161,0 +161,0 @@ bubbles: true,

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc