uppy
Version:
Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:
69 lines • 584 kB
JavaScript
(()=>{var jg=Object.create;var po=Object.defineProperty;var zg=Object.getOwnPropertyDescriptor;var Hg=Object.getOwnPropertyNames;var qg=Object.getPrototypeOf,Vg=Object.prototype.hasOwnProperty;var o=(i,e)=>po(i,"name",{value:e,configurable:!0});var pe=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),ho=(i,e)=>{for(var t in e)po(i,t,{get:e[t],enumerable:!0})},$g=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Hg(e))!Vg.call(i,s)&&s!==t&&po(i,s,{get:()=>e[s],enumerable:!(r=zg(e,s))||r.enumerable});return i};var ae=(i,e,t)=>(t=i!=null?jg(qg(i)):{},$g(e||!i||!i.__esModule?po(t,"default",{value:i,enumerable:!0}):t,i));var er=pe((T5,wc)=>{"use strict";wc.exports=o(function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);let t=e<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return`${(t?"-":"")+e} B`;let s=Math.min(Math.floor(Math.log(e)/Math.log(1024)),r.length-1);e=Number(e/1024**s);let n=r[s];return e>=10||e%1===0?`${(t?"-":"")+e.toFixed(0)} ${n}`:`${(t?"-":"")+e.toFixed(1)} ${n}`},"prettierBytes")});var Pc=pe((A5,xc)=>{"use strict";function Sc(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}o(Sc,"WildcardMatcher");Sc.prototype.match=function(i){var e=!0,t=this.parts,r,s=t.length,n;if(typeof i=="string"||i instanceof String)if(!this.hasWild&&this.text!=i)e=!1;else{for(n=(i||"").split(this.separator),r=0;e&&r<s;r++)t[r]!=="*"&&(r<n.length?e=t[r]===n[r]:e=!1);e=e&&n}else if(typeof i.splice=="function")for(e=[],r=i.length;r--;)this.match(i[r])&&(e[e.length]=i[r]);else if(typeof i=="object"){e={};for(var a in i)this.match(a)&&(e[a]=i[a])}return e};xc.exports=function(i,e,t){var r=new Sc(i,t||/[\/\.]/);return typeof e<"u"?r.match(e):r}});var kc=pe((U5,_c)=>{var wy=Pc(),Sy=/[\/\+\.]/;_c.exports=function(i,e){function t(r){var s=wy(r,i,Sy);return s&&s.length>=2}return o(t,"test"),e?t(e.split(";")[0]):t}});var ko=pe(($5,Cc)=>{function _y(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}o(_y,"isObject");Cc.exports=_y});var Rc=pe((G5,Ac)=>{var ky=typeof global=="object"&&global&&global.Object===Object&&global;Ac.exports=ky});var ra=pe((X5,Uc)=>{var Ey=Rc(),Fy=typeof self=="object"&&self&&self.Object===Object&&self,Ty=Ey||Fy||Function("return this")();Uc.exports=Ty});var Dc=pe((K5,Oc)=>{var Cy=ra(),Ay=o(function(){return Cy.Date.now()},"now");Oc.exports=Ay});var Nc=pe((J5,Ic)=>{var Ry=/\s/;function Uy(i){for(var e=i.length;e--&&Ry.test(i.charAt(e)););return e}o(Uy,"trimmedEndIndex");Ic.exports=Uy});var Lc=pe((Z5,Mc)=>{var Oy=Nc(),Dy=/^\s+/;function Iy(i){return i&&i.slice(0,Oy(i)+1).replace(Dy,"")}o(Iy,"baseTrim");Mc.exports=Iy});var sa=pe((t3,Bc)=>{var Ny=ra(),My=Ny.Symbol;Bc.exports=My});var qc=pe((i3,Hc)=>{var jc=sa(),zc=Object.prototype,Ly=zc.hasOwnProperty,By=zc.toString,as=jc?jc.toStringTag:void 0;function jy(i){var e=Ly.call(i,as),t=i[as];try{i[as]=void 0;var r=!0}catch{}var s=By.call(i);return r&&(e?i[as]=t:delete i[as]),s}o(jy,"getRawTag");Hc.exports=jy});var $c=pe((s3,Vc)=>{var zy=Object.prototype,Hy=zy.toString;function qy(i){return Hy.call(i)}o(qy,"objectToString");Vc.exports=qy});var Kc=pe((n3,Xc)=>{var Wc=sa(),Vy=qc(),$y=$c(),Wy="[object Null]",Gy="[object Undefined]",Gc=Wc?Wc.toStringTag:void 0;function Xy(i){return i==null?i===void 0?Gy:Wy:Gc&&Gc in Object(i)?Vy(i):$y(i)}o(Xy,"baseGetTag");Xc.exports=Xy});var Jc=pe((l3,Yc)=>{function Ky(i){return i!=null&&typeof i=="object"}o(Ky,"isObjectLike");Yc.exports=Ky});var Zc=pe((c3,Qc)=>{var Yy=Kc(),Jy=Jc(),Qy="[object Symbol]";function Zy(i){return typeof i=="symbol"||Jy(i)&&Yy(i)==Qy}o(Zy,"isSymbol");Qc.exports=Zy});var rp=pe((d3,ip)=>{var ev=Lc(),ep=ko(),tv=Zc(),tp=NaN,iv=/^[-+]0x[0-9a-f]+$/i,rv=/^0b[01]+$/i,sv=/^0o[0-7]+$/i,ov=parseInt;function nv(i){if(typeof i=="number")return i;if(tv(i))return tp;if(ep(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=ep(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=ev(i);var t=rv.test(i);return t||sv.test(i)?ov(i.slice(2),t?2:8):iv.test(i)?tp:+i}o(nv,"toNumber");ip.exports=nv});var Eo=pe((f3,op)=>{var av=ko(),oa=Dc(),sp=rp(),lv="Expected a function",uv=Math.max,cv=Math.min;function pv(i,e,t){var r,s,n,a,u,c,p=0,f=!1,d=!1,v=!0;if(typeof i!="function")throw new TypeError(lv);e=sp(e)||0,av(t)&&(f=!!t.leading,d="maxWait"in t,n=d?uv(sp(t.maxWait)||0,e):n,v="trailing"in t?!!t.trailing:v);function _(H){var Q=r,X=s;return r=s=void 0,p=H,a=i.apply(X,Q),a}o(_,"invokeFunc");function k(H){return p=H,u=setTimeout(R,e),f?_(H):a}o(k,"leadingEdge");function A(H){var Q=H-c,X=H-p,Z=e-Q;return d?cv(Z,n-X):Z}o(A,"remainingWait");function F(H){var Q=H-c,X=H-p;return c===void 0||Q>=e||Q<0||d&&X>=n}o(F,"shouldInvoke");function R(){var H=oa();if(F(H))return U(H);u=setTimeout(R,A(H))}o(R,"timerExpired");function U(H){return u=void 0,v&&r?_(H):(r=s=void 0,a)}o(U,"trailingEdge");function C(){u!==void 0&&clearTimeout(u),p=0,r=c=s=u=void 0}o(C,"cancel");function Y(){return u===void 0?a:U(oa())}o(Y,"flush");function $(){var H=oa(),Q=F(H);if(r=arguments,s=this,c=H,Q){if(u===void 0)return k(c);if(d)return clearTimeout(u),u=setTimeout(R,e),_(c)}return u===void 0&&(u=setTimeout(R,e)),a}return o($,"debounced"),$.cancel=C,$.flush=Y,$}o(pv,"debounce");op.exports=pv});var na=pe((g3,np)=>{var dv=Eo(),hv=ko(),fv="Expected a function";function mv(i,e,t){var r=!0,s=!0;if(typeof i!="function")throw new TypeError(fv);return hv(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),dv(i,e,{leading:r,maxWait:e,trailing:s})}o(mv,"throttle");np.exports=mv});var lp=pe((v3,ap)=>{ap.exports=o(function(){var e={},t=e._fns={};e.emit=o(function(a,u,c,p,f,d,v){var _=r(a);_.length&&s(a,_,[u,c,p,f,d,v])},"emit"),e.on=o(function(a,u){t[a]||(t[a]=[]),t[a].push(u)},"on"),e.once=o(function(a,u){function c(){u.apply(this,arguments),e.off(a,c)}o(c,"one"),this.on(a,c)},"once"),e.off=o(function(a,u){var c=[];if(a&&u){var p=this._fns[a],f=0,d=p?p.length:0;for(f;f<d;f++)p[f]!==u&&c.push(p[f])}c.length?this._fns[a]=c:delete this._fns[a]},"off");function r(n){var a=t[n]?t[n]:[],u=n.indexOf(":"),c=u===-1?[n]:[n.substring(0,u),n.substring(u+1)],p=Object.keys(t),f=0,d=p.length;for(f;f<d;f++){var v=p[f];if(v==="*"&&(a=a.concat(t[v])),c.length===2&&c[0]===v){a=a.concat(t[v]);break}}return a}o(r,"getListeners");function s(n,a,u){var c=0,p=a.length;for(c;c<p&&a[c];c++)a[c].event=n,a[c].apply(a[c],u)}return o(s,"emitAll"),e},"createNamespaceEmitter")});var mp=pe((G3,fp)=>{function Pt(i,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(i)),this._timeouts=i,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}o(Pt,"RetryOperation");fp.exports=Pt;Pt.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Pt.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Pt.prototype.retry=function(i){if(this._timeout&&clearTimeout(this._timeout),!i)return!1;var e=new Date().getTime();if(i&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(i),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(i);var t=this._timeouts.shift();if(t===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),t=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},t),this._options.unref&&this._timer.unref(),!0};Pt.prototype.attempt=function(i,e){this._fn=i,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var t=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){t._operationTimeoutCb()},t._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Pt.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)};Pt.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)};Pt.prototype.start=Pt.prototype.try;Pt.prototype.errors=function(){return this._errors};Pt.prototype.attempts=function(){return this._attempts};Pt.prototype.mainError=function(){if(this._errors.length===0)return null;for(var i={},e=null,t=0,r=0;r<this._errors.length;r++){var s=this._errors[r],n=s.message,a=(i[n]||0)+1;i[n]=a,a>=t&&(e=s,t=a)}return e}});var gp=pe(Ti=>{var bv=mp();Ti.operation=function(i){var e=Ti.timeouts(i);return new bv(e,{forever:i&&(i.forever||i.retries===1/0),unref:i&&i.unref,maxRetryTime:i&&i.maxRetryTime})};Ti.timeouts=function(i){if(i instanceof Array)return[].concat(i);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var t in i)e[t]=i[t];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],s=0;s<e.retries;s++)r.push(this.createTimeout(s,e));return i&&i.forever&&!r.length&&r.push(this.createTimeout(s,e)),r.sort(function(n,a){return n-a}),r};Ti.createTimeout=function(i,e){var t=e.randomize?Math.random()+1:1,r=Math.round(t*Math.max(e.minTimeout,1)*Math.pow(e.factor,i));return r=Math.min(r,e.maxTimeout),r};Ti.wrap=function(i,e,t){if(e instanceof Array&&(t=e,e=null),!t){t=[];for(var r in i)typeof i[r]=="function"&&t.push(r)}for(var s=0;s<t.length;s++){var n=t[s],a=i[n];i[n]=o(function(c){var p=Ti.operation(e),f=Array.prototype.slice.call(arguments,1),d=f.pop();f.push(function(v){p.retry(v)||(v&&(arguments[0]=p.mainError()),d.apply(this,arguments))}),p.attempt(function(){c.apply(i,f)})},"retryWrapper").bind(i,a),i[n].options=e}}});var vp=pe((J3,yp)=>{yp.exports=gp()});var Ge=pe((XP,No)=>{(function(){"use strict";var i={}.hasOwnProperty;function e(){for(var s="",n=0;n<arguments.length;n++){var a=arguments[n];a&&(s=r(s,t(a)))}return s}o(e,"classNames");function t(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return e.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var n="";for(var a in s)i.call(s,a)&&s[a]&&(n=r(n,a));return n}o(t,"parseValue");function r(s,n){return n?s?s+" "+n:s+n:s}o(r,"appendClass"),typeof No<"u"&&No.exports?(e.default=e,No.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var Op=pe((j_,ba)=>{"use strict";var e0=Object.prototype.hasOwnProperty,nt="~";function ps(){}o(ps,"Events");Object.create&&(ps.prototype=Object.create(null),new ps().__proto__||(nt=!1));function t0(i,e,t){this.fn=i,this.context=e,this.once=t||!1}o(t0,"EE");function Up(i,e,t,r,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new t0(t,r||i,s),a=nt?nt+e:e;return i._events[a]?i._events[a].fn?i._events[a]=[i._events[a],n]:i._events[a].push(n):(i._events[a]=n,i._eventsCount++),i}o(Up,"addListener");function qo(i,e){--i._eventsCount===0?i._events=new ps:delete i._events[e]}o(qo,"clearEvent");function st(){this._events=new ps,this._eventsCount=0}o(st,"EventEmitter");st.prototype.eventNames=o(function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)e0.call(t,r)&&e.push(nt?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},"eventNames");st.prototype.listeners=o(function(e){var t=nt?nt+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,n=r.length,a=new Array(n);s<n;s++)a[s]=r[s].fn;return a},"listeners");st.prototype.listenerCount=o(function(e){var t=nt?nt+e:e,r=this._events[t];return r?r.fn?1:r.length:0},"listenerCount");st.prototype.emit=o(function(e,t,r,s,n,a){var u=nt?nt+e:e;if(!this._events[u])return!1;var c=this._events[u],p=arguments.length,f,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),p){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,s),!0;case 5:return c.fn.call(c.context,t,r,s,n),!0;case 6:return c.fn.call(c.context,t,r,s,n,a),!0}for(d=1,f=new Array(p-1);d<p;d++)f[d-1]=arguments[d];c.fn.apply(c.context,f)}else{var v=c.length,_;for(d=0;d<v;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),p){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,r);break;case 4:c[d].fn.call(c[d].context,t,r,s);break;default:if(!f)for(_=1,f=new Array(p-1);_<p;_++)f[_-1]=arguments[_];c[d].fn.apply(c[d].context,f)}}return!0},"emit");st.prototype.on=o(function(e,t,r){return Up(this,e,t,r,!1)},"on");st.prototype.once=o(function(e,t,r){return Up(this,e,t,r,!0)},"once");st.prototype.removeListener=o(function(e,t,r,s){var n=nt?nt+e:e;if(!this._events[n])return this;if(!t)return qo(this,n),this;var a=this._events[n];if(a.fn)a.fn===t&&(!s||a.once)&&(!r||a.context===r)&&qo(this,n);else{for(var u=0,c=[],p=a.length;u<p;u++)(a[u].fn!==t||s&&!a[u].once||r&&a[u].context!==r)&&c.push(a[u]);c.length?this._events[n]=c.length===1?c[0]:c:qo(this,n)}return this},"removeListener");st.prototype.removeAllListeners=o(function(e){var t;return e?(t=nt?nt+e:e,this._events[t]&&qo(this,t)):(this._events=new ps,this._eventsCount=0),this},"removeAllListeners");st.prototype.off=st.prototype.removeListener;st.prototype.addListener=st.prototype.on;st.prefixed=nt;st.EventEmitter=st;typeof ba<"u"&&(ba.exports=st)});var dd=pe((Ma,La)=>{(function(i,e){typeof Ma=="object"&&typeof La<"u"?La.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Compressor=e())})(Ma,(function(){"use strict";function i(I,T){var O=Object.keys(I);if(Object.getOwnPropertySymbols){var L=Object.getOwnPropertySymbols(I);T&&(L=L.filter(function(K){return Object.getOwnPropertyDescriptor(I,K).enumerable})),O.push.apply(O,L)}return O}o(i,"ownKeys");function e(I){for(var T=1;T<arguments.length;T++){var O=arguments[T]!=null?arguments[T]:{};T%2?i(Object(O),!0).forEach(function(L){n(I,L,O[L])}):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(O)):i(Object(O)).forEach(function(L){Object.defineProperty(I,L,Object.getOwnPropertyDescriptor(O,L))})}return I}o(e,"_objectSpread2");function t(I,T){if(!(I instanceof T))throw new TypeError("Cannot call a class as a function")}o(t,"_classCallCheck");function r(I,T){for(var O=0;O<T.length;O++){var L=T[O];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(I,c(L.key),L)}}o(r,"_defineProperties");function s(I,T,O){return T&&r(I.prototype,T),O&&r(I,O),Object.defineProperty(I,"prototype",{writable:!1}),I}o(s,"_createClass");function n(I,T,O){return T=c(T),T in I?Object.defineProperty(I,T,{value:O,enumerable:!0,configurable:!0,writable:!0}):I[T]=O,I}o(n,"_defineProperty");function a(){return a=Object.assign?Object.assign.bind():function(I){for(var T=1;T<arguments.length;T++){var O=arguments[T];for(var L in O)Object.prototype.hasOwnProperty.call(O,L)&&(I[L]=O[L])}return I},a.apply(this,arguments)}o(a,"_extends");function u(I,T){if(typeof I!="object"||I===null)return I;var O=I[Symbol.toPrimitive];if(O!==void 0){var L=O.call(I,T||"default");if(typeof L!="object")return L;throw new TypeError("@@toPrimitive must return a primitive value.")}return(T==="string"?String:Number)(I)}o(u,"_toPrimitive");function c(I){var T=u(I,"string");return typeof T=="symbol"?T:String(T)}o(c,"_toPropertyKey");var p={exports:{}};(function(I){typeof window>"u"||(function(T){var O=T.HTMLCanvasElement&&T.HTMLCanvasElement.prototype,L=T.Blob&&(function(){try{return!!new Blob}catch{return!1}})(),K=L&&T.Uint8Array&&(function(){try{return new Blob([new Uint8Array(100)]).size===100}catch{return!1}})(),J=T.BlobBuilder||T.WebKitBlobBuilder||T.MozBlobBuilder||T.MSBlobBuilder,ne=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,ue=(L||J)&&T.atob&&T.ArrayBuffer&&T.Uint8Array&&function(te){var ie,Pe,Ee,ot,Ce,ee,et,Oe,jt;if(ie=te.match(ne),!ie)throw new Error("invalid data URI");for(Pe=ie[2]?ie[1]:"text/plain"+(ie[3]||";charset=US-ASCII"),Ee=!!ie[4],ot=te.slice(ie[0].length),Ee?Ce=atob(ot):Ce=decodeURIComponent(ot),ee=new ArrayBuffer(Ce.length),et=new Uint8Array(ee),Oe=0;Oe<Ce.length;Oe+=1)et[Oe]=Ce.charCodeAt(Oe);return L?new Blob([K?et:ee],{type:Pe}):(jt=new J,jt.append(ee),jt.getBlob(Pe))};T.HTMLCanvasElement&&!O.toBlob&&(O.mozGetAsFile?O.toBlob=function(te,ie,Pe){var Ee=this;setTimeout(function(){Pe&&O.toDataURL&&ue?te(ue(Ee.toDataURL(ie,Pe))):te(Ee.mozGetAsFile("blob",ie))})}:O.toDataURL&&ue&&(O.msToBlob?O.toBlob=function(te,ie,Pe){var Ee=this;setTimeout(function(){(ie&&ie!=="image/png"||Pe)&&O.toDataURL&&ue?te(ue(Ee.toDataURL(ie,Pe))):te(Ee.msToBlob(ie))})}:O.toBlob=function(te,ie,Pe){var Ee=this;setTimeout(function(){te(ue(Ee.toDataURL(ie,Pe)))})})),I.exports?I.exports=ue:T.dataURLtoBlob=ue})(window)})(p);var f=p.exports,d=o(function(T){return typeof Blob>"u"?!1:T instanceof Blob||Object.prototype.toString.call(T)==="[object Blob]"},"isBlob"),v={strict:!0,checkOrientation:!0,retainExif:!1,maxWidth:1/0,maxHeight:1/0,minWidth:0,minHeight:0,width:void 0,height:void 0,resize:"none",quality:.8,mimeType:"auto",convertTypes:["image/png"],convertSize:5e6,beforeDraw:null,drew:null,success:null,error:null},_=typeof window<"u"&&typeof window.document<"u",k=_?window:{},A=o(function(T){return T>0&&T<1/0},"isPositiveNumber"),F=Array.prototype.slice;function R(I){return Array.from?Array.from(I):F.call(I)}o(R,"toArray");var U=/^image\/.+$/;function C(I){return U.test(I)}o(C,"isImageType");function Y(I){var T=C(I)?I.substr(6):"";return T==="jpeg"&&(T="jpg"),".".concat(T)}o(Y,"imageTypeToExtension");var $=String.fromCharCode;function H(I,T,O){var L="",K;for(O+=T,K=T;K<O;K+=1)L+=$(I.getUint8(K));return L}o(H,"getStringFromCharCode");var Q=k.btoa;function X(I,T){for(var O=[],L=8192,K=new Uint8Array(I);K.length>0;)O.push($.apply(null,R(K.subarray(0,L)))),K=K.subarray(L);return"data:".concat(T,";base64,").concat(Q(O.join("")))}o(X,"arrayBufferToDataURL");function Z(I){var T=new DataView(I),O;try{var L,K,J;if(T.getUint8(0)===255&&T.getUint8(1)===216)for(var ne=T.byteLength,ue=2;ue+1<ne;){if(T.getUint8(ue)===255&&T.getUint8(ue+1)===225){K=ue;break}ue+=1}if(K){var te=K+4,ie=K+10;if(H(T,te,4)==="Exif"){var Pe=T.getUint16(ie);if(L=Pe===18761,(L||Pe===19789)&&T.getUint16(ie+2,L)===42){var Ee=T.getUint32(ie+4,L);Ee>=8&&(J=ie+Ee)}}}if(J){var ot=T.getUint16(J,L),Ce,ee;for(ee=0;ee<ot;ee+=1)if(Ce=J+ee*12+2,T.getUint16(Ce,L)===274){Ce+=8,O=T.getUint16(Ce,L),T.setUint16(Ce,1,L);break}}}catch{O=1}return O}o(Z,"resetAndGetOrientation");function ye(I){var T=0,O=1,L=1;switch(I){case 2:O=-1;break;case 3:T=-180;break;case 4:L=-1;break;case 5:T=90,L=-1;break;case 6:T=90;break;case 7:T=90,O=-1;break;case 8:T=-90;break}return{rotate:T,scaleX:O,scaleY:L}}o(ye,"parseOrientation");var se=/\.\d*(?:0|9){12}\d*$/;function we(I){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return se.test(I)?Math.round(I*T)/T:I}o(we,"normalizeDecimalNumber");function me(I){var T=I.aspectRatio,O=I.height,L=I.width,K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none",J=A(L),ne=A(O);if(J&&ne){var ue=O*T;(K==="contain"||K==="none")&&ue>L||K==="cover"&&ue<L?O=L/T:L=O*T}else J?O=L/T:ne&&(L=O*T);return{width:L,height:O}}o(me,"getAdjustedSizes");function _e(I){for(var T=R(new Uint8Array(I)),O=T.length,L=[],K=0;K+3<O;){var J=T[K],ne=T[K+1];if(J===255&&ne===218)break;if(J===255&&ne===216)K+=2;else{var ue=T[K+2]*256+T[K+3],te=K+ue+2,ie=T.slice(K,te);L.push(ie),K=te}}return L.reduce(function(Pe,Ee){return Ee[0]===255&&Ee[1]===225?Pe.concat(Ee):Pe},[])}o(_e,"getExif");function ve(I,T){var O=R(new Uint8Array(I));if(O[2]!==255||O[3]!==224)return I;var L=O[4]*256+O[5],K=[255,216].concat(T,O.slice(4+L));return new Uint8Array(K)}o(ve,"insertExif");var E=k.ArrayBuffer,w=k.FileReader,S=k.URL||k.webkitURL,B=/\.\w+$/,q=k.Compressor,j=(function(){function I(T,O){t(this,I),this.file=T,this.exif=[],this.image=new Image,this.options=e(e({},v),O),this.aborted=!1,this.result=null,this.init()}return o(I,"Compressor"),s(I,[{key:"init",value:o(function(){var O=this,L=this.file,K=this.options;if(!d(L)){this.fail(new Error("The first argument must be a File or Blob object."));return}var J=L.type;if(!C(J)){this.fail(new Error("The first argument must be an image File or Blob object."));return}if(!S||!w){this.fail(new Error("The current browser does not support image compression."));return}E||(K.checkOrientation=!1,K.retainExif=!1);var ne=J==="image/jpeg",ue=ne&&K.checkOrientation,te=ne&&K.retainExif;if(S&&!ue&&!te)this.load({url:S.createObjectURL(L)});else{var ie=new w;this.reader=ie,ie.onload=function(Pe){var Ee=Pe.target,ot=Ee.result,Ce={},ee=1;ue&&(ee=Z(ot),ee>1&&a(Ce,ye(ee))),te&&(O.exif=_e(ot)),ue||te?!S||ee>1?Ce.url=X(ot,J):Ce.url=S.createObjectURL(L):Ce.url=ot,O.load(Ce)},ie.onabort=function(){O.fail(new Error("Aborted to read the image with FileReader."))},ie.onerror=function(){O.fail(new Error("Failed to read the image with FileReader."))},ie.onloadend=function(){O.reader=null},ue||te?ie.readAsArrayBuffer(L):ie.readAsDataURL(L)}},"init")},{key:"load",value:o(function(O){var L=this,K=this.file,J=this.image;J.onload=function(){L.draw(e(e({},O),{},{naturalWidth:J.naturalWidth,naturalHeight:J.naturalHeight}))},J.onabort=function(){L.fail(new Error("Aborted to load the image."))},J.onerror=function(){L.fail(new Error("Failed to load the image."))},k.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(k.navigator.userAgent)&&(J.crossOrigin="anonymous"),J.alt=K.name,J.src=O.url},"load")},{key:"draw",value:o(function(O){var L=this,K=O.naturalWidth,J=O.naturalHeight,ne=O.rotate,ue=ne===void 0?0:ne,te=O.scaleX,ie=te===void 0?1:te,Pe=O.scaleY,Ee=Pe===void 0?1:Pe,ot=this.file,Ce=this.image,ee=this.options,et=document.createElement("canvas"),Oe=et.getContext("2d"),jt=Math.abs(ue)%180===90,zi=(ee.resize==="contain"||ee.resize==="cover")&&A(ee.width)&&A(ee.height),$t=Math.max(ee.maxWidth,0)||1/0,zt=Math.max(ee.maxHeight,0)||1/0,Wt=Math.max(ee.minWidth,0)||0,gi=Math.max(ee.minHeight,0)||0,Gt=K/J,Ve=ee.width,$e=ee.height;if(jt){var Or=[zt,$t];$t=Or[0],zt=Or[1];var Dr=[gi,Wt];Wt=Dr[0],gi=Dr[1];var Ir=[$e,Ve];Ve=Ir[0],$e=Ir[1]}zi&&(Gt=Ve/$e);var oo=me({aspectRatio:Gt,width:$t,height:zt},"contain");$t=oo.width,zt=oo.height;var no=me({aspectRatio:Gt,width:Wt,height:gi},"cover");if(Wt=no.width,gi=no.height,zi){var oe=me({aspectRatio:Gt,width:Ve,height:$e},ee.resize);Ve=oe.width,$e=oe.height}else{var Nr=me({aspectRatio:Gt,width:Ve,height:$e}),Hi=Nr.width;Ve=Hi===void 0?K:Hi;var Ft=Nr.height;$e=Ft===void 0?J:Ft}Ve=Math.floor(we(Math.min(Math.max(Ve,Wt),$t))),$e=Math.floor(we(Math.min(Math.max($e,gi),zt)));var Tn=-Ve/2,Xt=-$e/2,tt=Ve,Cn=$e,qi=[];if(zi){var Fe=0,be=0,Mr=K,Tt=J,ao=me({aspectRatio:Gt,width:K,height:J},{contain:"cover",cover:"contain"}[ee.resize]);Mr=ao.width,Tt=ao.height,Fe=(K-Mr)/2,be=(J-Tt)/2,qi.push(Fe,be,Mr,Tt)}if(qi.push(Tn,Xt,tt,Cn),jt){var _t=[$e,Ve];Ve=_t[0],$e=_t[1]}et.width=Ve,et.height=$e,C(ee.mimeType)||(ee.mimeType=ot.type);var lo="transparent";ot.size>ee.convertSize&&ee.convertTypes.indexOf(ee.mimeType)>=0&&(ee.mimeType="image/jpeg");var Ae=ee.mimeType==="image/jpeg";if(Ae&&(lo="#fff"),Oe.fillStyle=lo,Oe.fillRect(0,0,Ve,$e),ee.beforeDraw&&ee.beforeDraw.call(this,Oe,et),!this.aborted&&(Oe.save(),Oe.translate(Ve/2,$e/2),Oe.rotate(ue*Math.PI/180),Oe.scale(ie,Ee),Oe.drawImage.apply(Oe,[Ce].concat(qi)),Oe.restore(),ee.drew&&ee.drew.call(this,Oe,et),!this.aborted)){var dt=o(function(vi){if(!L.aborted){var Vi=o(function(Kt){return L.done({naturalWidth:K,naturalHeight:J,result:Kt})},"done");if(vi&&Ae&&ee.retainExif&&L.exif&&L.exif.length>0){var $i=o(function(Kt){return Vi(f(X(ve(Kt,L.exif),ee.mimeType)))},"next");if(vi.arrayBuffer)vi.arrayBuffer().then($i).catch(function(){L.fail(new Error("Failed to read the compressed image with Blob.arrayBuffer()."))});else{var vt=new w;L.reader=vt,vt.onload=function(Lr){var Kt=Lr.target;$i(Kt.result)},vt.onabort=function(){L.fail(new Error("Aborted to read the compressed image with FileReader."))},vt.onerror=function(){L.fail(new Error("Failed to read the compressed image with FileReader."))},vt.onloadend=function(){L.reader=null},vt.readAsArrayBuffer(vi)}}else Vi(vi)}},"callback");et.toBlob?et.toBlob(dt,ee.mimeType,ee.quality):dt(f(et.toDataURL(ee.mimeType,ee.quality)))}},"draw")},{key:"done",value:o(function(O){var L=O.naturalWidth,K=O.naturalHeight,J=O.result,ne=this.file,ue=this.image,te=this.options;if(S&&ue.src.indexOf("blob:")===0&&S.revokeObjectURL(ue.src),J)if(te.strict&&!te.retainExif&&J.size>ne.size&&te.mimeType===ne.type&&!(te.width>L||te.height>K||te.minWidth>L||te.minHeight>K||te.maxWidth<L||te.maxHeight<K))J=ne;else{var ie=new Date;J.lastModified=ie.getTime(),J.lastModifiedDate=ie,J.name=ne.name,J.name&&J.type!==ne.type&&(J.name=J.name.replace(B,Y(J.type)))}else J=ne;this.result=J,te.success&&te.success.call(this,J)},"done")},{key:"fail",value:o(function(O){var L=this.options;if(L.error)L.error.call(this,O);else throw O},"fail")},{key:"abort",value:o(function(){this.aborted||(this.aborted=!0,this.reader?this.reader.abort():this.image.complete?this.fail(new Error("The compression process has been aborted.")):(this.image.onload=null,this.image.onabort()))},"abort")}],[{key:"noConflict",value:o(function(){return window.Compressor=q,I},"noConflict")},{key:"setDefaults",value:o(function(O){a(v,O)},"setDefaults")}]),I})();return j}))});var Xh=pe((Pl,_l)=>{(function(i,e){typeof Pl=="object"&&typeof _l<"u"?_l.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Cropper=e())})(Pl,(function(){"use strict";function i(y,h){var g=Object.keys(y);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(y);h&&(m=m.filter(function(P){return Object.getOwnPropertyDescriptor(y,P).enumerable})),g.push.apply(g,m)}return g}o(i,"ownKeys");function e(y){for(var h=1;h<arguments.length;h++){var g=arguments[h]!=null?arguments[h]:{};h%2?i(Object(g),!0).forEach(function(m){c(y,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(g)):i(Object(g)).forEach(function(m){Object.defineProperty(y,m,Object.getOwnPropertyDescriptor(g,m))})}return y}o(e,"_objectSpread2");function t(y,h){if(typeof y!="object"||!y)return y;var g=y[Symbol.toPrimitive];if(g!==void 0){var m=g.call(y,h||"default");if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(y)}o(t,"_toPrimitive");function r(y){var h=t(y,"string");return typeof h=="symbol"?h:h+""}o(r,"_toPropertyKey");function s(y){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},s(y)}o(s,"_typeof");function n(y,h){if(!(y instanceof h))throw new TypeError("Cannot call a class as a function")}o(n,"_classCallCheck");function a(y,h){for(var g=0;g<h.length;g++){var m=h[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(y,r(m.key),m)}}o(a,"_defineProperties");function u(y,h,g){return h&&a(y.prototype,h),g&&a(y,g),Object.defineProperty(y,"prototype",{writable:!1}),y}o(u,"_createClass");function c(y,h,g){return h=r(h),h in y?Object.defineProperty(y,h,{value:g,enumerable:!0,configurable:!0,writable:!0}):y[h]=g,y}o(c,"_defineProperty");function p(y){return f(y)||d(y)||v(y)||k()}o(p,"_toConsumableArray");function f(y){if(Array.isArray(y))return _(y)}o(f,"_arrayWithoutHoles");function d(y){if(typeof Symbol<"u"&&y[Symbol.iterator]!=null||y["@@iterator"]!=null)return Array.from(y)}o(d,"_iterableToArray");function v(y,h){if(y){if(typeof y=="string")return _(y,h);var g=Object.prototype.toString.call(y).slice(8,-1);if(g==="Object"&&y.constructor&&(g=y.constructor.name),g==="Map"||g==="Set")return Array.from(y);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return _(y,h)}}o(v,"_unsupportedIterableToArray");function _(y,h){(h==null||h>y.length)&&(h=y.length);for(var g=0,m=new Array(h);g<h;g++)m[g]=y[g];return m}o(_,"_arrayLikeToArray");function k(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}o(k,"_nonIterableSpread");var A=typeof window<"u"&&typeof window.document<"u",F=A?window:{},R=A&&F.document.documentElement?"ontouchstart"in F.document.documentElement:!1,U=A?"PointerEvent"in F:!1,C="cropper",Y="all",$="crop",H="move",Q="zoom",X="e",Z="w",ye="s",se="n",we="ne",me="nw",_e="se",ve="sw",E="".concat(C,"-crop"),w="".concat(C,"-disabled"),S="".concat(C,"-hidden"),B="".concat(C,"-hide"),q="".concat(C,"-invisible"),j="".concat(C,"-modal"),I="".concat(C,"-move"),T="".concat(C,"Action"),O="".concat(C,"Preview"),L="crop",K="move",J="none",ne="crop",ue="cropend",te="cropmove",ie="cropstart",Pe="dblclick",Ee=R?"touchstart":"mousedown",ot=R?"touchmove":"mousemove",Ce=R?"touchend touchcancel":"mouseup",ee=U?"pointerdown":Ee,et=U?"pointermove":ot,Oe=U?"pointerup pointercancel":Ce,jt="ready",zi="resize",$t="wheel",zt="zoom",Wt="image/jpeg",gi=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Gt=/^data:/,Ve=/^data:image\/jpeg;base64,/,$e=/^img|canvas$/i,Or=200,Dr=100,Ir={viewMode:0,dragMode:L,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:Or,minContainerHeight:Dr,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},oo='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',no=Number.isNaN||F.isNaN;function oe(y){return typeof y=="number"&&!no(y)}o(oe,"isNumber");var Nr=o(function(h){return h>0&&h<1/0},"isPositiveNumber");function Hi(y){return typeof y>"u"}o(Hi,"isUndefined");function Ft(y){return s(y)==="object"&&y!==null}o(Ft,"isObject");var Tn=Object.prototype.hasOwnProperty;function Xt(y){if(!Ft(y))return!1;try{var h=y.constructor,g=h.prototype;return h&&g&&Tn.call(g,"isPrototypeOf")}catch{return!1}}o(Xt,"isPlainObject");function tt(y){return typeof y=="function"}o(tt,"isFunction");var Cn=Array.prototype.slice;function qi(y){return Array.from?Array.from(y):Cn.call(y)}o(qi,"toArray");function Fe(y,h){return y&&tt(h)&&(Array.isArray(y)||oe(y.length)?qi(y).forEach(function(g,m){h.call(y,g,m,y)}):Ft(y)&&Object.keys(y).forEach(function(g){h.call(y,y[g],g,y)})),y}o(Fe,"forEach");var be=Object.assign||o(function(h){for(var g=arguments.length,m=new Array(g>1?g-1:0),P=1;P<g;P++)m[P-1]=arguments[P];return Ft(h)&&m.length>0&&m.forEach(function(b){Ft(b)&&Object.keys(b).forEach(function(x){h[x]=b[x]})}),h},"assign"),Mr=/\.\d*(?:0|9){12}\d*$/;function Tt(y){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Mr.test(y)?Math.round(y*h)/h:y}o(Tt,"normalizeDecimalNumber");var ao=/^width|height|left|top|marginLeft|marginTop$/;function _t(y,h){var g=y.style;Fe(h,function(m,P){ao.test(P)&&oe(m)&&(m="".concat(m,"px")),g[P]=m})}o(_t,"setStyle");function lo(y,h){return y.classList?y.classList.contains(h):y.className.indexOf(h)>-1}o(lo,"hasClass");function Ae(y,h){if(h){if(oe(y.length)){Fe(y,function(m){Ae(m,h)});return}if(y.classList){y.classList.add(h);return}var g=y.className.trim();g?g.indexOf(h)<0&&(y.className="".concat(g," ").concat(h)):y.className=h}}o(Ae,"addClass");function dt(y,h){if(h){if(oe(y.length)){Fe(y,function(g){dt(g,h)});return}if(y.classList){y.classList.remove(h);return}y.className.indexOf(h)>=0&&(y.className=y.className.replace(h,""))}}o(dt,"removeClass");function yi(y,h,g){if(h){if(oe(y.length)){Fe(y,function(m){yi(m,h,g)});return}g?Ae(y,h):dt(y,h)}}o(yi,"toggleClass");var vi=/([a-z\d])([A-Z])/g;function Vi(y){return y.replace(vi,"$1-$2").toLowerCase()}o(Vi,"toParamCase");function $i(y,h){return Ft(y[h])?y[h]:y.dataset?y.dataset[h]:y.getAttribute("data-".concat(Vi(h)))}o($i,"getData");function vt(y,h,g){Ft(g)?y[h]=g:y.dataset?y.dataset[h]=g:y.setAttribute("data-".concat(Vi(h)),g)}o(vt,"setData");function Lr(y,h){if(Ft(y[h]))try{delete y[h]}catch{y[h]=void 0}else if(y.dataset)try{delete y.dataset[h]}catch{y.dataset[h]=void 0}else y.removeAttribute("data-".concat(Vi(h)))}o(Lr,"removeData");var Kt=/\s\s*/,Au=(function(){var y=!1;if(A){var h=!1,g=o(function(){},"listener"),m=Object.defineProperty({},"once",{get:o(function(){return y=!0,h},"get"),set:o(function(b){h=b},"set")});F.addEventListener("test",g,m),F.removeEventListener("test",g,m)}return y})();function kt(y,h,g){var m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},P=g;h.trim().split(Kt).forEach(function(b){if(!Au){var x=y.listeners;x&&x[b]&&x[b][g]&&(P=x[b][g],delete x[b][g],Object.keys(x[b]).length===0&&delete x[b],Object.keys(x).length===0&&delete y.listeners)}y.removeEventListener(b,P,m)})}o(kt,"removeListener");function bt(y,h,g){var m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},P=g;h.trim().split(Kt).forEach(function(b){if(m.once&&!Au){var x=y.listeners,D=x===void 0?{}:x;P=o(function(){delete D[b][g],y.removeEventListener(b,P,m);for(var z=arguments.length,N=new Array(z),M=0;M<z;M++)N[M]=arguments[M];g.apply(y,N)},"handler"),D[b]||(D[b]={}),D[b][g]&&y.removeEventListener(b,D[b][g],m),D[b][g]=P,y.listeners=D}y.addEventListener(b,P,m)})}o(bt,"addListener");function Wi(y,h,g){var m;return tt(Event)&&tt(CustomEvent)?m=new CustomEvent(h,{detail:g,bubbles:!0,cancelable:!0}):(m=document.createEvent("CustomEvent"),m.initCustomEvent(h,!0,!0,g)),y.dispatchEvent(m)}o(Wi,"dispatchEvent");function Ru(y){var h=y.getBoundingClientRect();return{left:h.left+(window.pageXOffset-document.documentElement.clientLeft),top:h.top+(window.pageYOffset-document.documentElement.clientTop)}}o(Ru,"getOffset");var An=F.location,wg=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Uu(y){var h=y.match(wg);return h!==null&&(h[1]!==An.protocol||h[2]!==An.hostname||h[3]!==An.port)}o(Uu,"isCrossOriginURL");function Ou(y){var h="timestamp=".concat(new Date().getTime());return y+(y.indexOf("?")===-1?"?":"&")+h}o(Ou,"addTimestamp");function Br(y){var h=y.rotate,g=y.scaleX,m=y.scaleY,P=y.translateX,b=y.translateY,x=[];oe(P)&&P!==0&&x.push("translateX(".concat(P,"px)")),oe(b)&&b!==0&&x.push("translateY(".concat(b,"px)")),oe(h)&&h!==0&&x.push("rotate(".concat(h,"deg)")),oe(g)&&g!==1&&x.push("scaleX(".concat(g,")")),oe(m)&&m!==1&&x.push("scaleY(".concat(m,")"));var D=x.length?x.join(" "):"none";return{WebkitTransform:D,msTransform:D,transform:D}}o(Br,"getTransforms");function Sg(y){var h=e({},y),g=0;return Fe(y,function(m,P){delete h[P],Fe(h,function(b){var x=Math.abs(m.startX-b.startX),D=Math.abs(m.startY-b.startY),W=Math.abs(m.endX-b.endX),z=Math.abs(m.endY-b.endY),N=Math.sqrt(x*x+D*D),M=Math.sqrt(W*W+z*z),V=(M-N)/N;Math.abs(V)>Math.abs(g)&&(g=V)})}),g}o(Sg,"getMaxZoomRatio");function uo(y,h){var g=y.pageX,m=y.pageY,P={endX:g,endY:m};return h?P:e({startX:g,startY:m},P)}o(uo,"getPointer");function xg(y){var h=0,g=0,m=0;return Fe(y,function(P){var b=P.startX,x=P.startY;h+=b,g+=x,m+=1}),h/=m,g/=m,{pageX:h,pageY:g}}o(xg,"getPointersCenter");function Yt(y){var h=y.aspectRatio,g=y.height,m=y.width,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",b=Nr(m),x=Nr(g);if(b&&x){var D=g*h;P==="contain"&&D>m||P==="cover"&&D<m?g=m/h:m=g*h}else b?g=m/h:x&&(m=g*h);return{width:m,height:g}}o(Yt,"getAdjustedSizes");function Pg(y){var h=y.width,g=y.height,m=y.degree;if(m=Math.abs(m)%180,m===90)return{width:g,height:h};var P=m%90*Math.PI/180,b=Math.sin(P),x=Math.cos(P),D=h*x+g*b,W=h*b+g*x;return m>90?{width:W,height:D}:{width:D,height:W}}o(Pg,"getRotatedSizes");function _g(y,h,g,m){var P=h.aspectRatio,b=h.naturalWidth,x=h.naturalHeight,D=h.rotate,W=D===void 0?0:D,z=h.scaleX,N=z===void 0?1:z,M=h.scaleY,V=M===void 0?1:M,ce=g.aspectRatio,le=g.naturalWidth,ke=g.naturalHeight,de=m.fillColor,Le=de===void 0?"transparent":de,We=m.imageSmoothingEnabled,De=We===void 0?!0:We,Ht=m.imageSmoothingQuality,ht=Ht===void 0?"low":Ht,G=m.maxWidth,he=G===void 0?1/0:G,Be=m.maxHeight,wt=Be===void 0?1/0:Be,qt=m.minWidth,bi=qt===void 0?0:qt,wi=m.minHeight,Jt=wi===void 0?0:wi,Ct=document.createElement("canvas"),lt=Ct.getContext("2d"),Si=Yt({aspectRatio:ce,width:he,height:wt}),co=Yt({aspectRatio:ce,width:bi,height:Jt},"cover"),Rn=Math.min(Si.width,Math.max(co.width,le)),Un=Math.min(Si.height,Math.max(co.height,ke)),Nu=Yt({aspectRatio:P,width:he,height:wt}),Mu=Yt({aspectRatio:P,width:bi,height:Jt},"cover"),Lu=Math.min(Nu.width,Math.max(Mu.width,b)),Bu=Math.min(Nu.height,Math.max(Mu.height,x)),Lg=[-Lu/2,-Bu/2,Lu,Bu];return Ct.width=Tt(Rn),Ct.height=Tt(Un),lt.fillStyle=Le,lt.fillRect(0,0,Rn,Un),lt.save(),lt.translate(Rn/2,Un/2),lt.rotate(W*Math.PI/180),lt.scale(N,V),lt.imageSmoothingEnabled=De,lt.imageSmoothingQuality=ht,lt.drawImage.apply(lt,[y].concat(p(Lg.map(function(Bg){return Math.floor(Tt(Bg))})))),lt.restore(),Ct}o(_g,"getSourceCanvas");var Du=String.fromCharCode;function kg(y,h,g){var m="";g+=h;for(var P=h;P<g;P+=1)m+=Du(y.getUint8(P));return m}o(kg,"getStringFromCharCode");var Eg=/^data:.*,/;function Fg(y){var h=y.replace(Eg,""),g=atob(h),m=new ArrayBuffer(g.length),P=new Uint8Array(m);return Fe(P,function(b,x){P[x]=g.charCodeAt(x)}),m}o(Fg,"dataURLToArrayBuffer");function Tg(y,h){for(var g=[],m=8192,P=new Uint8Array(y);P.length>0;)g.push(Du.apply(null,qi(P.subarray(0,m)))),P=P.subarray(m);return"data:".concat(h,";base64,").concat(btoa(g.join("")))}o(Tg,"arrayBufferToDataURL");function Cg(y){var h=new DataView(y),g;try{var m,P,b;if(h.getUint8(0)===255&&h.getUint8(1)===216)for(var x=h.byteLength,D=2;D+1<x;){if(h.getUint8(D)===255&&h.getUint8(D+1)===225){P=D;break}D+=1}if(P){var W=P+4,z=P+10;if(kg(h,W,4)==="Exif"){var N=h.getUint16(z);if(m=N===18761,(m||N===19789)&&h.getUint16(z+2,m)===42){var M=h.getUint32(z+4,m);M>=8&&(b=z+M)}}}if(b){var V=h.getUint16(b,m),ce,le;for(le=0;le<V;le+=1)if(ce=b+le*12+2,h.getUint16(ce,m)===274){ce+=8,g=h.getUint16(ce,m),h.setUint16(ce,1,m);break}}}catch{g=1}return g}o(Cg,"resetAndGetOrientation");function Ag(y){var h=0,g=1,m=1;switch(y){case 2:g=-1;break;case 3:h=-180;break;case 4:m=-1;break;case 5:h=90,m=-1;break;case 6:h=90;break;case 7:h=90,g=-1;break;case 8:h=-90;break}return{rotate:h,scaleX:g,scaleY:m}}o(Ag,"parseOrientation");var Rg={render:o(function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},"render"),initContainer:o(function(){var h=this.element,g=this.options,m=this.container,P=this.cropper,b=Number(g.minContainerWidth),x=Number(g.minContainerHeight);Ae(P,S),dt(h,S);var D={width:Math.max(m.offsetWidth,b>=0?b:Or),height:Math.max(m.offsetHeight,x>=0?x:Dr)};this.containerData=D,_t(P,{width:D.width,height:D.height}),Ae(h,S),dt(P,S)},"initContainer"),initCanvas:o(function(){var h=this.containerData,g=this.imageData,m=this.options.viewMode,P=Math.abs(g.rotate)%180===90,b=P?g.naturalHeight:g.naturalWidth,x=P?g.naturalWidth:g.naturalHeight,D=b/x,W=h.width,z=h.height;h.height*D>h.width?m===3?W=h.height*D:z=h.width/D:m===3?z=h.width/D:W=h.height*D;var N={aspectRatio:D,naturalWidth:b,naturalHeight:x,width:W,height:z};this.canvasData=N,this.limited=m===1||m===2,this.limitCanvas(!0,!0),N.width=Math.min(Math.max(N.width,N.minWidth),N.maxWidth),N.height=Math.min(Math.max(N.height,N.minHeight),N.maxHeight),N.left=(h.width-N.width)/2,N.top=(h.height-N.height)/2,N.oldLeft=N.left,N.oldTop=N.top,this.initialCanvasData=be({},N)},"initCanvas"),limitCanvas:o(function(h,g){var m=this.options,P=this.containerData,b=this.canvasData,x=this.cropBoxData,D=m.viewMode,W=b.aspectRatio,z=this.cropped&&x;if(h){var N=Number(m.minCanvasWidth)||0,M=Number(m.minCanvasHeight)||0;D>1?(N=Math.max(N,P.width),M=Math.max(M,P.height),D===3&&(M*W>N?N=M*W:M=N/W)):D>0&&(N?N=Math.max(N,z?x.width:0):M?M=Math.max(M,z?x.height:0):z&&(N=x.width,M=x.height,M*W>N?N=M*W:M=N/W));var V=Yt({aspectRatio:W,width:N,height:M});N=V.width,M=V.height,b.minWidth=N,b.minHeight=M,b.maxWidth=1/0,b.maxHeight=1/0}if(g)if(D>(z?0:1)){var ce=P.width-b.width,le=P.height-b.height;b.minLeft=Math.min(0,ce),b.minTop=Math.min(0,le),b.maxLeft=Math.max(0,ce),b.maxTop=Math.max(0,le),z&&this.limited&&(b.minLeft=Math.min(x.left,x.left+(x.width-b.width)),b.minTop=Math.min(x.top,x.top+(x.height-b.height)),b.maxLeft=x.left,b.maxTop=x.top,D===2&&(b.width>=P.width&&(b.minLeft=Math.min(0,ce),b.maxLeft=Math.max(0,ce)),b.height>=P.height&&(b.minTop=Math.min(0,le),b.maxTop=Math.max(0,le))))}else b.minLeft=-b.width,b.minTop=-b.height,b.maxLeft=P.width,b.maxTop=P.height},"limitCanvas"),renderCanvas:o(function(h,g){var m=this.canvasData,P=this.imageData;if(g){var b=Pg({width:P.naturalWidth*Math.abs(P.scaleX||1),height:P.naturalHeight*Math.abs(P.scaleY||1),degree:P.rotate||0}),x=b.width,D=b.height,W=m.width*(x/m.naturalWidth),z=m.height*(D/m.naturalHeight);m.left-=(W-m.width)/2,m.top-=(z-m.height)/2,m.width=W,m.height=z,m.aspectRatio=x/D,m.naturalWidth=x,m.naturalHeight=D,this.limitCanvas(!0,!1)}(m.width>m.maxWidth||m.width<m.minWidth)&&(m.left=m.oldLeft),(m.height>m.maxHeight||m.height<m.minHeight)&&(m.top=m.oldTop),m.width=Math.min(Math.max(m.width,m.minWidth),m.maxWidth),m.height=Math.min(Math.max(m.height,m.minHeight),m.maxHeight),this.limitCanvas(!1,!0),m.left=Math.min(Math.max(m.left,m.minLeft),m.maxLeft),m.top=Math.min(Math.max(m.top,m.minTop),m.maxTop),m.oldLeft=m.left,m.oldTop=m.top,_t(this.canvas,be({width:m.width,height:m.height},Br({translateX:m.left,translateY:m.top}))),this.renderImage(h),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},"renderCanvas"),renderImage:o(function(h){var g=this.canvasData,m=this.imageData,P=m.naturalWidth*(g.width/g.naturalWidth),b=m.naturalHeight*(g.height/g.naturalHeight);be(m,{width:P,height:b,left:(g.width-P)/2,top:(g.height-b)/2}),_t(this.image,be({width:m.width,height:m.height},Br(be({translateX:m.left,translateY:m.top},m)))),h&&this.output()},"renderImage"),initCropBox:o(function(){var h=this.options,g=this.canvasData,m=h.aspectRatio||h.initialAspectRatio,P=Number(h.autoCropArea)||.8,b={width:g.width,height:g.height};m&&(g.height*m>g.width?b.height=b.width/m:b.width=b.height*m),this.cropBoxData=b,this.limitCropBox(!0,!0),b.width=Math.min(Math.max(b.width,b.minWidth),b.maxWidth),b.height=Math.min(Math.max(b.height,b.minHeight),b.maxHeight),b.width=Math.max(b.minWidth,b.width*P),b.height=Math.max(b.minHeight,b.height*P),b.left=g.left+(g.width-b.width)/2,b.top=g.top+(g.height-b.height)/2,b.oldLeft=b.left,b.oldTop=b.top,this.initialCropBoxData=be({},b)},"initCropBox"),limitCropBox:o(function(h,g){var m=this.options,P=this.containerData,b=this.canvasData,x=this.cropBoxData,D=this.limited,W=m.aspectRatio;if(h){var z=Number(m.minCropBoxWidth)||0,N=Number(m.minCropBoxHeight)||0,M=D?Math.min(P.width,b.width,b.width+b.left,P.width-b.left):P.width,V=D?Math.min(P.height,b.height,b.height+b.top,P.height-b.top):P.height;z=Math.min(z,P.width),N=Math.min(N,P.height),W&&(z&&N?N*W>z?N=z/W:z=N*W:z?N=z/W:N&&(z=N*W),V*W>M?V=M/W:M=V*W),x.minWidth=Math.min(z,M),x.minHeight=Math.min(N,V),x.maxWidth=M,x.maxHeight=V}g&&(D?(x.minLeft=Math.max(0,b.left),x.minTop=Math.max(0,b.top),x.maxLeft=Math.min(P.width,b.left+b.width)-x.width,x.maxTop=Math.min(P.height,b.top+b.height)-x.height):(x.minLeft=0,x.minTop=0,x.maxLeft=P.width-x.width,x.maxTop=P.height-x.height))},"limitCropBox"),renderCropBox:o(function(){var h=this.options,g=this.containerData,m=this.cropBoxData;(m.width>m.maxWidth||m.width<m.minWidth)&&(m.left=m.oldLeft),(m.height>m.maxHeight||m.height<m.minHeight)&&(m.top=m.oldTop),m.width=Math.min(Math.max(m.width,m.minWidth),m.maxWidth),m.height=Math.min(Math.max(m.height,m.minHeight),m.maxHeight),this.limitCropBox(!1,!0),m.left=Math.min(Math.max(m.left,m.minLeft),m.maxLeft),m.top=Math.min(Math.max(m.top,m.minTop),m.maxTop),m.oldLeft=m.left,m.oldTop=m.top,h.movable&&h.cropBoxMovable&&vt(this.face,T,m.width>=g.width&&m.height>=g.height?H:Y),_t(this.cropBox,be({width:m.width,height:m.height},Br({translateX:m.left,translateY:m.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},"renderCropBox"),output:o(function(){this.preview(),Wi(this.element,ne,this.getData())},"output")},Ug={initPreview:o(function(){var h=this.element,g=this.crossOrigin,m=this.options.preview,P=g?this.crossOriginUrl:this.url,b=h.alt||"The image to preview",x=document.createElement("img");if(g&&(x.crossOrigin=g),x.src=P,x.alt=b,this.viewBox.appendChild(x),this.viewBoxImage=x,!!m){var D=m;typeof m=="string"?D=h.ownerDocument.querySelectorAll(m):m.querySelector&&(D=[m]),this.previews=D,Fe(D,function(W){var z=document.createElement("img");vt(W,O,{width:W.offsetWidth,height:W.offsetHeight,html:W.innerHTML}),g&&(z.crossOrigin=g),z.src=P,z.alt=b,z.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',W.innerHTML="",W.appendChild(z)})}},"initPreview"),resetPreview:o(function(){Fe(this.previews,function(h){var g=$i(h,O);_t(h,{width:g.width,height:g.height}),h.innerHTML=g.html,Lr(h,O)})},"resetPreview"),preview:o(function(){var h=this.imageData,g=this.canvasData,m=this.cropBoxData,P=m.width,b=m.height,x=h.width,D=h.height,W=m.left-g.left-h.left,z=m.top-g.top-h.top;!this.cropped||this.disabled||(_t(this.viewBoxImage,be({width:x,height:D},Br(be({translateX:-W,translateY:-z},h)))),Fe(this.previews,function(N){var M=$i(N,O),V=M.width,ce=M.height,le=V,ke=ce,de=1;P&&(de=V/P,ke=b*de),b&&ke>ce&&(de=ce/b,le=P*de,ke=ce),_t(N,{width:le,height:ke}),_t(N.getElementsByTagName("img")[0],be({width:x*de,height:D*de},Br(be({translateX:-W*de,translateY:-z*de},h))))}))},"preview")},Og={bind:o(function(){var h=this.element,g=this.options,m=this.cropper;tt(g.cropstart)&&bt(h,ie,g.cropstart),tt(g.cropmove)&&bt(h,te,g.cropmove),tt(g.cropend)&&bt(h,ue,g.cropend),tt(g.crop)&&bt(h,ne,g.crop),tt(g.zoom)&&bt(h,zt,g.zoom),bt(m,ee,this.onCropStart=this.cropStart.bind(this)),g.zoomable&&g.zoomOnWheel&&bt(m,$t,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),g.toggleDragModeOnDblclick&&bt(m,Pe,this.onDblclick=this.dblclick.bind(this)),bt(h.ownerDocument,et,this.onCropMove=this.cropMove.bind(this)),bt(h.ownerDocument,Oe,this.onCropEnd=this.cropEnd.bind(this)),g.responsive&&bt(window,zi,this.onResize=this.resize.bind(this))},"bind"),unbind:o(function(){var h=this.element,g=this.options,m=this.cropper;tt(g.cropstart)&&kt(h,ie,g.cropstart),tt(g.cropmove)&&kt(h,te,g.cropmove),tt(g.cropend)&&kt(h,ue,g.cropend),tt(g.crop)&&kt(h,ne,g.crop),tt(g.zoom)&&kt(h,zt,g.zoom),kt(m,ee,this.onCropStart),g.zoomable&&g.zoomOnWheel&&kt(m,$t,this.onWheel,{passive:!1,capture:!0}),g.toggleDragModeOnDblclick&&kt(m,Pe,this.onDblclick),kt(h.ownerDocument,et,this.onCropMove),kt(h.ownerDocument,Oe,this.onCropEnd),g.responsive&&kt(window,zi,this.onResize)},"unbind")},Dg={resize:o(function(){if(!this.disabled){var h=this.options,g=this.container,m=this.containerData,P=g.offsetWidth/m.width,b=g.offsetHeight/m.height,x=Math.abs(P-1)>Math.abs(b-1)?P:b;if(x!==1){var D,W;h.restore&&(D=this.getCanvasData(),W=this.getCropBoxData()),this.render(),h.restore&&(this.setCanvasData(Fe(D,function(z,N){D[N]=z*x})),this.setCropBoxData(Fe(W,function(z,N){W[N]=z*x})))}}},"resize"),dblclick:o(function(){this.disabled||this.options.dragMode===J||this.setDragMode(lo(this.dragBox,E)?K:L)},"dblclick"),wheel:o(function(h){var g=this,m=Number(this.options.wheelZoomRatio)||.1,P=1;this.disabled||(h.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){g.wheeling=!1},50),h.deltaY?P=h.deltaY>0?1:-1:h.wheelDelta?P=-h.wheelDelta/120:h.detail&&(P=h.detail>0?1:-1),this.zoom(-P*m,h)))},"wheel"),cropStart:o(function(h){var g=h.buttons,m=h.button;if(!(this.disabled||(h.type==="mousedown"||h.type==="pointerdown"&&h.pointerType==="mouse")&&(oe(g)&&g!==1||oe(m)&&m!==0||h.ctrlKey))){var P=this.options,b=this.pointers,x;h.changedTouches?Fe(h.changedTouches,function(D){b[D.identifier]=uo(D)}):b[h.pointerId||0]=uo(h),Object.keys(b).length>1&&P.zoomable&&P.zoomOnTouch?x=Q:x=$i(h.target,T),gi.test(x)&&Wi(this.element,ie,{originalEvent:h,action:x})!==!1&&(h.preventDefault(),this.action=x,this.cropping=!1,x===$&&(this.cropping=!0,Ae(this.dragBox,j)))}},"cropStart"),cropMove:o(function(h){var g=this.action;if(!(this.disabled||!g)){var m=this.pointers;h.preventDefault(),Wi(this.element,te,{originalEvent:h,action:g})!==!1&&(h.changedTouches?Fe(h.changedTouches,function(P){be(m[P.identifier]||{},uo(P,!0))}):be(m[h.pointerId||0]||{},uo(h,!0)),this.change(h))}},"cropMove"),cropEnd:o(function(h){if(!this.disabled){var g=this.action,m=this.pointers;h.changedTouches?Fe(h.changedTouches,function(P){delete m[P.identifier]}):delete m[h.pointerId||0],g&&(h.preventDefault(),Object.keys(m).length||(this.action=""),this.cropping&&(this.cropping=!1,yi(this.dragBox,j,this.cropped&&this.options.modal)),Wi(this.element,ue,{originalEvent:h,action:g}))}},"cropEnd")},Ig={change:o(function(h){var g=this.options,m=this.canvasData,P=this.containerData,b=this.cropBoxData,x=this.pointers,D=this.action,W=g.aspectRatio,z=b.left,N=b.top,M=b.width,V=b.height,ce=z+M,le=N+V,ke=0,de=0,Le=P.width,We=P.height,De=!0,Ht;!W&&h.shiftKey&&(W=M&&V?M/V:1),this.limited&&(ke=b.minLeft,de=b.minTop,Le=ke+Math.min(P.width,m.width,m.left+m.width),We=de+Math.min(P.height,m.height,m.top+m.height));var ht=x[Object.keys(x)[0]],G={x:ht.endX-ht.startX,y:ht.endY-ht.startY},he=o(function(wt){switch(wt){case X:ce+G.x>Le&&(G.x=Le-ce);break;case Z:z+G.x<ke&&(G.x=ke-z);break;case se:N+G.y<de&&(G.y=de-N);break;case ye:le+G.y>We&&(G.y=We-le);break}},"check");switch(D){case Y:z+=G.x,N+=G.y;break;case X:if(G.x>=0&&(ce>=Le||W&&(N<=de||le>=We))){De=!1;break}he(X),M+=G.x,M<0&&(D=Z,M=-M,z-=M),W&&(V=M/W,N+=(b.height-V)/2);break;case se:if(G.y<=0&&(N<=de||W&&(z<=ke||ce>=Le))){De=!1;break}he(se),V-=G.y,N+=G.y,V<0&&(D=ye,V=-V,N-=V),W&&(M=V*W,z+=(b.width-M)/2);break;case Z:if(G.x<=0&&(z<=ke||W&&(N<=de||le>=We))){De=!1;break}he(Z),M-=G.x,z+=G.x,M<0&&(D=X,M=-M,z-=M),W&&(V=M/W,N+=(b.height-V)/2);break;case ye:if(G.y>=0&&(le>=We||W&&(z<=ke||ce>=Le))){De=!1;break}he(ye),V+=G.y,V<0&&(D=se,V=-V,N-=V),W&&(M=V*W,z+=(b.width-M)/2);break;case we:if(W){if(G.y<=0&&(N<=de||ce>=Le)){De=!1;break}he(se),V-=G.y,N+=G.y,M=V*W}else he(se),he(X),G.x>=0?ce<Le?M+=G.x:G.y<=0&&N<=de&&(De=!1):M+=G.x,G.y<=0?N>de&&(V-=G.y,N+=G.y):(V-=G.y,N+=G.y);M<0&&V<0?(D=ve,V=-V,M=-M,N-=V,z-=M):M<0?(D=me,M=-M,z-=M):V<0&&(D=_e,V=-V,N-=V);break;case me:if(W){if(G.y<=0&&(N<=de||z<=ke)){De=!1;break}he(se),V-=G.y,N+=G.y,M=V*W,z+=b.width-M}else he(se),he(Z),G.x<=0?z>ke?(M-=G.x,z+=G.x):G.y<=0&&N<=de&&(De=!1):(M-=G.x,z+=G.x),G.y<=0?N>de&&(V-=G.y,N+=G.y):(V-=G.y,N+=G.y);M<0&&V<0?(D=_e,V=-V,M=-M,N-=V,z-=M):M<0?(D=we,M=-M,z-=M):V<0&&(D=ve,V=-V,N-=V);break;case ve:if(W){if(G.x<=0&&(z<=ke||le>=We)){De=!1;break}he(Z),M-=G.x,z+=G.x,V=M/W}else he(ye),he(Z),G.x<=0?z>ke?(M-=G.x,z+=G.x):G.y>=0&&le>=We&&(De=!1):(M-=G.x,z+=G.x),G.y>=0?le<We&&(V+=G.y):V+=G.y;M<0&&V<0?(D=we,V=-V,M=-M,N-=V,z-=M):M<0?(D=_e,M=-M,z-=M):V<0&&(D=me,V=-V,N-=V);break;case _e:if(W){if(G.x>=0&&(ce>=Le||le>=We)){De=!1;break}he(X),M+=G.x,V=M/W}else he(ye),he(X),G.x>=0?ce<Le?M+=G.x:G.y>=0&&le>=We&&(De=!1):M+=G.x,G.y>=0?le<We&&(V+=G.y):V+=G.y;M<0&&V<0?(D=me,V=-V,M=-M,N-=V,z-=M):M<0?(D=ve,M=-M,z-=M):V<0&&(D=we,V=-V,N-=V);break;case H:this.move(G.x,G.y),De=!1;break;case Q:this.zoom(Sg(x),h),De=!1;break;case $:if(!G.x||!G.y){De=!1;break}Ht=Ru(this.cropper),z=ht.startX-Ht.left,N=ht.startY-Ht.top,M=b.minWidth,V=b.minHeight,G.x>0?D=G.y>0?_e:we:G.x<0&&(z-=M,D=G.y>0?ve:me),G.y<0&&(N-=V),this.cropped||(dt(this.cropBox,S),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}De&&(b.width=M,b.height=V,b.left=z,b.top=N,this.action=D,this.renderCropBox()),Fe(x,function(Be){Be.startX=Be.endX,Be.startY=Be.endY})},"change")},Ng={crop:o(function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Ae(this.dragBox,j),dt(this.cropBox,S),this.setCropBoxData(this.initialCropBoxData)),this},"crop"),reset:o(function(){return this.ready&&!this.disabled&&(this.imageData=be({},this.initialImageData),this.canvasData=be({},this.initialCanvasData),this.cropBoxData=be({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},"reset"),clear:o(function(){return this.cropped&&!this.disabled&&(be(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),dt(this.dragBox,j),Ae(this.cropBox,S)),this},"clear"),replace:o(function(h){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&h&&(this.isImg&&(this.element.src=h),g?(this.url=h,this.image.src=h,this.ready&&(this.viewBoxImage.src=h,Fe(this.previews,function(m){m.getElementsByTagName("img")[0].src=h}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(h))),this},"replace"),enable:o(function(){return this.ready&&this.disabled&&(this.disabled=!1,dt(this.cropper,w)),this},"enable"),disable:o(function(){return this.ready&&!this.disabled&&(this.disabled=!0,Ae(this.cropper,w)),this},"disable"),destroy:o(function(){var h=this.element;return h[C]?(h[C]=void 0,this.isImg&&this.replaced&&(h.src=this.originalUrl),this.uncreate(),this):this},"destroy"),move:o(function(h){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,m=this.canvasData,P=m.left,b=m.top;return this.moveTo(Hi(h)?h:P+Number(h),Hi(g)?g:b+Number(g))},"move"),moveTo:o(function(h){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,m=this.canvasData,P=!1;return h=Number(h),g=Number(g),this.ready&&!this.disabled&&this.options.movable&&(oe(h)&&(m.left=h,P=!0),oe(g)&&(m.top=g,P=!0),P&&this.renderCanvas(!0)),this},"moveTo"),zoom:o(function(h,g){var m=this.canvasData;return h=Number(h),h<0?h=1/(1-h):h=1+h,this.zoomTo(m.width*h/m.naturalWidth,null,g)},"zoom"),zoomTo:o(function(h,g,m){var P=this.options,b=this.canvasData,x=b.width,D=b.height,W=b.naturalWidth,z=b.naturalHeight;if(h=Number(h),h>=0&&this.ready&&!this.disabled&&P.zoomable){var N=W*h,M=z*h;if(Wi(this.element,zt,{ratio:h,oldRatio:x/W,originalEvent:m})===!1)return this;if(m){var V=this.pointers,ce=Ru(this.cropper),le=V&&Object.keys(V).length?xg(V):{pageX:m.pageX,pageY:m.pageY};b.left-=(N-x)*((le.pageX-ce.left-b.left)/x),b.top-=(M-D)*((le.pageY-ce.top-b.top)/D)}else Xt(g)&&oe(g.x)&&oe(g.y)?(b.left-=(N-x)*((g.x-b.left)/x),b.top-=(M-D)*((g.y-b.top)/D)):(b.left-=(N-x)/2,b.top-=(M-D)/2);b.width=N,b.height=M,this.renderCanvas(!0)}return this},"zoomTo"),rotate:o(function(h){return this.rotateTo((this.imageData.rotate||0)+Number(h))},"rotate"),rotateTo:o(function(h){return h=Number(h),oe(h)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=h%360,this.renderCanvas(!0,!0)),this},"rotateTo"),scaleX:o(function(h){var g=this.imageData.scaleY;return this.scale(h,oe(g)?g:1)},"scaleX"),scaleY:o(function(h){var g=this.imageData.scaleX;return this.scale(oe(g)?g:1,h)},"scaleY"),scale:o(function(h){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,m=this.imageData,P=!1;return h=Number(h),g=Number(g),this.ready&&!this.disabled&&this.options.scalable&&(oe(h)&&(m.scaleX=h,P=!0),oe(g)&&(m.scaleY=g,P=!0),P&&this.renderCanvas(!0,!0)),this},"scale"),getData:o(function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,g=this.options,m=this.imageData,P=this.canvasData,b=this.cropBoxData,x;if(this.ready&&this.cropped){x={x:b.left-P.left,y:b.top-P.top,width:b.width,height:b.height};var D=m.width/m.naturalWidth;if(Fe(x,function(N,M){x[M]=N/D}),h){var W=Math.round(x.y+x.height),z=Math.round(x.x+x.width);x.x=Math.round(x.x),x.y=Math.round(x.y),x.width=z-x.x,x.height=W-x.y}}else x={x:0,y:0,width:0,height:0};return g.rotatable&&(x.rotate=m.rotate||0),g.scalable&&(x.scaleX=m.scaleX||1,x.scaleY=m.scaleY||1),x},"getData"),setData:o(function(h){var g=this.options,m=this.imageData,P=this.canvasData,b={};if(this.ready&&!this.disabled&&Xt(h)){var x=!1;g.rotatable&&oe(h.rotate)&&h.rotate!==m.rotate&&(m.rotate=h.rotate,x=!0),g.scalable&&(oe(h.scaleX)&&h.scaleX!==m.scaleX&&(m.scaleX=h.scaleX,x=!0),oe(h.scaleY)&&h.scaleY!==m.scaleY&&(m.scaleY=h.scaleY,x=!0)),x&&this.renderCanvas(!0,!0);var D=m.width/m.naturalWidth;oe(h.x)&&(b.left=h.x*D+P.left),oe(h.y)&&(b.top=h.y*D+P.top),oe(h.width)&&(b.width=h.width*D),oe(h.height)&&(b.height=h.height*D),this.setCropBoxData(b)}return this},"setData"),getContainerData:o(function(){return this.ready?be({},this.containerData):{}},"getContainerData"),getImageData:o(function(){return this.sized?be({},this.imageData):{}},"getImageData"),getCanvasData:o(function(){var h=this.canvasData,g={};return this.ready&&Fe(["left","top","width","height","naturalWidth","naturalHeight"],function(m){g[m]=h[m]}),g},"getCanvasData"),setCanvasData:o(function(h){var g=this.canvasData,m=g.aspectRatio;return this.ready&&!this.disabled&&Xt(h)&&(oe(h.left)&&(g.left=h.left),oe(h.top)&&(g.top=h.top),oe(h.width)?(g.width=h.width,g.height=h.width/m):oe(h.height)&&(g.height=h.height,g.width=h.height*m),this.renderCanvas(!0)),this},"setCanvasData"),getCropBoxData:o(function(){var h=this.cropBoxData,g;return this.ready&&this.cropped&&(g={left:h.left,top:h.top,width:h.width,height:h.height}),g||{}},"getCropBoxData"),setCropBoxData:o(function(h){var g=this.cropBoxData,m=this.options.aspectRatio,P,b;return this.ready&&this.cropped&&!this.disabled&&Xt(h)&&(oe(h.left)&&(g.left=h.left),oe(h.top)&&(g.top=h.top),oe(h.width)&&h.width!==g.width&&(P=!0,g.width=h.width),oe(h.height)&&h.height!==g.height&&(b=!0,g.height=h.height),m&&(P?g.height=g.width/m:b&&(g.width=g.height*m)),this.renderCropBox()),this},"setCropBoxData"),getCroppedCanvas:o(function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var g=this.canvasData,m=_g(this.image,this.imageData,g,h);if(!this.cropped)return m;var P=this.getData(h.rounded),b=P.x,x=P.y,D=P.width,W=P.height,z=m.width/Math.floor(g.naturalWidth);z!==1&&(b*=z,x*=z,D*=z,W*=z);var N=D/W,M=Yt({aspectRatio:N,width:h.maxWidth||1/0,height:h.maxHeight||1/0}),V=Yt({aspectRatio:N,width:h.minWidth||0,height:h.minHeight||0},"cover"),ce=Yt({aspectRatio:N,width:h.width||(z!==1?m.width:D),height:h.height||(z!==1?m.height:W)}),le=ce.width,ke=ce.height;le=Math.min(M.width,Math.max(V.width,le)),ke=Math.min(M.height,Math.max(V.height,ke));var de=document.createElement("canvas"),Le=de.getContext("2d");de.width=Tt(le),de.height=Tt(ke),Le.fillStyle=h.fillColor||"transparent",Le.fillRect(0,0,le,ke);var We=h.imageSmoothingEnabled,De=We===void 0?!0:We,Ht=h.imageSmoothingQuality;Le.imageSmoothingEnabled=De,Ht&&(Le.imageSmoothingQuality=Ht);var ht=m.width,G=m.height,he=b,Be=x,wt,qt,bi,wi,Jt,Ct;he<=-D||he>ht?(he=0,wt=0,bi=0,Jt=0):he<=0?(bi=-he,he=0,wt=Math.min(ht,D+he),Jt=wt):he<=ht&&(bi=0,wt=Math.min(D,ht-he),Jt=wt),wt<=0||Be<=-W||Be>G?(Be=0,qt=0,wi=0,Ct=0):Be<=0?(wi=-Be,Be=0,qt=Math.min(G,W+Be),Ct=qt):Be<=G&&(wi=0,qt=Math.min(W,G-Be),Ct=qt);var lt=[he,Be,wt,qt];if(Jt>0&&Ct>0){var Si=le/D;lt.push(bi*Si,wi*Si,Jt*Si,Ct*Si)}return Le.drawImage.apply(Le,[m].concat(p(lt.map(function(co){return Math.floor(Tt(co))})))),de},"getCroppedCanvas"),setAspectRatio:o(function(h){var g=this.options;return!this.disabled&&!Hi(h)&&(g.aspectRatio=Math.max(0,h)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},"setAspectRatio"),setDragMode:o(function(h){var g=this.options,m=this.dragBox,P=this.face;if(this.ready&&!this.disabled){var b=h===L,x=g.movable&&h===K;h=b||x?h:J,g.dragMode=h,vt(m,T,h),yi(m,E,b),yi(m,I,x),g.cropBoxMovable||(vt(P,T,h),yi(P,E,b),yi(P,I,x))}return this},"setDragMode")},Mg=F.Cropper,Iu=(function(){function y(h){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n(this,y),!h||!$e.test(h.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=h,this.options=be({},Ir,Xt(g)&&g),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return o(y,"Cropper"),u(y,[{key:"init",value:o(function(){var g=this.element,m=g.tagName.toLowerCase(),P;if(!g[C]){if(g[C]=this,m==="img"){if(this.isImg=!0,P=g.getAttribute("src")||"",this.originalUrl=P,!P)return;P=g.src}else m==="canvas"&&window.HTMLCanvasElement&&(P=g.toDataURL());this.load(P)}},"init")},{key:"load",value:o(function(g){var m=this;if(g){this.url=g,this.imageData={};var P=this.element,b=this.options;if(!b.rotatable&&!b.scalable&&(b.checkOrientation=!1),!b.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Gt.test(g)){Ve.test(g)?this.read(Fg(g)):this.clone();return}var x=new XMLHttpRequest,D=this.clone.bind(this);this.reloading=!0,this.xhr=x,x.onabort=D,x.onerror=D,x.ontimeout=D,x.onprogress=function(){x.getResponseHeader("content-type")!==Wt&&x.abort()},x.onload=function(){m.read(x.response)},x.onloadend=function(){m.reloading=!1,m.xhr=null},b.checkCrossOrigin&&Uu(g)&&P.crossOrigin&&(g=Ou(g)),x.open("GET",g,!0),x.responseType="arraybuffer",x.withCredentials=P.crossOrigin==="use-credentials",x.send()}},"load")},{key:"read",value:o(function(g){var m=this.options,P=this.imageData,b=Cg(g),x=0,D=1,W=1;if(b>1){this.url=Tg(g,Wt);var z=Ag(b);x=z.rotate,D=z.scaleX,W=z.scaleY}m.rotatable&&(P.rotate=x),m.scalable&&(P.scaleX=D,P.scaleY=W),this.clone()},"read")},{key:"clone",value:o(function(){var g=this.element,m=this.url,P=g.crossOrigin,b=m;this.options.checkCrossOrigin&&Uu(m)&&(P||(P="anonymous"),b=Ou(m)),this.crossOrigin=P,this.crossOriginUrl=b;var x=document.createElement("img");P&&(x.crossOrigin=P),x.src=b||m,x.alt=g.alt||"The image to crop",this.image=x,x.onload=this.start.bind(this),x.onerror=this.stop.bind(this),Ae(x,B),g.parentNode.insertBefore(x,g.nextSibling)},"clone")},{key:"start",value:o(function(){var g=this,m=this.image;m.onload=null,m.onerror=null,this.sizing=!0;var P=F.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(F.navigator.userAgent),b=o(function(z,N){be(g.imageData,{naturalWidth:z,naturalHeight:N,aspectRatio:z/N}),g.initialImageData=be({},g.imageData),g.sizing=!1,g.sized=!0,g.build()},"done");if(m.naturalWidth&&!P){b(m.naturalWidth,m.naturalHeight);return}var x=document.createElement("img"),D=document.body||document.documentElement;this.sizingImage=x,x.onload=function(){b(x.width,x.height),P||D.removeChild(x)},x.src=m.src,P||(x.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",D.appendChild(x))},"start")},{key:"stop",value:o(function(){var g=this.image;g.onload=null,g.onerror=null,g.parentNode.removeChild(g),this.image=null},"stop")},{key:"build",value:o(function(){if(!(!this.sized||this.ready)){var g=this.element,m=this.options,P=this.image,b=g.parentNode,x=document.createElement("div");x.innerHTML=oo;var D=x.querySelector(".".concat(C,"-container")),W=D.querySelector(".".concat(C,"-canvas")),z=D.querySelector(".".concat(C,"-drag-box")),N=D.querySelector(".".concat(C,"-crop-box")),M=N.querySelector(".".concat(C,"-face"));this.container=b,this.cropper=D,this.canvas=W,this.dragBox=z,this.cropBox=N,this.viewBox=D.querySelector(".".concat(C,"-view-box")),this.face=M,W.appendChild(P),Ae(g,S),b.insertBefore(D,g.nextSibling),dt(P,B),this.initPreview(),this.bind(),m.initialAspectRatio=Math.max(0,m.initialAspectRatio)||NaN,m.aspectRatio=Math.max(0,m.aspectRatio)||NaN,m.viewMode=Math.max(0,Math.min(3,Math.round(m.viewMode)))||0,Ae(N,S),m.guides||Ae(N.getElementsByClassName("".concat(C,"-dashed")),S),m.center||Ae(N.getElementsByClassName("".concat(C,"-center")),S),m.background&&Ae(D,"".concat(C,"-bg")),m.highlight||Ae(M,q),m.cropBoxMovable&&(Ae(M,I),vt(M,T,Y)),m.cropBoxResizable||(Ae(N.getElementsByClassName("".concat(C,"-line")),S),Ae(N.getElementsByClassName("".concat(C,"-point")),S)),this.render(),this.ready=!0,this.setDragMode(m.dragMode),m.autoCrop&&this.crop(),this.setData(m.data),tt(m.ready)&&bt(g,jt,m.ready,{once:!0}),Wi(g,jt)}},"build")},{key:"unbuild",value:o(function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var g=this.cropper.parentNode;g&&g.removeChild(this.cropper),dt(this.element,S)}},"unbuild")},{key:"uncreate",value:o(function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()},"uncreate")}],[{key:"noConflict",value:o(function(){return window.Cropper=Mg,y},"noConflict")},{key:"setDefaults",value:o(function(g){be(Ir,Xt(g)&&g)},"setDefaults")}])})();return be(Iu.prototype,Rg,Ug,Og,Dg,Ig,Ng),Iu}))});var sm=pe((S7,rm)=>{"use strict";rm.exports=o(function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0},"required")});var am=pe(Gl=>{"use strict";var uw=Object.prototype.hasOwnProperty,cw;function om(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}o(om,"decode");function nm(i){try{return encodeURIComponent(i)}catch{return null}}o(nm,"encode");function pw(i){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},r;r=e.exec(i);){var s=om(r[1]),n=om(r[2]);s===null||n===null||s in t||(t[s]=n)}return t}o(pw,"querystring");function dw(i,e){e=e||"";var t=[],r,s;typeof e!="string"&&(e="?");for(s in i)if(uw.call(i,s)){if(r=i[s],!r&&(r===null||r===cw||isNaN(r))&&(r=""),s=nm(s),r=nm(r),s===null||r===null)continue;t.push(s+"="+r)}return t.length?e+t.join("&"):""}o(dw,"querystringify");Gl.stringify=dw;Gl.parse=pw});var mm=pe((k7,fm)=>{"use strict";var um=sm(),yn=am(),hw=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,cm=/[\n\r\t]/g,fw=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,pm=/:\d+$/,mw=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,gw=/^[a-zA-Z]:/;function Kl(i){return(i||"").toString().replace(hw,"")}o(Kl,"trimLeft");var Xl=[["#","hash"],["?","query"],o(function(e,t){return Lt(t.protocol)?e.replace(/\\/g,"/"):e},"sanitize"),["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],lm={hash:1,query:1};function dm(i){var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e={};var t=e.location||{};i=i||t;var r={},s=typeof i,n;if(i.protocol==="blob:")r=new Bt(unescape(i.pathname),{});else if(s==="string"){r=new Bt(i,{});for(n in lm)delete r[n]}else if(s==="object"){for(n in i)n in lm||(r[n]=i[n]);r.slashes===void 0&&(r.slashes=fw.test(i.href))}return r}o(dm,"lolcation");function Lt(i){return i==="file:"||i==="ftp:"||i==="http:"||i==="https:"||i==="ws:"||i==="wss:"}o(Lt,"isSpecial");function hm(i,e){i=Kl(i),i=i.replace(cm,""),e=e||{};var t=mw.exec(i),r=t[1]?t[1].toLowerCase():"",s=!!t[2],n=!!t[3],a=0,u;return s?n?(u=t[2]+t[3]+t[4],a=t[2].length+t[3].length):(u=t[2]+t[4],a=t[2].length):n?(u=t[3]+t[4],a=t[3].length):u=t[4],r==="file:"?a>=2&&(u=u.slice(2)):Lt(r)?u=t[4]:r?s&&(u=u.slice(2)):a>=2&&Lt(e.protocol)&&(u=t[4]),{protocol:r,slashes:s||Lt(r),slashesCount:a,rest:u}}o(hm,"extractProtocol");function yw(i,e){if(i==="")return e;for(var t=(e||"/").split("/").slice(0,-1).concat(i.split("/")),r=t.length,s=t[r-1],n=!1,a=0;r--;)t[r]==="."?t.splice(r,1):t[r]===".."?(t.splice(r,1),a++):a&&(r===0&&(n=!0),t.splice(r,1),a--);return n&&t.unshift(""),(s==="."||s==="..")&&t.push(""),t.join("/")}o(yw,"resolve");function Bt(i,e,t){if(i=Kl(i),i=i.replace(cm,""),!(this instanceof Bt))return new Bt(i,e,t);var r,s,n,a,u,c,p=Xl.slice(),f=typeof e,d=this,v=0;for(f!=="object"&&f!=="string"&&(t=e,e=null),t&&typeof t!="function"&&(t=yn.parse),e=dm(e),s=hm(i||"",e),r=!s.protocol&&!s.slashes,d.slashes=s.slashes||r&&e.slashes,d.protocol=s.protocol||e.protocol||"",i=s.rest,(s.protocol==="file:"&&(s.slashesCount!==2||gw.test(i))||!s.slashes&&(s.protocol||s.slashesCount<2||!Lt(d.protocol)))&&(p[3]=[/(.*)/,"pathname"]);v<p.length;v++){if(a=p[v],typeof a=="function"){i=a(i,d);continue}n=a[0],c=a[1],n!==n?d[c]=i:typeof n=="string"?(u=n==="@"?i.lastIndexOf(n):i.indexOf(n),~u&&(typeof a[2]=="number"?(d[c]=i.slice(0,u),i=i.slice(u+a[2])):(d[c]=i.slice(u),i=i.slice(0,u)))):(u=n.exec(i))&&(d[c]=u[1],i=i.slice(0,u.index)),d[c]=d[c]||r&&a[3]&&e[c]||"",a[4]&&(d[c]=d[c].toLowerCase())}t&&(d.query=t(d.query)),r&&e.slashes&&d.pathname.charAt(0)!=="/"&&(d.pathname!==""||e.pathname!=="")&&(d.pathname=yw(d.pathname,e.pathname)),d.pathname.charAt(0)!=="/"&&Lt(d.protocol)&&(d.pathname="/"+d.pathname),um(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(u=d.auth.indexOf(":"),~u?(d.username=d.auth.slice(0,u),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(u+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin=d.protocol!=="file:"&&Lt(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}o(Bt,"Url");function vw(i,e,t){var r=this;switch(i){case"query":typeof e=="string"&&e.length&&(e=(t||yn.parse)(e)),r[i]=e;break;case"port":r[i]=e,um(e,r.protocol)?e&&(r.host=r.hostname+":"+e):(r.host=r.hostname,r[i]="");break;case"hostname":r[i]=e,r.port&&(e+=":"+r.port),r.host=e;break;case"host":r[i]=e,pm.test(e)?(e=e.split(":"),r.port=e.pop(),r.hostname=e.join(":")):(r.hostname=e,r.port="");break;case"protocol":r.protocol=e.toLowerCase(),r.slashes=!t;break;case"pathname":case"hash":if(e){var s=i==="pathname"?"/":"#";r[i]=e.charAt(0)!==s?s+e:e}else r[i]=e;break;case"username":case"password":r[i]=encodeURIComponent(e);break;case"auth":var n=e.indexOf(":");~n?(r.username=e.slice(0,n),r.username=encodeURIComponent(decodeURIComponent(r.username)),r.password=e.slice(n+1),r.password=encodeURIComponent(decodeURIComponent(r.password))):r.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<Xl.length;a++){var u=Xl[a];u[4]&&(r[u[1]]=r[u[1]].toLowerCase())}return r.auth=r.password?r.username+":"+r.password:r.username,r.origin=r.protocol!=="file:"&&Lt(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r}o(vw,"set");function bw(i){(!i||typeof i!="function")&&(i=yn.stringify);var e,t=this,r=t.host,s=t.protocol;s&&s.charAt(s.length-1)!==":"&&(s+=":");var n=s+(t.protocol&&t.slashes||Lt(t.protocol)?"//":"");return t.username?(n+=t.username,t.password&&(n+=":"+t.password),n+="@"):t.password?(n+=":"+t.password,n+="@"):t.protocol!=="file:"&&Lt(t.protocol)&&!r&&t.pathname!=="/"&&(n+="@"),(r[r.length-1]===":"||pm.test(t.hostname)&&!t.port)&&(r+=":"),n+=r+t.pathname,e=typeof t.query=="object"?i(t.query):t.query,e&&(n+=e.charAt(0)!=="?"?"?"+e:e),t.hash&&(n+=t.hash),n}o(bw,"toString");Bt.prototype={set:vw,toString:bw};Bt.extractProtocol=hm;Bt.location=dm;Bt.trimLeft=Kl;Bt.qs=yn;fm.exports=Bt});var pu=pe((CD,cu)=>{function Ze(i){if(i)return y2(i);this._callbacks=new Map}o(Ze,"Emitter");function y2(i){return Object.assign(i,Ze.prototype),i._callbacks=new Map,i}o(y2,"mixin");Ze.prototype.on=function(i,e){let t=this._callbacks.get(i)??[];return t.push(e),this._callbacks.set(i,t),this};Ze.prototype.once=function(i,e){let t=o((...r)=>{this.off(i,t),e.apply(this,r)},"on");return t.fn=e,this.on(i,t),this};Ze.prototype.off=function(i,e){if(i===void 0&&e===void 0)return this._callbacks.clear(),this;if(e===void 0)return this._callbacks.delete(i),this;let t=this._callbacks.get(i);if(t){for(let[r,s]of t.entries())if(s===e||s.fn===e){t.splice(r,1);break}t.length===0?this._callbacks.delete(i):this._callbacks.set(i,t)}return this};Ze.prototype.emit=function(i,...e){let t=this._callbacks.get(i);if(t){let r=[...t];for(let s of r)s.apply(this,e)}return this};Ze.prototype.listeners=function(i){return this._callbacks.get(i)??[]};Ze.prototype.listenerCount=function(i){if(i)return this.listeners(i).length;let e=0;for(let t of this._callbacks.values())e+=t.length;return e};Ze.prototype.hasListeners=function(i){return this.listenerCount(i)>0};Ze.prototype.addEventListener=Ze.prototype.on;Ze.prototype.removeListener=Ze.prototype.off;Ze.prototype.removeEventListener=Ze.prototype.off;Ze.prototype.removeAllListeners=Ze.prototype.off;typeof cu<"u"&&(cu.exports=Ze)});var lg=pe((QD,En)=>{"use strict";En.exports=bu;En.exports.isMobile=bu;En.exports.default=bu;var P2=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,_2=/CrOS/,k2=/android|ipad|playbook|silk/i;function bu(i){i||(i={});let e=i.ua;if(!e&&typeof navigator<"u"&&(e=navigator.userAgent),e&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string")return!1;let t=P2.test(e)&&!_2.test(e)||!!i.tablet&&k2.test(e);return!t&&i.tablet&&i.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.indexOf("Macintosh")!==-1&&e.indexOf("Safari")!==-1&&(t=!0),t}o(bu,"isMobile")});var Cu={};ho(Cu,{Audio:()=>lr,AwsS3:()=>bs,BasePlugin:()=>xe,Box:()=>si,Compressor:()=>ws,Core:()=>I2,Dashboard:()=>yr,DefaultStore:()=>_o,DragDrop:()=>vr,DropTarget:()=>Bs,Dropbox:()=>ni,Facebook:()=>ai,Form:()=>js,GoldenRetriever:()=>Hs,GoogleDrive:()=>li,GoogleDrivePicker:()=>br,GooglePhotosPicker:()=>wr,ImageEditor:()=>Sr,Instagram:()=>ui,OneDrive:()=>ci,RemoteSources:()=>$s,ScreenCapture:()=>xr,StatusBar:()=>Pr,ThumbnailGenerator:()=>Ii,Transloadit:()=>mi,Tus:()=>fi,UIPlugin:()=>re,Unsplash:()=>pi,Uppy:()=>To,Url:()=>Vt,Webcam:()=>Ur,XHRUpload:()=>so,Zoom:()=>di,debugLogger:()=>os,locales:()=>M2,server:()=>ma,views:()=>N2});function ut(i,e){return Object.hasOwn(i,e)}o(ut,"hasProperty");var{AbortController:jr}=globalThis,{AbortSignal:Wg}=globalThis,zr=o((i="Aborted",e)=>{let t=new DOMException(i,"AbortError");return e!=null&&ut(e,"cause")&&Object.defineProperty(t,"cause",{__proto__:null,configurable:!0,writable:!0,value:e.cause}),t},"createAbortError");function fo(i,e,t){return new Promise(r=>{i.toBlob(r,e,t)})}o(fo,"canvasToBlob");var Gg=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function Xg(i,e,t){let r=Gg.exec(i),s=e.mimeType??r?.[1]??"plain/text",n;if(r?.[2]!=null){let a=atob(decodeURIComponent(r[3])),u=new Uint8Array(a.length);for(let c=0;c<a.length;c++)u[c]=a.charCodeAt(c);n=[u]}else r?.[3]!=null&&(n=[decodeURIComponent(r[3])]);return t?new File(n,e.name||"",{type:s}):new Blob(n,{type:s})}o(Xg,"dataURItoBlob");var On=Xg;var Dn=class extends Error{static{o(this,"ErrorWithCause")}isNetworkError;cause;constructor(e,t){super(e),this.cause=t?.cause,this.cause&&ut(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}},xi=Dn;function Qt(i,e,t,r){return t===0||i===e?i:r===0?e:i+(e-i)*2**(-r/t)}o(Qt,"emaFilter");var Hr=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'];var In=class extends Error{static{o(this,"NetworkError")}cause;isNetworkError;request;constructor(e,t=null){super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}},St=In;var Nn=class{static{o(this,"ProgressTimeout")}#e;#t=!1;#r;#i;constructor(e,t){this.#i=e,this.#r=()=>t(e)}progress(){this.#t||this.#i>0&&(clearTimeout(this.#e),this.#e=setTimeout(this.#r,this.#i))}done(){this.#t||(clearTimeout(this.#e),this.#e=void 0,this.#t=!0)}},ju=Nn;var mo=o(()=>{},"noop");function Mn(i,e={}){let{body:t=null,headers:r={},method:s="GET",onBeforeRequest:n=mo,onUploadProgress:a=mo,shouldRetry:u=o(()=>!0,"shouldRetry"),onAfterResponse:c=mo,onTimeout:p=mo,responseType:f,retries:d=3,signal:v=null,timeout:_=3e4,withCredentials:k=!1}=e,A=o(U=>.3*2**(U-1)*1e3,"delay"),F=new ju(_,p);function R(U=0){return new Promise(async(C,Y)=>{let $=new XMLHttpRequest,H=o(X=>{u($)&&U<d?setTimeout(()=>{R(U+1).then(C,Y)},A(U)):(F.done(),Y(X))},"onError");$.open(s,i,!0),$.withCredentials=k,f&&($.responseType=f),$.onload=async()=>{try{await c($,U)}catch(X){X.request=$,H(X);return}$.status>=200&&$.status<300?(F.done(),C($)):u($)&&U<d?setTimeout(()=>{R(U+1).then(C,Y)},A(U)):(F.done(),Y(new St($.statusText,$)))},$.onerror=()=>H(new St($.statusText,$)),$.upload.onprogress=X=>{F.progress(),a(X)},r&&Object.keys(r).forEach(X=>{$.setRequestHeader(X,r[X])});function Q(){$.abort(),Y(new DOMException("Aborted","AbortError"))}if(o(Q,"abort"),v?.addEventListener("abort",Q),v?.aborted){Q();return}await n($,U),$.send(t)})}return o(R,"requestWithRetry"),R()}o(Mn,"fetcher");function Zt(...i){return fetch(...i).catch(e=>{throw e.name==="AbortError"?e:new St(e)})}o(Zt,"fetchWithNetworkError");var Kg=o(i=>"error"in i&&!!i.error,"hasError"),Yg=o(i=>i.progress.uploadComplete,"isCompleted");function Pi(i){return i.filter(e=>!Kg(e)&&!Yg(e))}o(Pi,"filterFilesToUpload");function _i(i){return i.filter(e=>!e.progress?.uploadStarted||!e.isRestored)}o(_i,"filterFilesToEmitUploadStarted");function qr(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}o(qr,"isDOMElement");function Jg(i){if(typeof i=="string"){let e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&qr(i)?[i]:null}o(Jg,"findAllDOMElements");var go=Jg;function Qg(i,e=document){return typeof i=="string"?e.querySelector(i):qr(i)?i:null}o(Qg,"findDOMElement");var Vr=Qg;function Et(i){let e=i.lastIndexOf(".");return e===-1||e===i.length-1?{name:i,extension:void 0}:{name:i.slice(0,e),extension:i.slice(e+1)}}o(Et,"getFileNameAndExtension");var Gi={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",msg:"application/vnd.ms-outlook",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function Xi(i){if(i.type)return i.type;let e=i.name?Et(i.name).extension?.toLowerCase():null;return e&&e in Gi?Gi[e]:"application/octet-stream"}o(Xi,"getFileType");function Zg(i){return i.charCodeAt(0).toString(32)}o(Zg,"encodeCharacter");function zu(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${Zg(t)}`,"/"))+e}o(zu,"encodeFilename");function Ln(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${zu(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${zu(i.meta.relativePath.toLowerCase())}`),i.data?.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}o(Ln,"generateFileID");function ey(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}o(ey,"hasFileStableId");function $r(i,e){if(ey(i))return i.id;let t=Xi(i);return Ln({...i,type:t},e)}o($r,"getSafeFileId");function At(i,e){return i===!0?Object.keys(e):Array.isArray(i)?i:[]}o(At,"getAllowedMetaFields");var je=Array.from;function Bn(i){let e=je(i.files);return Promise.resolve(e)}o(Bn,"fallbackApi");function yo(i,e,t,{onSuccess:r}){i.readEntries(s=>{let n=[...e,...s];s.length?queueMicrotask(()=>{yo(i,n,t,{onSuccess:r})}):r(n)},s=>{t(s),r(e)})}o(yo,"getFilesAndDirectoriesFromDirectory");function Hu(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,r)=>i.file(t,r))},async*values(){let t=i.createReader();yield*await new Promise(s=>{yo(t,[],e,{onSuccess:o(n=>s(n.map(a=>Hu(a,e))),"onSuccess")})})},isSameEntry:void 0}}o(Hu,"getAsFileSystemHandleFromEntry");async function*qu(i,e,t=void 0){let r=o(()=>`${e}/${i.name}`,"getNextRelativePath");if(i.kind==="file"){let s=await i.getFile();s!=null?(s.relativePath=e?r():null,yield s):t!=null&&(yield t)}else if(i.kind==="directory")for await(let s of i.values())yield*qu(s,e?r():i.name);else t!=null&&(yield t)}o(qu,"createPromiseToAddFileOrParseDirectory");async function*jn(i,e){let t=await Promise.all(Array.from(i.items,async r=>{let s;return s??=Hu(o(()=>typeof r.getAsEntry=="function"?r.getAsEntry():r.webkitGetAsEntry(),"getAsEntry")(),e),{fileSystemHandle:s,lastResortFile:r.getAsFile()}}));for(let{lastResortFile:r,fileSystemHandle:s}of t)if(s!=null)try{yield*qu(s,"",r)}catch(n){r!=null?yield r:e(n)}else r!=null&&(yield r)}o(jn,"getFilesFromDataTransfer");async function ei(i,e){let t=e?.logDropError??Function.prototype;try{let r=[];for await(let s of jn(i,t))r.push(s);return r}catch{return Bn(i)}}o(ei,"getDroppedFiles");var ty={__proto__:null,"audio/mp3":"mp3","audio/mp4":"mp4","audio/ogg":"ogg","audio/webm":"webm","image/gif":"gif","image/heic":"heic","image/heif":"heif","image/jpeg":"jpg","image/webp":"webp","image/png":"png","image/svg+xml":"svg","video/mp4":"mp4","video/ogg":"ogv","video/quicktime":"mov","video/webm":"webm","video/x-matroska":"mkv","video/x-msvideo":"avi"};function xt(i){return[i]=i.split(";",1),ty[i]||null}o(xt,"getFileTypeExtension");function vo(i){let t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?([^\n]+)/i.exec(i)?.[1];return`${/^http:\/\//i.test(i)?"ws":"wss"}://${t}`}o(vo,"getSocketHost");function iy(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}o(iy,"getTextDirection");var Wr=iy;function zn(i){return i<10?`0${i}`:i.toString()}o(zn,"pad");function ki(){let i=new Date,e=zn(i.getHours()),t=zn(i.getMinutes()),r=zn(i.getSeconds());return`${e}:${t}:${r}`}o(ki,"getTimeStamp");function Ki(){if(typeof window>"u")return!1;let i=document.body;return!(i==null||window==null||!("draggable"in i)||!("ondragstart"in i)||!("ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}o(Ki,"isDragDropSupported");function ry(i){return i?i.readyState===4&&i.status===0:!1}o(ry,"isNetworkError");var Gr=ry;function Xr(i){return i.startsWith("blob:")}o(Xr,"isObjectURL");function Kr(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}o(Kr,"isPreviewSupported");function Hn(i){let e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,r=Math.floor(i%60);return{hours:e,minutes:t,seconds:r}}o(Hn,"secondsToTime");function Yi(i){let e=Hn(i),t=e.hours===0?"":`${e.hours}h`,r=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,s=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${r}${s}`}o(Yi,"prettyETA");function sy(i){return new Error("Cancelled",{cause:i})}o(sy,"createCancelError");function Vu(i){if(i!=null){let e=o(()=>this.abort(i.reason),"abortPromise");i.addEventListener("abort",e,{once:!0});let t=o(()=>{i.removeEventListener("abort",e)},"removeAbortListener");this.then?.(t,t)}return this}o(Vu,"abortOn");var ft=class{static{o(this,"RateLimitedQueue")}#e=0;#t=[];#r=!1;#i;#s=1;#l;#o;limit;constructor(e){typeof e!="number"||e===0?this.limit=1/0:this.limit=e}#n(e){this.#e+=1;let t=!1,r;try{r=e()}catch(s){throw this.#e-=1,s}return{abort:o(s=>{t||(t=!0,this.#e-=1,r?.(s),this.#a())},"abort"),done:o(()=>{t||(t=!0,this.#e-=1,this.#a())},"done")}}#a(){queueMicrotask(()=>this.#c())}#c(){if(this.#r||this.#e>=this.limit||this.#t.length===0)return;let e=this.#t.shift();if(e==null)throw new Error("Invariant violation: next is null");let t=this.#n(e.fn);e.abort=t.abort,e.done=t.done}#u(e,t){let r={fn:e,priority:t?.priority||0,abort:o(()=>{this.#d(r)},"abort"),done:o(()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")},"done")},s=this.#t.findIndex(n=>r.priority>n.priority);return s===-1?this.#t.push(r):this.#t.splice(s,0,r),r}#d(e){let t=this.#t.indexOf(e);t!==-1&&this.#t.splice(t,1)}run(e,t){return!this.#r&&this.#e<this.limit?this.#n(e):this.#u(e,t)}wrapSyncFunction(e,t){return(...r)=>{let s=this.run(()=>(e(...r),queueMicrotask(()=>s.done()),()=>{}),t);return{abortOn:Vu,abort(){s.abort()}}}}wrapPromiseFunction(e,t){return(...r)=>{let s,n=new Promise((a,u)=>{s=this.run(()=>{let c,p;try{p=Promise.resolve(e(...r))}catch(f){p=Promise.reject(f)}return p.then(f=>{c?u(c):(s.done(),a(f))},f=>{c?u(c):(s.done(),u(f))}),f=>{c=sy(f)}},t)});return n.abort=a=>{s.abort(a)},n.abortOn=Vu,n}}resume(){this.#r=!1,clearTimeout(this.#i);for(let e=0;e<this.limit;e++)this.#a()}#p=o(()=>this.resume(),"#resume");pause(e=null){this.#r=!0,clearTimeout(this.#i),e!=null&&(this.#i=setTimeout(this.#p,e))}rateLimit(e){clearTimeout(this.#o),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(this.#l=this.limit-1,this.limit=this.#s,this.#o=setTimeout(this.#h,e))}#h=o(()=>{if(this.#r){this.#o=setTimeout(this.#h,0);return}this.#s=this.limit,this.limit=Math.ceil((this.#l+this.#s)/2);for(let e=this.#s;e<=this.limit;e++)this.#a();this.#l-this.#s>3?this.#o=setTimeout(this.#h,2e3):this.#s=Math.floor(this.#s/2)},"#increaseLimit");get isPaused(){return this.#r}},Yr=Symbol("__queue");function Ji(i){return{...i,type:i.mimeType,extension:i.name?Et(i.name).extension:null}}o(Ji,"remoteFileObjToLocal");function oy(i,e,t){let r=[];return i.forEach(s=>typeof s!="string"?r.push(s):e[Symbol.split](s).forEach((n,a,u)=>{n!==""&&r.push(n),a<u.length-1&&r.push(t)})),r}o(oy,"insertReplacement");function $u(i,e){let t=/\$/g,r="$$$$",s=[i];if(e==null)return s;for(let n of Object.keys(e))if(n!=="_"){let a=e[n];typeof a=="string"&&(a=t[Symbol.replace](a,r)),s=oy(s,new RegExp(`%\\{${n}\\}`,"g"),a)}return s}o($u,"interpolate");var ny=o(i=>{throw new Error(`missing string: ${i}`)},"defaultOnMissingKey"),ti=class{static{o(this,"Translator")}locale;constructor(e,{onMissingKey:t=ny}={}){this.locale={strings:{},pluralize(r){return r===1?0:1}},Array.isArray(e)?e.forEach(this.#t,this):this.#t(e),this.#e=t}#e;#t(e){if(!e?.strings)return;let t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];if(r==null&&(this.#e(e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return $u(r[n],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof r!="string")throw new Error("string was not a string");return $u(r,t)}};function Jr(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=4)return`${i.slice(0,e-1)}\u2026`;let t=e-3,r=Math.ceil(t/2),s=Math.floor(t/2);return i.slice(0,r)+"..."+i.slice(-s)}o(Jr,"truncateString");var qn=class extends Error{static{o(this,"UserFacingApiError")}name="UserFacingApiError"},Vn=qn;var es,ge,Yu,ay,Ei,Wu,Ju,Qu,Zu,Gn,$n,Wn,ly,Zr={},ec=[],uy=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ts=Array.isArray;function Rt(i,e){for(var t in e)i[t]=e[t];return i}o(Rt,"d");function Xn(i){i&&i.parentNode&&i.parentNode.removeChild(i)}o(Xn,"g");function is(i,e,t){var r,s,n,a={};for(n in e)n=="key"?r=e[n]:n=="ref"?s=e[n]:a[n]=e[n];if(arguments.length>2&&(a.children=arguments.length>3?es.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(n in i.defaultProps)a[n]===void 0&&(a[n]=i.defaultProps[n]);return Qr(i,a,r,s,null)}o(is,"_");function Qr(i,e,t,r,s){var n={type:i,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++Yu,__i:-1,__u:0};return s==null&&ge.vnode!=null&&ge.vnode(n),n}o(Qr,"m");function tc(){return{current:null}}o(tc,"b");function Re(i){return i.children}o(Re,"k");function Se(i,e){this.props=i,this.context=e}o(Se,"x");function Qi(i,e){if(e==null)return i.__?Qi(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?Qi(i):null}o(Qi,"S");function ic(i){var e,t;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,e=0;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null){i.__e=i.__c.base=t.__e;break}return ic(i)}}o(ic,"C");function Gu(i){(!i.__d&&(i.__d=!0)&&Ei.push(i)&&!wo.__r++||Wu!=ge.debounceRendering)&&((Wu=ge.debounceRendering)||Ju)(wo)}o(Gu,"M");function wo(){for(var i,e,t,r,s,n,a,u=1;Ei.length;)Ei.length>u&&Ei.sort(Qu),i=Ei.shift(),u=Ei.length,i.__d&&(t=void 0,s=(r=(e=i).__v).__e,n=[],a=[],e.__P&&((t=Rt({},r)).__v=r.__v+1,ge.vnode&&ge.vnode(t),Kn(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,n,s??Qi(r),!!(32&r.__u),a),t.__v=r.__v,t.__.__k[t.__i]=t,oc(n,t,a),t.__e!=s&&ic(t)));wo.__r=0}o(wo,"$");function rc(i,e,t,r,s,n,a,u,c,p,f){var d,v,_,k,A,F,R=r&&r.__k||ec,U=e.length;for(c=cy(t,e,R,c,U),d=0;d<U;d++)(_=t.__k[d])!=null&&(v=_.__i==-1?Zr:R[_.__i]||Zr,_.__i=d,F=Kn(i,_,v,s,n,a,u,c,p,f),k=_.__e,_.ref&&v.ref!=_.ref&&(v.ref&&Yn(v.ref,null,_),f.push(_.ref,_.__c||k,_)),A==null&&k!=null&&(A=k),4&_.__u||v.__k===_.__k?c=sc(_,c,i):typeof _.type=="function"&&F!==void 0?c=F:k&&(c=k.nextSibling),_.__u&=-7);return t.__e=A,c}o(rc,"I");function cy(i,e,t,r,s){var n,a,u,c,p,f=t.length,d=f,v=0;for(i.__k=new Array(s),n=0;n<s;n++)(a=e[n])!=null&&typeof a!="boolean"&&typeof a!="function"?(c=n+v,(a=i.__k[n]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?Qr(null,a,null,null,null):ts(a)?Qr(Re,{children:a},null,null,null):a.constructor==null&&a.__b>0?Qr(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=i,a.__b=i.__b+1,u=null,(p=a.__i=py(a,t,c,d))!=-1&&(d--,(u=t[p])&&(u.__u|=2)),u==null||u.__v==null?(p==-1&&(s>f?v--:s<f&&v++),typeof a.type!="function"&&(a.__u|=4)):p!=c&&(p==c-1?v--:p==c+1?v++:(p>c?v--:v++,a.__u|=4))):i.__k[n]=null;if(d)for(n=0;n<f;n++)(u=t[n])!=null&&(2&u.__u)==0&&(u.__e==r&&(r=Qi(u)),ac(u,u));return r}o(cy,"P");function sc(i,e,t){var r,s;if(typeof i.type=="function"){for(r=i.__k,s=0;r&&s<r.length;s++)r[s]&&(r[s].__=i,e=sc(r[s],e,t));return e}i.__e!=e&&(e&&i.type&&!t.contains(e)&&(e=Qi(i)),t.insertBefore(i.__e,e||null),e=i.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}o(sc,"A");function Ut(i,e){return e=e||[],i==null||typeof i=="boolean"||(ts(i)?i.some(function(t){Ut(t,e)}):e.push(i)),e}o(Ut,"H");function py(i,e,t,r){var s,n,a=i.key,u=i.type,c=e[t];if(c===null&&i.key==null||c&&a==c.key&&u==c.type&&(2&c.__u)==0)return t;if(r>(c!=null&&(2&c.__u)==0?1:0))for(s=t-1,n=t+1;s>=0||n<e.length;){if(s>=0){if((c=e[s])&&(2&c.__u)==0&&a==c.key&&u==c.type)return s;s--}if(n<e.length){if((c=e[n])&&(2&c.__u)==0&&a==c.key&&u==c.type)return n;n++}}return-1}o(py,"L");function Xu(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||uy.test(e)?t:t+"px"}o(Xu,"T");function bo(i,e,t,r,s){var n,a;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof r=="string"&&(i.style.cssText=r=""),r)for(e in r)t&&e in t||Xu(i.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||Xu(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(Zu,"$1")),a=e.toLowerCase(),e=a in i||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+n]=t,t?r?t.u=r.u:(t.u=Gn,i.addEventListener(e,n?Wn:$n,n)):i.removeEventListener(e,n?Wn:$n,n);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}o(bo,"j");function Ku(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=Gn++;else if(e.t<t.u)return;return t(ge.event?ge.event(e):e)}}}o(Ku,"F");function Kn(i,e,t,r,s,n,a,u,c,p){var f,d,v,_,k,A,F,R,U,C,Y,$,H,Q,X,Z,ye,se=e.type;if(e.constructor!=null)return null;128&t.__u&&(c=!!(32&t.__u),n=[u=e.__e=t.__e]),(f=ge.__b)&&f(e);e:if(typeof se=="function")try{if(R=e.props,U="prototype"in se&&se.prototype.render,C=(f=se.contextType)&&r[f.__c],Y=f?C?C.props.value:f.__:r,t.__c?F=(d=e.__c=t.__c).__=d.__E:(U?e.__c=d=new se(R,Y):(e.__c=d=new Se(R,Y),d.constructor=se,d.render=hy),C&&C.sub(d),d.props=R,d.state||(d.state={}),d.context=Y,d.__n=r,v=d.__d=!0,d.__h=[],d._sb=[]),U&&d.__s==null&&(d.__s=d.state),U&&se.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Rt({},d.__s)),Rt(d.__s,se.getDerivedStateFromProps(R,d.__s))),_=d.props,k=d.state,d.__v=e,v)U&&se.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),U&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(U&&se.getDerivedStateFromProps==null&&R!==_&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(R,Y),!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(R,d.__s,Y)===!1||e.__v==t.__v){for(e.__v!=t.__v&&(d.props=R,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(we){we&&(we.__=e)}),$=0;$<d._sb.length;$++)d.__h.push(d._sb[$]);d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(R,d.__s,Y),U&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(_,k,A)})}if(d.context=Y,d.props=R,d.__P=i,d.__e=!1,H=ge.__r,Q=0,U){for(d.state=d.__s,d.__d=!1,H&&H(e),f=d.render(d.props,d.state,d.context),X=0;X<d._sb.length;X++)d.__h.push(d._sb[X]);d._sb=[]}else do d.__d=!1,H&&H(e),f=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++Q<25);d.state=d.__s,d.getChildContext!=null&&(r=Rt(Rt({},r),d.getChildContext())),U&&!v&&d.getSnapshotBeforeUpdate!=null&&(A=d.getSnapshotBeforeUpdate(_,k)),Z=f,f!=null&&f.type===Re&&f.key==null&&(Z=nc(f.props.children)),u=rc(i,ts(Z)?Z:[Z],e,t,r,s,n,a,u,c,p),d.base=e.__e,e.__u&=-161,d.__h.length&&a.push(d),F&&(d.__E=d.__=null)}catch(we){if(e.__v=null,c||n!=null)if(we.then){for(e.__u|=c?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;n[n.indexOf(u)]=null,e.__e=u}else for(ye=n.length;ye--;)Xn(n[ye]);else e.__e=t.__e,e.__k=t.__k;ge.__e(we,e,t)}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):u=e.__e=dy(t.__e,e,t,r,s,n,a,c,p);return(f=ge.diffed)&&f(e),128&e.__u?void 0:u}o(Kn,"O");function oc(i,e,t){for(var r=0;r<t.length;r++)Yn(t[r],t[++r],t[++r]);ge.__c&&ge.__c(e,i),i.some(function(s){try{i=s.__h,s.__h=[],i.some(function(n){n.call(s)})}catch(n){ge.__e(n,s.__v)}})}o(oc,"z");function nc(i){return typeof i!="object"||i==null||i.__b&&i.__b>0?i:ts(i)?i.map(nc):Rt({},i)}o(nc,"N");function dy(i,e,t,r,s,n,a,u,c){var p,f,d,v,_,k,A,F=t.props,R=e.props,U=e.type;if(U=="svg"?s="http://www.w3.org/2000/svg":U=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n!=null){for(p=0;p<n.length;p++)if((_=n[p])&&"setAttribute"in _==!!U&&(U?_.localName==U:_.nodeType==3)){i=_,n[p]=null;break}}if(i==null){if(U==null)return document.createTextNode(R);i=document.createElementNS(s,U,R.is&&R),u&&(ge.__m&&ge.__m(e,n),u=!1),n=null}if(U==null)F===R||u&&i.data==R||(i.data=R);else{if(n=n&&es.call(i.childNodes),F=t.props||Zr,!u&&n!=null)for(F={},p=0;p<i.attributes.length;p++)F[(_=i.attributes[p]).name]=_.value;for(p in F)if(_=F[p],p!="children"){if(p=="dangerouslySetInnerHTML")d=_;else if(!(p in R)){if(p=="value"&&"defaultValue"in R||p=="checked"&&"defaultChecked"in R)continue;bo(i,p,null,_,s)}}for(p in R)_=R[p],p=="children"?v=_:p=="dangerouslySetInnerHTML"?f=_:p=="value"?k=_:p=="checked"?A=_:u&&typeof _!="function"||F[p]===_||bo(i,p,_,F[p],s);if(f)u||d&&(f.__html==d.__html||f.__html==i.innerHTML)||(i.innerHTML=f.__html),e.__k=[];else if(d&&(i.innerHTML=""),rc(e.type=="template"?i.content:i,ts(v)?v:[v],e,t,r,U=="foreignObject"?"http://www.w3.org/1999/xhtml":s,n,a,n?n[0]:t.__k&&Qi(t,0),u,c),n!=null)for(p=n.length;p--;)Xn(n[p]);u||(p="value",U=="progress"&&k==null?i.removeAttribute("value"):k!=null&&(k!==i[p]||U=="progress"&&!k||U=="option"&&k!=F[p])&&bo(i,p,k,F[p],s),p="checked",A!=null&&A!=i[p]&&bo(i,p,A,F[p],s))}return i}o(dy,"V");function Yn(i,e,t){try{if(typeof i=="function"){var r=typeof i.__u=="function";r&&i.__u(),r&&e==null||(i.__u=i(e))}else i.current=e}catch(s){ge.__e(s,t)}}o(Yn,"q");function ac(i,e,t){var r,s;if(ge.unmount&&ge.unmount(i),(r=i.ref)&&(r.current&&r.current!=i.__e||Yn(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){ge.__e(n,e)}r.base=r.__P=null}if(r=i.__k)for(s=0;s<r.length;s++)r[s]&&ac(r[s],e,t||typeof i.type!="function");t||Xn(i.__e),i.__c=i.__=i.__e=void 0}o(ac,"B");function hy(i,e,t){return this.constructor(i,t)}o(hy,"D");function Jn(i,e,t){var r,s,n,a;e==document&&(e=document.documentElement),ge.__&&ge.__(i,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,n=[],a=[],Kn(e,i=(!r&&t||e).__k=is(Re,null,[i]),s||Zr,Zr,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?es.call(e.childNodes):null,n,!r&&t?t:s?s.__e:e.firstChild,r,a),oc(n,i,a)}o(Jn,"E");function So(i,e,t){var r,s,n,a,u=Rt({},i.props);for(n in i.type&&i.type.defaultProps&&(a=i.type.defaultProps),e)n=="key"?r=e[n]:n=="ref"?s=e[n]:u[n]=e[n]===void 0&&a!=null?a[n]:e[n];return arguments.length>2&&(u.children=arguments.length>3?es.call(arguments,2):t),Qr(i.type,u,r||i.key,s||i.ref,null)}o(So,"J");es=ec.slice,ge={__e:o(function(i,e,t,r){for(var s,n,a;e=e.__;)if((s=e.__c)&&!s.__)try{if((n=s.constructor)&&n.getDerivedStateFromError!=null&&(s.setState(n.getDerivedStateFromError(i)),a=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(i,r||{}),a=s.__d),a)return s.__E=s}catch(u){i=u}throw i},"__e")},Yu=0,ay=o(function(i){return i!=null&&i.constructor==null},"t"),Se.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Rt({},this.state),typeof i=="function"&&(i=i(Rt({},t),this.props)),i&&Rt(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Gu(this))},Se.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Gu(this))},Se.prototype.render=Re,Ei=[],Ju=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Qu=o(function(i,e){return i.__v.__b-e.__v.__b},"e"),wo.__r=0,Zu=/(PointerCapture)$|Capture$/i,Gn=0,$n=Ku(!1),Wn=Ku(!0),ly=0;var fy=0,Fx=Array.isArray;function l(i,e,t,r,s,n){e||(e={});var a,u,c=e;if("ref"in c)for(u in c={},e)u=="ref"?a=e[u]:c[u]=e[u];var p={type:i,props:c,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--fy,__i:-1,__u:0,__source:s,__self:n};if(typeof i=="function"&&(a=i.defaultProps))for(u in a)c[u]===void 0&&(c[u]=a[u]);return ge.vnode&&ge.vnode(p),p}o(l,"u");var rs,Ue,Qn,lc,ss=0,gc=[],Ie=ge,uc=Ie.__b,cc=Ie.__r,pc=Ie.diffed,dc=Ie.__c,hc=Ie.unmount,fc=Ie.__;function ea(i,e){Ie.__h&&Ie.__h(Ue,i,ss||e),ss=0;var t=Ue.__H||(Ue.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}o(ea,"p");function it(i){return ss=1,my(vc,i)}o(it,"d");function my(i,e,t){var r=ea(rs++,2);if(r.t=i,!r.__c&&(r.__=[t?t(e):vc(void 0,e),function(u){var c=r.__N?r.__N[0]:r.__[0],p=r.t(c,u);c!==p&&(r.__N=[p,r.__[1]],r.__c.setState({}))}],r.__c=Ue,!Ue.__f)){var s=o(function(u,c,p){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(v){return!!v.__c});if(f.every(function(v){return!v.__N}))return!n||n.call(this,u,c,p);var d=r.__c.props!==u;return f.forEach(function(v){if(v.__N){var _=v.__[0];v.__=v.__N,v.__N=void 0,_!==v.__[0]&&(d=!0)}}),n&&n.call(this,u,c,p)||d},"f");Ue.__f=!0;var n=Ue.shouldComponentUpdate,a=Ue.componentWillUpdate;Ue.componentWillUpdate=function(u,c,p){if(this.__e){var f=n;n=void 0,s(u,c,p),n=f}a&&a.call(this,u,c,p)},Ue.shouldComponentUpdate=s}return r.__N||r.__}o(my,"h");function ze(i,e){var t=ea(rs++,3);!Ie.__s&&yc(t.__H,e)&&(t.__=i,t.u=e,Ue.__H.__h.push(t))}o(ze,"y");function Ye(i){return ss=5,Fi(function(){return{current:i}},[])}o(Ye,"A");function Fi(i,e){var t=ea(rs++,7);return yc(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}o(Fi,"T");function rt(i,e){return ss=8,Fi(function(){return i},e)}o(rt,"q");function gy(){for(var i;i=gc.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(xo),i.__H.__h.forEach(Zn),i.__H.__h=[]}catch(e){i.__H.__h=[],Ie.__e(e,i.__v)}}o(gy,"j");Ie.__b=function(i){Ue=null,uc&&uc(i)},Ie.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),fc&&fc(i,e)},Ie.__r=function(i){cc&&cc(i),rs=0;var e=(Ue=i.__c).__H;e&&(Qn===Ue?(e.__h=[],Ue.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(xo),e.__h.forEach(Zn),e.__h=[],rs=0)),Qn=Ue},Ie.diffed=function(i){pc&&pc(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(gc.push(e)!==1&&lc===Ie.requestAnimationFrame||((lc=Ie.requestAnimationFrame)||yy)(gy)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Qn=Ue=null},Ie.__c=function(i,e){e.some(function(t){try{t.__h.forEach(xo),t.__h=t.__h.filter(function(r){return!r.__||Zn(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],Ie.__e(r,t.__v)}}),dc&&dc(i,e)},Ie.unmount=function(i){hc&&hc(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{xo(r)}catch(s){e=s}}),t.__H=void 0,e&&Ie.__e(e,t.__v))};var mc=typeof requestAnimationFrame=="function";function yy(i){var e,t=o(function(){clearTimeout(r),mc&&cancelAnimationFrame(e),setTimeout(i)},"r"),r=setTimeout(t,35);mc&&(e=requestAnimationFrame(t))}o(yy,"w");function xo(i){var e=Ue,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),Ue=e}o(xo,"z");function Zn(i){var e=Ue;i.__c=i.__(),Ue=e}o(Zn,"B");function yc(i,e){return!i||i.length!==e.length||e.some(function(t,r){return t!==i[r]})}o(yc,"C");function vc(i,e){return typeof e=="function"?e(i):e}o(vc,"D");var vy={position:"relative",width:"100%",minHeight:"100%"},by={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};function Zi({data:i,rowHeight:e,renderRow:t,overscanCount:r=10,padding:s=4,...n}){let a=Ye(null),[u,c]=it(0),[p,f]=it(0);ze(()=>{function U(){a.current!=null&&p!==a.current.offsetHeight&&f(a.current.offsetHeight)}return o(U,"resize"),U(),window.addEventListener("resize",U),()=>{window.removeEventListener("resize",U)}},[p]);let d=rt(()=>{a.current&&c(a.current.scrollTop)},[]),v=Math.floor(u/e),_=Math.floor(p/e);r&&(v=Math.max(0,v-v%r),_+=r);let k=v+_+s,A=i.slice(v,k),F={...vy,height:i.length*e},R={...by,top:v*e};return l("div",{onScroll:d,ref:a,...n,children:l("div",{role:"presentation",style:F,children:l("div",{role:"presentation",style:R,children:A.map(t)})})})}o(Zi,"VirtualList");var xe=class{static{o(this,"BasePlugin")}uppy;opts;id;defaultLocale;i18n;i18nArray;type;VERSION;constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){let{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){let{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){let e=new ti([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}};var Ot=class{static{o(this,"EventManager")}#e;#t=[];constructor(e){this.#e=e}on(e,t){return this.#t.push([e,t]),this.#e.on(e,t)}remove(){for(let[e,t]of this.#t.splice(0))this.#e.off(e,t)}onFilePause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onFileRemove(e,t){this.on("file-removed",r=>{e===r.id&&t(r.id)})}onPause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onRetry(e,t){this.on("upload-retry",r=>{e===r?.id&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{this.#e.getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{this.#e.getFile(e)&&t()})}onCancelAll(e,t){this.on("cancel-all",(...r)=>{this.#e.getFile(e)&&t(...r)})}onResumeAll(e,t){this.on("resume-all",()=>{this.#e.getFile(e)&&t()})}};var bc={debug:o(()=>{},"debug"),warn:o(()=>{},"warn"),error:o((...i)=>console.error(`[Uppy] [${ki()}]`,...i),"error")},os={debug:o((...i)=>console.debug(`[Uppy] [${ki()}]`,...i),"debug"),warn:o((...i)=>console.warn(`[Uppy] [${ki()}]`,...i),"warn"),error:o((...i)=>console.error(`[Uppy] [${ki()}]`,...i),"error")};var ns=ae(er(),1),Ec=ae(kc(),1);var Fc={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},ct=class extends Error{static{o(this,"RestrictionError")}isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0},Po=class{static{o(this,"Restricter")}getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{let r=e();if(r.restrictions?.allowedFileTypes!=null&&!Array.isArray(r.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return r}}validateAggregateRestrictions(e,t){let{maxTotalFileSize:r,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s&&e.filter(a=>!a.isGhost).length+t.length>s)throw new ct(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(r){let n=[...e,...t].reduce((a,u)=>a+(u.size??0),0);if(n>r)throw new ct(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,ns.default)(r),size:(0,ns.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(a=>a.includes("/")?e.type?(0,Ec.default)(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){let a=s.join(", ");throw new ct(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new ct(this.getI18n()("exceedsSize",{size:(0,ns.default)(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(r&&e.size!=null&&e.size<r)throw new ct(this.getI18n()("inferiorSize",{size:(0,ns.default)(r)}),{file:e})}validate(e,t){t.forEach(r=>{this.validateSingleFile(r)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){let{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new ct(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){let t=new ct(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name??this.getI18n()("unnamed")})),{requiredMetaFields:r}=this.getOpts().restrictions,s=[];for(let n of r)(!Object.hasOwn(e.meta,n)||e.meta[n]==="")&&s.push(n);return{missingFields:s,error:t}}};function xy(i){let e=null,t;return(...r)=>(t=r,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}o(xy,"debounce");var ta=class i extends xe{static{o(this,"UIPlugin")}#e;isTargetDOMEl;el;parent;title;getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof i||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:i}}));else if(typeof e=="function"){let r=e;this.uppy.iteratePlugins(s=>{s instanceof r&&(t=s)})}return t}mount(e,t){let r=t.id,s=Vr(e);if(s){this.isTargetDOMEl=!0;let u=document.createElement("div");return u.classList.add("uppy-Root"),this.#e=xy(c=>{this.uppy.getPlugin(this.id)&&(Jn(this.render(c,u),u),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),Jn(this.render(this.uppy.getState(),u),u),this.el=u,s.appendChild(u),u.dir=this.opts.direction||Wr(u)||"ltr",this.onMount(),this.el}let n=this.getTargetPlugin(e);if(n)return this.uppy.log(`Installing ${r} to ${n.id}`),this.parent=n,this.el=n.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${r}`);let a=`Invalid target option given to ${r}.`;throw typeof e=="function"?a+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":a+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(a)}render(e,t){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){this.el!=null&&this.#e?.(e)}unmount(){this.isTargetDOMEl&&this.el?.remove(),this.onUnmount()}onMount(){}onUnmount(){}},re=ta;var Tc={name:"@uppy/store-default",description:"The default simple object-based store for Uppy.",version:"5.0.0",license:"MIT",main:"lib/index.js",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-store"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},devDependencies:{jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},exports:{".":"./lib/index.js","./package.json":"./package.json"},files:["src","lib","dist","CHANGELOG.md"]};var ia=class{static{o(this,"DefaultStore")}static VERSION=Tc.version;state={};#e=new Set;getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,this.#t(t,r,e)}subscribe(e){return this.#e.add(e),()=>{this.#e.delete(e)}}#t(...e){this.#e.forEach(t=>{t(...e)})}},_o=ia;var pp=ae(na(),1),dp=ae(lp(),1);var gv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Dt=o((i=21)=>{let e="",t=i|0;for(;t--;)e+=gv[Math.random()*64|0];return e},"nanoid");var up={name:"@uppy/core",description:"Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",version:"5.2.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.min.css":"./dist/style.min.css","./css/style.css":"./dist/style.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/store-default":"workspace:^","@uppy/utils":"workspace:^",lodash:"^4.17.21","mime-match":"^1.0.2","namespace-emitter":"^2.0.1",nanoid:"^5.0.9",preact:"^10.5.13"},devDependencies:{"@types/deep-freeze":"^0",cssnano:"^7.0.7","deep-freeze":"^0.0.1",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"}};function aa(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}o(aa,"getFileName");var cp={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};function la(i){if(i==null&&typeof navigator<"u"&&(i=navigator.userAgent),!i)return!0;let e=/Edge\/(\d+\.\d+)/.exec(i);if(!e)return!0;let r=e[1].split(".",2),s=parseInt(r[0],10),n=parseInt(r[1],10);return s<15||s===15&&n<15063||s>18||s===18&&n>=18218}o(la,"supportsUploadProgress");var Fo={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},ua=class i{static{o(this,"Uppy")}static VERSION=up.version;#e=Object.create(null);#t;#r;#i=(0,dp.default)();#s=new Set;#l=new Set;#o=new Set;defaultLocale;locale;opts;store;i18n;i18nArray;scheduledAutoProceed=null;wasOffline=!1;constructor(e){this.defaultLocale=cp;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:Fc,meta:{},onBeforeFileAdded:o((s,n)=>!Object.hasOwn(n,s.id),"onBeforeFileAdded"),onBeforeUpload:o(s=>s,"onBeforeUpload"),store:new _o,logger:bc,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e?.restrictions}},e?.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e?.debug&&(this.opts.logger=os),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Fo,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:la(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),this.#t=new Po(()=>this.opts,()=>this.i18n),this.#r=this.store.subscribe((s,n,a)=>{this.emit("state-update",s,n,a),this.updateAll(n)}),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),this.#S()}emit(e,...t){this.#i.emit(e,...t)}on(e,t){return this.#i.on(e,t),this}once(e,t){return this.#i.once(e,t),this}off(e,t){return this.#i.off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){let t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(([r,s])=>[r,{...t[r],...s}]))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can\u2019t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){let e=o(r=>this.log(`Missing i18n string: ${r}`,"error"),"onMissingKey"),t=new ti([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e?.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){let e={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},r=Object.create(null);Object.keys(t).forEach(s=>{r[s]={...t[s],progress:{...t[s].progress,...e},tus:void 0,transloadit:void 0}}),this.setState({files:r,...Fo})}clear(){let{capabilities:e,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...Fo,files:{}})}addPreProcessor(e){this.#s.add(e)}removePreProcessor(e){return this.#s.delete(e)}addPostProcessor(e){this.#o.add(e)}removePostProcessor(e){return this.#o.delete(e)}addUploader(e){this.#l.add(e)}removeUploader(e){return this.#l.delete(e)}setMeta(e){let t={...this.getState().meta,...e},r={...this.getState().files};Object.keys(r).forEach(s=>{r[s]={...r[s],meta:{...r[s].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})}setFileMeta(e,t){let r={...this.getState().files};if(!r[e]){this.log(`Was trying to set metadata for a file that has been removed: ${e}`);return}let s={...r[e].meta,...t};r[e]={...r[e],meta:s},this.setState({files:r})}getFile(e){return this.getState().files[e]}getFiles(){let{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(t=>this.getFile(t))}getObjectOfFilesPerState(){let{files:e,totalProgress:t,error:r}=this.getState(),s=Object.values(e),n=[],a=[],u=[],c=[],p=[],f=[],d=[],v=[],_=[];for(let k of s){let{progress:A}=k;!A.uploadComplete&&A.uploadStarted&&(n.push(k),k.isPaused||v.push(k)),A.uploadStarted||a.push(k),(A.uploadStarted||A.preprocess||A.postprocess)&&u.push(k),A.uploadStarted&&c.push(k),k.isPaused&&p.push(k),A.uploadComplete&&f.push(k),k.error&&d.push(k),(A.preprocess||A.postprocess)&&_.push(k)}return{newFiles:a,startedFiles:u,uploadStartedFiles:c,pausedFiles:p,completeFiles:f,erroredFiles:d,inProgressFiles:n,inProgressNotPausedFiles:v,processingFiles:_,isUploadStarted:c.length>0,isAllComplete:t===100&&f.length===s.length&&_.length===0,isAllErrored:!!r&&d.length===s.length,isAllPaused:n.length!==0&&p.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(k=>k.isGhost)}}#n(e){for(let a of e)a.isRestriction?this.emit("restriction-failed",a.file,a):this.emit("error",a,a.file),this.log(a,"warning");let t=e.filter(a=>a.isUserFacing),r=4,s=t.slice(0,r),n=t.slice(r);s.forEach(({message:a,details:u=""})=>{this.info({message:a,details:u},"error",this.opts.infoTimeout)}),n.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:n.length})})}validateRestrictions(e,t=this.getFiles()){try{this.#t.validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{this.#t.validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{this.#t.validateAggregateRestrictions(t,e)}catch(r){return r.message}return null}#a(e){let{missingFields:t,error:r}=this.#t.getMissingRequiredMetaFields(e);return t.length>0?(this.setFileState(e.id,{missingRequiredMetaFields:t,error:r.message}),this.log(r.message),this.emit("restriction-failed",e,r),!1):(t.length===0&&e.missingRequiredMetaFields&&this.setFileState(e.id,{missingRequiredMetaFields:[]}),!0)}#c(e){let t=!0;for(let r of Object.values(e))this.#a(r)||(t=!1);return t}#u(e){let{allowNewUpload:t}=this.getState();if(t===!1){let r=new ct(this.i18n("noMoreFilesAllowed"),{file:e});throw this.#n([r]),r}}checkIfFileAlreadyExists(e){let{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}#d(e){let t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e,meta:{},isRemote:!1,source:void 0,preview:void 0}:e,r=Xi(t),s=aa(r,t),n=Et(s).extension,a=$r(t,this.getID()),u={...t.meta,name:s,type:r},c=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:a,name:s,extension:n||"",meta:{...this.getState().meta,...u},type:r,progress:{percentage:0,bytesUploaded:!1,bytesTotal:c,uploadComplete:!1,uploadStarted:null},size:c,isGhost:!1,...t.isRemote?{isRemote:!0,remote:t.remote,data:t.data}:{isRemote:!1,data:t.data},preview:t.preview}}#p(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))}#h(e){let{files:t}=this.getState(),r={...t},s=[],n=[];for(let a of e)try{let u=this.#d(a);this.#u(u);let c=t[u.id],p=c?.isGhost;if(p&&!u.isRemote){if(u.data==null)throw new Error("File data is missing");u={...c,isGhost:!1,data:u.data},this.log(`Replaced the blob in the restored ghost file: ${u.name}, ${u.id}`)}let f=this.opts.onBeforeFileAdded(u,r);if(t=this.getState().files,r={...t,...r},!f&&this.checkIfFileAlreadyExists(u.id))throw new ct(this.i18n("noDuplicates",{fileName:u.name??this.i18n("unnamed")}),{file:u});if(f===!1&&!p)throw new ct("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:u});typeof f=="object"&&f!==null&&(u=f),this.#t.validateSingleFile(u),r[u.id]=u,s.push(u)}catch(u){n.push(u)}try{this.#t.validateAggregateRestrictions(Object.values(t),s)}catch(a){return n.push(a),{nextFilesState:t,validFilesToAdd:[],errors:n}}return{nextFilesState:r,validFilesToAdd:s,errors:n}}addFile(e){let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#h([e]),n=s.filter(u=>u.isRestriction);if(this.#n(n),s.length>0)throw s[0];this.setState({files:t});let[a]=r;return this.emit("file-added",a),this.emit("files-added",r),this.log(`Added file: ${a.name}, ${a.id}, mime type: ${a.type}`),this.#p(),a.id}addFiles(e){let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#h(e),n=s.filter(u=>u.isRestriction);this.#n(n);let a=s.filter(u=>!u.isRestriction);if(a.length>0){let u=`Multiple errors occurred while adding files:
`;if(a.forEach(c=>{u+=`
* ${c.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:a.length}),details:u},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(a,u);{let c=new Error(u);throw c.errors=a,c}}this.setState({files:t}),r.forEach(u=>{this.emit("file-added",u)}),this.emit("files-added",r),r.length>5?this.log(`Added batch of ${r.length} files`):Object.values(r).forEach(u=>{this.log(`Added file: ${u.name}
id: ${u.id}
type: ${u.type}`)}),r.length>0&&this.#p()}removeFiles(e){let{files:t,currentUploads:r}=this.getState(),s={...t},n={...r},a=Object.create(null);e.forEach(f=>{t[f]&&(a[f]=t[f],delete s[f])});function u(f){return a[f]===void 0}o(u,"fileIsNotRemoved"),Object.keys(n).forEach(f=>{let d=r[f].fileIDs.filter(u);if(d.length===0){delete n[f];return}let{capabilities:v}=this.getState();if(d.length!==r[f].fileIDs.length&&!v.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");n[f]={...r[f],fileIDs:d}});let c={currentUploads:n,files:s};Object.keys(s).length===0&&(c.allowNewUpload=!0,c.error=null,c.recoveredState=null),this.setState(c),this.#y();let p=Object.keys(a);p.forEach(f=>{this.emit("file-removed",a[f])}),p.length>5?this.log(`Removed ${p.length} files`):this.log(`Removed files: ${p.join(", ")}`)}removeFile(e){this.removeFiles([e])}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;let t=this.getFile(e),s=!(t.isPaused||!1);return this.setFileState(e,{isPaused:s}),this.emit("upload-pause",t,s),s}pauseAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!0};e[r]=s}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!1,error:null};e[r]=s}),this.setState({files:e}),this.emit("resume-all")}#f(){let{files:e}=this.getState();return Object.keys(e).filter(t=>{let r=e[t];return r.error&&(!r.missingRequiredMetaFields||r.missingRequiredMetaFields.length===0)})}async#g(){let e=this.#f(),t={...this.getState().files};if(e.forEach(s=>{t[s]={...t[s],isPaused:!1,error:null}}),this.setState({files:t,error:null}),this.emit("retry-all",this.getFilesByIds(e)),e.length===0)return{successful:[],failed:[]};let r=this.#w(e,{forceAllowNewUpload:!0});return this.#k(r)}async retryAll(){let e=await this.#g();return this.emit("complete",e),e}cancelAll(){this.emit("cancel-all");let{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t),this.setState(Fo)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));let t=this.#w([e],{forceAllowNewUpload:!0});return this.#k(t)}logout(){this.iteratePlugins(e=>{e.provider?.logout?.()})}#b=o((e,t)=>{let r=e?this.getFile(e.id):void 0;if(e==null||!r){this.log(`Not setting progress for a file that has been removed: ${e?.id}`);return}if(r.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);return}let s={bytesTotal:t.bytesTotal,percentage:t.bytesTotal!=null&&Number.isFinite(t.bytesTotal)&&t.bytesTotal>0?Math.round(t.bytesUploaded/t.bytesTotal*100):void 0};r.progress.uploadStarted!=null?this.setFileState(e.id,{progress:{...r.progress,...s,bytesUploaded:t.bytesUploaded}}):this.setFileState(e.id,{progress:{...r.progress,...s}}),this.#y()},"#handleUploadProgress");#m(){let e=this.#P(),t=null;e!=null&&(t=Math.round(e*100),t>100?t=100:t<0&&(t=0)),this.emit("progress",t??0),this.setState({totalProgress:t??0})}#y=(0,pp.default)(()=>this.#m(),500,{leading:!0,trailing:!0});[Symbol.for("uppy test: updateTotalProgress")](){return this.#m()}#P(){let t=this.getFiles().filter(c=>c.progress.uploadStarted||c.progress.preprocess||c.progress.postprocess);if(t.length===0)return 0;if(t.every(c=>c.progress.uploadComplete))return 1;let r=o(c=>c.progress.bytesTotal!=null&&c.progress.bytesTotal!==0,"isSizedFile"),s=t.filter(r),n=t.filter(c=>!r(c));if(s.every(c=>c.progress.uploadComplete)&&n.length>0&&!n.every(c=>c.progress.uploadComplete))return null;let a=s.reduce((c,p)=>c+(p.progress.bytesTotal??0),0),u=s.reduce((c,p)=>c+(p.progress.bytesUploaded||0),0);return a===0?0:u/a}#S(){let e=o((s,n,a)=>{let u=s.message||"Unknown error";s.details&&(u+=` ${s.details}`),this.setState({error:u}),n!=null&&n.id in this.getState().files&&this.setFileState(n.id,{error:u,response:a})},"errorHandler");this.on("error",e),this.on("upload-error",(s,n,a)=>{if(e(n,s,a),typeof n=="object"&&n.message){this.log(n.message,"error");let u=new Error(this.i18n("failedToUpload",{file:s?.name??""}));u.isUserFacing=!0,u.details=n.message,n.details&&(u.details+=` ${n.details}`),this.#n([u])}else this.#n([n])});let t=null;this.on("upload-stalled",(s,n)=>{let{message:a}=s,u=n.map(c=>c.meta.name).join(", ");t||(this.info({message:a,details:u},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${a} ${u}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});let r=o(s=>{let n=s.filter(u=>{let c=u!=null&&this.getFile(u.id);return c||this.log(`Not setting progress for a file that has been removed: ${u?.id}`),c}),a=Object.fromEntries(n.map(u=>[u.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:u.size}}]));this.patchFilesState(a)},"onUploadStarted");this.on("upload-start",r),this.on("upload-progress",this.#b),this.on("upload-success",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let a=this.getFile(s.id).progress,u=this.#o.size>0;this.setFileState(s.id,{progress:{...a,postprocess:u?{mode:"indeterminate"}:void 0,uploadComplete:!0,...!u&&{complete:!0},percentage:100,bytesUploaded:a.bytesTotal},response:n,uploadURL:n.uploadURL,isPaused:!1}),s.size==null&&this.setFileState(s.id,{size:n.bytesUploaded||a.bytesTotal}),this.#y()}),this.on("preprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getFile(s.id).progress,preprocess:n}})}),this.on("preprocess-complete",s=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let n={...this.getState().files};n[s.id]={...n[s.id],progress:{...n[s.id].progress}},delete n[s.id].progress.preprocess,this.setState({files:n})}),this.on("postprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getState().files[s.id].progress,postprocess:n}})}),this.on("postprocess-complete",s=>{let n=s&&this.getFile(s.id);if(n==null){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let{postprocess:a,...u}=n.progress;this.patchFilesState({[n.id]:{progress:{...u,complete:!0}}})}),this.on("restored",()=>{this.#y()}),this.on("dashboard:file-edit-complete",s=>{s&&this.#a(s)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",this.#v),window.addEventListener("offline",this.#v),setTimeout(this.#v,3e3))}updateOnlineStatus(){window.navigator.onLine??!0?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}#v=this.updateOnlineStatus.bind(this);getID(){return this.opts.id}use(e,...t){if(typeof e!="function"){let a=`Expected a plugin class, but got ${e===null?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(a)}let r=new e(this,...t),s=r.id;if(!s)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");let n=this.getPlugin(s);if(n){let a=`Already found a plugin named '${n.id}'. Tried to use: '${s}'.
Uppy plugins must have unique \`id\` options.`;throw new Error(a)}return e.VERSION&&this.log(`Using ${s} v${e.VERSION}`),r.type in this.#e?this.#e[r.type].push(r):this.#e[r.type]=[r],r.install(),this.emit("plugin-added",r),this}getPlugin(e){for(let t of Object.values(this.#e)){let r=t.find(s=>s.id===e);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](e){return this.#e[e]}iteratePlugins(e){Object.values(this.#e).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();let t=this.#e[e.type],r=t.findIndex(a=>a.id===e.id);r!==-1&&t.splice(r,1);let n={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(n)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),this.#r(),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",this.#v),window.removeEventListener("offline",this.#v))}hideInfo(){let{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t="info",r=3e3){let s=typeof e=="object";this.setState({info:[...this.getState().info,{type:t,message:s?e.message:e,details:s?e.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(e,t){let{logger:r}=this.opts;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e);break}}#x=new Map;registerRequestClient(e,t){this.#x.set(e,t)}getRequestClientForFile(e){if(!("remote"in e&&e.remote))throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);let t=this.#x.get(e.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}async restore(e){this.log(`Core: Running restored upload "${e}"`);let t=await this.#k(e);return this.emit("complete",t),t}#w(e,t={}){let{forceAllowNewUpload:r=!1}=t,{allowNewUpload:s,currentUploads:n}=this.getState();if(!s&&!r)throw new Error("Cannot create a new upload: already uploading.");let a=Dt();return this.emit("upload",a,this.getFilesByIds(e)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...n,[a]:{fileIDs:e,step:0,result:{}}}}),a}[Symbol.for("uppy test: createUpload")](...e){return this.#w(...e)}#E(e){let{currentUploads:t}=this.getState();return t[e]}addResultData(e,t){if(!this.#E(e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}let{currentUploads:r}=this.getState(),s={...r[e],result:{...r[e].result,...t}};this.setState({currentUploads:{...r,[e]:s}})}#_(e){let{[e]:t,...r}=this.getState().currentUploads;this.setState({currentUploads:r})}async#k(e){let t=o(()=>{let{currentUploads:a}=this.getState();return a[e]},"getCurrentUpload"),r=t();if(!r)throw new Error("Nonexistent upload");let s=[...this.#s,...this.#l,...this.#o];try{for(let a=r.step||0;a<s.length;a++){let u=s[a];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...r,step:a}}});let{fileIDs:c}=r;if(await u(c,e),r=t(),!r)break}}catch(a){throw this.#_(e),a}if(r){r.fileIDs.forEach(p=>{let f=this.getFile(p);f?.progress.postprocess&&this.emit("postprocess-complete",f)});let a=r.fileIDs.map(p=>this.getFile(p)),u=a.filter(p=>!p.error),c=a.filter(p=>p.error);this.addResultData(e,{successful:u,failed:c,uploadID:e}),r=t()}let n;return r&&(n=r.result,this.#_(e)),n==null&&(this.log(`Not setting result for an upload that has been removed: ${e}`),n={successful:[],failed:[],uploadID:e}),n}async upload(){this.#e.uploader?.length||this.log("No uploader type plugins are used","warning");let{files:e}=this.getState();if(this.#f().length>0){let s=await this.#g();if(!(this.getFiles().filter(a=>a.progress.uploadStarted==null).length>0))return this.emit("complete",s),s;({files:e}=this.getState())}let r=this.opts.onBeforeUpload(e);if(r===!1)throw new Error("Not starting the upload because onBeforeUpload returned false");r&&typeof r=="object"&&(e=r,this.setState({files:e}));try{if(this.#t.validateMinNumberOfFiles(e),!this.#c(e))throw new ct(this.i18n("missingRequiredMetaField"));let{currentUploads:s}=this.getState(),n=Object.values(s).flatMap(p=>p.fileIDs),a=Object.keys(e).filter(p=>{let f=this.getFile(p);return f&&!f.progress.uploadStarted&&!n.includes(p)}),u=this.#w(a),c=await this.#k(u);return this.emit("complete",c),c}catch(s){throw this.#n([s]),s}}},To=ua;var ma={};ho(ma,{Provider:()=>qe,RequestClient:()=>Je,SearchProvider:()=>Ci,getAllowedHosts:()=>He,tokenStorage:()=>Te});function vv(i){return i.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}o(vv,"escapeRegex");function ca(i){if(typeof i=="string")return new RegExp(i);if(i instanceof RegExp)return i}o(ca,"wrapInRegex");function He(i,e){if(i){let r=o(s=>{if(!(typeof s=="string"&&ca(s))&&!(s instanceof RegExp))throw new TypeError('The option "companionAllowedHosts" must be one of string, Array, RegExp')},"validate");return Array.isArray(i)?i.every(r):r(i),i}let t=e;return/^(?!https?:\/\/).*$/i.test(t)&&(t=`https://${e.replace(/^\/\//,"")}`),t=new URL(t).origin,t=vv(t),t}o(He,"getAllowedHosts");function hp(i,e){return(Array.isArray(e)?e.map(ca):[ca(e)]).some(r=>r?.test(i)||r?.test(`${i}/`))}o(hp,"isOriginAllowed");var wp=ae(vp(),1);var wv=Object.prototype.toString,Sv=o(i=>wv.call(i)==="[object Error]","isError"),xv=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed","terminated"]);function pa(i){return i&&Sv(i)&&i.name==="TypeError"&&typeof i.message=="string"?i.message==="Load failed"?i.stack===void 0:xv.has(i.message):!1}o(pa,"isNetworkError");var tr=class extends Error{static{o(this,"AbortError")}constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},bp=o((i,e,t)=>{let r=t.retries-(e-1);return i.attemptNumber=e,i.retriesLeft=r,i},"decorateErrorWithCounts");async function Co(i,e){return new Promise((t,r)=>{e={onFailedAttempt(){},retries:10,shouldRetry:o(()=>!0,"shouldRetry"),...e};let s=wp.default.operation(e),n=o(()=>{s.stop(),r(e.signal?.reason)},"abortHandler");e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",n,{once:!0});let a=o(()=>{e.signal?.removeEventListener("abort",n),s.stop()},"cleanUp");s.attempt(async u=>{try{let c=await i(u);a(),t(c)}catch(c){try{if(!(c instanceof Error))throw new TypeError(`Non-error was thrown: "${c}". You should only throw errors.`);if(c instanceof tr)throw c.originalError;if(c instanceof TypeError&&!pa(c))throw c;if(bp(c,u,e),await e.shouldRetry(c)||(s.stop(),r(c)),await e.onFailedAttempt(c),!s.retry(c))throw s.mainError()}catch(p){bp(p,u,e),a(),r(p)}}})})}o(Co,"pRetry");var Sp={name:"@uppy/companion-client",description:"Client library for communication with Companion. Intended for use in Uppy plugins.",version:"5.1.1",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","companion","provider"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^","namespace-emitter":"^2.0.1","p-retry":"^6.1.0"},devDependencies:{jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};var da=class extends Error{static{o(this,"AuthError")}isAuthError;constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}},xp=da;function _v(i){return i.replace(/\/$/,"")}o(_v,"stripSlash");var Pp=10,kv=300*1e3,fa=401,ha=class extends Error{static{o(this,"HttpError")}statusCode;constructor({statusCode:e,message:t}){super(t),this.name="HttpError",this.statusCode=e}};async function Ev(i){if(i.status===fa)throw new xp;if(i.ok)return i.json();let e=`Failed request with status: ${i.status}. ${i.statusText}`,t;try{t=await i.json(),t.message&&(e=`${e} message: ${t.message}`),t.requestId&&(e=`${e} request-Id: ${t.requestId}`)}catch(r){throw new Error(e,{cause:r})}throw i.status>=400&&i.status<=499&&t.message?new Vn(t.message):new ha({statusCode:i.status,message:e})}o(Ev,"handleJSONResponse");function Fv(i,e,t){let{progress:r,bytesUploaded:s,bytesTotal:n}=e;r&&(i.uppy.log(`Upload progress: ${r}`),i.uppy.emit("upload-progress",t,{uploadStarted:t.progress.uploadStarted??0,bytesUploaded:s,bytesTotal:n}))}o(Fv,"emitSocketProgress");var Je=class{static{o(this,"RequestClient")}static VERSION=Sp.version;#e;uppy;opts;constructor(e,t){this.uppy=e,this.opts=t,this.onReceiveResponse=this.onReceiveResponse.bind(this),this.#e=t.companionHeaders}setCompanionHeaders(e){this.#e=e}[Symbol.for("uppy test: getCompanionHeaders")](){return this.#e}get hostname(){let{companion:e}=this.uppy.getState(),t=this.opts.companionUrl;return _v(e?.[t]?e[t]:t)}async headers(e=!1){return{...{Accept:"application/json",...e?void 0:{"Content-Type":"application/json"}},...this.#e}}onReceiveResponse(e){let{headers:t}=e,s=this.uppy.getState().companion||{},n=this.opts.companionUrl;t.has("i-am")&&t.get("i-am")!==s[n]&&this.uppy.setState({companion:{...s,[n]:t.get("i-am")}})}#t(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`}async request({path:e,method:t="GET",data:r,skipPostResponse:s,signal:n}){try{let a=await this.headers(!r),u=await Zt(this.#t(e),{method:t,signal:n,headers:a,credentials:this.opts.companionCookiesRule||"same-origin",body:r?JSON.stringify(r):null});return s||this.onReceiveResponse(u),await Ev(u)}catch(a){throw a.isAuthError||a.name==="UserFacingApiError"||a.name==="AbortError"?a:new xi(`Could not ${t} ${this.#t(e)}`,{cause:a})}}async get(e,t){return this.request({...t,path:e})}async post(e,t,r){return this.request({...r,path:e,method:"POST",data:t})}async delete(e,t,r){return this.request({...r,path:e,method:"DELETE",data:t})}async uploadRemoteFile(e,t,r){try{let{signal:s,getQueue:n}=r||{};return await Co(async()=>{let a=this.uppy.getFile(e.id)?.serverToken;if(a!=null)return this.uppy.log(`Connecting to exiting websocket ${a}`),this.#i({file:e,queue:n(),signal:s});let c=await n().wrapPromiseFunction(async(...p)=>{try{return await this.#r(...p)}catch(f){if(f.isAuthError)throw new tr(f);if(f.cause==null)throw f;let d=f.cause,v=o(()=>[408,409,429,418,423].includes(d.statusCode)||d.statusCode>=500&&d.statusCode<=599&&![501,505].includes(d.statusCode),"isRetryableHttpError");throw d.name==="HttpError"&&!v()?new tr(d):d}},{priority:-1})({file:e,postBody:t,signal:s}).abortOn(s);if(this.uppy.getFile(e.id))return this.uppy.setFileState(e.id,{serverToken:c}),this.#i({file:this.uppy.getFile(e.id),queue:n(),signal:s})},{retries:Pp,signal:s,onFailedAttempt:o(a=>this.uppy.log(`Retrying upload due to: ${a.message}`,"warning"),"onFailedAttempt")})}catch(s){if(s.name==="AbortError")return;throw this.uppy.emit("upload-error",e,s),s}}#r=o(async({file:e,postBody:t,signal:r})=>{if(e.remote?.url==null)throw new Error("Cannot connect to an undefined URL");return(await this.post(e.remote.url,{...e.remote.body,...t},{signal:r})).token},"#requestSocketToken");async#i({file:e,queue:t,signal:r}){let s,{capabilities:n}=this.uppy.getState();try{return await new Promise((a,u)=>{let c=e.serverToken,p=vo(e.remote.companionUrl),f,d,v,{isPaused:_}=e,k=o((Q,X)=>{if(f==null||f.readyState!==f.OPEN){this.uppy.log(`Cannot send "${Q}" to socket ${e.id} because the socket state was ${String(f?.readyState)}`,"warning");return}f.send(JSON.stringify({action:Q,payload:X??{}}))},"socketSend");function A(){n.resumableUploads&&k(_?"pause":"resume")}o(A,"sendState");let F=o(async()=>{d&&d.abort(),d=new AbortController;let Q=o(Z=>{this.uppy.setFileState(e.id,{serverToken:null}),d?.abort?.(),u(Z)},"onFatalError");function X(){clearTimeout(v),!_&&(v=setTimeout(()=>Q(new Error("Timeout waiting for message from Companion socket")),kv))}o(X,"resetActivityTimeout");try{await t.wrapPromiseFunction(async()=>{await Co(o(async()=>new Promise((ye,se)=>{f=new WebSocket(`${p}/api/${c}`),X(),f.addEventListener("close",()=>{f=void 0,se(new Error("Socket closed unexpectedly"))}),f.addEventListener("error",me=>{this.uppy.log(`Companion socket error ${JSON.stringify(me)}, closing socket`,"warning"),f?.close()}),f.addEventListener("open",()=>{A()}),f.addEventListener("message",me=>{X();try{let{action:_e,payload:ve}=JSON.parse(me.data);switch(_e){case"progress":{Fv(this,ve,this.uppy.getFile(e.id));break}case"success":{let E=ve.response?.responseText;this.uppy.emit("upload-success",this.uppy.getFile(e.id),{uploadURL:ve.url,status:ve.response?.status??200,body:E?JSON.parse(E):void 0}),d?.abort?.(),a();break}case"error":{let{message:E}=ve.error;throw Object.assign(new Error(E),{cause:ve.error})}default:this.uppy.log(`Companion socket unknown action ${_e}`,"warning")}}catch(_e){Q(_e)}});let we=o(()=>{this.uppy.log(`Closing socket ${e.id}`),clearTimeout(v),f&&f.close(),f=void 0},"closeSocket");d.signal.addEventListener("abort",()=>{we()})}),"reconnectWebsocket"),{retries:Pp,signal:d.signal,onFailedAttempt:o(()=>{d.signal.aborted||this.uppy.log(`Retrying websocket ${e.id}`)},"onFailedAttempt")})})().abortOn(d.signal)}catch(Z){if(d.signal.aborted)return;Q(Z)}},"createWebsocket"),R=o(Q=>{n.resumableUploads&&(_=Q,f&&A())},"pause"),U=o(Q=>{n.individualCancellation&&Q.id===e.id&&(k("cancel"),d?.abort?.(),this.uppy.log(`upload ${e.id} was removed`),a())},"onFileRemove"),C=o(()=>{k("cancel"),d?.abort?.(),this.uppy.log(`upload ${e.id} was canceled`),a()},"onCancelAll"),Y=o((Q,X)=>{Q?.id===e.id&&R(X)},"onFilePausedChange"),$=o(()=>R(!0),"onPauseAll"),H=o(()=>R(!1),"onResumeAll");this.uppy.on("file-removed",U),this.uppy.on("cancel-all",C),this.uppy.on("upload-pause",Y),this.uppy.on("pause-all",$),this.uppy.on("resume-all",H),s=o(()=>{this.uppy.off("file-removed",U),this.uppy.off("cancel-all",C),this.uppy.off("upload-pause",Y),this.uppy.off("pause-all",$),this.uppy.off("resume-all",H)},"removeEventHandlers"),r.addEventListener("abort",()=>{d?.abort()}),F()})}finally{s?.()}}};var Tv=o(i=>i.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),"getName");function Cv(){return location.origin}o(Cv,"getOrigin");var qe=class extends Je{static{o(this,"Provider")}#e;provider;id;name;pluginId;tokenKey;companionKeysParams;preAuthToken;supportsRefreshToken;constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||Tv(this.id),this.pluginId=this.opts.pluginId,this.tokenKey=`companion-${this.pluginId}-auth-token`,this.companionKeysParams=this.opts.companionKeysParams,this.preAuthToken=null,this.supportsRefreshToken=!!t.supportsRefreshToken}async headers(){let[e,t]=await Promise.all([super.headers(),this.#t()]),r={};return t&&(r["uppy-auth-token"]=t),this.companionKeysParams&&(r["uppy-credentials-params"]=btoa(JSON.stringify({params:this.companionKeysParams}))),{...e,...r}}onReceiveResponse(e){super.onReceiveResponse(e);let t=this.#r(),s=t.getPluginState().authenticated?e.status!==fa:e.status<400;return t.setPluginState({authenticated:s}),e}async setAuthToken(e){return this.#r().storage.setItem(this.tokenKey,e)}async#t(){return this.#r().storage.getItem(this.tokenKey)}async removeAuthToken(){return this.#r().storage.removeItem(this.tokenKey)}#r(){let e=this.uppy.getPlugin(this.pluginId);if(e==null)throw new Error("Plugin was nullish");return e}async ensurePreAuth(){if(this.companionKeysParams&&!this.preAuthToken&&(await this.fetchPreAuthToken(),!this.preAuthToken))throw new Error("Could not load authentication data required for third-party login. Please try again later.")}authQuery(e){return{}}authUrl({authFormData:e,query:t}){let r=new URLSearchParams({...t,state:btoa(JSON.stringify({origin:Cv()})),...this.authQuery({authFormData:e})});return this.preAuthToken&&r.set("uppyPreAuthToken",this.preAuthToken),`${this.hostname}/${this.id}/connect?${r}`}async loginSimpleAuth({uppyVersions:e,authFormData:t,signal:r}){let s=await this.post(`${this.id}/simple-auth`,{form:t},{qs:{uppyVersions:e},signal:r});this.setAuthToken(s.uppyAuthToken)}async loginOAuth({uppyVersions:e,authFormData:t,signal:r}){await this.ensurePreAuth(),r.throwIfAborted();let s=this.authUrl({query:{uppyVersions:e},authFormData:t}),n=window.open(s,"_blank"),a,u;try{return await new Promise((c,p)=>{u=o(f=>{if(f.source!==n){let _="";try{_=JSON.stringify(f.data)}catch{}this.uppy.log(`ignoring event from unknown source ${_}`,"warning");return}let{companionAllowedHosts:d}=this.#r().opts;if(!hp(f.origin,d)){this.uppy.log(`ignoring event from ${f.origin} vs allowed pattern ${d}`,"warning");return}let v=typeof f.data=="string"?JSON.parse(f.data):f.data;if(v.error){let{uppy:_}=this,k=_.i18n("authAborted");_.info({message:k},"warning",5e3),p(new Error("auth aborted"));return}if(!v.token){p(new Error("did not receive token from auth window"));return}c(this.setAuthToken(v.token))},"handleMessage"),n&&(a=window.setInterval(()=>{n.closed&&p(new Error("Auth window was closed by the user"))},500)),r.addEventListener("abort",()=>p(new Error("Aborted"))),window.addEventListener("message",u)})}finally{n?.close(),window.clearInterval(a),u&&window.removeEventListener("message",u)}}async login({uppyVersions:e,authFormData:t,signal:r}){return this.loginOAuth({uppyVersions:e,authFormData:t,signal:r})}refreshTokenUrl(){return`${this.hostname}/${this.id}/refresh-token`}fileUrl(e){return`${this.hostname}/${this.id}/get/${e}`}async request(...e){await this.#e;try{return await super.request(...e)}catch(t){if(!this.supportsRefreshToken)throw t;let r=await this.#t();if(!t.isAuthError||!r)throw t;return this.#e==null&&(this.#e=(async()=>{try{this.uppy.log("[CompanionClient] Refreshing expired auth token");let s=await super.request({path:this.refreshTokenUrl(),method:"POST"});await this.setAuthToken(s.uppyAuthToken)}catch(s){throw s.isAuthError&&await this.removeAuthToken(),t}finally{this.#e=void 0}})()),await this.#e,super.request(...e)}}async fetchPreAuthToken(){if(this.companionKeysParams)try{let e=await this.post(`${this.id}/preauth/`,{params:this.companionKeysParams});this.preAuthToken=e.token}catch(e){this.uppy.log(`[CompanionClient] unable to fetch preAuthToken ${e}`,"warning")}}list(e,t){return this.get(`${this.id}/list/${e||""}`,t)}search(e,t={}){let r=new URLSearchParams;r.set("q",e),t.path&&r.set("path",t.path),t.cursor&&r.set("cursor",t.cursor);let n=`${`${this.id}/search`}?${r.toString()}`;return this.get(n,t)}async logout(e){let t=await this.get(`${this.id}/logout`,e);return await this.removeAuthToken(),t}};var Av=o(i=>i.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),"getName"),Ci=class extends Je{static{o(this,"SearchProvider")}provider;id;name;pluginId;constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||Av(this.id),this.pluginId=this.opts.pluginId}fileUrl(e){return`${this.hostname}/search/${this.id}/get/${e}`}search(e,t){return this.get(`search/${this.id}/list?q=${encodeURIComponent(e)}${t?`&${t}`:""}`)}};var Te={};ho(Te,{getItem:()=>Uv,removeItem:()=>Ov,setItem:()=>Rv});async function Rv(i,e){localStorage.setItem(i,e)}o(Rv,"setItem");async function Uv(i){return localStorage.getItem(i)}o(Uv,"getItem");async function Ov(i){localStorage.removeItem(i)}o(Ov,"removeItem");var Fa={};ho(Fa,{FilterInput:()=>rr,GoogleDriveIcon:()=>nr,GooglePhotosIcon:()=>or,GooglePickerView:()=>Ai,ProviderViews:()=>Ne,SearchProviderViews:()=>ri,SearchView:()=>Wo,authorize:()=>us,defaultPickerIcon:()=>ar,ensureScriptsInjected:()=>Ro,logout:()=>Uo,pollPickingSession:()=>Io,showDrivePicker:()=>Oo,showPhotosPicker:()=>Do,useSearchForm:()=>ir});function ir(i){let e=rt(r=>{r.preventDefault(),i()},[i]),[t]=it(()=>{let r=document.createElement("form");return r.setAttribute("tabindex","-1"),r.id=Dt(),r});return ze(()=>(document.body.appendChild(t),t.addEventListener("submit",e),()=>{t.removeEventListener("submit",e),document.body.removeChild(t)}),[t,e]),{formId:t.id}}o(ir,"useSearchForm");function Dv({value:i,onChange:e,onSubmit:t,inputLabel:r,i18n:s}){let{formId:n}=ir(t);return l("section",{className:"uppy-ProviderBrowser-searchFilter",children:[l("input",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterInput",type:"search","aria-label":r,placeholder:r,value:i,onInput:o(a=>e(a.target.value),"onInput"),form:n,"data-uppy-super-focusable":!0}),l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12",children:l("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})}),i&&l("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":s("resetFilter"),onClick:o(()=>e(""),"onClick"),children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19",children:l("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"})})})]})}o(Dv,"FilterInput");var rr=Dv;function Iv(){return l("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",children:l("g",{fill:"none","fill-rule":"evenodd",children:[l("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),l("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),l("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),l("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),l("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),l("path",{d:"M4 4h18v18H4z"})]})})}o(Iv,"GoogleIcon");function Nv({pluginName:i,i18n:e,onAuth:t}){let r=i==="Google Drive",s=rt(n=>{n.preventDefault(),t()},[t]);return l("form",{onSubmit:s,children:r?l("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0,children:[l(Iv,{}),e("signInWithGoogle")]}):l("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0,children:e("authenticateWith",{pluginName:i})})})}o(Nv,"DefaultForm");var Mv=o(({pluginName:i,i18n:e,onAuth:t})=>l(Nv,{pluginName:i,i18n:e,onAuth:t}),"defaultRenderForm");function ls({loading:i,pluginName:e,pluginIcon:t,i18n:r,handleAuth:s,renderForm:n=Mv}){return l("div",{className:"uppy-Provider-auth",children:[l("div",{className:"uppy-Provider-authIcon",children:t()}),l("div",{className:"uppy-Provider-authTitle",children:r("authenticateWithTitle",{pluginName:e})}),n({pluginName:e,i18n:r,loading:i,onAuth:s})]})}o(ls,"AuthView");var Ao=o(i=>({authorization:`Bearer ${i}`}),"getAuthHeader"),_p=new Set,kp=!1;async function Ep(i){_p.has(i)||(await new Promise((e,t)=>{let r=document.createElement("script");r.src=i,r.addEventListener("load",()=>e()),r.addEventListener("error",s=>t(s.error)),document.head.appendChild(r)}),_p.add(i))}o(Ep,"injectScript");async function Ro(i){await Promise.all([Ep("https://accounts.google.com/gsi/client"),(async()=>{await Ep("https://apis.google.com/js/api.js"),i==="drive"&&!kp&&(await new Promise(e=>gapi.load("client:picker",()=>e())),await gapi.client.load("https://www.googleapis.com/discovery/v1/apis/drive/v3/rest"),kp=!0)})()])}o(Ro,"ensureScriptsInjected");async function Lv(i,e){return!!(await fetch(`https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=${encodeURIComponent(i)}`,{signal:e})).ok}o(Lv,"isTokenValid");async function us({pickerType:i,clientId:e,accessToken:t}){let r=await new Promise((s,n)=>{let a=i==="drive"?["https://www.googleapis.com/auth/drive.file"]:["https://www.googleapis.com/auth/photospicker.mediaitems.readonly"],u=google.accounts.oauth2.initTokenClient({client_id:e,scope:a.join(" "),callback:s,error_callback:n});t===null?u.requestAccessToken({prompt:"consent"}):u.requestAccessToken({prompt:""})});if(r.error)throw new Error(`OAuth2 error: ${r.error}`);return r.access_token}o(us,"authorize");async function Uo(i){await new Promise(e=>google.accounts.oauth2.revoke(i,e))}o(Uo,"logout");var sr=class extends Error{static{o(this,"InvalidTokenError")}constructor(){super("Invalid or expired token"),this.name="InvalidTokenError"}};async function Oo({token:i,apiKey:e,appId:t,onFilesPicked:r,signal:s,onLoadingChange:n,onError:a}){if(!await Lv(i,s))throw new sr;async function u({doc:f,token:d,signal:v}){if(f.mimeType==="application/vnd.google-apps.shortcut")return f.shortcutDetails?.targetMimeType==="application/vnd.google-apps.folder"?[]:[{platform:"drive",id:f.id,name:f.name,mimeType:f.mimeType}];if(f.mimeType!=="application/vnd.google-apps.folder")return[{platform:"drive",id:f.id,name:f.name,mimeType:f.mimeType}];let _=Ao(d),k=[],A;do{let F=new URLSearchParams({q:`'${f.id.replace(/'/g,"\\'")}' in parents and trashed = false`,fields:"nextPageToken, files(id, name, mimeType, shortcutDetails(targetMimeType))",includeItemsFromAllDrives:"true",supportsAllDrives:"true",pageSize:"1000",...A&&{pageToken:A}}),R=await fetch(`https://www.googleapis.com/drive/v3/files?${F.toString()}`,{headers:_,signal:v});if(!R.ok)throw new Error(`Failed to list folder contents for '${f.name}' (${f.id}): ${R.status} ${R.statusText}`);let U=await R.json();A=U.nextPageToken;for(let C of U.files)k.push(...await u({doc:C,token:d,signal:v}))}while(A);return k}o(u,"handleDocObjectRecursively");let c=o(async f=>{if(f.action===google.picker.Action.PICKED)try{n(!0);let d=[];for(let v of f.docs)d.push(...await u({doc:v,token:i,signal:s}));r(d,i)}catch(d){a(d)}finally{n(!1)}},"onPicked"),p=new google.picker.PickerBuilder().enableFeature(google.picker.Feature.NAV_HIDDEN).enableFeature(google.picker.Feature.MULTISELECT_ENABLED).setDeveloperKey(e).setAppId(t).setOAuthToken(i).addView(new google.picker.DocsView(google.picker.ViewId.DOCS).setIncludeFolders(!0).setSelectFolderEnabled(!0).setMode(google.picker.DocsViewMode.LIST)).setCallback(c).build();p.setVisible(!0),s?.addEventListener("abort",()=>p.dispose())}o(Oo,"showDrivePicker");async function Do({token:i,pickingSession:e,onPickingSessionChange:t,signal:r}){let s=Ao(i),n=e;if(n==null){let u=await fetch("https://photospicker.googleapis.com/v1/sessions",{method:"post",headers:s,signal:r});if(u.status===401&&(await u.json()).error?.status==="UNAUTHENTICATED")throw new sr;if(!u.ok)throw new Error("Failed to create a session");n=await u.json(),t(n)}let a=window.open(n.pickerUri);r?.addEventListener("abort",()=>a?.close())}o(Do,"showPhotosPicker");async function Bv({accessToken:i,pickingSession:e,signal:t}){let r=Ao(i),s,n=[];do{let u=await fetch(`https://photospicker.googleapis.com/v1/mediaItems?${new URLSearchParams({sessionId:e.id,pageSize:String(100),...s&&{pageToken:s}}).toString()}`,{headers:r,signal:t});if(!u.ok)throw new Error("Failed to get a media items");let{mediaItems:c,nextPageToken:p}=await u.json();s=p,n.push(...c)}while(s);return n=n.flatMap(a=>a.type==="PHOTO"||a.type==="VIDEO"&&a.mediaFile.mediaFileMetadata.videoMetadata.processingStatus==="READY"?[a]:[]),n.map(a=>{let{id:u,type:c,mediaFile:{mimeType:p,filename:f,baseUrl:d}}=a;return{platform:"photos",id:u,mimeType:p,url:c==="VIDEO"?`${d}=dv`:`${d}=d`,name:f,metadata:{googlePhotosFileType:a.type,createTime:a.createTime,width:a.mediaFile.mediaFileMetadata.width,height:a.mediaFile.mediaFileMetadata.height,...a.type==="PHOTO"&&{cameraMake:a.mediaFile.mediaFileMetadata.photoMetadata?.cameraMake,cameraModel:a.mediaFile.mediaFileMetadata.photoMetadata?.cameraModel,focalLength:a.mediaFile.mediaFileMetadata.photoMetadata?.focalLength,apertureFNumber:a.mediaFile.mediaFileMetadata.photoMetadata?.apertureFNumber,isoEquivalent:a.mediaFile.mediaFileMetadata.photoMetadata?.isoEquivalent,exposureTime:a.mediaFile.mediaFileMetadata.photoMetadata?.exposureTime},...a.type==="VIDEO"&&{cameraMake:a.mediaFile.mediaFileMetadata.videoMetadata.cameraMake,cameraModel:a.mediaFile.mediaFileMetadata.videoMetadata.cameraModel,fps:a.mediaFile.mediaFileMetadata.videoMetadata.fps,processingStatus:a.mediaFile.mediaFileMetadata.videoMetadata.processingStatus}}}})}o(Bv,"resolvePickedPhotos");async function Io({pickingSessionRef:i,accessTokenRef:e,signal:t,onFilesPicked:r,onError:s}){for(let n=1;;)try{i.current!=null?n=parseFloat(i.current.pollingConfig.pollInterval):n=1,await Promise.race([new Promise(c=>setTimeout(c,n*1e3)),new Promise((c,p)=>{t.addEventListener("abort",p)})]),t.throwIfAborted();let a=e.current,u=i.current;if(u!=null&&a!=null){let c=Ao(a),p=await fetch(`https://photospicker.googleapis.com/v1/sessions/${encodeURIComponent(u.id)}`,{headers:c,signal:t});if(!p.ok)throw new Error("Failed to get session");if((await p.json()).mediaItemsSet){let d=await Bv({accessToken:a,pickingSession:u,signal:t});i.current=void 0,r(d,a)}u.pollingConfig.timeoutIn==="0s"&&(i.current=void 0)}}catch(a){if(a instanceof Error&&a.name==="AbortError")return;s(a)}}o(Io,"pollPickingSession");var or=o(()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"-7 -7 73 73",children:l("g",{fill:"none","fill-rule":"evenodd",children:[l("path",{d:"M-3-3h64v64H-3z"}),l("g",{"fill-rule":"nonzero",children:[l("path",{fill:"#FBBC04",d:"M14.8 13.4c8.1 0 14.7 6.6 14.7 14.8v1.3H1.3c-.7 0-1.3-.6-1.3-1.3C0 20 6.6 13.4 14.8 13.4z"}),l("path",{fill:"#EA4335",d:"M45.6 14.8c0 8.1-6.6 14.7-14.8 14.7h-1.3V1.3c0-.7.6-1.3 1.3-1.3C39 0 45.6 6.6 45.6 14.8z"}),l("path",{fill:"#4285F4",d:"M44.3 45.6c-8.2 0-14.8-6.6-14.8-14.8v-1.3h28.2c.7 0 1.3.6 1.3 1.3 0 8.2-6.6 14.8-14.8 14.8z"}),l("path",{fill:"#34A853",d:"M13.4 44.3c0-8.2 6.6-14.8 14.8-14.8h1.3v28.2c0 .7-.6 1.3-1.3 1.3-8.2 0-14.8-6.6-14.8-14.8z"})]})]})}),"GooglePhotosIcon"),nr=o(()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("g",{fillRule:"nonzero",fill:"none",children:[l("path",{d:"M6.663 22.284l.97 1.62c.202.34.492.609.832.804l3.465-5.798H5c0 .378.1.755.302 1.096l1.361 2.278z",fill:"#0066DA"}),l("path",{d:"M16 12.09l-3.465-5.798c-.34.195-.63.463-.832.804l-6.4 10.718A2.15 2.15 0 005 18.91h6.93L16 12.09z",fill:"#00AC47"}),l("path",{d:"M23.535 24.708c.34-.195.63-.463.832-.804l.403-.67 1.928-3.228c.201-.34.302-.718.302-1.096h-6.93l1.474 2.802 1.991 2.996z",fill:"#EA4335"}),l("path",{d:"M16 12.09l3.465-5.798A2.274 2.274 0 0018.331 6h-4.662c-.403 0-.794.11-1.134.292L16 12.09z",fill:"#00832D"}),l("path",{d:"M20.07 18.91h-8.14l-3.465 5.798c.34.195.73.292 1.134.292h12.802c.403 0 .794-.11 1.134-.292L20.07 18.91z",fill:"#2684FC"}),l("path",{d:"M23.497 12.455l-3.2-5.359a2.252 2.252 0 00-.832-.804L16 12.09l4.07 6.82h6.917c0-.377-.1-.755-.302-1.096l-3.188-5.359z",fill:"#FFBA00"})]})}),"GoogleDriveIcon");function jv(i,e){let[t,r]=it();ze(()=>{(async()=>r(await i.getItem(e)))()},[e,i]);let s=rt(async n=>(r(n),n==null?i.removeItem(e):i.setItem(e,n)),[e,i]);return[t,s]}o(jv,"useStore");function Ai({uppy:i,i18n:e,clientId:t,onFilesPicked:r,pickerType:s,apiKey:n,appId:a,storage:u}){let[c,p]=it(!1),[f,d]=jv(u,`uppy:google-${s}-picker:accessToken`),v=Ye(),_=Ye(f),k=Ye(!1),A=rt(U=>{i.log("Access token updated"),d(U),_.current=U},[d,i]);ze(()=>{_.current=f},[f]);let F=rt(async U=>{let C=f,Y=o(async $=>{if(s==="drive")await Oo({token:$,apiKey:n,appId:a,onFilesPicked:r,signal:U,onLoadingChange:o(H=>p(H),"onLoadingChange"),onError:o(H=>{i.log(H),i.info(e("failedToAddFiles"),"error")},"onError")});else{let H=o(Q=>{v.current=Q},"onPickingSessionChange");await Do({token:$,pickingSession:v.current,onPickingSessionChange:H,signal:U})}},"doShowPicker");p(!0);try{try{if(await Ro(s),C==null&&(C=await us({clientId:t,pickerType:s})),C==null)throw new Error;await Y(C),k.current=!0,A(C)}catch($){if($ instanceof sr)i.log("Token is invalid or expired, reauthenticating"),C=await us({pickerType:s,accessToken:C,clientId:t}),await Y(C),k.current=!0,A(C);else throw $}}catch($){$ instanceof Error&&"type"in $&&$.type==="popup_closed"||(A(null),i.log($))}finally{p(!1)}},[f,n,a,t,r,s,A,i,e]);ze(()=>{let U=new AbortController;return Io({pickingSessionRef:v,accessTokenRef:_,signal:U.signal,onFilesPicked:r,onError:o(C=>i.log(C),"onError")}),()=>U.abort()},[r,i]),ze(()=>{if(f===void 0||k.current)return;let U=new AbortController;return F(U.signal),()=>{k.current||U.abort()}},[f,F]);let R=rt(async()=>{f&&(await Uo(f),A(null),v.current=void 0)},[f,A]);return c?l("div",{children:[e("pleaseWait"),"..."]}):f==null?l(ls,{pluginName:e(s==="drive"?"pluginNameGoogleDrivePicker":"pluginNameGooglePhotosPicker"),pluginIcon:s==="drive"?nr:or,handleAuth:F,i18n:e,loading:c}):l("div",{style:{textAlign:"center"},children:[l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary",style:{display:"block",marginBottom:"1em"},disabled:c,onClick:o(()=>F(),"onClick"),children:e(s==="drive"?"pickFiles":"pickPhotos")}),l("button",{type:"button",className:"uppy-u-reset uppy-c-btn",disabled:c,onClick:R,children:e("logOut")})]})}o(Ai,"GooglePickerView");var Xp=ae(Ge(),1),Kp=ae(Eo(),1);var Mo={name:"@uppy/provider-views",description:"View library for Uppy remote provider plugins.",version:"5.2.2",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.min.css":"./dist/style.min.css","./css/style.css":"./dist/style.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",classnames:"^2.2.6",lodash:"^4.17.21",nanoid:"^5.0.9","p-queue":"^8.0.0",preact:"^10.5.13"},devDependencies:{"@types/gapi":"^0.0.47","@types/google.accounts":"^0.0.14","@types/google.picker":"^0.0.42",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};var Fp=ae(Ge(),1);function Hv(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58",children:l("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"})})}o(Hv,"FileIcon");function qv(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157",children:l("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"})})}o(qv,"FolderIcon");function Vv(){return l("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58",children:[l("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),l("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"})]})}o(Vv,"VideoIcon");function ii({itemIconString:i,alt:e=void 0}){if(i===null)return null;switch(i){case"file":return l(Hv,{});case"folder":return l(qv,{});case"video":return l(Vv,{});default:return l("img",{src:i,alt:e,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}o(ii,"ItemIcon");function $v({file:i,toggleCheckbox:e,className:t,isDisabled:r,restrictionError:s,showTitles:n,children:a=null,i18n:u}){return l("li",{className:t,title:r&&s?s:void 0,children:[l("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox uppy-ProviderBrowserItem-checkbox--grid",onChange:e,name:"listitem",id:i.id,checked:i.status==="checked",disabled:r,"data-uppy-super-focusable":!0}),l("label",{htmlFor:i.id,"aria-label":i.data.name??u("unnamed"),className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[l(ii,{itemIconString:i.data.thumbnail||i.data.icon}),n&&(i.data.name??u("unnamed")),a]})]})}o($v,"GridItem");var ga=$v;function ya({file:i,openFolder:e,className:t,isDisabled:r,restrictionError:s,toggleCheckbox:n,showTitles:a,i18n:u}){return l("li",{className:t,title:i.status!=="checked"&&s?s:void 0,children:[l("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox",onChange:n,name:"listitem",id:i.id,checked:i.status==="checked","aria-label":i.data.isFolder?u("allFilesFromFolderNamed",{name:i.data.name??u("unnamed")}):null,disabled:r,"data-uppy-super-focusable":!0}),i.data.isFolder?l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:o(()=>e(i.id),"onClick"),"aria-label":u("openFolderNamed",{name:i.data.name??u("unnamed")}),children:[l("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:l(ii,{itemIconString:i.data.icon})}),a&&i.data.name?l("span",{className:"uppy-truncate-text",children:i.data.name}):u("unnamed")]}):l("label",{htmlFor:i.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[l("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:l(ii,{itemIconString:i.data.icon})}),a&&l("span",{className:"uppy-truncate-text",children:i.data.name??u("unnamed")})]})]})}o(ya,"ListItem");function va(i){let{viewType:e,toggleCheckbox:t,showTitles:r,i18n:s,openFolder:n,file:a,utmSource:u}=i,c=a.type==="folder"?null:a.restrictionError,p=!!c&&a.status!=="checked",f={file:a,openFolder:n,toggleCheckbox:t,utmSource:u,i18n:s,viewType:e,showTitles:r,className:(0,Fp.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":p},{"uppy-ProviderBrowserItem--noPreview":a.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":a.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":a.status==="partial"}),isDisabled:p,restrictionError:c};switch(e){case"grid":return l(ga,{...f});case"list":return l(ya,{...f});case"unsplash":return l(ga,{...f,children:l("a",{href:`${a.data.author.url}?utm_source=${u}&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1,children:a.data.author.name})});default:throw new Error(`There is no such type ${e}`)}}o(va,"Item");function Wv(i){let{displayedPartialTree:e,viewType:t,toggleCheckbox:r,handleScroll:s,showTitles:n,i18n:a,isLoading:u,openFolder:c,noResultsLabel:p,virtualList:f,utmSource:d}=i,[v,_]=it(!1);if(ze(()=>{let A=o(R=>{R.key==="Shift"&&_(!1)},"handleKeyUp"),F=o(R=>{R.key==="Shift"&&_(!0)},"handleKeyDown");return document.addEventListener("keyup",A),document.addEventListener("keydown",F),()=>{document.removeEventListener("keyup",A),document.removeEventListener("keydown",F)}},[]),u)return l("div",{className:"uppy-Provider-loading",children:typeof u=="string"?u:a("loading")});if(e.length===0)return l("div",{className:"uppy-Provider-empty",children:p});let k=o(A=>l(va,{viewType:t,toggleCheckbox:o(F=>{F.stopPropagation(),F.preventDefault(),document.getSelection()?.removeAllRanges(),r(A,v)},"toggleCheckbox"),showTitles:n,i18n:a,openFolder:c,file:A,utmSource:d},A.id),"renderItem");return f?l("div",{className:"uppy-ProviderBrowser-body",children:l(Zi,{className:"uppy-ProviderBrowser-list",data:e,renderRow:k,rowHeight:35.5})}):l("div",{className:"uppy-ProviderBrowser-body",children:l("ul",{className:"uppy-ProviderBrowser-list",onScroll:s,tabIndex:-1,children:e.map(k)})})}o(Wv,"Browser");var Lo=Wv;var Tp=ae(Ge(),1);var Gv=o(i=>i.filter(t=>t.type==="file"&&t.status==="checked"?!0:t.type==="folder"&&t.status==="checked"?!i.some(s=>s.type!=="root"&&s.parentId===t.id):!1).length,"getNumberOfSelectedFiles"),Bo=Gv;function cs({cancelSelection:i,donePicking:e,i18n:t,partialTree:r,validateAggregateRestrictions:s}){let n=Fi(()=>s(r),[r,s]),a=Fi(()=>Bo(r),[r]);return a===0?null:l("div",{className:"uppy-ProviderBrowser-footer",children:[l("div",{className:"uppy-ProviderBrowser-footer-buttons",children:[l("button",{className:(0,Tp.default)("uppy-u-reset uppy-c-btn uppy-c-btn-primary",{"uppy-c-btn--disabled":n}),disabled:!!n,onClick:e,type:"button",children:t("selectX",{smart_count:a})}),l("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:i,type:"button",children:t("cancel")})]}),n&&l("div",{className:"uppy-ProviderBrowser-footer-error",children:n})]})}o(cs,"FooterActions");var Xv=o((i,e,t)=>{let r=i.name||i.id;return{id:i.id,source:e.id,name:r,type:i.mimeType,isRemote:!0,data:i,preview:i.thumbnail||void 0,meta:{authorName:i.author?.name,authorUrl:i.author?.url,relativePath:i.relDirPath||null,absolutePath:i.absDirPath},body:{fileId:i.id},remote:{companionUrl:e.opts.companionUrl,url:`${t.fileUrl(i.requestPath)}`,body:{fileId:i.id},providerName:t.name,provider:t.provider,requestClientId:t.provider}}},"companionFileToUppyFile"),Cp=Xv;var Kv=o((i,e,t)=>{let r=i.map(a=>Cp(a,e,t)),s=[],n=[];r.forEach(a=>{e.uppy.checkIfFileAlreadyExists($r(a,e.uppy.getID()))?n.push(a):s.push(a)}),s.length>0&&e.uppy.info(e.uppy.i18n("addedNumFiles",{numFiles:s.length})),n.length>0&&e.uppy.info(`Not adding ${n.length} files because they already exist`),e.uppy.addFiles(s)},"addFiles"),jo=Kv;var Yv=o((i,e,t,r)=>{let s=e.findIndex(n=>n.id===r);if(s!==-1&&t){let n=e.findIndex(u=>u.id===i);return e.slice(Math.min(s,n),Math.max(s,n)+1).map(u=>u.id)}return[i]},"getClickedRange"),zo=Yv;var Jv=o(i=>e=>{if(!e.isAuthError){if(e.name==="AbortError"){i.log("Aborting request","warning");return}i.log(e,"error"),e.name==="UserFacingApiError"&&i.info({message:i.i18n("companionError"),details:i.i18n(e.message)},"warning",5e3)}},"handleError"),It=Jv;var Qv=o((i,e)=>{let t=i.find(s=>s.id===e),r=[];for(;r=[t,...r],t.type!=="root";){let s=t.parentId;t=i.find(n=>n.id===s)}return r},"getBreadcrumbs"),Ap=Qv;var Rp=o((i,e,t)=>{let r=e===null?"null":e;if(t[r])return t[r];let s=i.find(a=>a.id===e);if(s.type==="root")return[];let n=[...Rp(i,s.parentId,t),s];return t[r]=n,n},"getPath"),Zv=o(i=>{let e=Object.create(null);return i.filter(s=>s.type==="file"&&s.status==="checked").map(s=>{let n=Rp(i,s.id,e),a=n.findIndex(f=>f.type==="folder"&&f.status==="checked"),u=n.slice(a),c=`/${n.map(f=>f.data.name).join("/")}`,p=u.length===1?void 0:u.map(f=>f.data.name).join("/");return{...s.data,absDirPath:c,relDirPath:p}})},"getCheckedFilesWithPaths"),Ho=Zv;var wa=ae(Op(),1);var ds=class extends Error{static{o(this,"TimeoutError")}constructor(e){super(e),this.name="TimeoutError"}},Sa=class extends Error{static{o(this,"AbortError")}constructor(e){super(),this.name="AbortError",this.message=e}},Dp=o(i=>globalThis.DOMException===void 0?new Sa(i):new DOMException(i),"getDOMException"),Ip=o(i=>{let e=i.reason===void 0?Dp("This operation was aborted."):i.reason;return e instanceof Error?e:Dp(e)},"getAbortedReason");function xa(i,e){let{milliseconds:t,fallback:r,message:s,customTimers:n={setTimeout,clearTimeout}}=e,a,c=new Promise((p,f)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){let{signal:v}=e;v.aborted&&f(Ip(v)),v.addEventListener("abort",()=>{f(Ip(v))})}if(t===Number.POSITIVE_INFINITY){i.then(p,f);return}let d=new ds;a=n.setTimeout.call(void 0,()=>{if(r){try{p(r())}catch(v){f(v)}return}typeof i.cancel=="function"&&i.cancel(),s===!1?p():s instanceof Error?f(s):(d.message=s??`Promise timed out after ${t} milliseconds`,f(d))},t),(async()=>{try{p(await i)}catch(v){f(v)}})()}).finally(()=>{c.clear()});return c.clear=()=>{n.clearTimeout.call(void 0,a),a=void 0},c}o(xa,"pTimeout");function Pa(i,e,t){let r=0,s=i.length;for(;s>0;){let n=Math.trunc(s/2),a=r+n;t(i[a],e)<=0?(r=++a,s-=n+1):s=n}return r}o(Pa,"lowerBound");var hs=class{static{o(this,"PriorityQueue")}#e=[];enqueue(e,t){t={priority:0,...t};let r={priority:t.priority,id:t.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=t.priority){this.#e.push(r);return}let s=Pa(this.#e,r,(n,a)=>a.priority-n.priority);this.#e.splice(s,0,r)}setPriority(e,t){let r=this.#e.findIndex(n=>n.id===e);if(r===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[s]=this.#e.splice(r,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this.#e.length}};var fs=class extends wa.default{static{o(this,"PQueue")}#e;#t;#r=0;#i;#s;#l=0;#o;#n;#a;#c;#u=0;#d;#p;#h;#f=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:hs,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#t=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#i=e.intervalCap,this.#s=e.interval,this.#a=new e.queueClass,this.#c=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#h=e.throwOnTimeout===!0,this.#p=e.autoStart===!1}get#g(){return this.#t||this.#r<this.#i}get#b(){return this.#u<this.#d}#m(){this.#u--,this.#S(),this.emit("next")}#y(){this.#x(),this.#v(),this.#n=void 0}get#P(){let e=Date.now();if(this.#o===void 0){let t=this.#l-e;if(t<0)this.#r=this.#e?this.#u:0;else return this.#n===void 0&&(this.#n=setTimeout(()=>{this.#y()},t)),!0}return!1}#S(){if(this.#a.size===0)return this.#o&&clearInterval(this.#o),this.#o=void 0,this.emit("empty"),this.#u===0&&this.emit("idle"),!1;if(!this.#p){let e=!this.#P;if(this.#g&&this.#b){let t=this.#a.dequeue();return t?(this.emit("active"),t(),e&&this.#v(),!0):!1}}return!1}#v(){this.#t||this.#o!==void 0||(this.#o=setInterval(()=>{this.#x()},this.#s),this.#l=Date.now()+this.#s)}#x(){this.#r===0&&this.#u===0&&this.#o&&(clearInterval(this.#o),this.#o=void 0),this.#r=this.#e?this.#u:0,this.#w()}#w(){for(;this.#S(););}get concurrency(){return this.#d}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#d=e,this.#w()}async#E(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,t){this.#a.setPriority(e,t)}async add(e,t={}){return t.id??=(this.#f++).toString(),t={timeout:this.timeout,throwOnTimeout:this.#h,...t},new Promise((r,s)=>{this.#a.enqueue(async()=>{this.#u++,this.#r++;try{t.signal?.throwIfAborted();let n=e({signal:t.signal});t.timeout&&(n=xa(Promise.resolve(n),{milliseconds:t.timeout})),t.signal&&(n=Promise.race([n,this.#E(t.signal)]));let a=await n;r(a),this.emit("completed",a)}catch(n){if(n instanceof ds&&!t.throwOnTimeout){r();return}s(n),this.emit("error",n)}finally{this.#m()}},t),this.emit("add"),this.#S()})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return this.#p?(this.#p=!1,this.#w(),this):this}pause(){this.#p=!0}clear(){this.#a=new this.#c}async onEmpty(){this.#a.size!==0&&await this.#_("empty")}async onSizeLessThan(e){this.#a.size<e||await this.#_("next",()=>this.#a.size<e)}async onIdle(){this.#u===0&&this.#a.size===0||await this.#_("idle")}async#_(e,t){return new Promise(r=>{let s=o(()=>{t&&!t()||(this.off(e,s),r())},"listener");this.on(e,s)})}get size(){return this.#a.size}sizeBy(e){return this.#a.filter(e).length}get pending(){return this.#u}get isPaused(){return this.#p}};var i0=o(i=>i.map(e=>({...e})),"shallowClone"),Vo=i0;var Np=o(async(i,e,t,r,s)=>{let n=[],a=t.cached?t.nextPagePath:t.id;for(;a;){let d=await r(a);n=n.concat(d.items),a=d.nextPagePath}let u=n.filter(d=>d.isFolder===!0),c=n.filter(d=>d.isFolder===!1),p=u.map(d=>({type:"folder",id:d.requestPath,cached:!1,nextPagePath:null,status:"checked",parentId:t.id,data:d})),f=c.map(d=>{let v=s(d);return{type:"file",id:d.requestPath,restrictionError:v,status:v?"unchecked":"checked",parentId:t.id,data:d}});t.cached=!0,t.nextPagePath=null,e.push(...f,...p),p.forEach(async d=>{i.add(()=>Np(i,e,d,r,s))})},"recursivelyFetch"),r0=o(async(i,e,t,r)=>{let s=new fs({concurrency:6}),n=Vo(i);return n.filter(u=>u.type==="folder"&&u.status==="checked"&&(u.cached===!1||u.nextPagePath)).forEach(u=>{s.add(()=>Np(s,n,u,e,t))}),s.on("completed",()=>{let u=n.filter(c=>c.type==="file"&&c.status==="checked").length;r(u)}),await s.onIdle(),n},"afterFill"),Mp=r0;var s0=o((i,e,t,r,s)=>{let n=e.filter(k=>!i.find(A=>A.id===k.requestPath)),a=n.filter(k=>k.isFolder===!0),u=n.filter(k=>k.isFolder===!1),c=t.type==="folder"&&t.status==="checked",p=a.map(k=>({type:"folder",id:k.requestPath,cached:!1,nextPagePath:null,status:c?"checked":"unchecked",parentId:t.id,data:k})),f=u.map(k=>{let A=s(k);return{type:"file",id:k.requestPath,restrictionError:A,status:c&&!A?"checked":"unchecked",parentId:t.id,data:k}}),d={...t,cached:!0,nextPagePath:r};return[...i.map(k=>k.id===d.id?d:k),...p,...f]},"afterOpenFolder"),Lp=s0;var o0=o((i,e,t,r,s)=>{let n=i.find(k=>k.id===e),a=t.filter(k=>k.isFolder===!0),u=t.filter(k=>k.isFolder===!1),c={...n,nextPagePath:r},p=i.map(k=>k.id===c.id?c:k),f=c.type==="folder"&&c.status==="checked",d=a.map(k=>({type:"folder",id:k.requestPath,cached:!1,nextPagePath:null,status:f?"checked":"unchecked",parentId:c.id,data:k})),v=u.map(k=>{let A=s(k);return{type:"file",id:k.requestPath,restrictionError:A,status:f&&!A?"checked":"unchecked",parentId:c.id,data:k}});return[...p,...d,...v]},"afterScrollFolder"),Bp=o0;var jp=o((i,e,t)=>{i.filter(s=>s.type!=="root"&&s.parentId===e).forEach(s=>{s.status=t&&!(s.type==="file"&&s.restrictionError)?"checked":"unchecked",jp(i,s.id,t)})},"percolateDown"),zp=o((i,e)=>{let t=i.find(a=>a.id===e);if(t.type==="root")return;let r=i.filter(a=>a.type!=="root"&&a.parentId===t.id&&!(a.type==="file"&&a.restrictionError)),s=r.every(a=>a.status==="checked"),n=r.every(a=>a.status==="unchecked");s&&t.cached?t.status="checked":n?t.status="unchecked":t.status="partial",zp(i,t.parentId)},"percolateUp"),n0=o((i,e)=>{let t=Vo(i),r=t.filter(s=>s.type!=="root"&&e.includes(s.id));return r.forEach(s=>{let n=s.status==="checked"?"unchecked":"checked";s.type==="file"?s.status=s.restrictionError?"unchecked":n:s.status=n,jp(t,s.id,s.status==="checked")}),zp(t,r[0].parentId),t},"afterToggleCheckbox"),Hp=n0;var Ri={afterOpenFolder:Lp,afterScrollFolder:Bp,afterToggleCheckbox:Hp,afterFill:Mp};var a0=o(i=>{let{scrollHeight:e,scrollTop:t,offsetHeight:r}=i.target;return e-(t+r)<50},"shouldHandleScroll"),$o=a0;var qp=ae(Ge(),1);var l0=o(({i18n:i,item:e,toggleCheckbox:t,openFolder:r})=>{let s="restrictionError"in e&&e.restrictionError!=null&&e.status!=="checked";return l("li",{className:(0,qp.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":s},{"uppy-ProviderBrowserItem--noPreview":e.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":e.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":e.status==="partial"}),title:("restrictionError"in e?e.restrictionError:void 0)??void 0,children:[l("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox",onChange:o(()=>t(e,!1),"onChange"),checked:e.status==="checked","aria-label":e.data.name??i("unnamed"),disabled:s,"data-uppy-super-focusable":!0}),l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",disabled:s,"aria-label":e.data.name,onClick:o(()=>{e.data.isFolder&&r(e.id)},"onClick"),children:[l("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:l(ii,{itemIconString:e.data.icon})}),e.data.name??i("unnamed")]})]})},"SearchResultItem"),Vp=l0;var u0=o(({searchResults:i,toggleCheckbox:e,openFolder:t,i18n:r})=>i.length===0?l("div",{className:"uppy-Provider-empty",children:r("noFilesFound")}):l("div",{className:"uppy-ProviderBrowser-body",children:l("ul",{className:"uppy-ProviderBrowser-list",children:i.map(s=>l(Vp,{i18n:r,item:s,toggleCheckbox:e,openFolder:t},s.id))})}),"GlobalSearchView"),$p=u0;var Wp=ae(Ge(),1);function _a(i){let{openFolder:e,title:t,breadcrumbsIcon:r,breadcrumbs:s,i18n:n}=i;return l("div",{className:"uppy-Provider-breadcrumbs",children:[l("div",{className:"uppy-Provider-breadcrumbsIcon",children:r}),s.map((a,u)=>l(Re,{children:[l("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:o(()=>e(a.id),"onClick"),children:a.type==="root"?t:a.data.name??n("unnamed")},a.id),s.length===u+1?"":" / "]}))]})}o(_a,"Breadcrumbs");function ka({i18n:i,logout:e,username:t}){return l(Re,{children:[t&&l("span",{className:"uppy-ProviderBrowser-user",children:t},"username"),l("button",{type:"button",onClick:e,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",children:i("logOut")},"logout")]})}o(ka,"User");function Ea(i){return l("div",{className:"uppy-ProviderBrowser-header",children:l("div",{className:(0,Wp.default)("uppy-ProviderBrowser-headerBar",!i.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple"),children:[i.showBreadcrumbs&&l(_a,{openFolder:i.openFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon?.(),title:i.title,i18n:i.i18n}),l(ka,{logout:i.logout,username:i.username,i18n:i.i18n})]})})}o(Ea,"Header");function ar(){return l("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30",children:l("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"})})}o(ar,"defaultPickerIcon");var Gp=o(i=>({authenticated:void 0,partialTree:[{type:"root",id:i,cached:!1,nextPagePath:null}],currentFolderId:i,searchString:"",didFirstRender:!1,username:null,loading:!1}),"getDefaultState"),Ne=class i{static{o(this,"ProviderView")}static VERSION=Mo.version;static[Symbol.for("uppy test: searchDebounceMs")];plugin;provider;opts;isHandlingScroll=!1;previousCheckbox=null;#e;constructor(e,t){this.plugin=e,this.provider=t.provider;let r={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1,virtualList:!1};this.opts={...r,...t},this.openFolder=this.openFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.openSearchResultFolder=this.openSearchResultFolder.bind(this),this.clearSearchState=this.clearSearchState.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider);let s=Symbol.for("uppy test: searchDebounceMs"),n=i[s],a=n??500,u=n===0?{leading:!0,trailing:!0}:void 0;this.#e=(0,Kp.default)(this.#i,a,u)}resetPluginState(){this.plugin.setPluginState(Gp(this.plugin.rootFolderId))}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}get isLoading(){return this.plugin.getPluginState().loading}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}clearSearchState(){this.plugin.setPluginState({searchResults:void 0})}#t;async#r(e){this.#t?.abort();let t=new AbortController;this.#t=t;let r=o(()=>{t.abort()},"cancelRequest");try{this.plugin.uppy.on("dashboard:close-panel",r),this.plugin.uppy.on("cancel-all",r),await e(t.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",r),this.plugin.uppy.off("cancel-all",r),this.#t=void 0}}async#i(){let{partialTree:e,currentFolderId:t,searchString:r}=this.plugin.getPluginState(),s=e.find(n=>n.id===t);if(r.trim()===""){this.#t?.abort(),this.clearSearchState();return}this.setLoading(!0),await this.#r(async n=>{let a=s.type==="root"?void 0:t,{items:u}=await this.provider.search(r,{signal:n,path:a}),{partialTree:c}=this.plugin.getPluginState(),p=[...c];for(let f of u){let v=decodeURIComponent(f.requestPath).split("/").filter(A=>A.length>0),_=this.plugin.rootFolderId,k;v.forEach((A,F,R)=>{let U=v.slice(0,F+1),C=encodeURIComponent(`/${U.join("/")}`),Y=p.find(X=>X.id===C&&X.type!=="root");if(Y){_=C,k=Y.status==="checked";return}let $=F===R.length-1,H,Q=k?"checked":"unchecked";if($)if(f.isFolder)H={type:"folder",id:C,cached:!1,nextPagePath:null,status:Q,parentId:_,data:f};else{let X=this.validateSingleFile(f);H={type:"file",id:C,restrictionError:X,status:X?"unchecked":Q,parentId:_,data:f}}else H={type:"folder",id:C,cached:!1,nextPagePath:null,status:Q,parentId:_,data:{name:decodeURIComponent(A),icon:"folder",isFolder:!0}};p.push(H),_=C,k=Q==="checked"})}this.plugin.setPluginState({partialTree:p,searchResults:u.map(f=>f.requestPath)})}).catch(It(this.plugin.uppy)),this.setLoading(!1)}onSearchInput=o(e=>{this.plugin.setPluginState({searchString:e}),this.opts.supportsSearch&&this.#e()},"onSearchInput");async openSearchResultFolder(e){this.plugin.setPluginState({searchString:""}),await this.openFolder(e)}async openFolder(e){this.clearSearchState(),this.previousCheckbox=null;let{partialTree:t}=this.plugin.getPluginState(),r=t.find(s=>s.id===e);if(r.cached){this.plugin.setPluginState({currentFolderId:e,searchString:""});return}this.setLoading(!0),await this.#r(async s=>{let n=e,a=[];do{let{username:c,nextPagePath:p,items:f}=await this.provider.list(n,{signal:s});this.plugin.setPluginState({username:c}),n=p,a=a.concat(f),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:a.length}))}while(this.opts.loadAllFiles&&n);let u=Ri.afterOpenFolder(t,a,r,n,this.validateSingleFile);this.plugin.setPluginState({partialTree:u,currentFolderId:e,searchString:""})}).catch(It(this.plugin.uppy)),this.setLoading(!1)}async logout(){await this.#r(async e=>{let t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){let r=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(r,"info",7e3)}this.plugin.setPluginState({...Gp(this.plugin.rootFolderId),authenticated:!1})}}).catch(It(this.plugin.uppy))}async handleAuth(e){await this.#r(async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),await Promise.all([this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId)])}).catch(It(this.plugin.uppy)),this.setLoading(!1)}async handleScroll(e){let{partialTree:t,currentFolderId:r}=this.plugin.getPluginState(),s=t.find(n=>n.id===r);$o(e)&&!this.isHandlingScroll&&s.nextPagePath&&(this.isHandlingScroll=!0,await this.#r(async n=>{let{nextPagePath:a,items:u}=await this.provider.list(s.nextPagePath,{signal:n}),c=Ri.afterScrollFolder(t,r,u,a,this.validateSingleFile);this.plugin.setPluginState({partialTree:c})}).catch(It(this.plugin.uppy)),this.isHandlingScroll=!1)}validateSingleFile=o(e=>{let t=Ji(e);return this.plugin.uppy.validateSingleFile(t)},"validateSingleFile");async donePicking(){let{partialTree:e}=this.plugin.getPluginState();this.isLoading||(this.setLoading(!0),await this.#r(async t=>{let r=await Ri.afterFill(e,a=>this.provider.list(a,{signal:t}),this.validateSingleFile,a=>{this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:a}))});if(this.validateAggregateRestrictions(r)){this.plugin.setPluginState({partialTree:r});return}let n=Ho(r);jo(n,this.plugin,this.provider),this.resetPluginState()}).catch(It(this.plugin.uppy)),this.setLoading(!1))}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=zo(e.id,this.getDisplayedPartialTree(),t,this.previousCheckbox),n=Ri.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.previousCheckbox=e.id}getDisplayedPartialTree=o(()=>{let{partialTree:e,currentFolderId:t,searchString:r}=this.plugin.getPluginState(),s=e.filter(a=>a.type!=="root"&&a.parentId===t);return this.opts.supportsSearch||r.trim()===""?s:s.filter(a=>(a.data.name??this.plugin.uppy.i18n("unnamed")).toLowerCase().indexOf(r.trim().toLowerCase())!==-1)},"getDisplayedPartialTree");getBreadcrumbs=o(()=>{let{partialTree:e,currentFolderId:t}=this.plugin.getPluginState();return Ap(e,t)},"getBreadcrumbs");getSelectedAmount=o(()=>{let{partialTree:e}=this.plugin.getPluginState();return Bo(e)},"getSelectedAmount");validateAggregateRestrictions=o(e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)},"validateAggregateRestrictions");#s(){let{i18n:e}=this.plugin.uppy,{searchResults:t,partialTree:r}=this.plugin.getPluginState(),s=new Map;r.forEach(a=>{a.type!=="root"&&s.set(a.id,a)});let n=t.map(a=>{let u=s.get(a);if(u==null)throw new Error("Partial tree not complete");return u});return l($p,{searchResults:n,openFolder:this.openSearchResultFolder,toggleCheckbox:this.toggleCheckbox,i18n:e})}render(e,t={}){let{didFirstRender:r}=this.plugin.getPluginState(),{i18n:s}=this.plugin.uppy;r||(this.plugin.setPluginState({didFirstRender:!0}),this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId));let n={...this.opts,...t},{authenticated:a,loading:u}=this.plugin.getPluginState(),c=this.plugin.icon||ar;if(a===!1)return l(ls,{pluginName:this.plugin.title,pluginIcon:c,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,renderForm:n.renderAuthForm,loading:u});let{partialTree:p,username:f,searchString:d,searchResults:v}=this.plugin.getPluginState(),_=this.getBreadcrumbs();return l("div",{className:(0,Xp.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${n.viewType}`),children:[l(Ea,{showBreadcrumbs:n.showBreadcrumbs,openFolder:this.openFolder,breadcrumbs:_,pluginIcon:c,title:this.plugin.title,logout:this.logout,username:f,i18n:s}),n.showFilter&&l(rr,{value:d,onChange:o(k=>this.onSearchInput(k),"onChange"),onSubmit:o(()=>{},"onSubmit"),inputLabel:s("filter"),i18n:s}),v?this.#s():l(Lo,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),openFolder:this.openFolder,virtualList:n.virtualList,noResultsLabel:s("noFilesFound"),handleScroll:this.handleScroll,viewType:n.viewType,showTitles:n.showTitles,i18n:this.plugin.uppy.i18n,isLoading:u,utmSource:"Companion"}),l(cs,{partialTree:p,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:s,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var Yp=ae(Ge(),1);function c0({value:i,onChange:e,onSubmit:t,inputLabel:r,loading:s=!1,children:n}){let{formId:a}=ir(t);return l("section",{className:"uppy-SearchProvider",children:[l("input",{className:"uppy-u-reset uppy-c-textInput uppy-SearchProvider-input",type:"search","aria-label":r,placeholder:r,value:i,onInput:o(u=>e(u.target.value),"onInput"),form:a,disabled:s,"data-uppy-super-focusable":!0}),l("button",{disabled:s,className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-SearchProvider-searchButton",type:"submit",form:a,children:n})]})}o(c0,"SearchView");var Wo=c0;var p0={loading:!1,searchString:"",partialTree:[{type:"root",id:null,cached:!1,nextPagePath:null}],currentFolderId:null,isInputMode:!0},d0={viewType:"grid",showTitles:!0,showFilter:!0,utmSource:"Companion"},ri=class{static{o(this,"SearchProviderView")}static VERSION=Mo.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider,this.opts={...d0,...t},this.setSearchString=this.setSearchString.bind(this),this.search=this.search.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.render=this.render.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}resetPluginState(){this.plugin.setPluginState(p0)}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}async search(){let{searchString:e}=this.plugin.getPluginState();if(e!==""){this.setLoading(!0);try{let t=await this.provider.search(e),r=[{type:"root",id:null,cached:!1,nextPagePath:t.nextPageQuery},...t.items.map(s=>({type:"file",id:s.requestPath,status:"unchecked",parentId:null,data:s}))];this.plugin.setPluginState({partialTree:r,isInputMode:!1})}catch(t){It(this.plugin.uppy)(t)}this.setLoading(!1)}}async handleScroll(e){let{partialTree:t,searchString:r}=this.plugin.getPluginState(),s=t.find(n=>n.type==="root");if($o(e)&&!this.isHandlingScroll&&s.nextPagePath){this.isHandlingScroll=!0;try{let n=await this.provider.search(r,s.nextPagePath),a={...s,nextPagePath:n.nextPageQuery},u=t.filter(p=>p.type!=="root"),c=[a,...u,...n.items.map(p=>({type:"file",id:p.requestPath,status:"unchecked",parentId:null,data:p}))];this.plugin.setPluginState({partialTree:c})}catch(n){It(this.plugin.uppy)(n)}this.isHandlingScroll=!1}}async donePicking(){let{partialTree:e}=this.plugin.getPluginState(),t=Ho(e);jo(t,this.plugin,this.provider),this.resetPluginState()}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=zo(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=Ri.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}validateSingleFile=o(e=>{let t=Ji(e);return this.plugin.uppy.validateSingleFile(t)},"validateSingleFile");getDisplayedPartialTree=o(()=>{let{partialTree:e}=this.plugin.getPluginState();return e.filter(t=>t.type!=="root")},"getDisplayedPartialTree");setSearchString=o(e=>{this.plugin.setPluginState({searchString:e}),e===""&&this.plugin.setPluginState({partialTree:[]})},"setSearchString");validateAggregateRestrictions=o(e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)},"validateAggregateRestrictions");render(e,t={}){let{isInputMode:r,searchString:s,loading:n,partialTree:a}=this.plugin.getPluginState(),{i18n:u}=this.plugin.uppy,c={...this.opts,...t};return r?l(Wo,{value:s,onChange:this.setSearchString,onSubmit:this.search,inputLabel:u("enterTextToSearch"),children:u("searchImages")}):l("div",{className:(0,Yp.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${c.viewType}`),children:[c.showFilter&&l(rr,{value:s,onChange:this.setSearchString,onSubmit:this.search,inputLabel:u("search"),i18n:u}),l(Lo,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),handleScroll:this.handleScroll,openFolder:o(async()=>{},"openFolder"),noResultsLabel:u("noSearchResults"),viewType:c.viewType,showTitles:c.showTitles,isLoading:n,i18n:u,virtualList:!1,utmSource:this.opts.utmSource}),l(cs,{partialTree:a,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:u,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var Jp={name:"@uppy/audio",description:"Uppy plugin that records audio using the device\u2019s microphone.",version:"3.1.0",license:"MIT",style:"dist/style.min.css",keywords:["file uploader","uppy","uppy-plugin","audio","microphone","sound","record","mediarecorder"],type:"module",sideEffects:["*.css"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",preact:"^10.5.13"},devDependencies:{cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"}};var Qp={strings:{pluginNameAudio:"Audio",startAudioRecording:"Begin audio recording",stopAudioRecording:"Stop audio recording",allowAudioAccessTitle:"Please allow access to your microphone",allowAudioAccessDescription:"In order to record audio, please allow microphone access for this site.",noAudioTitle:"Microphone Not Available",noAudioDescription:"In order to record audio, please connect a microphone or another audio input device",recordingStoppedMaxSize:"Recording stopped because the file size is about to exceed the limit",recordingLength:"Recording length %{recording_length}",submitRecordedFile:"Submit recorded file",discardRecordedFile:"Discard recorded file"}};var Zp=o(i=>{let{icon:e,hasAudio:t,i18n:r}=i;return l("div",{className:"uppy-Audio-permissons",children:[l("div",{className:"uppy-Audio-permissonsIcon",children:e()}),l("div",{className:"uppy-Audio-title",children:r(t?"allowAudioAccessTitle":"noAudioTitle")}),l("p",{children:r(t?"allowAudioAccessDescription":"noAudioDescription")})]})},"default");var ed=o(({currentDeviceId:i,audioSources:e,onChangeSource:t})=>l("div",{className:"uppy-Audio-videoSource",children:l("select",{className:"uppy-u-reset uppy-Audio-audioSource-select",onChange:o(r=>{t(r.target.value)},"onChange"),children:e.map(r=>l("option",{value:r.deviceId,selected:r.deviceId===i,children:r.label},r.deviceId))})}),"default");function td(i){return typeof i=="function"}o(td,"isFunction");function ms(i){return td(i)?i():i}o(ms,"result");var gs=class{static{o(this,"AudioOscilloscope")}canvas;canvasContext;width;height;analyser;bufferLength;dataArray;onDrawFrame;streamSource;audioContext;source;constructor(e,t={}){let r=t.canvas||{},s=t.canvasContext||{};this.analyser=null,this.bufferLength=0,this.canvas=e,this.width=ms(r.width)||this.canvas.width,this.height=ms(r.height)||this.canvas.height,this.canvas.width=this.width,this.canvas.height=this.height,this.canvasContext=this.canvas.getContext("2d"),this.canvasContext.fillStyle=ms(s.fillStyle)||"rgb(255, 255, 255)",this.canvasContext.strokeStyle=ms(s.strokeStyle)||"rgb(0, 0, 0)",this.canvasContext.lineWidth=ms(s.lineWidth)||1,this.onDrawFrame=td(t.onDrawFrame)?t.onDrawFrame:()=>{}}addSource(e){this.streamSource=e,this.audioContext=this.streamSource.context,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2048,this.bufferLength=this.analyser.frequencyBinCount,this.source=this.audioContext.createBufferSource(),this.dataArray=new Uint8Array(this.bufferLength),this.analyser.getByteTimeDomainData(this.dataArray),this.streamSource.connect(this.analyser)}draw(){let{analyser:e,dataArray:t,bufferLength:r}=this,s=this.canvasContext,n=this.width,a=this.height;e&&e.getByteTimeDomainData(t),s.fillRect(0,0,n,a),s.beginPath();let u=n*1/r,c=0;r||s.moveTo(0,this.height/2);for(let p=0;p<r;p++){let d=t[p]/128*(a/2);p===0?s.moveTo(c,d):s.lineTo(c,d),c+=u}s.lineTo(n,a/2),s.stroke(),this.onDrawFrame(this),requestAnimationFrame(this.#e)}#e=o(()=>this.draw(),"#draw")};function f0({onDiscard:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button",type:"button",title:e("discardRecordedFile"),"aria-label":e("discardRecordedFile"),onClick:i,"data-uppy-super-focusable":!0,children:l("svg",{width:"13",height:"13",viewBox:"0 0 13 13",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",className:"uppy-c-icon",children:l("g",{fill:"#FFF",fillRule:"evenodd",children:[l("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),l("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"})]})})})}o(f0,"DiscardButton");var id=f0;function Ta({recording:i,onStartRecording:e,onStopRecording:t,i18n:r}){return i?l("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button",type:"button",title:r("stopAudioRecording"),"aria-label":r("stopAudioRecording"),onClick:t,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:l("rect",{x:"15",y:"15",width:"70",height:"70"})})}):l("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button",type:"button",title:r("startAudioRecording"),"aria-label":r("startAudioRecording"),onClick:e,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14px",height:"20px",viewBox:"0 0 14 20",children:l("path",{d:"M7 14c2.21 0 4-1.71 4-3.818V3.818C11 1.71 9.21 0 7 0S3 1.71 3 3.818v6.364C3 12.29 4.79 14 7 14zm6.364-7h-.637a.643.643 0 0 0-.636.65V9.6c0 3.039-2.565 5.477-5.6 5.175-2.645-.264-4.582-2.692-4.582-5.407V7.65c0-.36-.285-.65-.636-.65H.636A.643.643 0 0 0 0 7.65v1.631c0 3.642 2.544 6.888 6.045 7.382v1.387H3.818a.643.643 0 0 0-.636.65v.65c0 .36.285.65.636.65h6.364c.351 0 .636-.29.636-.65v-.65c0-.36-.285-.65-.636-.65H7.955v-1.372C11.363 16.2 14 13.212 14 9.6V7.65c0-.36-.285-.65-.636-.65z",fill:"#FFF","fill-rule":"nonzero"})})})}o(Ta,"RecordButton");function Ca(i){return`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}o(Ca,"formatSeconds");function Aa({recordingLengthSeconds:i}){let e=Ca(i);return l("span",{children:e})}o(Aa,"RecordingLength");function m0({onSubmit:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button uppy-Audio-button--submit",type:"button",title:e("submitRecordedFile"),"aria-label":e("submitRecordedFile"),onClick:i,"data-uppy-super-focusable":!0,children:l("svg",{width:"12",height:"9",viewBox:"0 0 12 9",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon",children:l("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})})}o(m0,"SubmitButton");var rd=m0;function Ra(i){let{stream:e,recordedAudio:t,onStop:r,recording:s,supportsRecording:n,audioSources:a,showAudioSourceDropdown:u,onSubmit:c,i18n:p,onStartRecording:f,onStopRecording:d,onDiscardRecordedAudio:v,recordingLengthSeconds:_}=i,k=Ye(null),A=Ye();ze(()=>()=>{A.current=null,r()},[r]),ze(()=>{if(!t&&(A.current=new gs(k.current,{canvas:{width:600,height:600},canvasContext:{lineWidth:2,fillStyle:"rgb(0,0,0)",strokeStyle:"green"}}),A.current.draw(),e)){let Y=new AudioContext().createMediaStreamSource(e);A.current.addSource(Y)}},[t,e]);let F=t!=null,R=!F&&n,U=u&&!F&&a&&a.length>1;return l("div",{className:"uppy-Audio-container",children:[l("div",{className:"uppy-Audio-audioContainer",children:F?l("audio",{className:"uppy-Audio-player",controls:!0,src:t}):l("canvas",{ref:k,className:"uppy-Audio-canvas"})}),l("div",{className:"uppy-Audio-footer",children:[l("div",{className:"uppy-Audio-audioSourceContainer",children:U?ed(i):null}),l("div",{className:"uppy-Audio-buttonContainer",children:[R&&l(Ta,{recording:s,onStartRecording:f,onStopRecording:d,i18n:p}),F&&l(rd,{onSubmit:c,i18n:p}),F&&l(id,{onDiscard:v,i18n:p})]}),l("div",{className:"uppy-Audio-recordingLength",children:!F&&l(Aa,{recordingLengthSeconds:_})})]})]})}o(Ra,"RecordingScreen");function Ua(){return typeof MediaRecorder=="function"&&typeof MediaRecorder.prototype?.start=="function"}o(Ua,"supportsMediaRecorder");var lr=class extends re{static{o(this,"Audio")}static VERSION=Jp.version;#e;icon;#t=null;#r=!1;#i=null;#s=null;#l=null;#o;#n;constructor(e,t){super(e,t),this.#o=navigator.mediaDevices,this.#n=this.#o!=null,this.id=this.opts.id||"Audio",this.type="acquirer",this.icon=()=>l("svg",{className:"uppy-DashboardTab-iconAudio","aria-hidden":"true",focusable:"false",width:"32px",height:"32px",viewBox:"0 0 32 32",children:l("path",{d:"M21.143 12.297c.473 0 .857.383.857.857v2.572c0 3.016-2.24 5.513-5.143 5.931v2.64h2.572a.857.857 0 110 1.714H12.57a.857.857 0 110-1.714h2.572v-2.64C12.24 21.24 10 18.742 10 15.726v-2.572a.857.857 0 111.714 0v2.572A4.29 4.29 0 0016 20.01a4.29 4.29 0 004.286-4.285v-2.572c0-.474.384-.857.857-.857zM16 6.5a3 3 0 013 3v6a3 3 0 01-6 0v-6a3 3 0 013-3z",fill:"currentcolor","fill-rule":"nonzero"})}),this.defaultLocale=Qp,this.opts={...t},this.i18nInit(),this.title=this.i18n("pluginNameAudio"),this.setPluginState({hasAudio:!1,audioReady:!1,cameraError:null,recordingLengthSeconds:0,audioSources:[],currentDeviceId:null})}#a(){return this.#o?this.#o.enumerateDevices().then(e=>e.some(t=>t.kind==="audioinput")):Promise.resolve(!1)}#c=o(e=>{if(!this.#n)return Promise.reject(new Error("Microphone access not supported"));this.#r=!0,this.#a().then(t=>(this.setPluginState({hasAudio:t}),this.#o.getUserMedia({audio:!0}).then(r=>{this.#t=r;let s=null,n=r.getAudioTracks();e?.deviceId?s=n.findLast(a=>a.getSettings().deviceId===e.deviceId):s=n[0].getSettings().deviceId,this.#m(),this.setPluginState({currentDeviceId:s,audioReady:!0})}).catch(r=>{this.setPluginState({audioReady:!1,cameraError:r}),this.uppy.info(r.message,"error")})))},"#start");#u=o(()=>{this.#s=new MediaRecorder(this.#t),this.#i=[];let e=!1;this.#s.addEventListener("dataavailable",t=>{this.#i.push(t.data);let{restrictions:r}=this.uppy.opts;if(this.#i.length>1&&r.maxFileSize!=null&&!e){let s=this.#i.reduce((c,p)=>c+p.size,0),a=(s-this.#i[0].size)/(this.#i.length-1)*3,u=Math.max(0,r.maxFileSize-a);s>u&&(e=!0,this.uppy.info(this.i18n("recordingStoppedMaxSize"),"warning",4e3),this.#d())}}),this.#s.start(500),this.#e=setInterval(()=>{let t=this.getPluginState().recordingLengthSeconds;this.setPluginState({recordingLengthSeconds:t+1})},1e3),this.setPluginState({isRecording:!0})},"#startRecording");#d=o(()=>new Promise(t=>{this.#s.addEventListener("stop",()=>{t()}),this.#s.stop(),clearInterval(this.#e),this.setPluginState({recordingLengthSeconds:0})}).then(()=>(this.setPluginState({isRecording:!1}),this.#g())).then(t=>{try{this.#l=t,this.setPluginState({recordedAudio:URL.createObjectURL(t.data)})}catch(r){r.isRestriction||this.uppy.log(r)}}).then(()=>{this.#i=null,this.#s=null},t=>{throw this.#i=null,this.#s=null,t}),"#stopRecording");#p=o(()=>{this.setPluginState({recordedAudio:null}),this.#l=null},"#discardRecordedAudio");#h=o(()=>{try{this.#l&&this.uppy.addFile(this.#l)}catch(e){e.isRestriction||this.uppy.log(e,"warning")}},"#submit");#f=o(async()=>{this.#t&&this.#t.getAudioTracks().forEach(t=>t.stop()),this.#s&&await new Promise(e=>{this.#s.addEventListener("stop",e,{once:!0}),this.#s.stop(),clearInterval(this.#e)}),this.#i=null,this.#s=null,this.#r=!1,this.#t=null,this.setPluginState({recordedAudio:null,isRecording:!1,recordingLengthSeconds:0})},"#stop");#g(){let e=this.#i.find(a=>a.type?.length>0).type,t=xt(e);if(!t)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${e}"`));let r=`audio-${Date.now()}.${t}`,s=new Blob(this.#i,{type:e}),n={source:this.id,name:r,data:new Blob([s],{type:e}),type:e};return Promise.resolve(n)}#b=o(e=>{this.#f(),this.#c({deviceId:e})},"#changeSource");#m=o(()=>{this.#o.enumerateDevices().then(e=>{this.setPluginState({audioSources:e.filter(t=>t.kind==="audioinput")})})},"#updateSources");render(){this.#r||this.#c();let e=this.getPluginState();return!e.audioReady||!e.hasAudio?l(Zp,{icon:this.icon,i18n:this.i18n,hasAudio:e.hasAudio}):l(Ra,{...e,onChangeSource:this.#b,onStartRecording:this.#u,onStopRecording:this.#d,onDiscardRecordedAudio:this.#p,onSubmit:this.#h,onStop:this.#f,i18n:this.i18n,showAudioSourceDropdown:this.opts.showAudioSourceDropdown,supportsRecording:Ua(),recording:e.isRecording,stream:this.#t})}install(){this.setPluginState({audioReady:!1,recordingLengthSeconds:0});let{target:e}=this.opts;e&&this.mount(e,this),this.#o&&(this.#m(),this.#o.ondevicechange=()=>{if(this.#m(),this.#t){let t=!0,{audioSources:r,currentDeviceId:s}=this.getPluginState();r.forEach(n=>{s===n.deviceId&&(t=!1)}),t&&(this.#f(),this.#c())}})}uninstall(){this.#t&&this.#f(),this.unmount()}};var sd={name:"@uppy/aws-s3",description:"Upload to Amazon S3 with Uppy",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","aws s3","amazon s3","s3","uppy","uppy-plugin","multipart"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/utils":"workspace:^"},devDependencies:{"@aws-sdk/client-s3":"^3.362.0","@aws-sdk/s3-request-presigner":"^3.362.0","@uppy/core":"workspace:^",jsdom:"^26.1.0",nock:"^13.1.0",typescript:"^5.8.3",vitest:"^3.2.4","whatwg-fetch":"3.6.2"},peerDependencies:{"@uppy/core":"workspace:^"}};function y0({method:i="PUT",CanonicalUri:e="/",CanonicalQueryString:t="",SignedHeaders:r,HashedPayload:s}){let n=Object.keys(r).map(a=>a.toLowerCase()).sort();return[i,e,t,...n.map(a=>`${a}:${r[a]}`),"",n.join(";"),s].join(`
`)}o(y0,"createCanonicalRequest");var Oa=new TextEncoder,Da={name:"HMAC",hash:"SHA-256"};async function v0(i){let{subtle:e}=globalThis.crypto;return e.digest(Da.hash,Oa.encode(i))}o(v0,"digest");async function b0(i){let{subtle:e}=globalThis.crypto;return e.importKey("raw",typeof i=="string"?Oa.encode(i):i,Da,!1,["sign"])}o(b0,"generateHmacKey");function od(i){let e=new Uint8Array(i),t="";for(let r=0;r<e.length;r++)t+=e[r].toString(16).padStart(2,"0");return t}o(od,"arrayBufferToHexString");async function ys(i,e){let{subtle:t}=globalThis.crypto;return t.sign(Da,await b0(i),Oa.encode(e))}o(ys,"hash");async function Ia({accountKey:i,accountSecret:e,sessionToken:t,bucketName:r,Key:s,Region:n,expires:a,uploadId:u,partNumber:c}){let f=`s3.${n}.amazonaws.com`,d=`/${r}/${encodeURI(s).replace(/[;?:@&=+$,#!'()*]/g,Z=>`%${Z.charCodeAt(0).toString(16).toUpperCase()}`)}`,v="UNSIGNED-PAYLOAD",_=new Date().toISOString().replace(/[-:]|\.\d+/g,""),k=_.slice(0,8),A=`${k}/${n}/s3/aws4_request`,F=new URL(`https://${f}${d}`);F.searchParams.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),F.searchParams.set("X-Amz-Content-Sha256",v),F.searchParams.set("X-Amz-Credential",`${i}/${A}`),F.searchParams.set("X-Amz-Date",_),F.searchParams.set("X-Amz-Expires",a),F.searchParams.set("X-Amz-Security-Token",t),F.searchParams.set("X-Amz-SignedHeaders","host"),c&&F.searchParams.set("partNumber",c),u&&F.searchParams.set("uploadId",u),F.searchParams.set("x-id",c&&u?"UploadPart":"PutObject");let R=y0({CanonicalUri:d,CanonicalQueryString:F.search.slice(1),SignedHeaders:{host:f},HashedPayload:v}),U=od(await v0(R)),C=["AWS4-HMAC-SHA256",_,A,U].join(`
`),Y=await ys(`AWS4${e}`,k),$=await ys(Y,n),H=await ys($,"s3"),Q=await ys(H,"aws4_request"),X=od(await ys(Q,C));return F.searchParams.set("X-Amz-Signature",X),F}o(Ia,"createSignedURL");var w0=1024*1024,nd={getChunkSize(i){return Math.ceil(i.size/1e4)},onProgress(){},onPartComplete(){},onSuccess(){},onError(i){throw i}};function S0(i){if(typeof i=="string")return parseInt(i,10);if(typeof i=="number")return i;throw new TypeError("Expected a number")}o(S0,"ensureInt");var vs=Symbol("pausing upload, not an actual error"),Na=class{static{o(this,"MultipartUploader")}options;#e=new jr;#t=[];#r=[];#i;#s;#l=!1;#o;#n;#a;#c;#u=o(e=>e?.cause===vs?null:this.#o(e),"#onReject");#d=1e4;#p=5*w0;constructor(e,t){this.options={...nd,...t},this.options.getChunkSize??=nd.getChunkSize,this.#i=e,this.#s=t.file,this.#n=this.options.onSuccess,this.#o=this.options.onError,this.#a=this.options.shouldUseMultipart,this.#c=t.uploadId&&t.key,this.#h()}#h(){let e=this.#i.size,t=typeof this.#a=="function"?this.#a(this.#s):!!this.#a;if(t&&e>this.#p){let r=Math.max(this.options.getChunkSize(this.#i),this.#p),s=Math.floor(e/r);s>this.#d&&(s=this.#d,r=e/this.#d),this.#t=Array(s);for(let n=0,a=0;n<e;n+=r,a++){let u=Math.min(e,n+r),c=o(()=>{let p=n;return this.#i.slice(p,u)},"getData");if(this.#t[a]={getData:c,onProgress:this.#b(a),onComplete:this.#m(a),shouldUseMultipart:t},this.#c){let p=n+r>e?e-n:r;this.#t[a].setAsUploaded=()=>{this.#t[a]=null,this.#r[a].uploaded=p}}}}else this.#t=[{getData:o(()=>this.#i,"getData"),onProgress:this.#b(0),onComplete:this.#m(0),shouldUseMultipart:t}];this.#r=this.#t.map(()=>({uploaded:0}))}#f(){this.options.companionComm.uploadFile(this.#s,this.#t,this.#e.signal).then(this.#n,this.#u),this.#l=!0}#g(){this.options.companionComm.resumeUploadFile(this.#s,this.#t,this.#e.signal).then(this.#n,this.#u)}#b=o(e=>t=>{if(!t.lengthComputable)return;this.#r[e].uploaded=S0(t.loaded);let r=this.#r.reduce((s,n)=>s+n.uploaded,0);this.options.onProgress(r,this.#i.size)},"#onPartProgress");#m=o(e=>t=>{this.#t[e]=null,this.#r[e].etag=t,this.#r[e].done=!0;let r={PartNumber:e+1,ETag:t};this.options.onPartComplete(r)},"#onPartComplete");#y(){this.#e.abort(),this.options.companionComm.abortFileUpload(this.#s).catch(e=>this.options.log(e))}start(){this.#l?(this.#e.signal.aborted||this.#e.abort(vs),this.#e=new jr,this.#g()):this.#c?(this.options.companionComm.restoreUploadFile(this.#s,{uploadId:this.options.uploadId,key:this.options.key}),this.#g()):this.#f()}pause(){this.#e.abort(vs),this.#e=new jr}abort(e){e?.really?this.#y():this.pause()}[Symbol.for("uppy test: getChunkState")](){return this.#r}},ad=Na;function Xe(i){if(i?.aborted)throw zr("The operation was aborted",{cause:i.reason})}o(Xe,"throwIfAborted");function x0(i){let e=new URL(i);return e.search="",e.hash="",e.href}o(x0,"removeMetadataFromURL");var Go=class{static{o(this,"HTTPCommunicationQueue")}#e;#t=new WeakMap;#r;#i;#s;#l;#o;#n;#a;#c;#u;#d;#p;constructor(e,t,r,s){this.#n=e,this.#u=r,this.#p=s,this.setOptions(t)}setOptions(e){let t=this.#n;"abortMultipartUpload"in e&&(this.#e=t.wrapPromiseFunction(e.abortMultipartUpload,{priority:1})),"createMultipartUpload"in e&&(this.#r=t.wrapPromiseFunction(e.createMultipartUpload,{priority:-1})),"signPart"in e&&(this.#i=t.wrapPromiseFunction(e.signPart)),"listParts"in e&&(this.#l=t.wrapPromiseFunction(e.listParts)),"completeMultipartUpload"in e&&(this.#c=t.wrapPromiseFunction(e.completeMultipartUpload,{priority:1})),"retryDelays"in e&&(this.#a=e.retryDelays??[]),"uploadPartBytes"in e&&(this.#d=t.wrapPromiseFunction(e.uploadPartBytes,{priority:1/0})),"getUploadParameters"in e&&(this.#s=t.wrapPromiseFunction(e.getUploadParameters))}async#h(e,t){let r=this.#n,s=e?.source?.status;if(s==null)return!1;if(s===403&&e.message==="Request has expired"){if(!r.isPaused){if(r.limit===1||this.#o==null){let n=t.next();if(n==null||n.done)return!1;this.#o=n.value}r.rateLimit(0),await new Promise(n=>setTimeout(n,this.#o))}}else if(s===429){if(!r.isPaused){let n=t.next();if(n==null||n.done)return!1;r.rateLimit(n.value)}}else{if(s>400&&s<500&&s!==409)return!1;if(typeof navigator<"u"&&navigator.onLine===!1)r.isPaused||(r.pause(),window.addEventListener("online",()=>{r.resume()},{once:!0}));else{let n=t.next();if(n==null||n.done)return!1;await new Promise(a=>setTimeout(a,n.value))}}return!0}async getUploadId(e,t){let r;for(;;){if(e.data==null)throw new Error("File data is empty");if(r=this.#t.get(e.data),r==null)break;try{return await r}catch{}}let s=this.#r(this.#p(e),t),n=o(()=>{if(e.data==null)throw new Error("File data is empty");s.abort(t.reason),this.#t.delete(e.data)},"abortPromise");return t.addEventListener("abort",n,{once:!0}),this.#t.set(e.data,s),s.then(async a=>{if(t.removeEventListener("abort",n),this.#u(e,a),e.data==null)throw new Error("File data is empty");this.#t.set(e.data,a)},()=>{if(t.removeEventListener("abort",n),e.data==null)throw new Error("File data is empty");this.#t.delete(e.data)}),s}async abortFileUpload(e){if(e.data==null)throw new Error("File data is empty");let t=this.#t.get(e.data);if(t==null)return;this.#t.delete(e.data),this.#u(e,Object.create(null));let r;try{r=await t}catch{return}await this.#e(this.#p(e),r)}async#f(e,t,r){let{method:s="POST",url:n,fields:a,headers:u}=await this.#s(this.#p(e),{signal:r}).abortOn(r),c,p=t.getData();if(s.toUpperCase()==="POST"){let k=new FormData;Object.entries(a).forEach(([A,F])=>k.set(A,F)),k.set("file",p),c=k}else c=p;let{onProgress:f,onComplete:d}=t,v=await this.#d({signature:{url:n,headers:u,method:s},body:c,size:p.size,onProgress:f,onComplete:d,signal:r}).abortOn(r),_=a?.key;return this.#u(e,{key:_}),{...v,location:v.location??x0(n),bucket:a?.bucket,key:_}}async uploadFile(e,t,r){if(Xe(r),t.length===1&&!t[0].shouldUseMultipart)return this.#f(e,t[0],r);let{uploadId:s,key:n}=await this.getUploadId(e,r);Xe(r);try{let a=await Promise.all(t.map((u,c)=>this.uploadChunk(e,c+1,u,r)));return Xe(r),await this.#c(this.#p(e),{key:n,uploadId:s,parts:a,signal:r},r).abortOn(r)}catch(a){throw a?.cause!==vs&&a?.name!=="AbortError"&&this.abortFileUpload(e),a}}restoreUploadFile(e,t){if(e.data==null)throw new Error("File data is empty");this.#t.set(e.data,t)}async resumeUploadFile(e,t,r){if(Xe(r),t.length===1&&t[0]!=null&&!t[0].shouldUseMultipart)return this.#f(e,t[0],r);let{uploadId:s,key:n}=await this.getUploadId(e,r);Xe(r);let a=await this.#l(this.#p(e),{uploadId:s,key:n,signal:r},r).abortOn(r);Xe(r);let u=await Promise.all(t.map((c,p)=>{let f=p+1,d=a.find(({PartNumber:v})=>v===f);return d==null?this.uploadChunk(e,f,c,r):(c?.setAsUploaded?.(),{PartNumber:f,ETag:d.ETag})}));return Xe(r),this.#c(this.#p(e),{key:n,uploadId:s,parts:u,signal:r},r).abortOn(r)}async uploadChunk(e,t,r,s){Xe(s);let{uploadId:n,key:a}=await this.getUploadId(e,s),u=this.#a.values(),c=this.#a.values(),p=o(()=>{let f=u.next();return f==null||f.done?null:f.value},"shouldRetrySignature");for(;;){Xe(s);let f=r.getData(),{onProgress:d,onComplete:v}=r,_;try{_=await this.#i(this.#p(e),{uploadId:n,key:a,partNumber:t,body:f,signal:s}).abortOn(s)}catch(k){let A=p();if(A==null||s.aborted)throw k;await new Promise(F=>setTimeout(F,A));continue}Xe(s);try{return{PartNumber:t,...await this.#d({signature:_,body:f,size:f.size,onProgress:d,onComplete:v,signal:s}).abortOn(s)}}catch(k){if(!await this.#h(k,c))throw k}}}};function ur(i){if(i?.error){let e=new Error(i.message);throw Object.assign(e,i.error),e}return i}o(ur,"assertServerError");function ld(i){let e=i.Expiration;if(e){let t=Math.floor((new Date(e)-Date.now())/1e3);if(t>9)return t}}o(ld,"getExpiry");function ud({meta:i,allowedMetaFields:e,querify:t=!1}){let r=e??Object.keys(i);return i?Object.fromEntries(r.filter(s=>i[s]!=null).map(s=>{let n=t?`metadata[${s}]`:s,a=String(i[s]);return[n,a]})):{}}o(ud,"getAllowedMetadata");var P0={allowedMetaFields:!0,limit:6,getTemporarySecurityCredentials:!1,shouldUseMultipart:o((i=>(i.size||0)>100*1024*1024),"shouldUseMultipart"),retryDelays:[0,1e3,3e3,5e3]},bs=class i extends xe{static{o(this,"AwsS3Multipart")}static VERSION=sd.version;#e;#t;requests;uploaderEvents;uploaders;constructor(e,t){super(e,{...P0,uploadPartBytes:i.uploadPartBytes,createMultipartUpload:null,listParts:null,abortMultipartUpload:null,completeMultipartUpload:null,signPart:null,getUploadParameters:null,...t}),this.type="uploader",this.id=this.opts.id||"AwsS3Multipart",this.#r(t);let r={createMultipartUpload:this.createMultipartUpload,listParts:this.listParts,abortMultipartUpload:this.abortMultipartUpload,completeMultipartUpload:this.completeMultipartUpload,signPart:t?.getTemporarySecurityCredentials?this.createSignedURL:this.signPart,getUploadParameters:t?.getTemporarySecurityCredentials?this.createSignedURL:this.getUploadParameters};for(let s of Object.keys(r))this.opts[s]==null&&(this.opts[s]=r[s].bind(this));this.requests=this.opts.rateLimitedQueue??new ft(this.opts.limit),this.#e=new Go(this.requests,this.opts,this.#o,this.#n),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null)}[Symbol.for("uppy test: getClient")](){return this.#t}#r(e){e==null||!("endpoint"in e||"companionUrl"in e||"headers"in e||"companionHeaders"in e||"cookiesRule"in e||"companionCookiesRule"in e)||("companionUrl"in e&&!("endpoint"in e)&&this.uppy.log("`companionUrl` option has been removed in @uppy/aws-s3, use `endpoint` instead.","warning"),"companionHeaders"in e&&!("headers"in e)&&this.uppy.log("`companionHeaders` option has been removed in @uppy/aws-s3, use `headers` instead.","warning"),"companionCookiesRule"in e&&!("cookiesRule"in e)&&this.uppy.log("`companionCookiesRule` option has been removed in @uppy/aws-s3, use `cookiesRule` instead.","warning"),"endpoint"in e?this.#t=new Je(this.uppy,{pluginId:this.id,provider:"AWS",companionUrl:this.opts.endpoint,companionHeaders:this.opts.headers,companionCookiesRule:this.opts.cookiesRule}):("headers"in e&&this.#d(),"cookiesRule"in e&&(this.#t.opts.companionCookiesRule=e.cookiesRule)))}setOptions(e){this.#e.setOptions(e),super.setOptions(e),this.#r(e)}resetUploaderReferences(e,t){this.uploaders[e]&&(this.uploaders[e].abort({really:t?.abort||!1}),this.uploaders[e]=null),this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null)}#i(e){if(!this.#t)throw new Error(`Expected a \`endpoint\` option containing a URL, or if you are not using Companion, a custom \`${e}\` implementation.`)}createMultipartUpload(e,t){this.#i("createMultipartUpload"),Xe(t);let r=At(this.opts.allowedMetaFields,e.meta),s=ud({meta:e.meta,allowedMetaFields:r});return this.#t.post("s3/multipart",{filename:e.name,type:e.type,metadata:s},{signal:t}).then(ur)}listParts(e,{key:t,uploadId:r,signal:s},n){s??=n,this.#i("listParts"),Xe(s);let a=encodeURIComponent(t);return this.#t.get(`s3/multipart/${encodeURIComponent(r)}?key=${a}`,{signal:s}).then(ur)}completeMultipartUpload(e,{key:t,uploadId:r,parts:s,signal:n},a){n??=a,this.#i("completeMultipartUpload"),Xe(n);let u=encodeURIComponent(t),c=encodeURIComponent(r);return this.#t.post(`s3/multipart/${c}/complete?key=${u}`,{parts:s.map(({ETag:p,PartNumber:f})=>({ETag:p,PartNumber:f}))},{signal:n}).then(ur)}#s;async#l(e){if(Xe(e?.signal),this.#s==null){let{getTemporarySecurityCredentials:t}=this.opts;t===!0?(this.#i("getTemporarySecurityCredentials"),this.#s=this.#t.get("s3/sts",e).then(ur)):this.#s=t(e),this.#s=await this.#s,setTimeout(()=>{this.#s=null},(ld(this.#s.credentials)||0)*500)}return this.#s}async createSignedURL(e,t){let r=await this.#l(t),s=ld(r.credentials)||604800,{uploadId:n,key:a,partNumber:u}=t;return{method:"PUT",expires:s,fields:{},url:`${await Ia({accountKey:r.credentials.AccessKeyId,accountSecret:r.credentials.SecretAccessKey,sessionToken:r.credentials.SessionToken,expires:s,bucketName:r.bucket,Region:r.region,Key:a??`${crypto.randomUUID()}-${e.name}`,uploadId:n,partNumber:u})}`,headers:{"Content-Type":e.type}}}signPart(e,{uploadId:t,key:r,partNumber:s,signal:n}){if(this.#i("signPart"),Xe(n),t==null||r==null||s==null)throw new Error("Cannot sign without a key, an uploadId, and a partNumber");let a=encodeURIComponent(r);return this.#t.get(`s3/multipart/${encodeURIComponent(t)}/${s}?key=${a}`,{signal:n}).then(ur)}abortMultipartUpload(e,{key:t,uploadId:r,signal:s}){this.#i("abortMultipartUpload");let n=encodeURIComponent(t),a=encodeURIComponent(r);return this.#t.delete(`s3/multipart/${a}?key=${n}`,void 0,{signal:s}).then(ur)}getUploadParameters(e,t){this.#i("getUploadParameters");let{meta:r}=e,{type:s,name:n}=r,a=At(this.opts.allowedMetaFields,e.meta),u=ud({meta:r,allowedMetaFields:a,querify:!0}),c=new URLSearchParams({filename:n,type:s,...u});return this.#t.get(`s3/params?${c}`,t)}static async uploadPartBytes({signature:{url:e,expires:t,headers:r,method:s="PUT"},body:n,size:a=n.size,onProgress:u,onComplete:c,signal:p}){if(Xe(p),e==null)throw new Error("Cannot upload to an undefined URL");return new Promise((f,d)=>{let v=new XMLHttpRequest;v.open(s,e,!0),r&&Object.keys(r).forEach(A=>{v.setRequestHeader(A,r[A])}),v.responseType="text",typeof t=="number"&&(v.timeout=t*1e3);function _(){v.abort()}o(_,"onabort");function k(){p?.removeEventListener("abort",_)}o(k,"cleanup"),p?.addEventListener("abort",_),v.upload.addEventListener("progress",A=>{u(A)}),v.addEventListener("abort",()=>{k(),d(zr())}),v.addEventListener("timeout",()=>{k();let A=new Error("Request has expired");A.source={status:403},d(A)}),v.addEventListener("load",()=>{if(k(),v.status===403&&v.responseText.includes("<Message>Request has expired</Message>")){let C=new Error("Request has expired");C.source=v,d(C);return}if(v.status<200||v.status>=300){let C=new Error("Non 2xx");C.source=v,d(C);return}u?.({loaded:a,lengthComputable:!0});let A=v.getAllResponseHeaders().trim().split(/[\r\n]+/),F={__proto__:null};for(let C of A){let Y=C.split(": "),$=Y.shift(),H=Y.join(": ");F[$]=H}let{etag:R,location:U}=F;if(s.toUpperCase()==="POST"&&U==null&&console.error("@uppy/aws-s3: Could not read the Location header. This likely means CORS is not configured correctly on the S3 Bucket. See https://uppy.io/docs/aws-s3/#setting-up-your-s3-bucket"),R==null){console.error("@uppy/aws-s3: Could not read the ETag header. This likely means CORS is not configured correctly on the S3 Bucket. See https://uppy.io/docs/aws-s3/#setting-up-your-s3-bucket");return}c?.(R),f({...F,ETag:R})}),v.addEventListener("error",A=>{k();let F=new Error("Unknown error");F.source=A.target,d(F)}),v.send(n)})}#o=o((e,{key:t,uploadId:r})=>{let s=this.uppy.getFile(e.id);s!=null&&this.uppy.setFileState(e.id,{s3Multipart:{...s.s3Multipart,key:t,uploadId:r}})},"#setS3MultipartState");#n=o(e=>this.uppy.getFile(e.id)||e,"#getFile");#a(e){return new Promise((t,r)=>{let s=o((p,f)=>{let d=this.uppy.getFile(e.id);this.uppy.emit("upload-progress",d,{uploadStarted:d.progress.uploadStarted??0,bytesUploaded:p,bytesTotal:f})},"onProgress"),n=o(p=>{this.uppy.log(p),this.uppy.emit("upload-error",e,p),this.resetUploaderReferences(e.id),r(p)},"onError"),a=o(p=>{let f={body:{...p},status:200,uploadURL:p.location};this.resetUploaderReferences(e.id),this.uppy.emit("upload-success",this.#n(e),f),p.location&&this.uppy.log(`Download ${e.name} from ${p.location}`),t(void 0)},"onSuccess");if(e.data==null)throw new Error("File data is empty");let u=new ad(e.data,{companionComm:this.#e,log:o((...p)=>this.uppy.log(...p),"log"),getChunkSize:this.opts.getChunkSize?this.opts.getChunkSize.bind(this):void 0,onProgress:s,onError:n,onSuccess:a,onPartComplete:o(p=>{this.uppy.emit("s3-multipart:part-uploaded",this.#n(e),p)},"onPartComplete"),file:e,shouldUseMultipart:this.opts.shouldUseMultipart,...e.s3Multipart});this.uploaders[e.id]=u;let c=new Ot(this.uppy);this.uploaderEvents[e.id]=c,c.onFileRemove(e.id,p=>{u.abort(),this.resetUploaderReferences(e.id,{abort:!0}),t(`upload ${p} was removed`)}),c.onCancelAll(e.id,()=>{u.abort(),this.resetUploaderReferences(e.id,{abort:!0}),t(`upload ${e.id} was canceled`)}),c.onFilePause(e.id,p=>{p?u.pause():u.start()}),c.onPauseAll(e.id,()=>{u.pause()}),c.onResumeAll(e.id,()=>{u.start()}),u.start()})}#c(e){return{..."remote"in e&&e.remote?.body,protocol:"s3-multipart",size:e.data.size,metadata:e.meta}}#u=o(async e=>{if(e.length===0)return;let t=this.uppy.getFilesByIds(e),r=Pi(t),s=_i(r);this.uppy.emit("upload-start",s);let n=r.map(u=>{if(u.isRemote){let c=o(()=>this.requests,"getQueue");this.#p(!1);let p=new AbortController,f=o(v=>{v.id===u.id&&p.abort()},"removedHandler");this.uppy.on("file-removed",f);let d=this.uppy.getRequestClientForFile(u).uploadRemoteFile(u,this.#c(u),{signal:p.signal,getQueue:c});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",f)},{priority:-1})(),d}return this.#a(u)}),a=await Promise.allSettled(n);return this.#p(!0),a},"#upload");#d=o(()=>{this.#t?.setCompanionHeaders(this.opts.headers)},"#setCompanionHeaders");#p=o(e=>{let{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,resumableUploads:e}})},"#setResumableUploadsCapability");#h=o(()=>{this.#p(!0)},"#resetResumableCapability");install(){this.#p(!0),this.uppy.addPreProcessor(this.#d),this.uppy.addUploader(this.#u),this.uppy.on("cancel-all",this.#h)}uninstall(){this.uppy.removePreProcessor(this.#d),this.uppy.removeUploader(this.#u),this.uppy.off("cancel-all",this.#h)}};var cd={name:"@uppy/box",description:"Import files from Box, into Uppy.",version:"4.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","box"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var pd={strings:{pluginNameBox:"Box"}};var si=class extends re{static{o(this,"Box")}static VERSION=cd.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.id=this.opts.id||"Box",this.type="acquirer",this.storage=this.opts.storage||Te,this.files=[],this.icon=()=>l("svg",{className:"uppy-DashboardTab-iconBox","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("g",{fill:"currentcolor",fillRule:"nonzero",children:[l("path",{d:"m16.4 13.5c-1.6 0-3 0.9-3.7 2.2-0.7-1.3-2.1-2.2-3.7-2.2-1 0-1.8 0.3-2.5 0.8v-3.6c-0.1-0.3-0.5-0.7-1-0.7s-0.8 0.4-0.8 0.8v7c0 2.3 1.9 4.2 4.2 4.2 1.6 0 3-0.9 3.7-2.2 0.7 1.3 2.1 2.2 3.7 2.2 2.3 0 4.2-1.9 4.2-4.2 0.1-2.4-1.8-4.3-4.1-4.3m-7.5 6.8c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5m7.5 0c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5"}),l("path",{d:"m27.2 20.6l-2.3-2.8 2.3-2.8c0.3-0.4 0.2-0.9-0.2-1.2s-1-0.2-1.3 0.2l-2 2.4-2-2.4c-0.3-0.4-0.9-0.4-1.3-0.2-0.4 0.3-0.5 0.8-0.2 1.2l2.3 2.8-2.3 2.8c-0.3 0.4-0.2 0.9 0.2 1.2s1 0.2 1.3-0.2l2-2.4 2 2.4c0.3 0.4 0.9 0.4 1.3 0.2 0.4-0.3 0.4-0.8 0.2-1.2"})]})}),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"box",pluginId:this.id,supportsRefreshToken:!1}),this.defaultLocale=pd,this.i18nInit(),this.title=this.i18n("pluginNameBox"),this.render=this.render.bind(this)}install(){this.view=new Ne(this,{provider:this.provider,loadAllFiles:!0,virtualList:!0});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){return this.view.render(e)}};var Ba=ae(er(),1);var fd=ae(dd(),1);var hd={strings:{compressingImages:"Compressing images...",compressedX:"Saved %{size} by compressing images"}};var k0={quality:.6,limit:10},ws=class extends xe{static{o(this,"Compressor")}#e;constructor(e,t){super(e,{...k0,...t}),this.id=this.opts.id||"Compressor",this.type="modifier",this.defaultLocale=hd,this.#e=new ft(this.opts.limit),this.i18nInit(),this.prepareUpload=this.prepareUpload.bind(this),this.compress=this.compress.bind(this)}compress(e){return new Promise((t,r)=>{new fd.default(e,{...this.opts,success:t,error:r})})}async prepareUpload(e){let t=0,r=[],s=this.#e.wrapPromiseFunction(async a=>{try{if(a.data==null)throw new Error("File data is empty");let u=await this.compress(a.data),c=a.data.size-u.size;this.uppy.log(`[Image Compressor] Image ${a.id} compressed by ${(0,Ba.default)(c)}`),t+=c;let{name:p,type:f,size:d}=u,v=Et(p),k=`${Et(a.meta.name).name}.${v.extension}`;this.uppy.setFileState(a.id,{...p&&{name:p},...v.extension&&{extension:v.extension},...f&&{type:f},...d&&{size:d},data:u,meta:{...a.meta,type:f,name:k}}),r.push(a)}catch(u){this.uppy.log(`[Image Compressor] Failed to compress ${a.id}:`,"warning"),this.uppy.log(u,"warning")}}),n=e.map(a=>{let u=this.uppy.getFile(a);return this.uppy.emit("preprocess-progress",u,{mode:"indeterminate",message:this.i18n("compressingImages")}),u.isRemote||(u.data.type||(u.data=u.data.slice(0,u.data.size,u.type)),!u.type?.startsWith("image/"))?Promise.resolve():s(u)});await Promise.all(n),this.uppy.emit("compressor:complete",r),t>1024&&this.uppy.info(this.i18n("compressedX",{size:(0,Ba.default)(t)}),"info");for(let a of e){let u=this.uppy.getFile(a);this.uppy.emit("preprocess-complete",u)}}install(){this.uppy.addPreProcessor(this.prepareUpload)}uninstall(){this.uppy.removePreProcessor(this.prepareUpload)}};function fe(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}o(fe,"e");var Pd=typeof self<"u"?self:global,_s=typeof navigator<"u",E0=_s&&typeof HTMLImageElement>"u",md=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),_d=Pd.Buffer,kd=!!_d,F0=o(i=>i!==void 0,"h");function Ed(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(F0).length===0)}o(Ed,"f");function Ke(i){let e=new Error(i);throw delete e.stack,e}o(Ke,"l");function gd(i){let e=(function(t){let r=0;return t.ifd0.enabled&&(r+=1024),t.exif.enabled&&(r+=2048),t.makerNote&&(r+=2048),t.userComment&&(r+=1024),t.gps.enabled&&(r+=512),t.interop.enabled&&(r+=100),t.ifd1.enabled&&(r+=1024),r+2048})(i);return i.jfif.enabled&&(e+=50),i.xmp.enabled&&(e+=2e4),i.iptc.enabled&&(e+=14e3),i.icc.enabled&&(e+=6e3),e}o(gd,"o");var ja=o(i=>String.fromCharCode.apply(null,i),"u"),yd=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0,Oi=class i{static{o(this,"c")}static from(e,t){return e instanceof this&&e.le===t?e:new i(e,void 0,void 0,t)}constructor(e,t=0,r,s){if(typeof s=="boolean"&&(this.le=s),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){r===void 0&&(r=e.byteLength-t);let n=new DataView(e,t,r);this._swapDataView(n)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof i){r===void 0&&(r=e.byteLength-t),(t+=e.byteOffset)+r>e.byteOffset+e.byteLength&&Ke("Creating view outside of available memory in ArrayBuffer");let n=new DataView(e.buffer,t,r);this._swapDataView(n)}else if(typeof e=="number"){let n=new DataView(new ArrayBuffer(e));this._swapDataView(n)}else Ke("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,t,r=i){return e instanceof DataView||e instanceof i?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||Ke("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new r(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new i(this,e,t)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return s=this.getUint8Array(e,t),yd?yd.decode(s):kd?Buffer.from(s).toString("utf8"):decodeURIComponent(escape(ja(s)));var s}getLatin1String(e=0,t=this.byteLength){let r=this.getUint8Array(e,t);return ja(r)}getUnicodeString(e=0,t=this.byteLength){let r=[];for(let s=0;s<t&&e+s<this.byteLength;s+=2)r.push(this.getUint16(e+s));return ja(r)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,t=this.le){return this.dataView.getInt16(e,t)}getInt32(e,t=this.le){return this.dataView.getInt32(e,t)}getUint16(e,t=this.le){return this.dataView.getUint16(e,t)}getUint32(e,t=this.le){return this.dataView.getUint32(e,t)}getFloat32(e,t=this.le){return this.dataView.getFloat32(e,t)}getFloat64(e,t=this.le){return this.dataView.getFloat64(e,t)}getFloat(e,t=this.le){return this.dataView.getFloat32(e,t)}getDouble(e,t=this.le){return this.dataView.getFloat64(e,t)}getUintBytes(e,t,r){switch(t){case 1:return this.getUint8(e,r);case 2:return this.getUint16(e,r);case 4:return this.getUint32(e,r);case 8:return this.getUint64&&this.getUint64(e,r)}}getUint(e,t,r){switch(t){case 8:return this.getUint8(e,r);case 16:return this.getUint16(e,r);case 32:return this.getUint32(e,r);case 64:return this.getUint64&&this.getUint64(e,r)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}};function Ha(i,e){Ke(`${i} '${e}' was not loaded, try using full build of exifr.`)}o(Ha,"p");var ks=class extends Map{static{o(this,"g")}constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||Ha(this.kind,e),t&&(e in t||(function(r,s){Ke(`Unknown ${r} '${s}'.`)})(this.kind,e),t[e].enabled||Ha(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},Qo=new ks("file parser"),mt=new ks("segment parser"),Ts=new ks("file reader"),T0=Pd.fetch;function vd(i,e){return(t=i).startsWith("data:")||t.length>1e4?Va(i,e,"base64"):md&&i.includes("://")?qa(i,e,"url",Xo):md?Va(i,e,"fs"):_s?qa(i,e,"url",Xo):void Ke("Invalid input argument");var t}o(vd,"k");async function qa(i,e,t,r){return Ts.has(t)?Va(i,e,t):r?(async function(s,n){let a=await n(s);return new Oi(a)})(i,r):void Ke(`Parser ${t} is not loaded`)}o(qa,"O");async function Va(i,e,t){let r=new(Ts.get(t))(i,e);return await r.read(),r}o(Va,"v");var Xo=o(i=>T0(i).then((e=>e.arrayBuffer())),"S"),Es=o(i=>new Promise(((e,t)=>{let r=new FileReader;r.onloadend=()=>e(r.result||new ArrayBuffer),r.onerror=t,r.readAsArrayBuffer(i)})),"A"),$a=class extends Map{static{o(this,"U")}get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}};function Fd(i,e,t){let r=new $a;for(let[s,n]of t)r.set(s,n);if(Array.isArray(e))for(let s of e)i.set(s,r);else i.set(e,r);return r}o(Fd,"x");function Td(i,e,t){let r,s=i.get(e);for(r of t)s.set(r[0],r[1])}o(Td,"C");var Cs=new Map,Ya=new Map,Ja=new Map,cr=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],Zo=["jfif","xmp","icc","iptc","ihdr"],Fs=["tiff",...Zo],Me=["ifd0","ifd1","exif","gps","interop"],pr=[...Fs,...Me],dr=["makerNote","userComment"],en=["translateKeys","translateValues","reviveValues","multiSegment"],hr=[...en,"sanitize","mergeOutput","silentErrors"],Ko=class{static{o(this,"_")}get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},Ui=class extends Ko{static{o(this,"D")}get needed(){return this.enabled||this.deps.size>0}constructor(e,t,r,s){if(super(),fe(this,"enabled",!1),fe(this,"skip",new Set),fe(this,"pick",new Set),fe(this,"deps",new Set),fe(this,"translateKeys",!1),fe(this,"translateValues",!1),fe(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(s),this.canBeFiltered=Me.includes(e),this.canBeFiltered&&(this.dict=Cs.get(e)),r!==void 0)if(Array.isArray(r))this.parse=this.enabled=!0,this.canBeFiltered&&r.length>0&&this.translateTagSet(r,this.pick);else if(typeof r=="object"){if(this.enabled=!0,this.parse=r.parse!==!1,this.canBeFiltered){let{pick:n,skip:a}=r;n&&n.length>0&&this.translateTagSet(n,this.pick),a&&a.length>0&&this.translateTagSet(a,this.skip)}this.applyInheritables(r)}else r===!0||r===!1?this.parse=this.enabled=r:Ke(`Invalid options argument: ${r}`)}applyInheritables(e){let t,r;for(t of en)r=e[t],r!==void 0&&(this[t]=r)}translateTagSet(e,t){if(this.dict){let r,s,{tagKeys:n,tagValues:a}=this.dict;for(r of e)typeof r=="string"?(s=a.indexOf(r),s===-1&&(s=n.indexOf(Number(r))),s!==-1&&t.add(Number(n[s]))):t.add(r)}else for(let r of e)t.add(r)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,Yo(this.pick,this.deps)):this.enabled&&this.pick.size>0&&Yo(this.pick,this.deps)}},at={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},bd=new Map,Di=class extends Ko{static{o(this,"R")}static useCached(e){let t=bd.get(e);return t!==void 0||(t=new this(e),bd.set(e,t)),t}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):Ke(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=_s?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of cr)this[e]=at[e];for(e of hr)this[e]=at[e];for(e of dr)this[e]=at[e];for(e of pr)this[e]=new Ui(e,at[e],void 0,this)}setupFromTrue(){let e;for(e of cr)this[e]=at[e];for(e of hr)this[e]=at[e];for(e of dr)this[e]=!0;for(e of pr)this[e]=new Ui(e,!0,void 0,this)}setupFromArray(e){let t;for(t of cr)this[t]=at[t];for(t of hr)this[t]=at[t];for(t of dr)this[t]=at[t];for(t of pr)this[t]=new Ui(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,Me)}setupFromObject(e){let t;for(t of(Me.ifd0=Me.ifd0||Me.image,Me.ifd1=Me.ifd1||Me.thumbnail,Object.assign(this,e),cr))this[t]=za(e[t],at[t]);for(t of hr)this[t]=za(e[t],at[t]);for(t of dr)this[t]=za(e[t],at[t]);for(t of Fs)this[t]=new Ui(t,at[t],e[t],this);for(t of Me)this[t]=new Ui(t,at[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,Me,pr),e.tiff===!0?this.batchEnableWithBool(Me,!0):e.tiff===!1?this.batchEnableWithUserValue(Me,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,Me):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,Me)}batchEnableWithBool(e,t){for(let r of e)this[r].enabled=t}batchEnableWithUserValue(e,t){for(let r of e){let s=t[r];this[r].enabled=s!==!1&&s!==void 0}}setupGlobalFilters(e,t,r,s=r){if(e&&e.length){for(let a of s)this[a].enabled=!1;let n=wd(e,r);for(let[a,u]of n)Yo(this[a].pick,u),this[a].enabled=!0}else if(t&&t.length){let n=wd(t,r);for(let[a,u]of n)Yo(this[a].skip,u)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:r,iptc:s,icc:n}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),r.enabled||e.skip.add(700),s.enabled||e.skip.add(33723),n.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:r,interop:s}=this;s.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),r.needed&&e.deps.add(34853),this.tiff.enabled=Me.some((n=>this[n].enabled===!0))||this.makerNote||this.userComment;for(let n of Me)this[n].finalizeFilters()}get onlyTiff(){return!Zo.map((e=>this[e].enabled)).some((e=>e===!0))&&this.tiff.enabled}checkLoadedPlugins(){for(let e of Fs)this[e].enabled&&!mt.has(e)&&Ha("segment parser",e)}};function wd(i,e){let t,r,s,n,a=[];for(s of e){for(n of(t=Cs.get(s),r=[],t))(i.includes(n[0])||i.includes(n[1]))&&r.push(n[0]);r.length&&a.push([s,r])}return a}o(wd,"K");function za(i,e){return i!==void 0?i:e!==void 0?e:void 0}o(za,"W");function Yo(i,e){for(let t of e)i.add(t)}o(Yo,"X");fe(Di,"default",at);var fr=class{static{o(this,"H")}constructor(e){fe(this,"parsers",{}),fe(this,"output",{}),fe(this,"errors",[]),fe(this,"pushToErrors",(t=>this.errors.push(t))),this.options=Di.useCached(e)}async read(e){this.file=await(function(t,r){return typeof t=="string"?vd(t,r):_s&&!E0&&t instanceof HTMLImageElement?vd(t.src,r):t instanceof Uint8Array||t instanceof ArrayBuffer||t instanceof DataView?new Oi(t):_s&&t instanceof Blob?qa(t,r,"blob",Es):void Ke("Invalid input argument")})(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[r,s]of Qo)if(s.canHandle(e,t))return this.fileParser=new s(this.options,this.file,this.parsers),e[r]=!0;this.file.close&&this.file.close(),Ke("Unknown file format")}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),Ed(r=e)?void 0:r;var r}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map((async r=>{let s=await r.parse();r.assignToOutput(e,s)}));this.options.silentErrors&&(t=t.map((r=>r.catch(this.pushToErrors)))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,r=mt.get("tiff",e);var s;if(t.tiff?s={start:0,type:"tiff"}:t.jpeg&&(s=await this.fileParser.getOrFindSegment("tiff")),s===void 0)return;let n=await this.fileParser.ensureSegmentChunk(s),a=this.parsers.tiff=new r(n,e,t),u=await a.extractThumbnail();return t.close&&t.close(),u}};async function Cd(i,e){let t=new fr(e);return await t.read(i),t.parse()}o(Cd,"Y");var C0=Object.freeze({__proto__:null,parse:Cd,Exifr:fr,fileParsers:Qo,segmentParsers:mt,fileReaders:Ts,tagKeys:Cs,tagValues:Ya,tagRevivers:Ja,createDictionary:Fd,extendDictionary:Td,fetchUrlAsArrayBuffer:Xo,readBlobAsArrayBuffer:Es,chunkedProps:cr,otherSegments:Zo,segments:Fs,tiffBlocks:Me,segmentsAndBlocks:pr,tiffExtractables:dr,inheritables:en,allFormatters:hr,Options:Di}),oi=class{static{o(this,"J")}static findPosition(e,t){let r=e.getUint16(t+2)+2,s=typeof this.headerLength=="function"?this.headerLength(e,t,r):this.headerLength,n=t+s,a=r-s;return{offset:t,length:r,headerLength:s,start:n,size:a,end:n+a}}static parse(e,t={}){return new this(e,new Di({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof Oi?e:new Oi(e)}constructor(e,t={},r){fe(this,"errors",[]),fe(this,"raw",new Map),fe(this,"handleError",(s=>{if(!this.options.silentErrors)throw s;this.errors.push(s.message)})),this.chunk=this.normalizeInput(e),this.file=r,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let r=Ja.get(t),s=Ya.get(t),n=Cs.get(t),a=this.options[t],u=a.reviveValues&&!!r,c=a.translateValues&&!!s,p=a.translateKeys&&!!n,f={};for(let[d,v]of e)u&&r.has(d)?v=r.get(d)(v):c&&s.has(d)&&(v=this.translateValue(v,s.get(d))),p&&n.has(d)&&(d=n.get(d)||d),f[d]=v;return f}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,r){if(this.globalOptions.mergeOutput)return Object.assign(e,r);e[t]?Object.assign(e[t],r):e[t]=r}};fe(oi,"headerLength",4),fe(oi,"type",void 0),fe(oi,"multiSegment",!1),fe(oi,"canHandle",(()=>!1));function A0(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}o(A0,"q");function R0(i){return i>=224&&i<=239}o(R0,"Q");function U0(i,e,t){for(let[r,s]of mt)if(s.canHandle(i,e,t))return r}o(U0,"Z");var Jo=class extends class{constructor(e,t,r){fe(this,"errors",[]),fe(this,"ensureSegmentChunk",(async s=>{let n=s.start,a=s.size||65536;if(this.file.chunked)if(this.file.available(n,a))s.chunk=this.file.subarray(n,a);else try{s.chunk=await this.file.readChunk(n,a)}catch(u){Ke(`Couldn't read segment: ${JSON.stringify(s)}. ${u.message}`)}else this.file.byteLength>n+a?s.chunk=this.file.subarray(n,a):s.size===void 0?s.chunk=this.file.subarray(n):Ke("Segment unreachable: "+JSON.stringify(s));return s.chunk})),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=r}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let r=new(mt.get(e))(t,this.options,this.file);return this.parsers[e]=r}createParsers(e){for(let t of e){let{type:r,chunk:s}=t,n=this.options[r];if(n&&n.enabled){let a=this.parsers[r];a&&a.append||a||this.createParser(r,s)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}}{static{o(this,"ee")}constructor(...e){super(...e),fe(this,"appSegments",[]),fe(this,"jpegSegments",[]),fe(this,"unknownSegments",[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(mt.keyList())):(e=e===void 0?mt.keyList().filter((t=>this.options[t].enabled)):e.filter((t=>this.options[t].enabled&&mt.has(t))),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:r,findAll:s,wanted:n,remaining:a}=this;if(!s&&this.file.chunked&&(s=Array.from(n).some((u=>{let c=mt.get(u),p=this.options[u];return c.multiSegment&&p.multiSegment})),s&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,r.byteLength),!this.options.onlyTiff&&r.chunked){let u=!1;for(;a.size>0&&!u&&(r.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:c}=r,p=this.appSegments.some((f=>!this.file.available(f.offset||f.start,f.length||f.size)));if(u=e>c&&!p?!await r.readNextChunk(e):!await r.readNextChunk(c),(e=this.findAppSegmentsInRange(e,r.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let r,s,n,a,u,c,{file:p,findAll:f,wanted:d,remaining:v,options:_}=this;for(;e<t;e++)if(p.getUint8(e)===255){if(r=p.getUint8(e+1),R0(r)){if(s=p.getUint16(e+2),n=U0(p,e,s),n&&d.has(n)&&(a=mt.get(n),u=a.findPosition(p,e),c=_[n],u.type=n,this.appSegments.push(u),!f&&(a.multiSegment&&c.multiSegment?(this.unfinishedMultiSegment=u.chunkNumber<u.chunkCount,this.unfinishedMultiSegment||v.delete(n)):v.delete(n),v.size===0)))break;_.recordUnknownSegments&&(u=oi.findPosition(p,e),u.marker=r,this.unknownSegments.push(u)),e+=s+1}else if(A0(r)){if(s=p.getUint16(e+2),r===218&&_.stopAfterSos!==!1)return;_.recordJpegSegments&&this.jpegSegments.push({offset:e,length:s,marker:r}),e+=s+1}}return e}mergeMultiSegments(){if(!this.appSegments.some((t=>t.multiSegment)))return;let e=(function(t,r){let s,n,a,u=new Map;for(let c=0;c<t.length;c++)s=t[c],n=s[r],u.has(n)?a=u.get(n):u.set(n,a=[]),a.push(s);return Array.from(u)})(this.appSegments,"type");this.mergedAppSegments=e.map((([t,r])=>{let s=mt.get(t,this.options);return s.handleMultiSegments?{type:t,chunk:s.handleMultiSegments(r)}:r[0]}))}getSegment(e){return this.appSegments.find((t=>t.type===e))}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}};fe(Jo,"type","jpeg"),Qo.set("jpeg",Jo);var O0=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],Wa=class extends oi{static{o(this,"se")}parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,r=new Map){let{pick:s,skip:n}=this.options[t];s=new Set(s);let a=s.size>0,u=n.size===0,c=this.chunk.getUint16(e);e+=2;for(let p=0;p<c;p++){let f=this.chunk.getUint16(e);if(a){if(s.has(f)&&(r.set(f,this.parseTag(e,f,t)),s.delete(f),s.size===0))break}else!u&&n.has(f)||r.set(f,this.parseTag(e,f,t));e+=12}return r}parseTag(e,t,r){let{chunk:s}=this,n=s.getUint16(e+2),a=s.getUint32(e+4),u=O0[n];if(u*a<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&Ke(`Invalid TIFF value type. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&Ke(`Invalid TIFF value offset. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e} is outside of chunk size ${s.byteLength}`),n===1)return s.getUint8Array(e,a);if(n===2)return(c=(function(p){for(;p.endsWith("\0");)p=p.slice(0,-1);return p})(c=s.getString(e,a)).trim())===""?void 0:c;var c;if(n===7)return s.getUint8Array(e,a);if(a===1)return this.parseTagValue(n,e);{let p=new((function(d){switch(d){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}})(n))(a),f=u;for(let d=0;d<a;d++)p[d]=this.parseTagValue(n,e),e+=f;return p}}parseTagValue(e,t){let{chunk:r}=this;switch(e){case 1:return r.getUint8(t);case 3:return r.getUint16(t);case 4:return r.getUint32(t);case 5:return r.getUint32(t)/r.getUint32(t+4);case 6:return r.getInt8(t);case 8:return r.getInt16(t);case 9:return r.getInt32(t);case 10:return r.getInt32(t)/r.getInt32(t+4);case 11:return r.getFloat(t);case 12:return r.getDouble(t);case 13:return r.getUint32(t);default:Ke(`Invalid tiff type ${e}`)}}},Ps=class extends Wa{static{o(this,"ie")}static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1165519206&&e.getUint16(t+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let t=this[e]();return t.catch!==void 0&&(t=t.catch(this.handleError)),t}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}parseBlock(e,t){let r=new Map;return this[t]=r,this.parseTags(e,t,r),r}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&Ke("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&Ke(`IFD0 offset points to outside of file.
this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,gd(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,gd(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let r=e.get(t);r&&r.length===1&&e.set(t,r[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",Sd(...e.get(2),e.get(1))),e.set("longitude",Sd(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,r,s={};for(t of Me)if(e=this[t],!Ed(e))if(r=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(s,r)}else s[t]=r;return this.makerNote&&(s.makerNote=this.makerNote),this.userComment&&(s.userComment=this.userComment),s}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[r,s]of Object.entries(t))this.assignObjectToOutput(e,r,s)}};function Sd(i,e,t,r){var s=i+e/60+t/3600;return r!=="S"&&r!=="W"||(s*=-1),s}o(Sd,"ne");fe(Ps,"type","tiff"),fe(Ps,"headerLength",10),mt.set("tiff",Ps);var PF=Object.freeze({__proto__:null,default:C0,Exifr:fr,fileParsers:Qo,segmentParsers:mt,fileReaders:Ts,tagKeys:Cs,tagValues:Ya,tagRevivers:Ja,createDictionary:Fd,extendDictionary:Td,fetchUrlAsArrayBuffer:Xo,readBlobAsArrayBuffer:Es,chunkedProps:cr,otherSegments:Zo,segments:Fs,tiffBlocks:Me,segmentsAndBlocks:pr,tiffExtractables:dr,inheritables:en,allFormatters:hr,Options:Di,parse:Cd}),Qa={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},_F=Object.assign({},Qa,{firstChunkSize:4e4,gps:[1,2,3,4]});var kF=Object.assign({},Qa,{tiff:!1,ifd1:!0,mergeOutput:!1});var D0=Object.assign({},Qa,{firstChunkSize:4e4,ifd0:[274]});async function I0(i){let e=new fr(D0);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}o(I0,"ce");var N0=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}}),Ss=!0,xs=!0;if(typeof navigator=="object"){let i=navigator.userAgent;if(i.includes("iPad")||i.includes("iPhone")){let e=i.match(/OS (\d+)_(\d+)/);if(e){let[,t,r]=e;Ss=Number(t)+.1*Number(r)<13.4,xs=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);Ss=xs=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);Ss=xs=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);Ss=xs=Number(e)<77}}async function Ad(i){let e=await I0(i);return Object.assign({canvas:Ss,css:xs},N0[e])}o(Ad,"ye");var Ga=class extends Oi{static{o(this,"be")}constructor(...e){super(...e),fe(this,"ranges",new Xa),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,r){if(e===0&&this.byteLength===0&&r){let s=new DataView(r.buffer||r,r.byteOffset,r.byteLength);this._swapDataView(s)}else{let s=e+t;if(s>this.byteLength){let{dataView:n}=this._extend(s);this._swapDataView(n)}}}_extend(e){let t;t=kd?_d.allocUnsafe(e):new Uint8Array(e);let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:r}}subarray(e,t,r=!1){return t=t||this._lengthToEnd(e),r&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,r=!1){r&&this._tryExtend(t,e.byteLength,e);let s=super.set(e,t);return this.ranges.add(t,s.byteLength),s}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}},Xa=class{static{o(this,"we")}constructor(){fe(this,"list",[])}get length(){return this.list.length}add(e,t,r=0){let s=e+t,n=this.list.filter((a=>xd(e,a.offset,s)||xd(e,a.end,s)));if(n.length>0){e=Math.min(e,...n.map((u=>u.offset))),s=Math.max(s,...n.map((u=>u.end))),t=s-e;let a=n.shift();a.offset=e,a.length=t,a.end=s,this.list=this.list.filter((u=>!n.includes(u)))}else this.list.push({offset:e,length:t,end:s})}available(e,t){let r=e+t;return this.list.some((s=>s.offset<=e&&r<=s.end))}};function xd(i,e,t){return i<=e&&e<=t}o(xd,"ke");var Ka=class extends Ga{static{o(this,"Oe")}constructor(e,t){super(0),fe(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,r=await this.readChunk(e,t);return!!r&&r.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}};Ts.set("blob",class extends Ka{async readWhole(){this.chunked=!1;let i=await Es(this.input);this._swapArrayBuffer(i)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(i,e){let t=e?i+e:void 0,r=this.input.slice(i,t),s=await Es(r);return this.set(s,i,!0)}});var Rd={name:"@uppy/thumbnail-generator",description:"Uppy plugin that generates small previews of images to show on your upload UI.",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","thumbnail","preview","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",exifr:"^7.0.0"},devDependencies:{jsdom:"^26.1.0","namespace-emitter":"2.0.1",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};var Ud={strings:{generatingThumbnails:"Generating thumbnails..."}};function L0(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(r){if(r.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return i.toBlob?new Promise(r=>{i.toBlob(r,e,t)}).then(r=>{if(r===null)throw new Error("cannot read image, probably an svg with external resources");return r}):Promise.resolve().then(()=>On(i.toDataURL(e,t),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}o(L0,"canvasToBlob");function B0(i,e){let t=i.width,r=i.height;(e.deg===90||e.deg===270)&&(t=i.height,r=i.width);let s=document.createElement("canvas");s.width=t,s.height=r;let n=s.getContext("2d");return n.translate(t/2,r/2),e.canvas&&(n.rotate(e.rad),n.scale(e.scaleX,e.scaleY)),n.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),s}o(B0,"rotateImage");function j0(i){let e=i.width/i.height,t=5e6,r=4096,s=Math.floor(Math.sqrt(t*e)),n=Math.floor(t/Math.sqrt(t*e));if(s>r&&(s=r,n=Math.round(s/e)),n>r&&(n=r,s=Math.round(e*n)),i.width>s){let a=document.createElement("canvas");return a.width=s,a.height=n,a.getContext("2d").drawImage(i,0,0,s,n),a}return i}o(j0,"protect");var z0={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1},Ii=class extends re{static{o(this,"ThumbnailGenerator")}static VERSION=Rd.version;queue;queueProcessing;defaultThumbnailDimension;thumbnailType;constructor(e,t){if(super(e,{...z0,...t}),this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=Ud,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(e,t,r){if(e.data==null)throw new Error("File data is empty");let s=URL.createObjectURL(e.data),n=new Promise((u,c)=>{let p=new Image;p.src=s,p.addEventListener("load",()=>{URL.revokeObjectURL(s),u(p)}),p.addEventListener("error",f=>{URL.revokeObjectURL(s),c(f.error||new Error("Could not create thumbnail"))})}),a=Ad(e.data).catch(()=>1);return Promise.all([n,a]).then(([u,c])=>{let p=this.getProportionalDimensions(u,t,r,c.deg),f=B0(u,c),d=this.resizeImage(f,p.width,p.height);return L0(d,this.thumbnailType,80)}).then(u=>URL.createObjectURL(u))}getProportionalDimensions(e,t,r,s){let n=e.width/e.height;if((s===90||s===270)&&(n=e.height/e.width),t!=null){let a=t;return e.width<t&&(a=e.width),{width:a,height:Math.round(a/n)}}if(r!=null){let a=r;return e.height<r&&(a=e.height),{width:Math.round(a*n),height:a}}return{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/n)}}resizeImage(e,t,r){let s=j0(e),n=Math.ceil(Math.log2(s.width/t));n<1&&(n=1);let a=t*2**(n-1),u=r*2**(n-1),c=2;for(;n--;){let p=document.createElement("canvas");p.width=a,p.height=u,p.getContext("2d").drawImage(s,0,0,a,u),s=p,a=Math.round(a/c),u=Math.round(u/c)}return s}setPreviewURL(e,t){this.uppy.setFileState(e,{preview:t})}addToQueue(e){this.queue.push(e),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){let e=this.uppy.getFile(this.queue.shift());return e?this.requestThumbnail(e).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(e){return Kr(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(t=>{this.setPreviewURL(e.id,t),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${e.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(e.id),t)}).catch(t=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${e.id}:`,"warning"),this.uppy.log(t,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(e.id),t)}):Promise.resolve()}onFileAdded=o(e=>{!e.preview&&e.data&&Kr(e.type)&&!e.isRemote&&this.addToQueue(e.id)},"onFileAdded");onCancelRequest=o(e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1)},"onCancelRequest");onFileRemoved=o(e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1),e.preview&&Xr(e.preview)&&URL.revokeObjectURL(e.preview)},"onFileRemoved");onRestored=o(()=>{this.uppy.getFiles().filter(t=>t.isRestored).forEach(t=>{(!t.preview||Xr(t.preview))&&this.addToQueue(t.id)})},"onRestored");onAllFilesRemoved=o(()=>{this.queue=[]},"onAllFilesRemoved");waitUntilAllProcessed=o(e=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-progress",s,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});let t=o(()=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-complete",s)})},"emitPreprocessCompleteForAll");return new Promise(r=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{t(),r()}):(t(),r())})},"waitUntilAllProcessed");install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}};var Od={name:"@uppy/dashboard",description:"Universal UI plugin for Uppy.",version:"5.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest run --project browser"},keywords:["file uploader","uppy","uppy-plugin","dashboard","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/provider-views":"workspace:^","@uppy/thumbnail-generator":"workspace:^","@uppy/utils":"workspace:^",classnames:"^2.2.6",lodash:"^4.17.21",nanoid:"^5.0.9",preact:"^10.5.13","shallow-equal":"^3.0.0"},devDependencies:{"@uppy/core":"workspace:^","@uppy/dropbox":"workspace:^","@uppy/google-drive":"workspace:^","@uppy/url":"workspace:^","@uppy/webcam":"workspace:^","@vitest/browser":"^3.2.4",cssnano:"^7.0.7",jsdom:"^26.1.0",playwright:"1.57.0",postcss:"^8.5.6","postcss-cli":"^11.0.1","resize-observer-polyfill":"^1.5.0",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};var dh=ae(Ge(),1);var Za=class extends Se{static{o(this,"AddFiles")}fileInput=null;folderInput=null;mobilePhotoFileInput=null;mobileVideoFileInput=null;triggerFileInputClick=o(()=>{this.fileInput?.click()},"triggerFileInputClick");triggerFolderInputClick=o(()=>{this.folderInput?.click()},"triggerFolderInputClick");triggerVideoCameraInputClick=o(()=>{this.mobileVideoFileInput?.click()},"triggerVideoCameraInputClick");triggerPhotoCameraInputClick=o(()=>{this.mobilePhotoFileInput?.click()},"triggerPhotoCameraInputClick");onFileInputChange=o(e=>{this.props.handleInputChange(e),e.currentTarget.value=""},"onFileInputChange");renderHiddenInput=o((e,t)=>l("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:e,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:this.props.allowedFileTypes?.join(", "),ref:t}),"renderHiddenInput");renderHiddenCameraInput=o((e,t,r)=>{let n={photo:"image/*",video:"video/*"}[e];return l("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${e}`,onChange:this.onFileInputChange,capture:t===""?"environment":t,accept:n,ref:r})},"renderHiddenCameraInput");renderMyDeviceAcquirer=o(()=>l("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice",children:l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick,children:[l("div",{className:"uppy-DashboardTab-inner",children:l("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"})})}),l("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("myDevice")})]})}),"renderMyDeviceAcquirer");renderPhotoCamera=o(()=>l("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera",children:l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick,children:[l("div",{className:"uppy-DashboardTab-inner",children:l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"})})}),l("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("takePictureBtn")})]})}),"renderPhotoCamera");renderVideoCamera=o(()=>l("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera",children:l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick,children:[l("div",{className:"uppy-DashboardTab-inner",children:l("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "})})}),l("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("recordVideoBtn")})]})}),"renderVideoCamera");renderBrowseButton=o((e,t)=>{let r=this.props.acquirers.length;return l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:t,"data-uppy-super-focusable":r===0,children:e})},"renderBrowseButton");renderDropPasteBrowseTagline=o(e=>{let t=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),r=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),s=this.props.fileManagerSelectionType,n=s.charAt(0).toUpperCase()+s.slice(1);return l("div",{class:"uppy-Dashboard-AddFiles-title",children:this.props.disableLocalFiles?this.props.i18n("importFiles"):e>0?this.props.i18nArray(`dropPasteImport${n}`,{browseFiles:t,browseFolders:r,browse:t}):this.props.i18nArray(`dropPaste${n}`,{browseFiles:t,browseFolders:r,browse:t})})},"renderDropPasteBrowseTagline");[Symbol.for("uppy test: disable unused locale key warning")](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderAcquirer=o(e=>l("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id,children:l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":e.id,"aria-controls":`uppy-DashboardContent-panel--${e.id}`,"aria-selected":this.props.activePickerPanel?.id===e.id,"data-uppy-super-focusable":!0,onClick:o(()=>this.props.showPanel(e.id),"onClick"),children:[l("div",{className:"uppy-DashboardTab-inner",children:e.icon()}),l("div",{className:"uppy-DashboardTab-name",children:e.name})]})}),"renderAcquirer");renderAcquirers=o(e=>{let t=[...e],r=t.splice(e.length-2,e.length);return l(Re,{children:[t.map(s=>this.renderAcquirer(s)),l("span",{role:"presentation",style:{"white-space":"nowrap"},children:r.map(s=>this.renderAcquirer(s))})]})},"renderAcquirers");renderSourcesList=o((e,t)=>{let{showNativePhotoCameraButton:r,showNativeVideoCameraButton:s}=this.props,n=[],a="myDevice";t||n.push({key:a,elements:this.renderMyDeviceAcquirer()}),r&&n.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),s&&n.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),n.push(...e.map(f=>({key:f.id,elements:this.renderAcquirer(f)}))),n.length===1&&n[0].key===a&&(n=[]);let c=[...n],p=c.splice(n.length-2,n.length);return l(Re,{children:[this.renderDropPasteBrowseTagline(n.length),l("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist",children:[c.map(({key:f,elements:d})=>l(Re,{children:d},f)),l("span",{role:"presentation",style:{"white-space":"nowrap"},children:p.map(({key:f,elements:d})=>l(Re,{children:d},f))})]})]})},"renderSourcesList");renderPoweredByUppy(){let{i18nArray:e}=this.props,t=l("span",{children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",children:l("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})}),l("span",{className:"uppy-Dashboard-poweredByUppy",children:"Uppy"})]}),r=e("poweredBy",{uppy:t});return l("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy",children:r})}render(){let{showNativePhotoCameraButton:e,showNativeVideoCameraButton:t,nativeCameraFacingMode:r}=this.props;return l("div",{className:"uppy-Dashboard-AddFiles",children:[this.renderHiddenInput(!1,s=>{this.fileInput=s}),this.renderHiddenInput(!0,s=>{this.folderInput=s}),e&&this.renderHiddenCameraInput("photo",r,s=>{this.mobilePhotoFileInput=s}),t&&this.renderHiddenCameraInput("video",r,s=>{this.mobileVideoFileInput=s}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),l("div",{className:"uppy-Dashboard-AddFiles-info",children:[this.props.note&&l("div",{className:"uppy-Dashboard-note",children:this.props.note}),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()]})]})}},tn=Za;var Dd=ae(Ge(),1);var q0=o(i=>l("div",{className:(0,Dd.default)("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel,children:[l("div",{className:"uppy-DashboardContent-bar",children:[l("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18n("addingMoreFiles")}),l("button",{className:"uppy-DashboardContent-back",type:"button",onClick:o(()=>i.toggleAddFilesPanel(!1),"onClick"),children:i.i18n("back")})]}),l(tn,{...i})]}),"AddFilesPanel"),Id=q0;var Nd=ae(Ge(),1);function V0(i){let e=i.files[i.fileCardFor],t=o(()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()},"handleCancel");return l("div",{className:(0,Nd.default)("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor",children:[l("div",{className:"uppy-DashboardContent-bar",children:[l("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18nArray("editing",{file:l("span",{className:"uppy-DashboardContent-titleFile",children:e.meta?e.meta.name:e.name})})}),l("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:i.i18n("cancel")}),l("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor,children:i.i18n("save")})]}),l("div",{className:"uppy-DashboardContent-panelBody",children:i.editors.map(r=>i.uppy.getPlugin(r.id).render(i.state))})]})}o(V0,"EditorPanel");var Md=V0;var Ld=ae(Ge(),1);function $0(){return l("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:l("g",{fill:"#686DE0",fillRule:"evenodd",children:[l("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),l("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),l("circle",{cx:"7.5",cy:"9.5",r:"1.5"})]})})}o($0,"iconImage");function W0(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:l("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"})})}o(W0,"iconAudio");function G0(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:l("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"})})}o(G0,"iconVideo");function X0(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:l("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"})})}o(X0,"iconPDF");function K0(){return l("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:l("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"})})}o(K0,"iconArchive");function Y0(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:l("g",{fill:"#A7AFB7",fillRule:"nonzero",children:[l("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),l("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})]})})}o(Y0,"iconFile");function J0(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:l("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"})})}o(J0,"iconText");function Ni(i){let e={color:"#838999",icon:Y0()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:J0()}:t==="image"?{color:"#686de0",icon:$0()}:t==="audio"?{color:"#068dbb",icon:W0()}:t==="video"?{color:"#19af67",icon:G0()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:X0()}:t==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:K0()}:e}o(Ni,"getIconByMime");function Q0(i){let{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}o(Q0,"ignoreEvent");var Nt=Q0;function As(i){let{file:e}=i;if(e.preview)return l("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});let{color:t,icon:r}=Ni(e.type);return l("div",{className:"uppy-Dashboard-Item-previewIconWrap",children:[l("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t},children:r}),l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76",children:l("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})})]})}o(As,"FilePreview");function el(i){let{computedMetaFields:e,requiredMetaFields:t,updateMeta:r,form:s,formState:n}=i,a={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(u=>{let c=`uppy-Dashboard-FileCard-input-${u.id}`,p=t.includes(u.id);return l("fieldset",{className:"uppy-Dashboard-FileCard-fieldset",children:[l("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:c,children:u.name}),u.render!==void 0?u.render({value:n[u.id],onChange:o(f=>r(f,u.id),"onChange"),fieldCSSClasses:a,required:p,form:s.id},is):l("input",{className:a.text,id:c,form:s.id,type:u.type||"text",required:p,value:n[u.id],placeholder:u.placeholder,onInput:o(f=>r(f.target.value,u.id),"onInput"),"data-uppy-super-focusable":!0})]},u.id)})}o(el,"RenderMetaFields");function tl(i){let{files:e,fileCardFor:t,toggleFileCard:r,saveFileCard:s,metaFields:n,requiredMetaFields:a,openFileEditor:u,i18n:c,i18nArray:p,className:f,canEditFile:d}=i,v=o(()=>typeof n=="function"?n(e[t]):n,"getMetaFields"),_=e[t],k=v()??[],A=d(_),F={};k.forEach(X=>{F[X.id]=_.meta[X.id]??""});let[R,U]=it(F),C=rt(X=>{X.preventDefault(),s(R,t)},[s,R,t]),Y=o((X,Z)=>{U({...R,[Z]:X})},"updateMeta"),$=o(()=>{r(!1)},"handleCancel"),[H]=it(()=>{let X=document.createElement("form");return X.setAttribute("tabindex","-1"),X.id=Dt(),X}),Q=Ye(null);return ze(()=>{let X=Q.current?.getRootNode()??document;return X instanceof Document?X.body.appendChild(H):(X instanceof ShadowRoot,X.appendChild(H)),H.addEventListener("submit",C),()=>{H.removeEventListener("submit",C),H.parentNode&&H.parentNode.removeChild(H)}},[H,C]),l("div",{className:(0,Ld.default)("uppy-Dashboard-FileCard",f),"data-uppy-panelType":"FileCard",onDragOver:Nt,onDragLeave:Nt,onDrop:Nt,onPaste:Nt,ref:Q,children:[l("div",{className:"uppy-DashboardContent-bar",children:[l("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:p("editing",{file:l("span",{className:"uppy-DashboardContent-titleFile",children:_.meta?_.meta.name:_.name})})}),l("button",{className:"uppy-DashboardContent-back",type:"button",form:H.id,title:c("finishEditingFile"),onClick:$,children:c("cancel")})]}),l("div",{className:"uppy-Dashboard-FileCard-inner",children:[l("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:Ni(_.type).color},children:[l(As,{file:_}),A&&l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:o(X=>{C(X),u(_)},"onClick"),children:c("editImage")})]}),l("div",{className:"uppy-Dashboard-FileCard-info",children:l(el,{computedMetaFields:k,requiredMetaFields:a,updateMeta:Y,form:H,formState:R})}),l("div",{className:"uppy-Dashboard-FileCard-actions",children:[l("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:H.id,children:c("saveChanges")}),l("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:$,form:H.id,children:c("cancel")})]})]})]})}o(tl,"FileCard");var Hd=ae(Ge(),1);function Bd(i,e){if(i===e)return!0;if(!i||!e)return!1;let t=Object.keys(i),r=Object.keys(e),s=t.length;if(r.length!==s)return!1;for(let n=0;n<s;n++){let a=t[n];if(i[a]!==e[a]||!Object.prototype.hasOwnProperty.call(e,a))return!1}return!0}o(Bd,"shallowEqualObjects");function il(i,e="Copy the URL below"){return new Promise(t=>{let r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=i,document.body.appendChild(r),r.select();let s=o(()=>{document.body.removeChild(r),window.prompt(e,i),t()},"magicCopyFailed");try{return document.execCommand("copy")?(document.body.removeChild(r),t()):s()}catch{return document.body.removeChild(r),s()}})}o(il,"copyToClipboard");function Z0({file:i,uploadInProgressOrComplete:e,metaFields:t,canEditFile:r,i18n:s,onClick:n}){return!e&&t&&t.length>0||!e&&r(i)?l("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":s("editFileWithFilename",{file:i.meta.name}),title:s("editFileWithFilename",{file:i.meta.name}),onClick:o(()=>n(),"onClick"),children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14",children:l("g",{fillRule:"evenodd",children:[l("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),l("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),l("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})]})})}):null}o(Z0,"EditButton");function eb({i18n:i,onClick:e,file:t}){return l("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":i("removeFile",{file:t.meta.name}),title:i("removeFile",{file:t.meta.name}),onClick:o(()=>e(),"onClick"),children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18",children:[l("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),l("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})]})})}o(eb,"RemoveButton");function tb({file:i,uppy:e,i18n:t}){let r=o(s=>{il(i.uploadURL,t("copyLinkToClipboardFallback")).then(()=>{e.log("Link copied to clipboard."),e.info(t("copyLinkToClipboardSuccess"),"info",3e3)}).catch(e.log).then(()=>s.target.focus({preventScroll:!0}))},"copyLinkToClipboard");return l("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":t("copyLink"),title:t("copyLink"),onClick:o(s=>r(s),"onClick"),children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12",children:l("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})})})}o(tb,"CopyLinkButton");function rl(i){let{uppy:e,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,showLinkToFileUploadResult:a,showRemoveButton:u,i18n:c,toggleFileCard:p,openFileEditor:f}=i;return l("div",{className:"uppy-Dashboard-Item-actionWrapper",children:[l(Z0,{i18n:c,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,onClick:o(()=>{n&&n.length>0?p(!0,t.id):f(t)},"editAction")}),a&&t.uploadURL?l(tb,{file:t,uppy:e,i18n:c}):null,u?l(eb,{i18n:c,file:t,onClick:o(()=>e.removeFile(t.id),"onClick")}):null]})}o(rl,"Buttons");var jd=ae(er(),1);var ib=o((i,e)=>(typeof e=="function"?e():e).filter(s=>s.id===i)[0].name,"metaFieldIdToName");function Rs(i){let{file:e,toggleFileCard:t,i18n:r,metaFields:s}=i,{missingRequiredMetaFields:n}=e;if(!n?.length)return null;let a=n.map(u=>ib(u,s)).join(", ");return l("div",{className:"uppy-Dashboard-Item-errorMessage",children:[r("missingRequiredMetaFields",{smart_count:n.length,fields:a})," ",l("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:o(()=>t(!0,e.id),"onClick"),children:r("editFile")})]})}o(Rs,"MetaErrorMessage");var rb=o(i=>{let{author:e,name:t}=i.file.meta;function r(){return i.isSingleFile&&i.containerHeight>=350?90:i.containerWidth<=352?35:i.containerWidth<=576?60:e?20:30}return o(r,"getMaxNameLength"),l("div",{className:"uppy-Dashboard-Item-name",title:t,children:Jr(t,r())})},"renderFileName"),sb=o(i=>{let{author:e}=i.file.meta,t="remote"in i.file?i.file.remote?.providerName:void 0,r="\xB7";return e?l("div",{className:"uppy-Dashboard-Item-author",children:[l("a",{href:`${e.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",children:Jr(e.name,13)}),t?l(Re,{children:[` ${r} `,t,` ${r} `]}):null]}):null},"renderAuthor"),ob=o(i=>i.file.size&&l("div",{className:"uppy-Dashboard-Item-statusSize",children:(0,jd.default)(i.file.size)}),"renderFileSize"),nb=o(i=>i.file.isGhost&&l("span",{children:[" \u2022 ",l("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:o(()=>i.toggleAddFilesPanel(!0),"onClick"),children:i.i18n("reSelect")})]}),"ReSelectButton"),ab=o(({file:i,onClick:e})=>i.error?l("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":i.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:e,type:"button",children:"?"}):null,"ErrorButton");function sl(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,toggleAddFilesPanel:n,isSingleFile:a,containerHeight:u,containerWidth:c}=i;return l("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source,children:[l("div",{className:"uppy-Dashboard-Item-fileName",children:[rb({file:e,isSingleFile:a,containerHeight:u,containerWidth:c}),l(ab,{file:e,onClick:o(()=>alert(e.error),"onClick")})]}),l("div",{className:"uppy-Dashboard-Item-status",children:[sb({file:e}),ob({file:e}),nb({file:e,toggleAddFilesPanel:n,i18n:t})]}),l(Rs,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}o(sl,"FileInfo");function ol(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,showLinkToFileUploadResult:n}=i,u=e.preview?"rgba(255, 255, 255, 0.5)":Ni(e.type).color;return l("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:u},children:[n&&e.uploadURL&&l("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name,children:l("span",{hidden:!0,children:e.meta.name})}),l(As,{file:e}),l(Rs,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}o(ol,"FilePreviewAndLink");function lb(i){if(!i.isUploaded){if(i.error&&!i.hideRetryButton){i.uppy.retryUpload(i.file.id);return}i.resumableUploads&&!i.hidePauseResumeButton?i.uppy.pauseResume(i.file.id):i.individualCancellation&&!i.hideCancelButton&&i.uppy.removeFile(i.file.id)}}o(lb,"onPauseResumeCancelRetry");function zd(i){return i.isUploaded?i.i18n("uploadComplete"):i.error?i.i18n("retryUpload"):i.resumableUploads?i.file.isPaused?i.i18n("resumeUpload"):i.i18n("pauseUpload"):i.individualCancellation?i.i18n("cancelUpload"):""}o(zd,"progressIndicatorTitle");function nl(i){return l("div",{className:"uppy-Dashboard-Item-progress",children:l("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":zd(i),title:zd(i),onClick:o(()=>lb(i),"onClick"),children:i.children})})}o(nl,"ProgressIndicatorButton");function rn({children:i}){return l("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle",children:i})}o(rn,"ProgressCircleContainer");function al({progress:i}){let e=2*Math.PI*15;return l("g",{children:[l("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),l("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":e,"stroke-dashoffset":e-e/100*i})]})}o(al,"ProgressCircle");function ll(i){return!i.file.progress.uploadStarted||i.file.progress.percentage===void 0?null:i.isUploaded?l("div",{className:"uppy-Dashboard-Item-progress",children:l("div",{className:"uppy-Dashboard-Item-progressIndicator",children:l(rn,{children:[l("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),l("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"})]})})}):i.recoveredState?null:i.error&&!i.hideRetryButton?l(nl,{...i,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19",children:[l("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),l("path",{d:"M7.9 3H10v2H7.9z"}),l("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),l("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"})]})}):i.resumableUploads&&!i.hidePauseResumeButton?l(nl,{...i,children:l(rn,{children:[l(al,{progress:i.file.progress.percentage}),i.file.isPaused?l("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):l("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)",children:[l("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),l("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})]})]})}):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?l(nl,{...i,children:l(rn,{children:[l(al,{progress:i.file.progress.percentage}),l("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"})]})}):l("div",{className:"uppy-Dashboard-Item-progress",children:l("div",{className:"uppy-Dashboard-Item-progressIndicator",children:l(rn,{children:l(al,{progress:i.file.progress.percentage})})})})}o(ll,"FileProgress");var Us=class extends Se{static{o(this,"FileItem")}componentDidMount(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!Bd(this.props,e)}componentDidUpdate(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){let{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){let{file:e}=this.props,t=e.progress.preprocess||e.progress.postprocess,r=!!e.progress.uploadComplete&&!t&&!e.error,s=!!e.progress.uploadStarted||!!t,n=e.progress.uploadStarted&&!e.progress.uploadComplete||t,a=e.error||!1,{isGhost:u}=e,c=(this.props.individualCancellation||!n)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(c=!0);let p=(0,Hd.default)({"uppy-Dashboard-Item":!0,"is-inprogress":n&&!this.props.recoveredState,"is-processing":t,"is-complete":r,"is-error":!!a,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":u});return l("div",{className:p,id:`uppy_${e.id}`,role:this.props.role,children:[l("div",{className:"uppy-Dashboard-Item-preview",children:[l(ol,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),l(ll,{uppy:this.props.uppy,file:e,error:a,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})]}),l("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons",children:[l(sl,{file:e,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),l(rl,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:c,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:s,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})]})]})}};function ub(i,e){let t=[],r=[];return i.forEach(s=>{r.length<e?r.push(s):(t.push(r),r=[s])}),r.length&&t.push(r),t}o(ub,"chunks");function ul({id:i,i18n:e,uppy:t,files:r,resumableUploads:s,hideRetryButton:n,hidePauseResumeButton:a,hideCancelButton:u,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:p,metaFields:f,isSingleFile:d,toggleFileCard:v,handleRequestThumbnail:_,handleCancelThumbnail:k,recoveredState:A,individualCancellation:F,itemsPerRow:R,openFileEditor:U,canEditFile:C,toggleAddFilesPanel:Y,containerWidth:$,containerHeight:H}){let Q=R===1?71:200,X=Fi(()=>{let ye=o((we,me)=>Number(r[me].isGhost)-Number(r[we].isGhost),"sortByGhostComesFirst"),se=Object.keys(r);return A&&se.sort(ye),ub(se,R)},[r,R,A]),Z=o(ye=>l("div",{class:"uppy-Dashboard-filesInner",role:"presentation",children:ye.map(se=>l(Us,{uppy:t,id:i,i18n:e,resumableUploads:s,individualCancellation:F,hideRetryButton:n,hidePauseResumeButton:a,hideCancelButton:u,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:p,metaFields:f,recoveredState:A,isSingleFile:d,containerWidth:$,containerHeight:H,toggleFileCard:v,handleRequestThumbnail:_,handleCancelThumbnail:k,role:"listitem",openFileEditor:U,canEditFile:C,toggleAddFilesPanel:Y,file:r[se]},se))},ye[0]),"renderRow");return d?l("div",{class:"uppy-Dashboard-files",children:Z(X[0])}):l(Zi,{class:"uppy-Dashboard-files",role:"list",data:X,renderRow:Z,rowHeight:Q})}o(ul,"FileList");var qd=300,Os=class extends Se{static{o(this,"FadeIn")}ref=tc();componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,qd)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,qd)}render(){let{children:e}=this.props;return l("div",{className:"uppy-Informer-animated",ref:this.ref,children:e})}};function cb(i,e){return Object.assign(i,e)}o(cb,"assign");function pb(i,e){return i?.key??e}o(pb,"getKey");function db(i,e){let t=i._ptgLinkedRefs||(i._ptgLinkedRefs={});return t[e]||(t[e]=r=>{i.refs[e]=r})}o(db,"linkRef");function Ds(i){let e={};for(let t=0;t<i.length;t++)if(i[t]!=null){let r=pb(i[t],t.toString(36));e[r]=i[t]}return e}o(Ds,"getChildMapping");function hb(i,e){i=i||{},e=e||{};let t=o(a=>Object.hasOwn(e,a)?e[a]:i[a],"getValueForKey"),r={},s=[];for(let a in i)Object.hasOwn(e,a)?s.length&&(r[a]=s,s=[]):s.push(a);let n={};for(let a in e){if(Object.hasOwn(r,a))for(let u=0;u<r[a].length;u++){let c=r[a][u];n[r[a][u]]=t(c)}n[a]=t(a)}for(let a=0;a<s.length;a++)n[s[a]]=t(s[a]);return n}o(hb,"mergeChildMappings");var fb=o(i=>i,"identity"),sn=class extends Se{static{o(this,"TransitionGroup")}constructor(e,t){super(e,t),this.refs={},this.state={children:Ds(Ut(Ut(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){let e=this.state.children;for(let t in e)e[t]&&this.performAppear(t)}componentWillReceiveProps(e){let t=Ds(Ut(e.children)||[]),r=this.state.children;this.setState(n=>({children:hb(n.children,t)}));let s;for(s in t)if(Object.hasOwn(t,s)){let n=r&&Object.hasOwn(r,s);t[s]&&n&&this.currentlyTransitioningKeys[s]?(this.keysToEnter.push(s),this.keysToAbortLeave.push(s)):t[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToEnter.push(s)}for(s in r)if(Object.hasOwn(r,s)){let n=t&&Object.hasOwn(t,s);r[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToLeave.push(s)}}componentDidUpdate(){let{keysToEnter:e}=this;this.keysToEnter=[],e.forEach(this.performEnter);let{keysToLeave:t}=this;this.keysToLeave=[],t.forEach(this.performLeave)}_finishAbort(e){let t=this.keysToAbortLeave.indexOf(e);t!==-1&&this.keysToAbortLeave.splice(t,1)}performAppear(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)}_handleDoneAppearing(e){let t=this.refs[e];t?.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=Ds(Ut(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performEnter(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)}_handleDoneEntering(e){let t=this.refs[e];t?.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=Ds(Ut(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performLeave(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;this.currentlyTransitioningKeys[e]=!0;let r=this.refs[e];r?.componentWillLeave?r.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)}_handleDoneLeaving(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;let r=this.refs[e];r?.componentDidLeave&&r.componentDidLeave(),delete this.currentlyTransitioningKeys[e];let s=Ds(Ut(this.props.children)||[]);if(s&&Object.hasOwn(s,e))this.performEnter(e);else{let n=cb({},this.state.children);delete n[e],this.setState({children:n})}}render({childFactory:e,transitionLeave:t,transitionName:r,transitionAppear:s,transitionEnter:n,transitionLeaveTimeout:a,transitionEnterTimeout:u,transitionAppearTimeout:c,component:p,...f},{children:d}){let v=Object.entries(d).map(([_,k])=>{if(!k)return;let A=db(this,_);return So(e(k),{ref:A,key:_})}).filter(Boolean);return is(p,f,v)}};sn.defaultProps={component:"span",childFactory:fb};var Vd=sn;var mr=class extends Se{static{o(this,"Informer")}render(){let{info:e}=this.props.uppy.getState();return l("div",{className:"uppy uppy-Informer",children:l(Vd,{children:e.map(t=>l(Os,{children:l("p",{role:"alert",children:[t.message," ",t.details&&l("span",{"aria-label":t.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:o(()=>alert(`${t.message}
${t.details}`),"onClick"),children:"?"})]})},t.message))})})}};var $d=ae(Ge(),1);function mb({activePickerPanel:i,className:e,hideAllPanels:t,i18n:r,state:s,uppy:n}){let a=Ye(null);return l("div",{className:(0,$d.default)("uppy-DashboardContent-panel",e),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${i.id}`,onDragOver:Nt,onDragLeave:Nt,onDrop:Nt,onPaste:Nt,children:[l("div",{className:"uppy-DashboardContent-bar",children:[l("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:r("importFrom",{name:i.name})}),l("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:r("cancel")})]}),l("div",{ref:a,className:"uppy-DashboardContent-panelBody",children:n.getPlugin(i.id).render(s,a.current)})]})}o(mb,"PickerPanelContent");var Wd=mb;var Mt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function gb(i,e,t,r={}){if(i)return Mt.STATE_ERROR;if(e)return Mt.STATE_COMPLETE;if(t)return Mt.STATE_PAUSED;let s=Mt.STATE_WAITING,n=Object.keys(r);for(let a=0;a<n.length;a++){let{progress:u}=r[n[a]];if(u.uploadStarted&&!u.uploadComplete)return Mt.STATE_UPLOADING;u.preprocess&&s!==Mt.STATE_UPLOADING&&(s=Mt.STATE_PREPROCESSING),u.postprocess&&s!==Mt.STATE_UPLOADING&&s!==Mt.STATE_PREPROCESSING&&(s=Mt.STATE_POSTPROCESSING)}return s}o(gb,"getUploadingState");function yb({files:i,i18n:e,isAllComplete:t,isAllErrored:r,isAllPaused:s,inProgressNotPausedFiles:n,newFiles:a,processingFiles:u}){switch(gb(r,t,s,i)){case"uploading":return e("uploadingXFiles",{smart_count:n.length});case"preprocessing":case"postprocessing":return e("processingXFiles",{smart_count:u.length});case"paused":return e("uploadPaused");case"waiting":return e("xFilesSelected",{smart_count:a.length});case"complete":return e("uploadComplete");case"error":return e("error");default:}}o(yb,"UploadStatus");function vb(i){let{i18n:e,isAllComplete:t,hideCancelButton:r,maxNumberOfFiles:s,toggleAddFilesPanel:n,uppy:a}=i,{allowNewUpload:u}=i;return u&&s&&(u=i.totalFileCount<i.maxNumberOfFiles),l("div",{className:"uppy-DashboardContent-bar",children:[!t&&!r?l("button",{className:"uppy-DashboardContent-back",type:"button",onClick:o(()=>a.cancelAll(),"onClick"),children:e("cancel")}):l("div",{}),l("div",{className:"uppy-DashboardContent-title",children:l(yb,{...i})}),u?l("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:o(()=>n(!0),"onClick"),children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15",children:l("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})}),l("span",{className:"uppy-DashboardContent-addMoreCaption",children:e("addMore")})]}):l("div",{})]})}o(vb,"PanelTopBar");var Gd=vb;var Kd=ae(Ge(),1);var gr="uppy-transition-slideDownUp",Xd=250;function bb({children:i}){let[e,t]=it(null),[r,s]=it(""),n=Ye(),a=Ye(),u=Ye(),c=rt(()=>{s(`${gr}-enter`),cancelAnimationFrame(u.current),clearTimeout(a.current),a.current=void 0,u.current=requestAnimationFrame(()=>{s(`${gr}-enter ${gr}-enter-active`),n.current=setTimeout(()=>{s("")},Xd)})},[]),p=rt(()=>{s(`${gr}-leave`),cancelAnimationFrame(u.current),clearTimeout(n.current),n.current=void 0,u.current=requestAnimationFrame(()=>{s(`${gr}-leave ${gr}-leave-active`),a.current=setTimeout(()=>{t(null),s("")},Xd)})},[]);return ze(()=>{let f=Ut(i)[0];e!==f&&(f&&!e?c():e&&!f&&!a.current&&p(),t(f))},[i,e,c,p]),ze(()=>()=>{clearTimeout(n.current),clearTimeout(a.current),cancelAnimationFrame(u.current)},[]),e?So(e,{className:(0,Kd.default)(r,e.props.className)}):null}o(bb,"Slide");var Is=bb;var gt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var fl=ae(Ge(),1);var cl=ae(er(),1);var pl=ae(Ge(),1);var wb="\xB7",Yd=o(()=>` ${wb} `,"renderDot");function Jd(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:a,startUpload:u}=i,c=(0,pl.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===gt.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":a}),p=e&&t&&!r?s("uploadXNewFiles",{smart_count:e}):s("uploadXFiles",{smart_count:e});return l("button",{type:"button",className:c,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:u,disabled:a,"data-uppy-super-focusable":!0,children:p})}o(Jd,"UploadBtn");function Qd(i){let{i18n:e,uppy:t}=i;return l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:o(()=>t.retryAll().catch(()=>{}),"onClick"),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:l("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})}),e("retry")]})}o(Qd,"RetryBtn");function Zd(i){let{i18n:e,uppy:t}=i;return l("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:o(()=>t.cancelAll(),"onClick"),"data-cy":"cancel","data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:l("g",{fill:"none",fillRule:"evenodd",children:[l("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),l("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"})]})})})}o(Zd,"CancelBtn");function eh(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,a=t(e?"resume":"pause");function u(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return o(u,"togglePauseResume"),l("button",{title:a,"aria-label":a,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:u,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:l("g",{fill:"none",fillRule:"evenodd",children:[l("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),l("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}o(eh,"PauseResumeButton");function th(i){let{i18n:e,doneButtonHandler:t}=i;return l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0,children:e("done")})}o(th,"DoneBtn");function ih(){return l("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:l("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"})})}o(ih,"LoadingSpinner");function rh(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return l("div",{className:"uppy-StatusBar-content",children:[l(ih,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}o(rh,"ProgressBarProcessing");function Sb(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:a}=i,u=e>1,c=(0,cl.default)(r);return l("div",{className:"uppy-StatusBar-statusSecondary",children:[u&&a("filesUploadedOfTotal",{complete:t,smart_count:e}),l("span",{className:"uppy-StatusBar-additionalInfo",children:[u&&Yd(),s!=null?a("dataUploadedOfTotal",{complete:c,total:(0,cl.default)(s)}):a("dataUploadedOfUnknown",{complete:c}),Yd(),n!=null&&a("xTimeLeft",{time:Yi(n)})]})]})}o(Sb,"ProgressDetails");function sh(i){let{i18n:e,complete:t,numUploads:r}=i;return l("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:t,smart_count:r})})}o(sh,"FileUploadCount");function xb(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,pl.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return l("div",{className:"uppy-StatusBar-statusSecondary",children:[l("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:t})}),l("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r,children:e("upload")})]})}o(xb,"UploadNewlyAddedFiles");function oh(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,hideProgressDetails:s,isUploadStarted:n,isAllComplete:a,isAllPaused:u,newFiles:c,numUploads:p,complete:f,totalUploadedSize:d,totalSize:v,totalETA:_,startUpload:k}=i,A=c&&n;if(!n||a)return null;let F=e(u?"paused":"uploading");function R(){return!u&&!A&&!s?t?l(Sb,{numUploads:p,complete:f,totalUploadedSize:d,totalSize:v,totalETA:_,i18n:e}):l(sh,{i18n:e,complete:f,numUploads:p}):null}return o(R,"renderProgressDetails"),l("div",{className:"uppy-StatusBar-content",title:F,children:[u?null:l(ih,{}),l("div",{className:"uppy-StatusBar-status",children:[l("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${F}: ${r}%`:F}),R(),A?l(xb,{i18n:e,newFiles:c,startUpload:k}):null]})]})}o(oh,"ProgressBarUploading");function nh(i){let{i18n:e}=i;return l("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:l("div",{className:"uppy-StatusBar-status",children:l("div",{className:"uppy-StatusBar-statusPrimary",children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:l("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}o(nh,"ProgressBarComplete");function ah(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let a=`${t("uploadFailed")}
${e}`;alert(a)}return o(n,"displayErrorAlert"),l("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:l("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})}),l("div",{className:"uppy-StatusBar-status",children:[l("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),l("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:n,type:"button",children:"?"})]}),l(sh,{i18n:t,complete:r,numUploads:s})]})]})}o(ah,"ProgressBarError");function Ns(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:a,postprocess:u}=n;r==null&&(a||u)&&({mode:t,message:r}=a||u),a?.mode==="determinate"&&e.push(a.value),u?.mode==="determinate"&&e.push(u.value)}let s=e.reduce((n,a)=>n+a/e.length,0);return{mode:t,message:r,value:s}}o(Ns,"calculateProcessingProgress");var{STATE_ERROR:lh,STATE_WAITING:Pb,STATE_PREPROCESSING:dl,STATE_UPLOADING:on,STATE_POSTPROCESSING:hl,STATE_COMPLETE:nn}=gt;function ml({newFiles:i,allowNewUpload:e,isUploadInProgress:t,isAllPaused:r,resumableUploads:s,error:n,hideUploadButton:a=void 0,hidePauseResumeButton:u=!1,hideCancelButton:c=!1,hideRetryButton:p=!1,recoveredState:f,uploadState:d,totalProgress:v,files:_,supportsUploadProgress:k,hideAfterFinish:A=!1,isSomeGhost:F,doneButtonHandler:R=void 0,isUploadStarted:U,i18n:C,startUpload:Y,uppy:$,isAllComplete:H,hideProgressDetails:Q=void 0,numUploads:X,complete:Z,totalSize:ye,totalETA:se,totalUploadedSize:we}){function me(){switch(d){case hl:case dl:{let ne=Ns(_);return ne.mode==="determinate"?ne.value*100:v}case lh:return null;case on:return k?v:null;default:return v}}o(me,"getProgressValue");function _e(){switch(d){case hl:case dl:{let{mode:ne}=Ns(_);return ne==="indeterminate"}case on:return!k;default:return!1}}o(_e,"getIsIndeterminate");let ve=me(),E=ve??100,w=!n&&i&&(!t&&!r||f)&&e&&!a,S=!c&&d!==Pb&&d!==nn,B=s&&!u&&d===on,q=n&&!H&&!p,j=R&&d===nn,I=(0,fl.default)("uppy-StatusBar-progress",{"is-indeterminate":_e()}),T=(0,fl.default)("uppy-StatusBar",`is-${d}`,{"has-ghosts":F}),O=(()=>{switch(d){case dl:case hl:return l(rh,{progress:Ns(_)});case nn:return l(nh,{i18n:C});case lh:return l(ah,{error:n,i18n:C,numUploads:X,complete:Z});case on:return l(oh,{i18n:C,supportsUploadProgress:k,totalProgress:v,hideProgressDetails:Q,isUploadStarted:U,isAllComplete:H,isAllPaused:r,newFiles:i,numUploads:X,complete:Z,totalUploadedSize:we,totalSize:ye,totalETA:se,startUpload:Y});default:return null}})();return!(w||q||B||S||j)&&!O||d===nn&&A?null:l("div",{className:T,children:[l("div",{className:I,style:{width:`${E}%`},role:"progressbar","aria-label":`${E}%`,"aria-valuetext":`${E}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":ve}),O,l("div",{className:"uppy-StatusBar-actions",children:[w?l(Jd,{newFiles:i,isUploadStarted:U,recoveredState:f,i18n:C,isSomeGhost:F,startUpload:Y,uploadState:d}):null,q?l(Qd,{i18n:C,uppy:$}):null,B?l(eh,{isAllPaused:r,i18n:C,isAllComplete:H,resumableUploads:s,uppy:$}):null,S?l(Zd,{i18n:C,uppy:$}):null,j?l(th,{i18n:C,doneButtonHandler:R}):null]})]})}o(ml,"StatusBarUI");var _b=2e3,kb=2e3;function Eb(i,e,t,r){if(i)return gt.STATE_ERROR;if(e)return gt.STATE_COMPLETE;if(t)return gt.STATE_WAITING;let s=gt.STATE_WAITING,n=Object.keys(r);for(let a=0;a<n.length;a++){let{progress:u}=r[n[a]];if(u.uploadStarted&&!u.uploadComplete)return gt.STATE_UPLOADING;u.preprocess&&(s=gt.STATE_PREPROCESSING),u.postprocess&&s!==gt.STATE_PREPROCESSING&&(s=gt.STATE_POSTPROCESSING)}return s}o(Eb,"getUploadingState");var Ms=class extends Se{static{o(this,"StatusBar")}#e;#t;#r;#i;componentDidMount(){this.#e=performance.now(),this.#t=this.props.uppy.getFiles().reduce((e,t)=>e+(t.progress.bytesUploaded||0),0),this.props.uppy.on("upload",this.#s)}componentWillUnmount(){this.props.uppy.off("upload",this.#s)}#s=o(()=>{let{recoveredState:e}=this.props.uppy.getState();if(this.#r=null,this.#i=null,e){this.#t=Object.values(e.files).reduce((t,{progress:r})=>t+(r.bytesUploaded||0),0);return}this.#e=performance.now(),this.#t=0},"#onUploadStart");#l(e){if(e.total==null||e.total===0)return null;let t=e.total-e.uploaded;if(t<=0)return null;this.#e??=performance.now();let r=performance.now()-this.#e;if(r===0)return Math.round((this.#i??0)/100)/10;if(this.#t==null)return this.#t=e.uploaded,null;let s=e.uploaded-this.#t;if(this.#t=e.uploaded,s<=0)return Math.round((this.#i??0)/100)/10;let n=s/r;if(!Number.isFinite(n)||n<=0)return null;let a=this.#r==null?n:Qt(n,this.#r,_b,r);if(!Number.isFinite(a)||a<=0)return null;this.#r=a;let u=t/a;if(!Number.isFinite(u)||u<0)return null;let c=Math.max((this.#i??0)-r,0),p=this.#i==null?u:Qt(u,c,kb,r);return!Number.isFinite(p)||p<0?null:(this.#i=p,this.#e=performance.now(),Math.round(p/100)/10)}startUpload=o(()=>{let{recoveredState:e}=this.props.uppy.getState();e?this.props.uppy.emit("restore-confirmed"):this.props.uppy.upload().catch((()=>{}))},"startUpload");render(){let{capabilities:e,files:t,allowNewUpload:r,totalProgress:s,error:n,recoveredState:a}=this.props.uppy.getState(),{newFiles:u,startedFiles:c,completeFiles:p,isUploadStarted:f,isAllComplete:d,isAllPaused:v,isUploadInProgress:_,isSomeGhost:k}=this.props.uppy.getObjectOfFilesPerState(),A=a?Object.values(t):u,F=!!e.resumableUploads,R=e.uploadProgress!==!1,U=null,C=0;c.every($=>$.progress.bytesTotal!=null&&$.progress.bytesTotal!==0)?(U=0,c.forEach($=>{U+=$.progress.bytesTotal||0,C+=$.progress.bytesUploaded||0})):c.forEach($=>{C+=$.progress.bytesUploaded||0});let Y=this.#l({uploaded:C,total:U});return l(ml,{error:n,uploadState:Eb(n,d,a,t||{}),allowNewUpload:r,totalProgress:s,totalSize:U,totalUploadedSize:C,isAllComplete:d,isAllPaused:v,isUploadStarted:f,isUploadInProgress:_,isSomeGhost:k,recoveredState:a,complete:p.length,newFiles:A.length,numUploads:c.length,totalETA:Y,files:t,i18n:this.props.i18n,uppy:this.props.uppy,startUpload:this.startUpload,doneButtonHandler:this.props.doneButtonHandler,resumableUploads:F,supportsUploadProgress:R,hideProgressDetails:this.props.hideProgressDetails,hideUploadButton:this.props.hideUploadButton,hideRetryButton:this.props.hideRetryButton,hidePauseResumeButton:this.props.hidePauseResumeButton,hideCancelButton:this.props.hideCancelButton,hideAfterFinish:this.props.hideAfterFinish})}};var uh=900,ch=700,gl=576,ph=330;function yl(i){let e=i.totalFileCount===0,t=i.totalFileCount===1,r=i.containerWidth>gl,s=i.containerHeight>ph,n=(0,dh.default)({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":i.disabled,"uppy-Dashboard--animateOpenClose":i.animateOpenClose,"uppy-Dashboard--isClosing":i.isClosing,"uppy-Dashboard--isDraggingOver":i.isDraggingOver,"uppy-Dashboard--modal":!i.inline,"uppy-size--md":i.containerWidth>gl,"uppy-size--lg":i.containerWidth>ch,"uppy-size--xl":i.containerWidth>uh,"uppy-size--height-md":i.containerHeight>ph,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&t&&s}),a=1;i.containerWidth>uh?a=5:i.containerWidth>ch?a=4:i.containerWidth>gl&&(a=3);let u=i.showSelectedFiles&&!e,c=i.recoveredState?Object.keys(i.recoveredState.files).length:null,p=i.files?Object.keys(i.files).filter(v=>i.files[v].isGhost).length:0,f=o(()=>p>0?i.i18n("recoveredXFiles",{smart_count:p}):i.i18n("recoveredAllFiles"),"renderRestoredText");return l("div",{className:n,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&Ki(),"aria-hidden":i.inline?"false":i.isHidden,"aria-disabled":i.disabled,"aria-label":i.inline?i.i18n("dashboardTitle"):i.i18n("dashboardWindowTitle"),onPaste:i.handlePaste,onDragOver:i.handleDragOver,onDragLeave:i.handleDragLeave,onDrop:i.handleDrop,children:[l("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),l("div",{className:"uppy-Dashboard-inner",role:i.inline?void 0:"dialog",style:{width:i.inline&&i.width?i.width:"",height:i.inline&&i.height?i.height:""},children:[i.inline?null:l("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal,children:l("span",{"aria-hidden":"true",children:"\xD7"})}),l("div",{className:"uppy-Dashboard-innerWrap",children:[l("div",{className:"uppy-Dashboard-dropFilesHereHint",children:i.i18n("dropHint")}),u&&l(Gd,{...i}),c!=null&&c>0&&l("div",{className:"uppy-Dashboard-serviceMsg",children:[l("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:l("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[l("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),l("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),l("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),l("strong",{className:"uppy-Dashboard-serviceMsg-title",children:i.i18n("sessionRestored")}),l("div",{className:"uppy-Dashboard-serviceMsg-text",children:f()})]}),u?l(ul,{id:i.id,i18n:i.i18n,uppy:i.uppy,files:i.files,resumableUploads:i.resumableUploads,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,showLinkToFileUploadResult:i.showLinkToFileUploadResult,showRemoveButtonAfterComplete:i.showRemoveButtonAfterComplete,metaFields:i.metaFields,toggleFileCard:i.toggleFileCard,handleRequestThumbnail:i.handleRequestThumbnail,handleCancelThumbnail:i.handleCancelThumbnail,recoveredState:i.recoveredState,individualCancellation:i.individualCancellation,openFileEditor:i.openFileEditor,canEditFile:i.canEditFile,toggleAddFilesPanel:i.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:a,containerWidth:i.containerWidth,containerHeight:i.containerHeight}):l(tn,{i18n:i.i18n,i18nArray:i.i18nArray,acquirers:i.acquirers,handleInputChange:i.handleInputChange,maxNumberOfFiles:i.maxNumberOfFiles,allowedFileTypes:i.allowedFileTypes,showNativePhotoCameraButton:i.showNativePhotoCameraButton,showNativeVideoCameraButton:i.showNativeVideoCameraButton,nativeCameraFacingMode:i.nativeCameraFacingMode,showPanel:i.showPanel,activePickerPanel:i.activePickerPanel,disableLocalFiles:i.disableLocalFiles,fileManagerSelectionType:i.fileManagerSelectionType,note:i.note,proudlyDisplayPoweredByUppy:i.proudlyDisplayPoweredByUppy}),l(Is,{children:i.showAddFilesPanel?l(Id,{...i,isSizeMD:r},"AddFiles"):null}),l(Is,{children:i.fileCardFor?l(tl,{...i},"FileCard"):null}),l(Is,{children:i.activePickerPanel?l(Wd,{...i},"Picker"):null}),l(Is,{children:i.showFileEditor?l(Md,{...i},"Editor"):null}),l("div",{className:"uppy-Dashboard-progressindicators",children:[!i.disableInformer&&l(mr,{uppy:i.uppy}),!i.disableStatusBar&&l(Ms,{uppy:i.uppy,i18n:i.i18n,hideProgressDetails:i.hideProgressDetails,hideUploadButton:i.hideUploadButton,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,hideAfterFinish:i.hideProgressAfterFinish,doneButtonHandler:i.doneButtonHandler}),!i.disableInformer&&l(mr,{uppy:i.uppy}),i.progressindicators.map(v=>i.uppy.getPlugin(v.id).render(i.state))]})]})]})]})}o(yl,"Dashboard");var hh={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video",uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}};var fh=ae(Eo(),1);function Ls(i,e){if(e){let t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}o(Ls,"getActiveOverlayEl");function vl(){let i=!1;return(0,fh.default)(o((t,r)=>{let s=Ls(t,r),n=s.contains(document.activeElement);if(n&&i)return;let a=s.querySelector("[data-uppy-super-focusable]");n&&!a||(a?(a.focus({preventScroll:!0}),i=!0):(s.querySelector(Hr)?.focus({preventScroll:!0}),i=!1))},"superFocus"),260)}o(vl,"createSuperFocus");function mh(i,e){let t=e[0];t&&(t.focus(),i.preventDefault())}o(mh,"focusOnFirstNode");function Fb(i,e){let t=e[e.length-1];t&&(t.focus(),i.preventDefault())}o(Fb,"focusOnLastNode");function Tb(i){return i.contains(document.activeElement)}o(Tb,"isFocusInOverlay");function bl(i,e,t){let r=Ls(t,e),s=je(r.querySelectorAll(Hr)),n=s.indexOf(document.activeElement);Tb(r)?i.shiftKey&&n===0?Fb(i,s):!i.shiftKey&&n===s.length-1&&mh(i,s):mh(i,s)}o(bl,"trapFocus");function gh(i,e,t){e===null||bl(i,e,t)}o(gh,"forInline");var yh=9,Ab=27;function vh(){let i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}o(vh,"createPromise");var Rb={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:ar,showLinkToFileUploadResult:!1,hideProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,disabled:!1,disableLocalFiles:!1,nativeCameraFacingMode:"",onDragLeave:o(()=>{},"onDragLeave"),onDragOver:o(()=>{},"onDragOver"),onDrop:o(()=>{},"onDrop"),plugins:[],doneButtonHandler:void 0,onRequestCloseModal:null,inline:!1,animateOpenClose:!0,browserBackButtonClose:!1,closeAfterFinish:!1,closeModalOnClickOutside:!1,disablePageScrollWhenModalOpen:!0,trigger:null,width:750,height:550},yr=class extends re{static{o(this,"Dashboard")}static VERSION=Od.version;#e;modalName=`uppy-Dashboard-${Dt()}`;superFocus=vl();ifFocusedOnUppyRecently=!1;dashboardIsDisabled;savedScrollPosition;savedActiveElement;resizeObserver;darkModeMediaQuery;makeDashboardInsidesVisibleAnywayTimeout;constructor(e,t){let r=t?.autoOpen??null;super(e,{...Rb,...t,autoOpen:r}),this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=hh,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),this.opts.onRequestCloseModal??=()=>this.closeModal(),this.i18nInit()}removeTarget=o(e=>{let r=this.getPluginState().targets.filter(s=>s.id!==e.id);this.setPluginState({targets:r})},"removeTarget");addTarget=o(e=>{let t=e.id||e.constructor.name,r=e.title||t,s=e.type;if(s!=="acquirer"&&s!=="progressindicator"&&s!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;let n={id:t,name:r,type:s},u=this.getPluginState().targets.slice();return u.push(n),this.setPluginState({targets:u}),this.el},"addTarget");hideAllPanels=o(()=>{let e=this.getPluginState(),t={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};e.activePickerPanel===t.activePickerPanel&&e.showAddFilesPanel===t.showAddFilesPanel&&e.showFileEditor===t.showFileEditor&&e.activeOverlayType===t.activeOverlayType||(this.setPluginState(t),this.uppy.emit("dashboard:close-panel",e.activePickerPanel?.id))},"hideAllPanels");showPanel=o(e=>{let{targets:t}=this.getPluginState(),r=t.find(s=>s.type==="acquirer"&&s.id===e);this.setPluginState({activePickerPanel:r,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",e)},"showPanel");canEditFile=o(e=>{let{targets:t}=this.getPluginState();return this.#n(t).some(s=>this.uppy.getPlugin(s.id).canEditFile(e))},"canEditFile");openFileEditor=o(e=>{let{targets:t}=this.getPluginState(),r=this.#n(t);this.setPluginState({showFileEditor:!0,fileCardFor:e.id||null,activeOverlayType:"FileEditor"}),r.forEach(s=>{this.uppy.getPlugin(s.id).selectFile(e)})},"openFileEditor");closeFileEditor=o(()=>{let{metaFields:e}=this.getPluginState();e&&e.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})},"closeFileEditor");saveFileEditor=o(()=>{let{targets:e}=this.getPluginState();this.#n(e).forEach(r=>{this.uppy.getPlugin(r.id).save()}),this.closeFileEditor()},"saveFileEditor");openModal=o(()=>{let{promise:e,resolve:t}=vh();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){let r=o(()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",r,!1),t()},"handler");this.el.addEventListener("animationend",r,!1)}else this.setPluginState({isHidden:!1}),t();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),e},"openModal");closeModal=o(e=>{let t=e?.manualClose??!0,{isHidden:r,isClosing:s}=this.getPluginState();if(r||s)return;let{promise:n,resolve:a}=vh();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});let u=o(()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",u,!1),a()},"handler");this.el.addEventListener("animationend",u,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),a();return document.removeEventListener("keydown",this.handleKeyDownInModal),t&&this.opts.browserBackButtonClose&&history.state?.[this.modalName]&&history.back(),this.uppy.emit("dashboard:modal-closed"),n},"closeModal");isModalOpen=o(()=>!this.getPluginState().isHidden||!1,"isModalOpen");requestCloseModal=o(()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal(),"requestCloseModal");setDarkModeCapability=o(e=>{let{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,darkMode:e}})},"setDarkModeCapability");handleSystemDarkModeChange=o(e=>{let t=e.matches;this.uppy.log(`[Dashboard] Dark mode is ${t?"on":"off"}`),this.setDarkModeCapability(t)},"handleSystemDarkModeChange");toggleFileCard=o((e,t)=>{let r=this.uppy.getFile(t);e?this.uppy.emit("dashboard:file-edit-start",r):this.uppy.emit("dashboard:file-edit-complete",r),this.setPluginState({fileCardFor:e?t:null,activeOverlayType:e?"FileCard":null})},"toggleFileCard");toggleAddFilesPanel=o(e=>{this.setPluginState({showAddFilesPanel:e,activeOverlayType:e?"AddFiles":null})},"toggleAddFilesPanel");addFiles=o(e=>{let t=e.map(r=>({source:this.id,name:r.name,type:r.type,data:r,meta:{relativePath:r.relativePath||r.webkitRelativePath||null}}));try{this.uppy.addFiles(t)}catch(r){this.uppy.log(r)}},"addFiles");startListeningToResize=o(()=>{this.resizeObserver=new ResizeObserver(e=>{let t=e[0],{width:r,height:s}=t.contentRect;this.setPluginState({containerWidth:r,containerHeight:s,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{let e=this.getPluginState(),t=!this.opts.inline&&e.isHidden;!e.areInsidesReadyToBeVisible&&!t&&(this.uppy.log("[Dashboard] resize event didn\u2019t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)},"startListeningToResize");stopListeningToResize=o(()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)},"stopListeningToResize");recordIfFocusedOnUppyRecently=o(e=>{this.el.contains(e.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())},"recordIfFocusedOnUppyRecently");disableInteractiveElements=o(e=>{let t=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],r=this.#e??je(this.el.querySelectorAll(t)).filter(s=>!s.classList.contains("uppy-Dashboard-close"));for(let s of r)s.tagName==="A"?s.setAttribute("aria-disabled",e):s.disabled=e;e?this.#e=r:this.#e=null,this.dashboardIsDisabled=e},"disableInteractiveElements");updateBrowserHistory=o(()=>{history.state?.[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)},"updateBrowserHistory");handlePopState=o(e=>{this.isModalOpen()&&(!e.state||!e.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&e.state?.[this.modalName]&&history.back()},"handlePopState");handleKeyDownInModal=o(e=>{e.keyCode===Ab&&this.requestCloseModal(),e.keyCode===yh&&bl(e,this.getPluginState().activeOverlayType,this.el)},"handleKeyDownInModal");handleClickOutside=o(()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()},"handleClickOutside");handlePaste=o(e=>{this.uppy.iteratePlugins(r=>{r.type==="acquirer"&&r.handleRootPaste?.(e)});let t=je(e.clipboardData.files);t.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(t))},"handlePaste");handleInputChange=o(e=>{e.preventDefault();let t=je(e.currentTarget.files||[]);t.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(t))},"handleInputChange");handleDragOver=o(e=>{e.preventDefault(),e.stopPropagation();let t=o(()=>{let a=!0;return this.uppy.iteratePlugins(u=>{u.canHandleRootDrop?.(e)&&(a=!0)}),a},"canSomePluginHandleRootDrop"),r=o(()=>{let{types:a}=e.dataTransfer;return a.some(u=>u==="Files")},"doesEventHaveFiles"),s=t(),n=r();if(!s&&!n||this.opts.disabled||this.opts.disableLocalFiles&&(n||!s)||!this.uppy.getState().allowNewUpload){e.dataTransfer.dropEffect="none";return}e.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(e)},"handleDragOver");handleDragLeave=o(e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(e)},"handleDragLeave");handleDrop=o(async e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(n=>{n.type==="acquirer"&&n.handleRootDrop?.(e)});let t=!1,r=o(n=>{this.uppy.log(n,"error"),t||(this.uppy.info(n.message,"error"),t=!0)},"logDropError");this.uppy.log("[Dashboard] Processing dropped files");let s=await ei(e.dataTransfer,{logDropError:r});s.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(s)),this.opts.onDrop(e)},"handleDrop");handleRequestThumbnail=o(e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",e)},"handleRequestThumbnail");handleCancelThumbnail=o(e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",e)},"handleCancelThumbnail");handleKeyDownInInline=o(e=>{e.keyCode===yh&&gh(e,this.getPluginState().activeOverlayType,this.el)},"handleKeyDownInInline");handlePasteOnBody=o(e=>{this.el.contains(document.activeElement)&&this.handlePaste(e)},"handlePasteOnBody");handleComplete=o(({failed:e})=>{this.opts.closeAfterFinish&&!e?.length&&this.requestCloseModal()},"handleComplete");#t=o(()=>{if(this.opts.disableThumbnailGenerator)return;let e=600,t=this.uppy.getFiles();if(t.length===1){let r=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);r?.setOptions({thumbnailWidth:e});let s={...t[0],preview:void 0};r?.requestThumbnail(s).then(()=>{r?.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}},"#generateLargeThumbnailIfSingleFile");#r=o(e=>{let t=e[0],{metaFields:r}=this.getPluginState(),s=r&&r.length>0,n=this.canEditFile(t);s&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,t.id):n&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(t)},"#openFileEditorWhenFilesAdded");initEvents=o(()=>{if(this.opts.trigger&&!this.opts.inline){let e=go(this.opts.trigger);e?e.forEach(t=>t.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",this.#u),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",this.#t),this.uppy.on("file-removed",this.#t),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",this.#r)},"initEvents");removeEvents=o(()=>{let e=go(this.opts.trigger);!this.opts.inline&&e&&e.forEach(t=>t.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",this.#u),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",this.#t),this.uppy.off("file-removed",this.#t),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",this.#r)},"removeEvents");superFocusOnEachUpdate=o(()=>{let e=this.el.contains(document.activeElement),t=document.activeElement===document.body||document.activeElement===null,r=this.uppy.getState().info.length===0,s=!this.opts.inline;r&&(s||e||t&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()},"superFocusOnEachUpdate");afterUpdate=o(()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()},"afterUpdate");saveFileCard=o((e,t)=>{this.uppy.setFileMeta(t,e),this.toggleFileCard(!1,t)},"saveFileCard");#i=o(e=>{let t=this.uppy.getPlugin(e.id);return{...e,icon:t.icon||this.opts.defaultPickerIcon,render:t.render}},"#attachRenderFunctionToTarget");#s=o(e=>{let t=this.uppy.getPlugin(e.id);return typeof t.isSupported!="function"?!0:t.isSupported()},"#isTargetSupported");#l=o(e=>e.filter(t=>t.type==="acquirer"&&this.#s(t)).map(this.#i),"#getAcquirers");#o=o(e=>e.filter(t=>t.type==="progressindicator").map(this.#i),"#getProgressIndicators");#n=o(e=>e.filter(t=>t.type==="editor").map(this.#i),"#getEditors");render=o(e=>{let t=this.getPluginState(),{files:r,capabilities:s,allowNewUpload:n}=e,{newFiles:a,uploadStartedFiles:u,completeFiles:c,erroredFiles:p,inProgressFiles:f,inProgressNotPausedFiles:d,processingFiles:v,isUploadStarted:_,isAllComplete:k,isAllPaused:A}=this.uppy.getObjectOfFilesPerState(),F=this.#l(t.targets),R=this.#o(t.targets),U=this.#n(t.targets),C;return this.opts.theme==="auto"?C=s.darkMode?"dark":"light":C=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),yl({state:e,isHidden:t.isHidden,files:r,newFiles:a,uploadStartedFiles:u,completeFiles:c,erroredFiles:p,inProgressFiles:f,inProgressNotPausedFiles:d,processingFiles:v,isUploadStarted:_,isAllComplete:k,isAllPaused:A,totalFileCount:Object.keys(r).length,totalProgress:e.totalProgress,allowNewUpload:n,acquirers:F,theme:C,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:t.activePickerPanel,showFileEditor:t.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:t.isClosing,progressindicators:R,editors:U,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:e.recoveredState,metaFields:t.metaFields,resumableUploads:s.resumableUploads||!1,individualCancellation:s.individualCancellation,isMobileDevice:s.isMobileDevice,fileCardFor:t.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:t.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:t.containerWidth,containerHeight:t.containerHeight,areInsidesReadyToBeVisible:t.areInsidesReadyToBeVisible,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleRequestThumbnail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:t.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop,disableInformer:this.opts.disableInformer,disableStatusBar:this.opts.disableStatusBar,hideProgressDetails:this.opts.hideProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideProgressAfterFinish:this.opts.hideProgressAfterFinish,doneButtonHandler:this.opts.doneButtonHandler})},"render");#a=o(()=>{let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r?r.mount(this,r):this.uppy.log(`[Uppy] Dashboard could not find plugin '${t}', make sure to uppy.use() the plugins you are specifying`,"warning")})},"#addSpecifiedPluginsFromOptions");#c=o(()=>{this.uppy.iteratePlugins(this.#u)},"#autoDiscoverPlugins");#u=o(e=>{let t=["acquirer","editor"];e&&!e.opts?.target&&t.includes(e.type)&&(this.getPluginState().targets.some(s=>e.id===s.id)||e.mount(this,e))},"#addSupportedPluginIfNoTarget");#d(){let{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s}=this.opts;return{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s,lazy:!s}}setOptions(e){super.setOptions(e),this.uppy.getPlugin(this.#p())?.setOptions(this.#d())}#p(){return`${this.id}:ThumbnailGenerator`}install=o(()=>{this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});let{inline:e,closeAfterFinish:t}=this.opts;if(e&&t)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");let{allowMultipleUploads:r,allowMultipleUploadBatches:s}=this.uppy.opts;(r||s)&&t&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");let{target:n}=this.opts;n&&this.mount(n,this),this.opts.disableThumbnailGenerator||this.uppy.use(Ii,{id:this.#p(),...this.#d()}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;let a=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;this.uppy.log(`[Dashboard] Dark mode is ${a?"on":"off"}`),this.setDarkModeCapability(a),this.opts.theme==="auto"&&this.darkModeMediaQuery?.addListener(this.handleSystemDarkModeChange),this.#a(),this.#c(),this.initEvents()},"install");uninstall=o(()=>{if(!this.opts.disableThumbnailGenerator){let t=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);t&&this.uppy.removePlugin(t)}let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r&&r.unmount()}),this.opts.theme==="auto"&&this.darkModeMediaQuery?.removeListener(this.handleSystemDarkModeChange),this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()},"uninstall")};var bh={name:"@uppy/drag-drop",description:"Droppable zone UI for Uppy. Drag and drop files into it to upload.",version:"5.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","drag-drop","drag","drop","dropzone","upload"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var wh={strings:{dropHereOr:"Drop here or %{browse}",browse:"browse"}};var Ob={inputName:"files[]",width:"100%",height:"100%"},vr=class i extends re{static{o(this,"DragDrop")}static VERSION=bh.version;isDragDropSupported=Ki();fileInputRef;constructor(e,t){super(e,{...Ob,...t}),this.type="acquirer",this.id=this.opts.id||"DragDrop",this.title="Drag & Drop",this.defaultLocale=wh,this.i18nInit()}addFiles=o(e=>{let t=e.map(r=>({source:this.id,name:r.name,type:r.type,data:r,meta:{relativePath:r.relativePath||null}}));try{this.uppy.addFiles(t)}catch(r){this.uppy.log(r)}},"addFiles");onInputChange=o(e=>{let t=je(e.currentTarget.files||[]);t.length>0&&(this.uppy.log("[DragDrop] Files selected through input"),this.addFiles(t)),e.currentTarget.value=""},"onInputChange");handleDragOver=o(e=>{e.preventDefault(),e.stopPropagation();let{types:t}=e.dataTransfer,r=t.some(n=>n==="Files"),{allowNewUpload:s}=this.uppy.getState();if(!r||!s){e.dataTransfer.dropEffect="none";return}e.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver?.(e)},"handleDragOver");handleDragLeave=o(e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave?.(e)},"handleDragLeave");handleDrop=o(async e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1});let t=o(s=>{this.uppy.log(s,"error")},"logDropError"),r=await ei(e.dataTransfer,{logDropError:t});r.length>0&&(this.uppy.log("[DragDrop] Files dropped"),this.addFiles(r)),this.opts.onDrop?.(e)},"handleDrop");renderHiddenFileInput(){let{restrictions:e}=this.uppy.opts;return l("input",{className:"uppy-DragDrop-input",type:"file",hidden:!0,ref:o(t=>{this.fileInputRef=t},"ref"),name:this.opts.inputName,multiple:e.maxNumberOfFiles!==1,accept:e.allowedFileTypes?.join(", "),onChange:this.onInputChange})}static renderArrowSvg(){return l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-DragDrop-arrow",width:"16",height:"16",viewBox:"0 0 16 16",children:l("path",{d:"M11 10V0H5v10H2l6 6 6-6h-3zm0 0",fillRule:"evenodd"})})}renderLabel(){return l("div",{className:"uppy-DragDrop-label",children:this.i18nArray("dropHereOr",{browse:l("span",{className:"uppy-DragDrop-browse",children:this.i18n("browse")})})})}renderNote(){return l("span",{className:"uppy-DragDrop-note",children:this.opts.note})}render(){let e=`uppy-u-reset
uppy-DragDrop-container
${this.isDragDropSupported?"uppy-DragDrop--isDragDropSupported":""}
${this.getPluginState().isDraggingOver?"uppy-DragDrop--isDraggingOver":""}
`,t={width:this.opts.width,height:this.opts.height};return l("button",{type:"button",className:e,style:t,onClick:o(()=>this.fileInputRef.click(),"onClick"),onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,onDrop:this.handleDrop,children:[this.renderHiddenFileInput(),l("div",{className:"uppy-DragDrop-inner",children:[i.renderArrowSvg(),this.renderLabel(),this.renderNote()]})]})}install(){let{target:e}=this.opts;this.setPluginState({isDraggingOver:!1}),e&&this.mount(e,this)}uninstall(){this.unmount()}};var Sh={name:"@uppy/drop-target",description:"Lets your users drag and drop files on a DOM element",version:"4.1.0",license:"MIT",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","drag-drop","drag","drop","dropzone","upload"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Ib={target:null};function wl(i){return i.dataTransfer?.types?.some(e=>e==="Files")??!1}o(wl,"isFileTransfer");var Bs=class extends xe{static{o(this,"DropTarget")}static VERSION=Sh.version;nodes;constructor(e,t){super(e,{...Ib,...t}),this.type="acquirer",this.id=this.opts.id||"DropTarget"}addFiles=o(e=>{let t=e.map(r=>({source:this.id,name:r.name,type:r.type,data:r,meta:{relativePath:r.relativePath||null}}));try{this.uppy.addFiles(t)}catch(r){this.uppy.log(r)}},"addFiles");handleDrop=o(async e=>{if(!wl(e))return;e.preventDefault(),e.stopPropagation(),e.currentTarget?.classList.remove("uppy-is-drag-over"),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(n=>{n.type==="acquirer"&&n.handleRootDrop?.(e)});let t=!1,r=o(n=>{this.uppy.log(n,"error"),t||(this.uppy.info(n.message,"error"),t=!0)},"logDropError"),s=await ei(e.dataTransfer,{logDropError:r});s.length>0&&(this.uppy.log("[DropTarget] Files were dropped"),this.addFiles(s)),this.opts.onDrop?.(e)},"handleDrop");handleDragOver=o(e=>{wl(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",e.currentTarget.classList.add("uppy-is-drag-over"),this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver?.(e))},"handleDragOver");handleDragLeave=o(e=>{wl(e)&&(e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),e.currentTarget?.classList.remove("uppy-is-drag-over"),this.opts.onDragLeave?.(e))},"handleDragLeave");addListeners=o(()=>{let{target:e}=this.opts;if(e instanceof Element?this.nodes=[e]:typeof e=="string"&&(this.nodes=je(document.querySelectorAll(e))),!this.nodes||this.nodes.length===0)throw new Error(`"${e}" does not match any HTML elements`);this.nodes.forEach(t=>{t.addEventListener("dragover",this.handleDragOver,!1),t.addEventListener("dragleave",this.handleDragLeave,!1),t.addEventListener("drop",this.handleDrop,!1)})},"addListeners");removeListeners=o(()=>{this.nodes&&this.nodes.forEach(e=>{e.removeEventListener("dragover",this.handleDragOver,!1),e.removeEventListener("dragleave",this.handleDragLeave,!1),e.removeEventListener("drop",this.handleDrop,!1)})},"removeListeners");install(){this.setPluginState({isDraggingOver:!1}),this.addListeners()}uninstall(){this.removeListeners()}};var xh={name:"@uppy/dropbox",description:"Import files from Dropbox, into Uppy.",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","dropbox"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var Ph={strings:{pluginNameDropbox:"Dropbox"}};var ni=class extends re{static{o(this,"Dropbox")}static VERSION=xh.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.id=this.opts.id||"Dropbox",this.type="acquirer",this.storage=this.opts.storage||Te,this.files=[],this.icon=()=>l("svg",{className:"uppy-DashboardTab-iconDropbox","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{d:"M10.5 7.5L5 10.955l5.5 3.454 5.5-3.454 5.5 3.454 5.5-3.454L21.5 7.5 16 10.955zM10.5 21.319L5 17.864l5.5-3.455 5.5 3.455zM16 17.864l5.5-3.455 5.5 3.455-5.5 3.455zM16 25.925l-5.5-3.455 5.5-3.454 5.5 3.454z",fill:"currentcolor",fillRule:"nonzero"})}),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"dropbox",pluginId:this.id,supportsRefreshToken:!0}),this.defaultLocale=Ph,this.i18nInit(),this.title=this.i18n("pluginNameDropbox"),this.render=this.render.bind(this)}install(){this.view=new Ne(this,{provider:this.provider,loadAllFiles:!0,virtualList:!0,supportsSearch:!0});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){return this.view.render(e)}};var _h={name:"@uppy/facebook",description:"Import files from Facebook, into Uppy.",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","facebook"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var kh={strings:{pluginNameFacebook:"Facebook"}};var ai=class extends re{static{o(this,"Facebook")}static VERSION=_h.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.id=this.opts.id||"Facebook",this.type="acquirer",this.storage=this.opts.storage||Te,this.files=[],this.icon=()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("g",{fill:"none",fillRule:"evenodd",children:[l("path",{d:"M27 16c0-6.075-4.925-11-11-11S5 9.925 5 16c0 5.49 4.023 10.041 9.281 10.866V19.18h-2.793V16h2.793v-2.423c0-2.757 1.642-4.28 4.155-4.28 1.204 0 2.462.215 2.462.215v2.707h-1.387c-1.366 0-1.792.848-1.792 1.718V16h3.05l-.487 3.18h-2.563v7.686C22.977 26.041 27 21.49 27 16",fill:"#1777F2"}),l("path",{d:"M20.282 19.18L20.77 16h-3.051v-2.063c0-.87.426-1.718 1.792-1.718h1.387V9.512s-1.258-.215-2.462-.215c-2.513 0-4.155 1.523-4.155 4.28V16h-2.793v3.18h2.793v7.686a11.082 11.082 0 003.438 0V19.18h2.563",fill:"#FFFFFE"})]})}),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"facebook",pluginId:this.id,supportsRefreshToken:!1}),this.defaultLocale=kh,this.i18nInit(),this.title=this.i18n("pluginNameFacebook"),this.render=this.render.bind(this)}install(){this.view=new Ne(this,{provider:this.provider});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){let{partialTree:t,currentFolderId:r}=this.getPluginState();return t.filter(n=>n.type==="folder"&&n.parentId===r).length===0?this.view.render(e,{viewType:"grid",showFilter:!1,showTitles:!1}):this.view.render(e)}};function an(){return an=Object.assign||function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},an.apply(this,arguments)}o(an,"_extends");var Lb={"[object HTMLCollection]":!0,"[object NodeList]":!0,"[object RadioNodeList]":!0},Bb={button:!0,fieldset:!0,reset:!0,submit:!0},jb={checkbox:!0,radio:!0},zb=/^\s+|\s+$/g,Hb=Array.prototype.slice,Eh=Object.prototype.toString;function ln(i,e){if(!i)throw new Error("A form is required by getFormData, was given form="+i);e=an({includeDisabled:!1,trim:!1},e);for(var t={},r,s=[],n={},a=0,u=i.elements.length;a<u;a++){var c=i.elements[a];Bb[c.type]||c.disabled&&!e.includeDisabled||(r=c.name||c.id,r&&!n[r]&&(s.push(r),n[r]=!0))}for(var p=0,f=s.length;p<f;p++){r=s[p];var d=Th(i,r,e);d!=null&&(t[r]=d)}return t}o(ln,"getFormData");function Th(i,e,t){if(!i)throw new Error("A form is required by getFieldData, was given form="+i);if(!e&&Eh.call(e)!=="[object String]")throw new Error("A field name is required by getFieldData, was given fieldName="+e);t=an({includeDisabled:!1,trim:!1},t);var r=i.elements[e];if(!r||r.disabled&&!t.includeDisabled)return null;if(!Lb[Eh.call(r)])return Fh(r,t.trim);for(var s=[],n=!0,a=0,u=r.length;a<u;a++)if(!(r[a].disabled&&!t.includeDisabled)){n&&r[a].type!=="radio"&&(n=!1);var c=Fh(r[a],t.trim);c!=null&&(s=s.concat(c))}return n&&s.length===1?s[0]:s.length>0?s:null}o(Th,"getFieldData");function Fh(i,e){var t=null,r=i.type;if(r==="select-one")return i.options.length&&(t=i.options[i.selectedIndex].value),t;if(r==="select-multiple"){t=[];for(var s=0,n=i.options.length;s<n;s++)i.options[s].selected&&t.push(i.options[s].value);return t.length===0&&(t=null),t}return r==="file"&&"files"in i?(i.multiple?(t=Hb.call(i.files),t.length===0&&(t=null)):t=i.files[0],t):(jb[r]?i.checked&&(r==="checkbox"&&!i.hasAttribute("value")?t=!0:t=i.value):t=e?i.value.replace(zb,""):i.value,t)}o(Fh,"getFormElementValue");ln.getFieldData=Th;var Ch={name:"@uppy/form",description:"Connect Uppy to an existing HTML <form>.",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","form"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^","get-form-data":"^3.0.0"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{typescript:"^5.8.3"}};var Vb={resultName:"uppyResult",getMetaFromForm:!0,addResultToForm:!0,submitOnSuccess:!1,triggerUploadOnSubmit:!1};function $b(i){if(i==null||i.nodeName!=="FORM")throw new Error("ASSERTION FAILED: the target is not a <form> element",{cause:i});return i}o($b,"assertHTMLFormElement");var js=class extends xe{static{o(this,"Form")}static VERSION=Ch.version;#e;constructor(e,t){super(e,{...Vb,...t}),this.type="acquirer",this.id=this.opts.id||"Form",this.handleFormSubmit=this.handleFormSubmit.bind(this),this.handleUploadStart=this.handleUploadStart.bind(this),this.handleSuccess=this.handleSuccess.bind(this),this.addResultToForm=this.addResultToForm.bind(this),this.getMetaFromForm=this.getMetaFromForm.bind(this)}handleUploadStart(){this.opts.getMetaFromForm&&this.getMetaFromForm()}handleSuccess(e){this.opts.addResultToForm&&this.addResultToForm(e),this.opts.submitOnSuccess&&this.#e.reportValidity()&&this.#e.submit()}handleFormSubmit(e){if(this.opts.triggerUploadOnSubmit){e.preventDefault();let t=je(e.target.elements),r=[];t.forEach(s=>{(s.tagName==="BUTTON"||s.tagName==="INPUT"&&s.type==="submit")&&!s.disabled&&(s.disabled=!0,r.push(s))}),this.uppy.upload().then(()=>{r.forEach(s=>{s.disabled=!1})},s=>(r.forEach(n=>{n.disabled=!1}),Promise.reject(s))).catch(s=>{this.uppy.log(s.stack||s.message||s)})}}addResultToForm(e){this.uppy.log("[Form] Adding result to the original form:"),this.uppy.log(e);let t=this.#e.querySelector(`[name="${this.opts.resultName}"]`);if(t){let r;try{r=JSON.parse(t.value)}catch{}Array.isArray(r)||(r=[]),r.push(e),t.value=JSON.stringify(r);return}t=document.createElement("input"),t.name=this.opts.resultName,t.type="hidden",t.value=JSON.stringify([e]),this.#e.appendChild(t)}getMetaFromForm(){let e=ln(this.#e);delete e[this.opts.resultName],this.uppy.setMeta(e)}install(){this.#e=$b(Vr(this.opts.target)),this.#e.addEventListener("submit",this.handleFormSubmit),this.uppy.on("upload",this.handleUploadStart),this.uppy.on("complete",this.handleSuccess)}uninstall(){this.#e.removeEventListener("submit",this.handleFormSubmit),this.uppy.off("upload",this.handleUploadStart),this.uppy.off("complete",this.handleSuccess)}};var Ah={name:"@uppy/golden-retriever",description:"The GoldenRetriever Uppy plugin saves selected files in browser cache to seamlessly resume uploding after browser crash or accidentally closed tab",version:"5.2.1",license:"MIT",type:"module",sideEffects:["lib/ServiceWorker.js"],scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest run --project browser"},keywords:["file uploader","restore files","crash recovery","golden retriever","resumable uploads","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./lib/ServiceWorker.js":"./lib/ServiceWorker.js","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",lodash:"^4.17.21"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^","@uppy/dashboard":"workspace:^","@uppy/xhr-upload":"workspace:^","@vitest/browser":"^3.2.4",typescript:"^5.8.3",vitest:"^3.2.4"}};var Ih=typeof window<"u"&&(window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB),Gb=!!Ih,Rh="uppy-blobs",pt="files",Nh=1440*60*1e3,Xb=3,Uh=1048576;function Kb(i){let e=i.openCursor();e.onsuccess=t=>{let r=t.target.result;if(!r)return;let s=r.value;s.expires=Date.now()+Nh,r.update(s)}}o(Kb,"migrateExpiration");function Oh(i){let e=Ih.open(i,Xb);return new Promise((t,r)=>{e.onupgradeneeded=s=>{let n=s.target.result,a=s.currentTarget.transaction;if(s.oldVersion<2&&n.createObjectStore(pt,{keyPath:"id"}).createIndex("store","store",{unique:!1}),s.oldVersion<3){let u=a.objectStore(pt);u.createIndex("expires","expires",{unique:!1}),Kb(u)}a.oncomplete=()=>{t(n)}},e.onsuccess=s=>{t(s.target.result)},e.onerror=r})}o(Oh,"connect");function un(i){return new Promise((e,t)=>{i.onsuccess=r=>{e(r.target.result)},i.onerror=t})}o(un,"waitForRequest");var Dh=!1,cn=class i{static{o(this,"IndexedDBStore")}#e;opts;name;static isSupported;constructor(e){this.opts={dbName:Rh,storeName:"default",expires:Nh,maxFileSize:10*Uh,maxTotalSize:300*Uh,...e},this.name=this.opts.storeName;let t=o(async()=>{let r=await Oh(this.opts.dbName);return this.#e=r,r},"createConnection");Dh?this.#e=t():(Dh=!0,this.#e=i.cleanup().then(t,t))}get ready(){return Promise.resolve(this.#e)}key(e){return`${this.name}!${e}`}async list(){let s=(await this.#e).transaction([pt],"readonly").objectStore(pt).index("store").getAll(IDBKeyRange.only(this.name)),n=await un(s);return Object.fromEntries(n.map(a=>[a.fileID,a.data]))}async get(e){let s=(await this.#e).transaction([pt],"readonly").objectStore(pt).get(this.key(e)),{data:n}=await un(s);return{id:n.fileID,data:n.data}}async getSize(){let s=(await this.#e).transaction([pt],"readonly").objectStore(pt).index("store").openCursor(IDBKeyRange.only(this.name));return new Promise((n,a)=>{let u=0;s.onsuccess=c=>{let p=c.target.result;p?(u+=p.value.data.size,p.continue()):n(u)},s.onerror=()=>{a(new Error("Could not retrieve stored blobs size"))}})}async put(e){if(e.data.size!=null&&e.data.size>this.opts.maxFileSize)throw new Error("File is too big to store.");if(await this.getSize()>this.opts.maxTotalSize)throw new Error("No space left");let n=(await this.#e).transaction([pt],"readwrite").objectStore(pt).add({id:this.key(e.id),fileID:e.id,store:this.name,expires:Date.now()+this.opts.expires,data:e.data});return un(n)}async delete(e){let s=(await this.#e).transaction([pt],"readwrite").objectStore(pt).delete(this.key(e));return un(s)}static async cleanup(){let e=await Oh(Rh),s=e.transaction([pt],"readwrite").objectStore(pt).index("expires").openCursor(IDBKeyRange.upperBound(Date.now()));await new Promise((n,a)=>{s.onsuccess=u=>{let c=u.target.result;c?(c.delete(),c.continue()):n()},s.onerror=a}),e.close()}};cn.isSupported=Gb;var Mh=cn;var Lh=ae(na(),1);function Bh(i){try{return JSON.parse(i)}catch{return null}}o(Bh,"maybeParse");var jh="uppyState:",Yb=o(i=>`${jh}${i}`,"getItemKey");function Jb(){let i=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(jh)&&i.push(r)}let e=Date.now();i.forEach(t=>{let r=localStorage.getItem(t);if(!r)return;let s=Bh(r);s?.expires&&s.expires<e&&localStorage.removeItem(t)})}o(Jb,"expireOldState");var zs=class{static{o(this,"MetaDataStore")}opts;name;#e;constructor(e){this.opts={expires:1440*60*1e3,throttleTime:500,...e},this.name=Yb(e.storeName),this.#e=this.opts.throttleTime===0?this.save:(0,Lh.default)(this.save,this.opts.throttleTime,{leading:!0,trailing:!0})}#t;load=o(()=>{Jb();let e=localStorage.getItem(this.name);if(!e)return;let t=Bh(e);if(t)return this.#t=t,t.metadata},"load");get=o(()=>this.#t?.metadata,"get");save=o(()=>{if(this.#t===null){localStorage.removeItem(this.name);return}let e=JSON.stringify(this.#t);localStorage.setItem(this.name,e)},"save");set=o(e=>{this.#t=e===null?null:{metadata:e,expires:Date.now()+this.opts.expires},this.#e()},"set")};var zh=typeof navigator<"u"&&"serviceWorker"in navigator;function Qb(){return new Promise((i,e)=>{zh?navigator.serviceWorker.controller?i():navigator.serviceWorker.addEventListener("controllerchange",()=>{i()}):e(new Error("Unsupported"))})}o(Qb,"waitForServiceWorker");var pn=class{static{o(this,"ServiceWorkerStore")}#e;name;static isSupported;constructor(e){this.#e=Qb().then(t=>{this.#e=t}),this.name=e.storeName}get ready(){return Promise.resolve(this.#e)}async list(){return await this.#e,new Promise((e,t)=>{let r=o(s=>{if(s.data.store===this.name)switch(s.data.type){case"uppy/ALL_FILES":e(s.data.files),navigator.serviceWorker.removeEventListener("message",r);break;default:t()}},"onMessage");navigator.serviceWorker.addEventListener("message",r),navigator.serviceWorker.controller.postMessage({type:"uppy/GET_FILES",store:this.name})})}async put(e){await this.#e,navigator.serviceWorker.controller.postMessage({type:"uppy/ADD_FILE",store:this.name,file:e})}async delete(e){await this.#e,navigator.serviceWorker.controller.postMessage({type:"uppy/REMOVE_FILE",store:this.name,fileID:e})}};pn.isSupported=zh;var Hh=pn;var Zb={expires:1440*60*1e3,serviceWorker:!1},Hs=class i extends xe{static{o(this,"GoldenRetriever")}static VERSION=Ah.version;#e;#t;#r;static[Symbol.for("uppy test: throttleTime")];constructor(e,t){super(e,{...Zb,...t}),this.type="debugger",this.id=this.opts.id||"GoldenRetriever",this.#e=new zs({expires:this.opts.expires,storeName:e.getID(),throttleTime:i[Symbol.for("uppy test: throttleTime")]??void 0}),this.opts.serviceWorker&&(this.#t=new Hh({storeName:e.getID()})),this.#r=new Mh({expires:this.opts.expires,...this.opts.indexedDB||{},storeName:e.getID()})}async#i(){let e=this.#e.load();if(!e)return;let t=e.currentUploads||{},r=Object.entries(e.files||{}),s=Object.fromEntries(r.every(([,v])=>v.progress.complete&&!v.error)?[]:r),n=Object.entries(s);this.uppy.log(`[GoldenRetriever] Recovered ${Object.keys(t).length} current uploads and ${n.length} files from Local Storage`);let a=n.length>0;a||this.uppy.log("[GoldenRetriever] No files need to be loaded, restored only processing state...");let[u,c]=await Promise.all([this.#l(),this.#o()]),p={...u,...c},f=Object.fromEntries(n.map(([v,_])=>{if(_.isRemote)return[v,{..._,isRestored:!0,data:{size:null}}];let k=p[v];return[v,!_.progress.uploadComplete&&k==null?{..._,isRestored:!0,isGhost:!0,data:void 0}:{..._,isRestored:!0,isGhost:!1,data:k}]}));this.uppy.setState({recoveredState:a?e:null,currentUploads:a?t:{},files:f}),this.uppy.emit("restored",e.pluginData);let d=Object.keys(p).filter(v=>!s[v]);if(d.length)try{this.uppy.log(`[GoldenRetriever] Cleaning up ${d.length} old files`),await this.#n(d)}catch(v){this.uppy.log(`[GoldenRetriever] Could not clean up ${d.length} old files`,"warning"),this.uppy.log(v)}}#s=o(({pluginData:e,...t})=>{let r=this.#e.get();this.#e.set({...r??{currentUploads:{},files:{}},...t,pluginData:{...r?.pluginData,...e}})},"#patchMetadata");async#l(){if(!this.#t)return{};try{let e=await this.#t.list(),t=Object.keys(e).length;return this.uppy.log(t>0?`[GoldenRetriever] Successfully recovered ${t} blobs from Service Worker!`:"[GoldenRetriever] No blobs found in Service Worker"),e}catch(e){return this.uppy.log("[GoldenRetriever] Failed to recover blobs from Service Worker","warning"),this.uppy.log(e),{}}}async#o(){try{let e=await this.#r.list(),t=Object.keys(e).length;return this.uppy.log(t>0?`[GoldenRetriever] Successfully recovered ${t} blobs from IndexedDB!`:"[GoldenRetriever] No blobs found in IndexedDB"),e}catch(e){return this.uppy.log("[GoldenRetriever] Failed to recover blobs from IndexedDB","warning"),this.uppy.log(e),{}}}async#n(e){await Promise.all(e.map(async t=>{try{await Promise.all([this.#t?.delete(t),this.#r.delete(t)])}catch(r){this.uppy.log(`[GoldenRetriever] Could not remove file ${t} from all stores`,"warning"),this.uppy.log(r)}})),e.length>0&&this.uppy.log(`[GoldenRetriever] Removed ${e.length} blobs`)}async[Symbol.for("uppy test: deleteBlobs")](e){return this.#n(e)}#a=o(async e=>{let{id:t,data:r,isRemote:s}=e;s||r==null||await Promise.all([this.#t?.put({id:t,data:r}).catch(n=>{this.uppy.log("[GoldenRetriever] Could not store file in Service Worker","warning"),this.uppy.log(n)}),this.#r.put({id:t,data:r}).catch(n=>{n instanceof Event&&n.target instanceof IDBRequest&&n.target.error?.name==="ConstraintError"||(this.uppy.log("[GoldenRetriever] Could not store file in IndexedDB","warning"),this.uppy.log(n))})])},"#addBlobToStores");#c=o((e,t,r)=>{if(t.currentUploads!==e.currentUploads){let{currentUploads:s}=this.uppy.getState();this.#s({currentUploads:s})}if(t.files!==e.files){Object.values(e.files).some(f=>!f.progress.complete)&&(Object.values(t.files).length===0||Object.values(t.files).every(f=>f.progress.complete&&!f.error))&&(this.uppy.log("[GoldenRetriever] All files have been uploaded and processed successfully, clearing recovery state"),this.uppy.setState({recoveredState:null}));let s=Object.fromEntries(Object.entries(t.files).map(([f,{data:d,preview:v,..._}])=>[f,_]));this.#s({files:s});let n=Object.values(t.files).filter(f=>e.files[f.id]==null),a=Object.values(t.files).flatMap(f=>{let d=e.files[f.id];return d!=null&&f.data!==d.data?[f]:[]}),c=[...Object.values(e.files).filter(f=>{let d=t.files[f.id];return d==null||d.progress.uploadComplete&&!f.progress.uploadComplete}),...a],p=[...n,...a];(async()=>{await this.#n(c.map(f=>f.id));for(let f of p)await this.#a(f);p.length>0&&this.uppy.log(`[GoldenRetriever] Added ${p.length} blobs`)})()}},"#handleStateUpdate");#u=o(()=>{this.uppy.log("[GoldenRetriever] Restore confirmed, proceeding...");let{currentUploads:e}=this.uppy.getState();Object.keys(e).length>0?(this.uppy.resumeAll(),Object.keys(e).forEach(t=>{this.uppy.restore(t)})):this.uppy.upload(),this.uppy.setState({recoveredState:null})},"#handleRestoreConfirmed");#d=o(e=>{this.#s({pluginData:e})},"#handlePluginDataChanged");install(){this.#i(),this.uppy.on("state-update",this.#c),this.uppy.on("restore-confirmed",this.#u),this.uppy.on("restore:plugin-data-changed",this.#d)}uninstall(){this.uppy.off("state-update",this.#c),this.uppy.off("restore-confirmed",this.#u),this.uppy.off("restore:plugin-data-changed",this.#d)}};var qh={name:"@uppy/google-drive",description:"The Google Drive plugin for Uppy lets users import files from their Google Drive account",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","google drive","cloud storage","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var qs=class extends Ne{static{o(this,"DriveProviderViews")}toggleCheckbox(e,t){e.data.custom?.isSharedDrive||super.toggleCheckbox(e,t)}};var Vh={strings:{pluginNameGoogleDrive:"Google Drive"}};var li=class extends re{static{o(this,"GoogleDrive")}static VERSION=qh.version;icon;provider;view;storage;files;rootFolderId="root";constructor(e,t){super(e,t),this.type="acquirer",this.storage=this.opts.storage||Te,this.files=[],this.id=this.opts.id||"GoogleDrive",this.icon=()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("g",{fillRule:"nonzero",fill:"none",children:[l("path",{d:"M6.663 22.284l.97 1.62c.202.34.492.609.832.804l3.465-5.798H5c0 .378.1.755.302 1.096l1.361 2.278z",fill:"#0066DA"}),l("path",{d:"M16 12.09l-3.465-5.798c-.34.195-.63.463-.832.804l-6.4 10.718A2.15 2.15 0 005 18.91h6.93L16 12.09z",fill:"#00AC47"}),l("path",{d:"M23.535 24.708c.34-.195.63-.463.832-.804l.403-.67 1.928-3.228c.201-.34.302-.718.302-1.096h-6.93l1.474 2.802 1.991 2.996z",fill:"#EA4335"}),l("path",{d:"M16 12.09l3.465-5.798A2.274 2.274 0 0018.331 6h-4.662c-.403 0-.794.11-1.134.292L16 12.09z",fill:"#00832D"}),l("path",{d:"M20.07 18.91h-8.14l-3.465 5.798c.34.195.73.292 1.134.292h12.802c.403 0 .794-.11 1.134-.292L20.07 18.91z",fill:"#2684FC"}),l("path",{d:"M23.497 12.455l-3.2-5.359a2.252 2.252 0 00-.832-.804L16 12.09l4.07 6.82h6.917c0-.377-.1-.755-.302-1.096l-3.188-5.359z",fill:"#FFBA00"})]})}),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"drive",pluginId:this.id,supportsRefreshToken:!0}),this.defaultLocale=Vh,this.i18nInit(),this.title=this.i18n("pluginNameGoogleDrive"),this.render=this.render.bind(this)}install(){this.view=new qs(this,{provider:this.provider,loadAllFiles:!0,virtualList:!0});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){return this.view.render(e)}};var $h={name:"@uppy/google-drive-picker",description:"The Google Drive Picker plugin for Uppy lets users import files from their Google Drive account",version:"1.1.1",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","google drive","google picker","cloud storage","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var Sl={strings:{pluginNameGoogleDrivePicker:"Google Drive"}};var br=class i extends re{static{o(this,"GoogleDrivePicker")}static VERSION=$h.version;static requestClientId=i.name;type="acquirer";icon=nr;storage;defaultLocale=Sl;constructor(e,t){super(e,t),this.id=this.opts.id||"GoogleDrivePicker",this.storage=this.opts.storage||Te,this.defaultLocale=Sl,this.i18nInit(),this.title=this.i18n("pluginNameGoogleDrivePicker");let r=new Je(e,{pluginId:this.id,provider:"url",companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule});this.uppy.registerRequestClient(i.requestClientId,r)}install(){let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}handleFilesPicked=o(async(e,t)=>{this.uppy.addFiles(e.map(({id:r,mimeType:s,name:n,platform:a,...u})=>({source:this.id,name:n,type:s,data:{size:null},isRemote:!0,remote:{companionUrl:this.opts.companionUrl,url:`${this.opts.companionUrl}/google-picker/get`,body:{fileId:r,accessToken:t,platform:a,..."url"in u&&{url:u.url}},requestClientId:i.requestClientId},..."metadata"in u&&{meta:u.metadata}})))},"handleFilesPicked");render=o(()=>l(Ai,{storage:this.storage,pickerType:"drive",uppy:this.uppy,i18n:this.i18n,clientId:this.opts.clientId,apiKey:this.opts.apiKey,appId:this.opts.appId,onFilesPicked:this.handleFilesPicked}),"render")};var Wh={name:"@uppy/google-photos-picker",description:"The Google Photos Picker plugin for Uppy lets users import files from their Google Photos account",version:"1.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","google photos","google picker","cloud storage","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var xl={strings:{pluginNameGooglePhotosPicker:"Google Photos"}};var wr=class i extends re{static{o(this,"GooglePhotosPicker")}static VERSION=Wh.version;static requestClientId=i.name;type="acquirer";icon=or;storage;defaultLocale=xl;constructor(e,t){super(e,t),this.id=this.opts.id||"GooglePhotosPicker",this.storage=this.opts.storage||Te,this.defaultLocale=xl,this.i18nInit(),this.title=this.i18n("pluginNameGooglePhotosPicker");let r=new Je(e,{pluginId:this.id,provider:"url",companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule});this.uppy.registerRequestClient(i.requestClientId,r)}install(){let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}handleFilesPicked=o(async(e,t)=>{this.uppy.addFiles(e.map(({id:r,mimeType:s,name:n,platform:a,...u})=>({source:this.id,name:n,type:s,data:{size:null},isRemote:!0,remote:{companionUrl:this.opts.companionUrl,url:`${this.opts.companionUrl}/google-picker/get`,body:{fileId:r,accessToken:t,platform:a,..."url"in u&&{url:u.url}},requestClientId:i.requestClientId},..."metadata"in u&&{meta:u.metadata}})))},"handleFilesPicked");render=o(()=>l(Ai,{storage:this.storage,pickerType:"photos",uppy:this.uppy,i18n:this.i18n,clientId:this.opts.clientId,onFilesPicked:this.handleFilesPicked}),"render")};var Gh={name:"@uppy/image-editor",description:"Image editor and cropping UI",version:"4.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","upload","uppy","uppy-plugin","image editor","cropper","crop","rotate","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",cropperjs:"^1.6.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Zh=ae(Xh(),1);function s1(i,e){let t=i.width/e.width,r=i.height/e.height,s=Math.min(t,r),n=e.width*s,a=e.height*s,u=(i.width-n)/2,c=(i.height-a)/2;return{width:n,height:a,left:u,top:c}}o(s1,"getCanvasDataThatFitsPerfectlyIntoContainer");var Kh=s1;function o1(i){return i*(Math.PI/180)}o(o1,"toRadians");function n1(i,e,t){let r=Math.abs(o1(t));return Math.max((Math.sin(r)*i+Math.cos(r)*e)/e,(Math.sin(r)*e+Math.cos(r)*i)/i)}o(n1,"getScaleFactorThatRemovesDarkCorners");var Yh=n1;function a1(i,e,t){return e.left<i.left?{left:i.left,width:t.width}:e.top<i.top?{top:i.top,height:t.height}:e.left+e.width>i.left+i.width?{left:i.left+i.width-t.width,width:t.width}:e.top+e.height>i.top+i.height?{top:i.top+i.height-t.height,height:t.height}:null}o(a1,"limitCropboxMovementOnMove");var Jh=a1;function l1(i,e,t){return e.left<i.left?{left:i.left,width:t.left+t.width-i.left}:e.top<i.top?{top:i.top,height:t.top+t.height-i.top}:e.left+e.width>i.left+i.width?{left:t.left,width:i.left+i.width-t.left}:e.top+e.height>i.top+i.height?{top:t.top,height:i.top+i.height-t.top}:null}o(l1,"limitCropboxMovementOnResize");var Qh=l1;var Vs=class extends Se{static{o(this,"Editor")}imgElement;cropper;constructor(e){super(e),this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){let{opts:e,storeCropperInstance:t}=this.props;this.cropper=new Zh.default(this.imgElement,e.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),t(this.cropper)}componentWillUnmount(){this.cropper.destroy(),this.imgElement.removeEventListener("cropstart",this.storePrevCropboxData),this.imgElement.removeEventListener("cropend",this.limitCropboxMovement)}storePrevCropboxData(){this.setState({prevCropboxData:this.cropper.getCropBoxData()})}limitCropboxMovement(e){let t=this.cropper.getCanvasData(),r=this.cropper.getCropBoxData(),{prevCropboxData:s}=this.state;if(e.detail.action==="all"){let n=Jh(t,r,s);n&&this.cropper.setCropBoxData(n)}else{let n=Qh(t,r,s);n&&this.cropper.setCropBoxData(n)}}onRotate90Deg=o(()=>{let{angle90Deg:e}=this.state,t=e-90;this.setState({angle90Deg:t,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(t);let r=this.cropper.getCanvasData(),s=this.cropper.getContainerData(),n=Kh(s,r);this.cropper.setCanvasData(n),this.cropper.setCropBoxData(n)},"onRotate90Deg");onRotateGranular=o(e=>{let t=Number(e.target.value);this.setState({angleGranular:t});let{angle90Deg:r}=this.state,s=r+t;this.cropper.rotateTo(s);let n=this.cropper.getImageData(),a=Yh(n.naturalWidth,n.naturalHeight,t),u=this.cropper.getImageData().scaleX<0?-a:a;this.cropper.scale(u,a)},"onRotateGranular");renderGranularRotate(){let{i18n:e}=this.props,{angleGranular:t}=this.state;return l("label",{role:"tooltip","aria-label":`${t}\xBA`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper",children:l("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:t,min:"-45",max:"45","aria-label":e("rotate")})})}renderRevert(){let{i18n:e,opts:t}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("revert"),onClick:o(()=>{this.cropper.reset(),this.cropper.setAspectRatio(t.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})},"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0z",fill:"none"}),l("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})]})})}renderRotate(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("rotate"),onClick:this.onRotate90Deg,children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),l("path",{d:"M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z"})]})})}renderFlip(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("flipHorizontal"),onClick:o(()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1),"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0z",fill:"none"}),l("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"})]})})}renderZoomIn(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomIn"),onClick:o(()=>this.cropper.zoom(.1),"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24",children:[l("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),l("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})]})})}renderZoomOut(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomOut"),onClick:o(()=>this.cropper.zoom(-.1),"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})]})})}renderCropSquare(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioSquare"),onClick:o(()=>this.cropper.setAspectRatio(1),"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0z",fill:"none"}),l("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})]})})}renderCropWidescreen(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioLandscape"),onClick:o(()=>this.cropper.setAspectRatio(16/9),"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z"}),l("path",{fill:"none",d:"M0 0h24v24H0z"})]})})}renderCropWidescreenVertical(){let{i18n:e}=this.props;return l("button",{"data-microtip-position":"top",type:"button","aria-label":e("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:o(()=>this.cropper.setAspectRatio(9/16),"onClick"),children:l("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z"}),l("path",{d:"M0 0h24v24H0z",fill:"none"})]})})}render(){let{currentImage:e,opts:t}=this.props,{actions:r}=t;if(e.data==null)throw new Error("File data is empty");let s=URL.createObjectURL(e.data);return l("div",{className:"uppy-ImageCropper",children:[l("div",{className:"uppy-ImageCropper-container",children:l("img",{className:"uppy-ImageCropper-image",alt:e.name,src:s,ref:o(n=>{this.imgElement=n},"ref")})}),l("div",{className:"uppy-ImageCropper-controls",children:[r.revert&&this.renderRevert(),r.rotate&&this.renderRotate(),r.granularRotate&&this.renderGranularRotate(),r.flip&&this.renderFlip(),r.zoomIn&&this.renderZoomIn(),r.zoomOut&&this.renderZoomOut(),r.cropSquare&&this.renderCropSquare(),r.cropWidescreen&&this.renderCropWidescreen(),r.cropWidescreenVertical&&this.renderCropWidescreenVertical()]})]})}};var ef={strings:{revert:"Reset",rotate:"Rotate 90\xB0",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}};var tf={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},rf={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},u1={quality:.8,actions:rf,cropperOptions:tf},Sr=class extends re{static{o(this,"ImageEditor")}static VERSION=Gh.version;cropper;constructor(e,t){super(e,{...u1,...t,actions:{...rf,...t?.actions},cropperOptions:{...tf,...t?.cropperOptions}}),this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=ef,this.i18nInit()}canEditFile(e){if(!e.type||e.isRemote)return!1;let t=e.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(t)}save=o(()=>{let e=o(s=>{let{currentImage:n}=this.getPluginState();this.uppy.setFileState(n.id,{data:new File([s],n.name??this.i18n("unnamed"),{type:s.type}),size:s.size,preview:void 0});let a=this.uppy.getFile(n.id);this.uppy.emit("thumbnail:request",a),this.setPluginState({currentImage:a}),this.uppy.emit("file-editor:complete",a)},"saveBlobCallback"),{currentImage:t}=this.getPluginState(),r=this.cropper.getCroppedCanvas({});r.width%2!==0&&this.cropper.setData({width:r.width-1}),r.height%2!==0&&this.cropper.setData({height:r.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(e,t.type,this.opts.quality)},"save");storeCropperInstance=o(e=>{this.cropper=e},"storeCropperInstance");selectFile=o(e=>{this.uppy.emit("file-editor:start",e),this.setPluginState({currentImage:e})},"selectFile");install(){this.setPluginState({currentImage:null});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){let{currentImage:e}=this.getPluginState();if(e){let t=this.uppy.getFile(e.id);this.uppy.emit("file-editor:cancel",t)}this.unmount()}render(){let{currentImage:e}=this.getPluginState();return e===null||e.isRemote?null:l(Vs,{currentImage:e,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}};var sf={name:"@uppy/instagram",description:"Import photos and videos from Instagram, into Uppy.",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","instagram","provider","photos","videos"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var of={strings:{pluginNameInstagram:"Instagram"}};var ui=class extends re{static{o(this,"Instagram")}static VERSION=sf.version;icon;provider;view;storage;files;rootFolderId="recent";constructor(e,t){super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Te,this.id=this.opts.id||"Instagram",this.icon=()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:[l("defs",{children:l("path",{d:"M16.825 5l.483-.001.799.002c1.168.005 1.598.021 2.407.057 1.17.05 1.97.235 2.67.506.725.28 1.34.655 1.951 1.265.613.61.99 1.223 1.273 1.946.273.7.46 1.498.516 2.67l.025.552.008.205c.029.748.037 1.51.042 3.777l.001.846v.703l-.001.398a50.82 50.82 0 01-.058 2.588c-.05 1.17-.235 1.97-.506 2.67a5.394 5.394 0 01-1.265 1.951c-.61.613-1.222.99-1.946 1.273-.699.273-1.498.46-2.668.516-.243.012-.451.022-.656.03l-.204.007c-.719.026-1.512.034-3.676.038l-.847.001h-1.1a50.279 50.279 0 01-2.587-.059c-1.171-.05-1.971-.235-2.671-.506a5.394 5.394 0 01-1.951-1.265 5.385 5.385 0 01-1.272-1.946c-.274-.699-.46-1.498-.517-2.668a88.15 88.15 0 01-.03-.656l-.007-.205c-.026-.718-.034-1.512-.038-3.674v-2.129c.006-1.168.022-1.597.058-2.406.051-1.171.235-1.971.506-2.672a5.39 5.39 0 011.265-1.95 5.381 5.381 0 011.946-1.272c.699-.274 1.498-.462 2.669-.517l.656-.03.204-.007c.718-.026 1.511-.034 3.674-.038zm.678 1.981h-1.226l-.295.001c-2.307.005-3.016.013-3.777.043l-.21.009-.457.02c-1.072.052-1.654.232-2.042.383-.513.2-.879.44-1.263.825a3.413 3.413 0 00-.82 1.267c-.15.388-.33.97-.375 2.043a48.89 48.89 0 00-.056 2.482v.398 1.565c.006 2.937.018 3.285.073 4.444.05 1.073.231 1.654.382 2.043.2.512.44.878.825 1.263.386.383.753.621 1.267.82.388.15.97.328 2.043.374.207.01.388.017.563.024l.208.007a63.28 63.28 0 002.109.026h1.564c2.938-.006 3.286-.019 4.446-.073 1.071-.051 1.654-.232 2.04-.383.514-.2.88-.44 1.264-.825.384-.386.622-.753.82-1.266.15-.389.328-.971.375-2.044.039-.88.054-1.292.057-2.723v-1.15-.572c-.006-2.936-.019-3.284-.074-4.445-.05-1.071-.23-1.654-.382-2.04-.2-.515-.44-.88-.825-1.264a3.405 3.405 0 00-1.267-.82c-.388-.15-.97-.328-2.042-.375a48.987 48.987 0 00-2.535-.056zm-1.515 3.37a5.65 5.65 0 11.021 11.299 5.65 5.65 0 01-.02-11.3zm.004 1.982a3.667 3.667 0 10.015 7.334 3.667 3.667 0 00-.015-7.334zm5.865-3.536a1.32 1.32 0 11.005 2.64 1.32 1.32 0 01-.005-2.64z",id:"a"})}),l("g",{fill:"none","fill-rule":"evenodd",children:[l("mask",{id:"b",fill:"#fff",children:l("use",{xlinkHref:"#a"})}),l("image",{mask:"url(#b)",x:"4",y:"4",width:"24",height:"24",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALKADAAQAAAABAAAALAAAAAD8buejAAALZklEQVRYCVWZC2LbNhAFCRKykvP0bD1506SxRKIzbwHJoU3jv5h9WICU3P7+6zlG2zZvr8s/rW1tN7U0rMll8aDYufdzbLfc1JHmpv3jpPy8tsO+3O2s/O6YMSjTl/qdCds4mIIG60m8vdq2Z+phm2V4vAb9+o7BbZeuoM0NyYazvTvbvlN1MGjHUAesZ/IWWOsCeF0BOwAK4ITR0WYd/QKHEPv2DEymmorZtiubjOHEMYEzXmC9GMxu+95Kz+kuwxjDBKb8iUoCAdqZoAeyALreW6ZNx9Y4Jz8cLwjTZOEoR+HU05k2RzgP2iafGgfZiEdZbEr94zpX/xkPtDtGAxF+LRcgTsp9CAZg0rnEnXmPqFshY5vLnVWxLXO/bah2sZQgBZppGSe8NbjNPN5kc/WbIYEn8U+jXCOezT4zfgS1eoVEhceVeK74Fe4N6CoYEoLWykzHsd+GMAUqdTTVvvqT1uWqB3lVCLb12/ORAe8/5Zu9mp7lqoEFUCAFDIxqz7i1bq2AY1U9jqq2QK/7DYl+1AeZlAFcEc+U/jkRUqsvCHQ/nyGvjrOl6EuZWRWVGCKUMCkntQ5o+u2AZ3OxakbTcoBZnY0xhgGCUM4Kp1xtBTnBnXM5ASRms/Fs7d9OpX8bXN45pibQY/ML1MmA5G9CINBuCpdftexr6i2c5qd9J441LNJm3zk1GVusJ7v6mPJ7HPxJR0Li/vg9O1XHTEgvsQoSgExU0NnlLF0paK+6d06aOMKE2nCKV0ofNw4WsWmLsWrv6lPLnhGpr9E137QkHOMB/jh/T8MOqOadXarR44zPBW5NvDccnBxVmdK81+7RQ5p6qnQoRDZPh9+xWj0N2XpqxX1HzMty9UlFnKya/h3gulziAsyxwkSmpTIPB8vagKLyktRdDuBEHNGZMm4oCFWgjq31WPHpaC93gGNqpOpP4Ez4spa+nMNvhTWcuPKAJ79fqIxVoUvdjEG9qSy2WhpQlz61yG/gnKEA25IrIOYK6DIsQs2EE9LR/sTKq38Nd1y/X//FXG0QDHkEqSz3EYVV2dhb00rgLPSDcqmrScs55NNOD2zVqKmYnYTFnkACp520dkW5vBxK99BVzr792/iZ+VVo92UkKU2oG5WFTb6mNiA1H2C8KC0E44qaQleR3EQvQNwLrECOVAiSwM5gpF7nvDND0lZvYuQ9JbZfqdTrqCgwMcVrRS0z9QkLu9NWmkgEHb8p2zDRylj9VWA3lXD2vObEdWpT3w5MiFqQ1W/lteG4eipastxv2w+TeTBP0ypK84HiOW9fUzLcjRDwCW2b2VxmnGSKTX6uRSwMnC9YX4l05Mh2uwI+QVWdWUOSTWd5Xjjf7/tPYk2stSh053XTGN5RJMCMSajMcS8Trn3j/E1ajthlxCkmJXVi47PSUsyyq+jyexsayQNuv5GVYJaszprNsQD3RkgYiy49kFl2JlJJxlf8Uu/lpkq7+aWqzEzjr5cTVpFaJvSVr8AKRtiTlVPFk5t1nO30W+o6jrbAk76kxFa/tX+dom4C1wDPk03gqCw8HTBSxx4FHxIA+mh2pM3rKu5SNqBAuOSZnHzsB9JwW7DV/ge8dlVsOh375PvH8YO8EALU1HuecIC6qQgXifNuSx9XAoLaoGIYDjkWFrawX1U1XrknuMFw7QBSPtg79XovmBvwqnDICrhClEO6wgKFj9vPqJWlthUvdgH1DOA8+wFMexzQc5BUS1d1IsdBSjEv4Fe1LgBO1CpFPTpV1JuPSFNt4y/trzbtaUfwBWwM3/6JsrL6MSQYwLKXAm9YJBxsM8992MblZ63Gami0+rnwOMyPykVpQsyl9eYNOfVC6kRBkwaop//LgcAKWivkHF791g0JK5kMmCgKPas2QRkUFQsuTvm6R1946Wg95k764ZRLW59yO5UVGsawwELupCfAbdCuAwvcz5Xk18rIVEdgSRBRgO77R206QdXHuA2goaGiCQ0GmUfN1JlmFayjv0IcKGkfYt4HAj0yuQBRGDjzuS/rTmAf29Gov1S+FF7QBayNcpoBOEsMt3vFcIUC7VxOnE+pxmkgqEzduzwsPykrjBszCusgdarsRIAL6CM/KqsqcAf1vj8P1TXFyN6e5G8ao48fjKfDQJYizIdIfb+Xwp6Z2fE2C7mUfUEzMKqSBp4VUV1A49Sz1M2LzVzahEfyHUAcQNltR0nADYkBvHXDZQo8H9dQvHF7qhjPtSolBJ0A/vaLwdRz5YFFGoWBy8E/4aKcjqimaUBXXnjBpzOZnMlIVXsTVEBBUa+dD0BR0xVopgAD70psY0KjMHpmHB2kApea9o23NS83mpsref5OZet4U/0CMhSEDpwnxB9lVKSfk5djllXRFPizQmKcqMpnyZ3ycPntf96Ym9ChzU8vCQnhgWZ2UuySArw+cVBG4gqNCS6YoSEEziRWVStKUpe4FfCd91V0XA/qgOJuF7FpGjjyQgsFoNDtibp8cm+cyXxbB6zh4pMUO4H06yzsv4E/A6rg/uRJRnMRmrhMDIhyOjABX9CMDFhBFxx19KujjqWeim5PwVFU6IBiewfyk7IPETcg52kjXN7nsbaoEykKf/cjUgVxpTZZVtnqFMgv4FHa8oSOisawinMLHfUBzJcK1j8BeqquedKDtgcgnA4bym4P6gBWYVM3W/pn41ku5L4RElFWtlk5SXHEThhOWDiIyVROlQNM+wyHimlgATI/PPIm4BB8qfqwHnhgL89gzs+Ww1xQb4821SZ/4IwOJiRqH/X9u7Hj08JLSZfawOQcpRzwgk1oBNzzcgLn1FBNHspMENik9OG4awIDaUjw9rKNT1KXPl9neua6sSbkgqfs/CNfBdNfDDhQuL4AKXEXeOgZID91eOiRUnEFOIA5rnTkBU0/IT05gByoq5KBJF4Hym4Pxh3UcxZ7HjdhEhKWURbhavNR9rjLBwk3ryDcrGzfvk9I69b1yhMGWQ4bqMwv/RMSplQkjjVKXzZX8wESVcuB7QG0YUCMjk/aOmWgc/vC4oMCVYfghIGP6MT1zpeUhM1rQzOnGxmFKwTCir1Xaj5vN7T7nDZvnbDGHbCKnwji2zofNsOvbold3zlUtKGosBun3PbJSrrReHEaCQVCIDEMaCCBs+P+AbybkbIhmbNecGwF+E5/L2ECuPKCWsUESQkKnyyJ93TGACk7OrAY9P8XG//fGCoM7DAEUGnj5Mw7aQfelySWOm9iPuFyvrL8rKQR6mM6qdCUDQsfNPVu4yv/HaPOT1e/yDaviMKmTkg/I/F7MUG9OlrmDrBLRVd3c8KBJlPEKoVRcIJuhoQAmZDUkPC00W5OI1dOpQ1F61kFNqr9SmFcaHdBheOaDHF6QZMOP6QyiZ804oj98wLiAMIgcWw4UDYkDAWfR+4d5s0zP2GgUZX04i+NeSgYGokvbDhIZYUWHgd9K8zZzir264NxZUFbsfM1jdqpV2naA48tx6hsvBSabE4IMtlcOGgq8PqCjoly2rw2soqy4RJWQtPZl6PUCU14ZUWENuZV2Honn3f+k6R6wrkqgTStyQ0bFY+XAaafMRFgUlVeXxXFUcpLEYfZz3FrVUzZrOOJK+4B/wnIZ8TGRvb9OB8EUM0w8uNYj/oa9iK9AMoy6gA72o02srMxpAPUD+EDnVEF7P5xw896VyAbFk8MgnpVpR3gfLnt/wECq3rYFvYLcKCpqvcI+/hVl8AumXDeApklDRRKJSS+KOaq1Rgg4igOYtiQK1hJy46TBtDjznDp3iqJff5j0/LfSZbYVdauqXccJ9W+czupp0sU9gMlqkQ52lU1E6tUwoDUukAD6YRpAwqDrAErzA8QCRvXm98KEep0xIdY1CN1ye27IP0IHvvYIW18qGz8S7VWUZuMkUOb3P8DHTl67ur/i1UAAAAASUVORK5CYII="})]})]}),this.defaultLocale=of,this.i18nInit(),this.title=this.i18n("pluginNameInstagram"),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"instagram",pluginId:this.id,supportsRefreshToken:!1}),this.render=this.render.bind(this)}install(){this.view=new Ne(this,{provider:this.provider,viewType:"grid",showTitles:!1,showFilter:!1,showBreadcrumbs:!1});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){return this.view.render(e)}};var nf={name:"@uppy/onedrive",description:"Import files from OneDrive, into Uppy.",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","onedrive"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var af={strings:{pluginNameOneDrive:"OneDrive"}};var ci=class extends re{static{o(this,"OneDrive")}static VERSION=nf.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Te,this.id=this.opts.id||"OneDrive",this.icon=()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("g",{fill:"none",fillRule:"nonzero",children:[l("path",{d:"M13.39 12.888l4.618 2.747 2.752-1.15a4.478 4.478 0 012.073-.352 6.858 6.858 0 00-5.527-5.04 6.895 6.895 0 00-6.876 2.982l.07-.002a5.5 5.5 0 012.89.815z",fill:"#0364B8"}),l("path",{d:"M13.39 12.887v.001a5.5 5.5 0 00-2.89-.815l-.07.002a5.502 5.502 0 00-4.822 2.964 5.43 5.43 0 00.38 5.62l4.073-1.702 1.81-.757 4.032-1.685 2.105-.88-4.619-2.748z",fill:"#0078D4"}),l("path",{d:"M22.833 14.133a4.479 4.479 0 00-2.073.352l-2.752 1.15.798.475 2.616 1.556 1.141.68 3.902 2.321a4.413 4.413 0 00-.022-4.25 4.471 4.471 0 00-3.61-2.284z",fill:"#1490DF"}),l("path",{d:"M22.563 18.346l-1.141-.68-2.616-1.556-.798-.475-2.105.88L11.87 18.2l-1.81.757-4.073 1.702A5.503 5.503 0 0010.5 23h12.031a4.472 4.472 0 003.934-2.333l-3.902-2.321z",fill:"#28A8EA"})]})}),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"onedrive",pluginId:this.id,supportsRefreshToken:!0}),this.defaultLocale=af,this.i18nInit(),this.title=this.i18n("pluginNameOneDrive"),this.render=this.render.bind(this)}install(){this.view=new Ne(this,{provider:this.provider,loadAllFiles:!0,virtualList:!0});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){return this.view.render(e)}};var lf={name:"@uppy/unsplash",description:"Import files from Unsplash, the free stock photography resource, into Uppy",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","unsplash"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var uf={strings:{pluginNameUnsplash:"Unsplash"}};var pi=class extends re{static{o(this,"Unsplash")}static VERSION=lf.version;icon;provider;view;storage;files;hostname;constructor(e,t){if(super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Te,this.id=this.opts.id||"Unsplash",this.defaultLocale=uf,this.i18nInit(),this.title=this.i18n("pluginNameUnsplash"),this.icon=()=>l("svg",{className:"uppy-DashboardTab-iconUnsplash",viewBox:"0 0 32 32",height:"32",width:"32","aria-hidden":"true",children:l("g",{fill:"currentcolor",children:[l("path",{d:"M46.575 10.883v-9h12v9zm12 5h10v18h-32v-18h10v9h12z"}),l("path",{d:"M13 12.5V8h6v4.5zm6 2.5h5v9H8v-9h5v4.5h6z"})]})}),!this.opts.companionUrl)throw new Error("Companion hostname is required, please consult https://uppy.io/docs/companion");this.hostname=this.opts.companionUrl,this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new Ci(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule,provider:"unsplash",pluginId:this.id})}install(){this.view=new ri(this,{provider:this.provider,viewType:"unsplash",showFilter:!0,utmSource:this.opts.utmSource});let{target:e}=this.opts;e&&this.mount(e,this)}render(e){return this.view.render(e)}uninstall(){this.unmount()}};var cf={name:"@uppy/url",description:"The Url plugin lets users import files from the Internet. Paste any URL and it\u2019ll be added!",version:"5.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest run --project browser"},keywords:["file uploader","url","import from url","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/utils":"workspace:^",nanoid:"^5.0.9",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^","@vitest/browser":"^3.2.4",cssnano:"^7.0.7",playwright:"1.57.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"}};var pf={strings:{pluginNameUrl:"Link",import:"Import",enterUrlToImport:"Enter URL to import a file",failedToFetch:"Companion failed to fetch this URL, please make sure it\u2019s correct",enterCorrectUrl:"Incorrect URL: Please make sure you are entering a direct link to a file"}};var kl=class extends Se{static{o(this,"UrlUI")}form=document.createElement("form");input;constructor(e){super(e),this.form.id=Dt()}componentDidMount(){this.input.value="",this.form.addEventListener("submit",this.#e),document.body.appendChild(this.form)}componentWillUnmount(){this.form.removeEventListener("submit",this.#e),document.body.removeChild(this.form)}#e=o(e=>{e.preventDefault();let{addFile:t}=this.props,r=this.input.value.trim();t(r)},"#handleSubmit");render(){let{i18n:e}=this.props;return l("div",{className:"uppy-Url",children:[l("input",{className:"uppy-u-reset uppy-c-textInput uppy-Url-input",type:"text","aria-label":e("enterUrlToImport"),placeholder:e("enterUrlToImport"),ref:o(t=>{this.input=t},"ref"),"data-uppy-super-focusable":!0,form:this.form.id}),l("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Url-importButton",type:"submit",form:this.form.id,children:e("import")})]})}},df=kl;function dn(i,e,t){let r=je(i.items),s;switch(e){case"paste":{if(r.some(a=>a.kind==="file"))return;s=r.filter(a=>a.kind==="string"&&a.type==="text/plain");break}case"drop":{s=r.filter(n=>n.kind==="string"&&n.type==="text/uri-list");break}default:throw new Error(`isDropOrPaste must be either 'drop' or 'paste', but it's ${e}`)}s.forEach(n=>{n.getAsString(a=>t(a))})}o(dn,"forEachDroppedOrPastedUrl");function f1(){return l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{d:"M23.637 15.312l-2.474 2.464a3.582 3.582 0 01-.577.491c-.907.657-1.897.986-2.968.986a4.925 4.925 0 01-3.959-1.971c-.248-.329-.164-.902.165-1.149.33-.247.907-.164 1.155.164 1.072 1.478 3.133 1.724 4.618.656a.642.642 0 00.33-.328l2.473-2.463c1.238-1.313 1.238-3.366-.082-4.597a3.348 3.348 0 00-4.618 0l-1.402 1.395a.799.799 0 01-1.154 0 .79.79 0 010-1.15l1.402-1.394a4.843 4.843 0 016.843 0c2.062 1.805 2.144 5.007.248 6.896zm-8.081 5.664l-1.402 1.395a3.348 3.348 0 01-4.618 0c-1.319-1.23-1.319-3.365-.082-4.596l2.475-2.464.328-.328c.743-.492 1.567-.739 2.475-.657.906.165 1.648.574 2.143 1.314.248.329.825.411 1.155.165.33-.248.412-.822.165-1.15-.825-1.068-1.98-1.724-3.216-1.888-1.238-.247-2.556.082-3.628.902l-.495.493-2.474 2.464c-1.897 1.969-1.814 5.09.083 6.977.99.904 2.226 1.396 3.463 1.396s2.473-.492 3.463-1.395l1.402-1.396a.79.79 0 000-1.15c-.33-.328-.908-.41-1.237-.082z",fill:"#FF753E","fill-rule":"nonzero"})})}o(f1,"UrlIcon");function m1(i){let e=/^[a-z0-9]+:\/\//,t="http://";return e.test(i)?i:t+i}o(m1,"addProtocolToURL");function g1(i){return je(i.dataTransfer.items).filter(r=>r.kind==="string"&&r.type==="text/uri-list").length>0}o(g1,"canHandleRootDrop");function y1(i){return i?.startsWith("http://")||i?.startsWith("https://")}o(y1,"checkIfCorrectURL");function v1(i){let{pathname:e}=new URL(i);return e.substring(e.lastIndexOf("/")+1)}o(v1,"getFileNameFromUrl");var Vt=class i extends re{static{o(this,"Url")}static VERSION=cf.version;static requestClientId=i.name;icon;hostname;client;canHandleRootDrop;constructor(e,t){if(super(e,t),this.id=this.opts.id||"Url",this.type="acquirer",this.icon=()=>l(f1,{}),this.defaultLocale=pf,this.i18nInit(),this.title=this.i18n("pluginNameUrl"),this.hostname=this.opts.companionUrl,!this.hostname)throw new Error("Companion hostname is required, please consult https://uppy.io/docs/companion");this.client=new Je(e,{pluginId:this.id,provider:"url",companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionCookiesRule:this.opts.companionCookiesRule}),this.uppy.registerRequestClient(i.requestClientId,this.client)}getMeta=o(e=>this.client.post("url/meta",{url:e}),"getMeta");addFile=o(async(e,t)=>{if(e.startsWith("blob"))return;let r=m1(e);if(!y1(r)){this.uppy.log(`[URL] Incorrect URL entered: ${r}`),this.uppy.info(this.i18n("enterCorrectUrl"),"error",4e3);return}this.uppy.log(`[URL] Adding file from dropped/pasted url: ${r}`);try{let s=await this.getMeta(r),n={meta:t,source:this.id,name:s.name||v1(r),type:s.type,data:{size:s.size},isRemote:!0,body:{url:r},remote:{companionUrl:this.opts.companionUrl,url:`${this.hostname}/url/get`,body:{fileId:r,url:r},requestClientId:i.requestClientId}};this.uppy.log("[Url] Adding remote file");try{return this.uppy.addFile(n)}catch(a){return a.isRestriction||this.uppy.log(a),a}}catch(s){return this.uppy.log(s),this.uppy.info({message:this.i18n("failedToFetch"),details:s},"error",4e3),s}},"addFile");handleRootDrop=o(e=>{dn(e.dataTransfer,"drop",t=>{this.addFile(t)})},"handleRootDrop");handleRootPaste=o(e=>{dn(e.clipboardData,"paste",t=>{this.addFile(t)})},"handleRootPaste");render(){return l(df,{i18n:this.i18n,addFile:this.addFile})}install(){let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.unmount()}};Vt.prototype.canHandleRootDrop=g1;var hf={name:"@uppy/zoom",description:"Import files from zoom, into Uppy.",version:"4.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","zoom"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/provider-views":"workspace:^","@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{"@uppy/core":"workspace:^",typescript:"^5.8.3"}};var ff={strings:{pluginNameZoom:"Zoom"}};var di=class extends re{static{o(this,"Zoom")}static VERSION=hf.version;icon;provider;view;storage;files;rootFolderId=null;constructor(e,t){super(e,t),this.type="acquirer",this.files=[],this.storage=this.opts.storage||Te,this.id=this.opts.id||"Zoom",this.icon=()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{d:"M24.5 11.125l-2.75 2.063c-.473.353-.75.91-.75 1.5v3.124c0 .59.277 1.147.75 1.5l2.75 2.063a.938.938 0 001.5-.75v-8.75a.938.938 0 00-1.5-.75zm-4.75 9.5c0 1.035-.84 1.875-1.875 1.875H9.75A3.75 3.75 0 016 18.75v-6.875C6 10.84 6.84 10 7.875 10H16a3.75 3.75 0 013.75 3.75v6.875z",fill:"#2E8CFF","fill-rule":"evenodd"})}),this.opts.companionAllowedHosts=He(this.opts.companionAllowedHosts,this.opts.companionUrl),this.provider=new qe(e,{companionUrl:this.opts.companionUrl,companionHeaders:this.opts.companionHeaders,companionKeysParams:this.opts.companionKeysParams,companionCookiesRule:this.opts.companionCookiesRule,provider:"zoom",pluginId:this.id,supportsRefreshToken:!1}),this.defaultLocale=ff,this.i18nInit(),this.title=this.i18n("pluginNameZoom"),this.render=this.render.bind(this)}install(){this.view=new Ne(this,{provider:this.provider});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.view.tearDown(),this.unmount()}render(e){return this.view.render(e)}};var mf={name:"@uppy/remote-sources",description:"Uppy plugin that includes all remote sources that Uppy+Companion offer, like Instagram, Google Drive, Dropox, Box, Unsplash, Url etc",version:"3.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","instagram","google-drive","facebook","dropbox","onedrive","zoom","unsplash","box","url"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/box":"workspace:^","@uppy/dashboard":"workspace:^","@uppy/dropbox":"workspace:^","@uppy/facebook":"workspace:^","@uppy/google-drive":"workspace:^","@uppy/instagram":"workspace:^","@uppy/onedrive":"workspace:^","@uppy/unsplash":"workspace:^","@uppy/url":"workspace:^","@uppy/zoom":"workspace:^"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{"@uppy/core":"workspace:^",jsdom:"^26.1.0","resize-observer-polyfill":"^1.5.1",typescript:"^5.8.3",vitest:"^3.2.4"}};var El={__proto__:null,Box:si,Dropbox:ni,Facebook:ai,GoogleDrive:li,Instagram:ui,OneDrive:ci,Unsplash:pi,Url:Vt,Zoom:di},S1={sources:Object.keys(El)},$s=class extends xe{static{o(this,"RemoteSources")}static VERSION=mf.version;#e=new Set;constructor(e,t){if(super(e,{...S1,...t}),this.id=this.opts.id||"RemoteSources",this.type="preset",this.opts.companionUrl==null)throw new Error("Please specify companionUrl for RemoteSources to work, see https://uppy.io/docs/remote-sources#companionUrl")}setOptions(e){this.uninstall(),super.setOptions(e),this.install()}install(){this.opts.sources.forEach(e=>{let{sources:t,...r}=this.opts,s={...r,companionKeysParams:this.opts.companionKeysParams?.[e]},n=El[e];if(n==null){let a=Object.keys(El),u=new Intl.ListFormat("en",{style:"long",type:"disjunction"});throw new Error(`Invalid plugin: "${e}" is not one of: ${u.format(a)}.`)}this.uppy.use(n,s),this.#e.add(this.uppy.getPlugin(e))})}uninstall(){for(let e of this.#e)this.uppy.removePlugin(e);this.#e.clear()}};var gf={name:"@uppy/screen-capture",description:"Uppy plugin that captures video from display or application.",version:"5.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","screen capture","video","record","mediarecorder"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},publishConfig:{access:"public"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var yf={strings:{pluginNameScreenCapture:"Screencast",startCapturing:"Begin screen capturing",stopCapturing:"Stop screen capturing",submitRecordedFile:"Submit recorded file",streamActive:"Stream active",streamPassive:"Stream passive",micDisabled:"Microphone access denied by user",recording:"Recording",takeScreenshot:"Take Screenshot",discardMediaFile:"Discard Media"}};function Fl({onDiscard:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--discard",type:"button",title:e("discardMediaFile"),"aria-label":e("discardMediaFile"),onClick:i,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[l("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}o(Fl,"DiscardButton");function Tl({recording:i,onStartRecording:e,onStopRecording:t,i18n:r}){return i?l("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video uppy-ScreenCapture-button--stop-rec",type:"button",title:r("stopCapturing"),"aria-label":r("stopCapturing"),onClick:t,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:l("rect",{x:"15",y:"15",width:"70",height:"70"})})}):l("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video",type:"button",title:r("startCapturing"),"aria-label":r("startCapturing"),onClick:e,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:l("path",{d:"M4.5 4.5a3 3 0 0 0-3 3v9a3 3 0 0 0 3 3h8.25a3 3 0 0 0 3-3v-9a3 3 0 0 0-3-3H4.5ZM19.94 18.75l-2.69-2.69V7.94l2.69-2.69c.944-.945 2.56-.276 2.56 1.06v11.38c0 1.336-1.616 2.005-2.56 1.06Z"})})})}o(Tl,"RecordButton");function Cl({onScreenshot:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--screenshot",type:"button",title:e("takeScreenshot"),"aria-label":e("takeScreenshot"),onClick:i,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:[l("path",{d:"M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z"}),l("path",{"fill-rule":"evenodd",d:"M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z","clip-rule":"evenodd"})]})})}o(Cl,"ScreenshotButton");function P1(i){return(i-(i%=60))/60+(i>9?":":":0")+i}o(P1,"fmtMSS");var Al=class extends Se{static{o(this,"StopWatch")}wrapperStyle={width:"100%",height:"100%",display:"flex"};overlayStyle={position:"absolute",width:"100%",height:"100%",background:"black",opacity:.7};infoContainerStyle={marginLeft:"auto",marginRight:"auto",marginTop:"auto",marginBottom:"auto",zIndex:1,color:"white"};infotextStyle={marginLeft:"auto",marginRight:"auto",marginBottom:"1rem",fontSize:"1.5rem"};timeStyle={display:"block",fontWeight:"bold",marginLeft:"auto",marginRight:"auto",fontSize:"3rem",fontFamily:"Courier New"};timerRunning=!1;timer;constructor(e){super(e),this.state={elapsedTime:0}}startTimer(){this.timerTick(),this.timerRunning=!0}resetTimer(){clearTimeout(this.timer),this.setState({elapsedTime:0}),this.timerRunning=!1}timerTick(){this.timer=setTimeout(()=>{this.setState(e=>({elapsedTime:e.elapsedTime+1})),this.timerTick()},1e3)}render(){let{recording:e,i18n:t}={...this.props},{elapsedTime:r}=this.state,s=P1(r);return e&&!this.timerRunning&&this.startTimer(),!e&&this.timerRunning&&this.resetTimer(),e?l("div",{style:this.wrapperStyle,children:[l("div",{style:this.overlayStyle}),l("div",{style:this.infoContainerStyle,children:[l("div",{style:this.infotextStyle,children:t("recording")}),l("div",{style:this.timeStyle,children:s})]})]}):null}},vf=Al;function Rl({streamActive:i,i18n:e}){return i?l("div",{title:e("streamActive"),className:"uppy-ScreenCapture-icon--stream uppy-ScreenCapture-icon--streamActive",children:l("svg",{"aria-hidden":"true",focusable:"false",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),l("path",{d:"M0 0h24v24H0z",fill:"none"}),l("path",{d:"M1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm18-7H5v1.63c3.96 1.28 7.09 4.41 8.37 8.37H19V7zM1 10v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11zm20-7H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})]})}):l("div",{title:e("streamPassive"),className:"uppy-ScreenCapture-icon--stream",children:l("svg",{"aria-hidden":"true",focusable:"false",width:"24",height:"24",viewBox:"0 0 24 24",children:[l("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),l("path",{d:"M0 0h24v24H0z",fill:"none"}),l("path",{d:"M21 3H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm0-4v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11z"})]})})}o(Rl,"StreamStatus");function Ul({recording:i,recordedVideo:e,onSubmit:t,capturedScreenshotUrl:r,i18n:s}){return(e||r)&&!i?l("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--submit",type:"button",title:s("submitRecordedFile"),"aria-label":s("submitRecordedFile"),onClick:t,"data-uppy-super-focusable":!0,children:l("svg",{width:"12",height:"9",viewBox:"0 0 12 9",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon",children:l("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})}):null}o(Ul,"SubmitButton");var Ol=class extends Se{static{o(this,"RecorderScreen")}videoElement=null;componentWillUnmount(){let{onStop:e}=this.props;e()}render(){let{recording:e,stream:t,recordedVideo:r,enableScreenshots:s,capturedScreenshotUrl:n}=this.props,a={playsinline:!0};return(e||!r&&!e)&&(a.muted=!0,a.autoplay=!0,a.srcObject=t),r&&!e&&(a.muted=!1,a.controls=!0,a.src=r,this.videoElement&&(this.videoElement.srcObject=null)),l("div",{className:"uppy uppy-ScreenCapture-container",children:[l("div",{className:"uppy-ScreenCapture-mediaContainer",children:[l(Rl,{...this.props}),n&&!e&&!r?l("div",{className:"uppy-ScreenCapture-imageContainer",children:l("img",{src:n,className:"uppy-ScreenCapture-media",alt:"screenshotPreview"})}):l("video",{ref:o(u=>{this.videoElement=u},"ref"),className:"uppy-ScreenCapture-media",...a}),l("div",{children:l(vf,{...this.props})})]}),l("div",{className:"uppy-ScreenCapture-buttonContainer",children:r||n?l(Re,{children:[l(Ul,{...this.props}),l(Fl,{...this.props})]}):l(Re,{children:[s&&!e&&l(Cl,{...this.props}),l(Tl,{...this.props})]})})]})}},bf=Ol;function Dl(){return l("svg",{className:"uppy-DashboardTab-iconScreenRec","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("g",{fill:"currentcolor",fillRule:"evenodd",children:[l("path",{d:"M24.182 9H7.818C6.81 9 6 9.742 6 10.667v10c0 .916.81 1.666 1.818 1.666h4.546V24h7.272v-1.667h4.546c1 0 1.809-.75 1.809-1.666l.009-10C26 9.742 25.182 9 24.182 9zM24 21H8V11h16v10z"}),l("circle",{cx:"16",cy:"16",r:"2"})]})})}o(Dl,"ScreenRecIcon");function _1(){return window.MediaRecorder&&navigator.mediaDevices?.getDisplayMedia}o(_1,"isScreenRecordingSupported");function k1(){return window.MediaRecorder&&navigator.mediaDevices}o(k1,"getMediaDevices");var E1=["image/png","image/jpeg","image/webp"],F1={displayMediaConstraints:{video:{width:1280,height:720,frameRate:{ideal:3,max:5},cursor:"motion",displaySurface:"monitor"}},userMediaConstraints:{audio:!0},preferredVideoMimeType:"video/webm",preferredImageMimeType:"image/png",enableScreenshots:!0},xr=class extends re{static{o(this,"ScreenCapture")}static VERSION=gf.version;mediaDevices;protocol;icon;streamInterrupted;captureActive;capturedMediaFile;videoStream=null;audioStream=null;userDenied=!1;recorder=null;outputStream=null;recordingChunks=null;constructor(e,t){super(e,{...F1,...t}),this.mediaDevices=k1(),this.protocol=location.protocol==="https:"?"https":"http",this.id=this.opts.id||"ScreenCapture",this.type="acquirer",this.icon=Dl,this.defaultLocale=yf,this.i18nInit(),this.title=this.i18n("pluginNameScreenCapture"),this.install=this.install.bind(this),this.setPluginState=this.setPluginState.bind(this),this.render=this.render.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.startRecording=this.startRecording.bind(this),this.stopRecording=this.stopRecording.bind(this),this.submit=this.submit.bind(this),this.streamInterrupted=this.streamInactivated.bind(this),this.captureScreenshot=this.captureScreenshot.bind(this),this.discardRecordedMedia=this.discardRecordedMedia.bind(this),this.captureActive=!1,this.capturedMediaFile=null,this.setPluginState({streamActive:!1,audioStreamActive:!1,recording:!1,recordedVideo:null,screenRecError:null,capturedScreenshotUrl:null,status:"init"})}install(){if(!_1())return this.uppy.log("Screen recorder access is not supported","warning"),null;this.setPluginState({streamActive:!1,audioStreamActive:!1,status:"init"});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){this.videoStream&&this.stop(),this.unmount()}start(){return this.mediaDevices?(this.captureActive=!0,this.selectAudioStreamSource(),this.selectVideoStreamSource().then(e=>{e===!1&&this.parent?.hideAllPanels&&(this.parent.hideAllPanels(),this.captureActive=!1)})):Promise.reject(new Error("Screen recorder access not supported"))}selectVideoStreamSource(){return this.videoStream?new Promise(e=>e(this.videoStream)):this.mediaDevices.getDisplayMedia(this.opts.displayMediaConstraints).then(e=>(this.videoStream=e,this.videoStream.addEventListener("inactive",()=>{this.streamInactivated()}),this.setPluginState({streamActive:!0,status:"ready",screenRecError:null}),e)).catch(e=>(this.setPluginState({screenRecError:e,status:"error"}),this.userDenied=!0,setTimeout(()=>{this.userDenied=!1},1e3),!1))}selectAudioStreamSource(){return this.audioStream?new Promise(e=>e(this.audioStream)):this.mediaDevices.getUserMedia(this.opts.userMediaConstraints).then(e=>(this.audioStream=e,this.setPluginState({audioStreamActive:!0}),e)).catch(e=>(e.name==="NotAllowedError"&&(this.uppy.info(this.i18n("micDisabled"),"error",5e3),this.uppy.log(this.i18n("micDisabled"),"warning")),!1))}startRecording(){let e={};this.capturedMediaFile=null,this.recordingChunks=[];let{preferredVideoMimeType:t}=this.opts;this.selectVideoStreamSource().then(r=>{if(r===!1)throw new Error("No video stream available");t&&MediaRecorder.isTypeSupported(t)&&xt(t)&&(e.mimeType=t);let s=[r.getVideoTracks()[0]];this.audioStream&&s.push(this.audioStream.getAudioTracks()[0]),this.outputStream=new MediaStream(s),this.recorder=new MediaRecorder(this.outputStream,e),this.recorder.addEventListener("dataavailable",n=>{this.recordingChunks.push(n.data)}),this.recorder.start(),this.setPluginState({recording:!0,status:"recording"})}).catch(r=>{this.uppy.log(r,"error"),this.setPluginState({screenRecError:r,status:"error"})})}streamInactivated(){let{recordedVideo:e,recording:t}={...this.getPluginState()};!e&&!t?(this.parent?.hideAllPanels&&this.parent.hideAllPanels(),this.setPluginState({status:"init"})):t&&(this.uppy.log("Capture stream inactive \u2014 stop recording"),this.stopRecording()),this.videoStream=null,this.audioStream=null,this.setPluginState({streamActive:!1,audioStreamActive:!1})}stopRecording(){return new Promise(t=>{this.recorder.addEventListener("stop",()=>{t()}),this.recorder.stop()}).then(()=>(this.setPluginState({recording:!1}),this.getVideo())).then(t=>{this.capturedMediaFile=t,this.setPluginState({recordedVideo:URL.createObjectURL(t.data),status:"captured"})}).then(()=>{this.recordingChunks=null,this.recorder=null},t=>{throw this.recordingChunks=null,this.recorder=null,t})}discardRecordedMedia(){let{capturedScreenshotUrl:e,recordedVideo:t}=this.getPluginState();e&&URL.revokeObjectURL(e),t&&URL.revokeObjectURL(t),this.capturedMediaFile=null,this.setPluginState({recordedVideo:null,capturedScreenshotUrl:null,status:this.getPluginState().streamActive?"ready":"init"})}submit(){try{this.capturedMediaFile&&this.uppy.addFile(this.capturedMediaFile)}catch(e){e.isRestriction||this.uppy.log(e,"warning")}}stop(){this.videoStream&&(this.videoStream.getVideoTracks().forEach(r=>{r.stop()}),this.videoStream.getAudioTracks().forEach(r=>{r.stop()}),this.videoStream=null),this.audioStream&&(this.audioStream.getAudioTracks().forEach(r=>{r.stop()}),this.audioStream.getVideoTracks().forEach(r=>{r.stop()}),this.audioStream=null),this.outputStream&&(this.outputStream.getAudioTracks().forEach(r=>{r.stop()}),this.outputStream.getVideoTracks().forEach(r=>{r.stop()}),this.outputStream=null);let{capturedScreenshotUrl:e,recordedVideo:t}=this.getPluginState();e&&URL.revokeObjectURL(e),t&&URL.revokeObjectURL(t),this.setPluginState({recording:!1,streamActive:!1,audioStreamActive:!1,recordedVideo:null,capturedScreenshotUrl:null,status:"init"}),this.captureActive=!1}getVideo(){let e=this.recordingChunks[0].type,t=xt(e);if(!t)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${e}"`));let r=`screencap-${Date.now()}.${t}`,s=new Blob(this.recordingChunks,{type:e}),n={source:this.id,name:r,data:new Blob([s],{type:e}),type:e};return Promise.resolve(n)}async captureScreenshot(){if(!this.mediaDevices?.getDisplayMedia)throw new Error("Screen capture is not supported");try{let e=this.videoStream;if(!e){let u=await this.selectVideoStreamSource();if(!u)throw new Error("Failed to get screen capture stream");e=u}let t=document.createElement("video");t.srcObject=e,await new Promise(u=>{t.onloadedmetadata=()=>{t.play(),u(null)}});let r=document.createElement("canvas");r.width=t.videoWidth,r.height=t.videoHeight;let s=r.getContext("2d");if(!s)throw new Error("Failed to get canvas context");s.drawImage(t,0,0,r.width,r.height);let n=this.opts.preferredImageMimeType;(!n||!E1.includes(n))&&(this.uppy.log(`Unsupported image type "${n}", falling back to image/png`,"warning"),n="image/png");let a=1;return new Promise((u,c)=>{r.toBlob(p=>{if(!p){c(new Error("Failed to create screenshot blob"));return}let f=xt(n)||"png",d={source:this.id,name:`Screenshot ${new Date().toISOString()}.${f}`,type:n,data:p};try{this.capturedMediaFile=d;let v=URL.createObjectURL(p);this.setPluginState({capturedScreenshotUrl:v,status:"captured"}),u()}catch(v){this.getPluginState().capturedScreenshotUrl&&this.setPluginState({capturedScreenshotUrl:null}),v.isRestriction||this.uppy.log(v,"error"),c(v)}finally{t.srcObject=null,r.remove(),t.remove()}},n,a)})}catch(e){throw this.uppy.log(e,"error"),e}}render(){let e=this.getPluginState();return!e.streamActive&&!this.captureActive&&!this.userDenied&&this.start(),l(bf,{...e,onStartRecording:this.startRecording,onStopRecording:this.stopRecording,enableScreenshots:this.opts.enableScreenshots,onScreenshot:this.captureScreenshot,onStop:this.stop,onSubmit:this.submit,i18n:this.i18n,stream:this.videoStream,onDiscard:this.discardRecordedMedia})}};var wf={name:"@uppy/status-bar",description:"A progress bar for Uppy, with many bells and whistles.",version:"5.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","progress bar","status bar","progress","upload","eta","speed"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/utils":"workspace:^",classnames:"^2.2.6",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Sf={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",cancel:"Cancel",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",retryUpload:"Retry upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details",failedToAddFiles:"Failed to add files"}};var yt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var Bl=ae(Ge(),1);var Il=ae(er(),1);var Nl=ae(Ge(),1);var C1="\xB7",xf=o(()=>` ${C1} `,"renderDot");function Pf(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:a,startUpload:u}=i,c=(0,Nl.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===yt.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":a}),p=e&&t&&!r?s("uploadXNewFiles",{smart_count:e}):s("uploadXFiles",{smart_count:e});return l("button",{type:"button",className:c,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:u,disabled:a,"data-uppy-super-focusable":!0,children:p})}o(Pf,"UploadBtn");function _f(i){let{i18n:e,uppy:t}=i;return l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:o(()=>t.retryAll().catch(()=>{}),"onClick"),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:l("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})}),e("retry")]})}o(_f,"RetryBtn");function kf(i){let{i18n:e,uppy:t}=i;return l("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:o(()=>t.cancelAll(),"onClick"),"data-cy":"cancel","data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:l("g",{fill:"none",fillRule:"evenodd",children:[l("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),l("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"})]})})})}o(kf,"CancelBtn");function Ef(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,a=t(e?"resume":"pause");function u(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return o(u,"togglePauseResume"),l("button",{title:a,"aria-label":a,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:u,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:l("g",{fill:"none",fillRule:"evenodd",children:[l("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),l("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}o(Ef,"PauseResumeButton");function Ff(i){let{i18n:e,doneButtonHandler:t}=i;return l("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0,children:e("done")})}o(Ff,"DoneBtn");function Tf(){return l("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:l("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"})})}o(Tf,"LoadingSpinner");function Cf(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return l("div",{className:"uppy-StatusBar-content",children:[l(Tf,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}o(Cf,"ProgressBarProcessing");function A1(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:a}=i,u=e>1,c=(0,Il.default)(r);return l("div",{className:"uppy-StatusBar-statusSecondary",children:[u&&a("filesUploadedOfTotal",{complete:t,smart_count:e}),l("span",{className:"uppy-StatusBar-additionalInfo",children:[u&&xf(),s!=null?a("dataUploadedOfTotal",{complete:c,total:(0,Il.default)(s)}):a("dataUploadedOfUnknown",{complete:c}),xf(),n!=null&&a("xTimeLeft",{time:Yi(n)})]})]})}o(A1,"ProgressDetails");function Af(i){let{i18n:e,complete:t,numUploads:r}=i;return l("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:t,smart_count:r})})}o(Af,"FileUploadCount");function R1(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,Nl.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return l("div",{className:"uppy-StatusBar-statusSecondary",children:[l("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:t})}),l("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r,children:e("upload")})]})}o(R1,"UploadNewlyAddedFiles");function Rf(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,showProgressDetails:s,isUploadStarted:n,isAllComplete:a,isAllPaused:u,newFiles:c,numUploads:p,complete:f,totalUploadedSize:d,totalSize:v,totalETA:_,startUpload:k}=i,A=c&&n;if(!n||a)return null;let F=e(u?"paused":"uploading");function R(){return!u&&!A&&s?t?l(A1,{numUploads:p,complete:f,totalUploadedSize:d,totalSize:v,totalETA:_,i18n:e}):l(Af,{i18n:e,complete:f,numUploads:p}):null}return o(R,"renderProgressDetails"),l("div",{className:"uppy-StatusBar-content",title:F,children:[u?null:l(Tf,{}),l("div",{className:"uppy-StatusBar-status",children:[l("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${F}: ${r}%`:F}),R(),A?l(R1,{i18n:e,newFiles:c,startUpload:k}):null]})]})}o(Rf,"ProgressBarUploading");function Uf(i){let{i18n:e}=i;return l("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:l("div",{className:"uppy-StatusBar-status",children:l("div",{className:"uppy-StatusBar-statusPrimary",children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:l("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}o(Uf,"ProgressBarComplete");function Of(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let a=`${t("uploadFailed")}
${e}`;alert(a)}return o(n,"displayErrorAlert"),l("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:l("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})}),l("div",{className:"uppy-StatusBar-status",children:[l("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),l("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:n,type:"button",children:"?"})]}),l(Af,{i18n:t,complete:r,numUploads:s})]})]})}o(Of,"ProgressBarError");function Ws(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:a,postprocess:u}=n;r==null&&(a||u)&&({mode:t,message:r}=a||u),a?.mode==="determinate"&&e.push(a.value),u?.mode==="determinate"&&e.push(u.value)}let s=e.reduce((n,a)=>n+a/e.length,0);return{mode:t,message:r,value:s}}o(Ws,"calculateProcessingProgress");var{STATE_ERROR:Df,STATE_WAITING:U1,STATE_PREPROCESSING:Ml,STATE_UPLOADING:hn,STATE_POSTPROCESSING:Ll,STATE_COMPLETE:fn}=yt;function jl({newFiles:i,allowNewUpload:e,isUploadInProgress:t,isAllPaused:r,resumableUploads:s,error:n,hideUploadButton:a=void 0,hidePauseResumeButton:u=!1,hideCancelButton:c=!1,hideRetryButton:p=!1,recoveredState:f,uploadState:d,totalProgress:v,files:_,supportsUploadProgress:k,hideAfterFinish:A=!1,isSomeGhost:F,doneButtonHandler:R=void 0,isUploadStarted:U,i18n:C,startUpload:Y,uppy:$,isAllComplete:H,showProgressDetails:Q=void 0,numUploads:X,complete:Z,totalSize:ye,totalETA:se,totalUploadedSize:we}){function me(){switch(d){case Ll:case Ml:{let ne=Ws(_);return ne.mode==="determinate"?ne.value*100:v}case Df:return null;case hn:return k?v:null;default:return v}}o(me,"getProgressValue");function _e(){switch(d){case Ll:case Ml:{let{mode:ne}=Ws(_);return ne==="indeterminate"}case hn:return!k;default:return!1}}o(_e,"getIsIndeterminate");let ve=me(),E=ve??100,w=!n&&i&&(!t&&!r||f)&&e&&!a,S=!c&&d!==U1&&d!==fn,B=s&&!u&&d===hn,q=n&&!H&&!p,j=R&&d===fn,I=(0,Bl.default)("uppy-StatusBar-progress",{"is-indeterminate":_e()}),T=(0,Bl.default)("uppy-StatusBar",`is-${d}`,{"has-ghosts":F}),O=(()=>{switch(d){case Ml:case Ll:return l(Cf,{progress:Ws(_)});case fn:return l(Uf,{i18n:C});case Df:return l(Of,{error:n,i18n:C,numUploads:X,complete:Z});case hn:return l(Rf,{i18n:C,supportsUploadProgress:k,totalProgress:v,showProgressDetails:Q,isUploadStarted:U,isAllComplete:H,isAllPaused:r,newFiles:i,numUploads:X,complete:Z,totalUploadedSize:we,totalSize:ye,totalETA:se,startUpload:Y});default:return null}})();return!(w||q||B||S||j)&&!O||d===fn&&A?null:l("div",{className:T,children:[l("div",{className:I,style:{width:`${E}%`},role:"progressbar","aria-label":`${E}%`,"aria-valuetext":`${E}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":ve}),O,l("div",{className:"uppy-StatusBar-actions",children:[w?l(Pf,{newFiles:i,isUploadStarted:U,recoveredState:f,i18n:C,isSomeGhost:F,startUpload:Y,uploadState:d}):null,q?l(_f,{i18n:C,uppy:$}):null,B?l(Ef,{isAllPaused:r,i18n:C,isAllComplete:H,resumableUploads:s,uppy:$}):null,S?l(kf,{i18n:C,uppy:$}):null,j?l(Ff,{i18n:C,doneButtonHandler:R}):null]})]})}o(jl,"StatusBarUI");var O1=2e3,D1=2e3;function I1(i,e,t,r){if(i)return yt.STATE_ERROR;if(e)return yt.STATE_COMPLETE;if(t)return yt.STATE_WAITING;let s=yt.STATE_WAITING,n=Object.keys(r);for(let a=0;a<n.length;a++){let{progress:u}=r[n[a]];if(u.uploadStarted&&!u.uploadComplete)return yt.STATE_UPLOADING;u.preprocess&&(s=yt.STATE_PREPROCESSING),u.postprocess&&s!==yt.STATE_PREPROCESSING&&(s=yt.STATE_POSTPROCESSING)}return s}o(I1,"getUploadingState");var N1={hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null},Pr=class extends re{static{o(this,"StatusBar")}static VERSION=wf.version;#e;#t;#r;#i;constructor(e,t){super(e,{...N1,...t}),this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=Sf,this.i18nInit(),this.render=this.render.bind(this),this.install=this.install.bind(this)}#s(e){if(e.total==null||e.total===0)return null;let t=e.total-e.uploaded;if(t<=0)return null;this.#e??=performance.now();let r=performance.now()-this.#e;if(r===0)return Math.round((this.#i??0)/100)/10;let s=e.uploaded-this.#t;if(this.#t=e.uploaded,s<=0)return Math.round((this.#i??0)/100)/10;let n=s/r,a=this.#r==null?n:Qt(n,this.#r,O1,r);this.#r=a;let u=t/a,c=Math.max(this.#i-r,0),p=this.#i==null?u:Qt(u,c,D1,r);return this.#i=p,this.#e=performance.now(),Math.round(p/100)/10}startUpload=o(()=>this.uppy.upload().catch((()=>{})),"startUpload");render(e){let{capabilities:t,files:r,allowNewUpload:s,totalProgress:n,error:a,recoveredState:u}=e,{newFiles:c,startedFiles:p,completeFiles:f,isUploadStarted:d,isAllComplete:v,isAllPaused:_,isUploadInProgress:k,isSomeGhost:A}=this.uppy.getObjectOfFilesPerState(),F=u?Object.values(r):c,R=!!t.resumableUploads,U=t.uploadProgress!==!1,C=null,Y=0;p.every(H=>H.progress.bytesTotal!=null&&H.progress.bytesTotal!==0)?(C=0,p.forEach(H=>{C+=H.progress.bytesTotal||0,Y+=H.progress.bytesUploaded||0})):p.forEach(H=>{Y+=H.progress.bytesUploaded||0});let $=this.#s({uploaded:Y,total:C});return jl({error:a,uploadState:I1(a,v,u,e.files||{}),allowNewUpload:s,totalProgress:n,totalSize:C,totalUploadedSize:Y,isAllComplete:!1,isAllPaused:_,isUploadStarted:d,isUploadInProgress:k,isSomeGhost:A,recoveredState:u,complete:f.length,newFiles:F.length,numUploads:p.length,totalETA:$,files:r,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:R,supportsUploadProgress:U,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideAfterFinish:this.opts.hideAfterFinish})}onMount(){let e=this.el;Wr(e)||(e.dir="ltr")}#l=o(()=>{let{recoveredState:e}=this.uppy.getState();if(this.#r=null,this.#i=null,e){this.#t=Object.values(e.files).reduce((t,{progress:r})=>t+r.bytesUploaded,0),this.uppy.emit("restore-confirmed");return}this.#e=performance.now(),this.#t=0},"#onUploadStart");install(){let{target:e}=this.opts;e&&this.mount(e,this),this.uppy.on("upload",this.#l),this.#e=performance.now(),this.#t=this.uppy.getFiles().reduce((t,r)=>t+r.progress.bytesUploaded,0)}uninstall(){this.unmount(),this.uppy.off("upload",this.#l)}};function _r(i){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_r(i)}o(_r,"_typeof");function If(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,L1(r.key),r)}}o(If,"_defineProperties");function M1(i,e,t){return e&&If(i.prototype,e),t&&If(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(M1,"_createClass");function L1(i){var e=B1(i,"string");return _r(e)=="symbol"?e:e+""}o(L1,"_toPropertyKey");function B1(i,e){if(_r(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(_r(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(B1,"_toPrimitive");function j1(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(j1,"_classCallCheck");function z1(i,e,t){return e=Xs(e),H1(i,Hl()?Reflect.construct(e,t||[],Xs(i).constructor):e.apply(i,t))}o(z1,"_callSuper");function H1(i,e){if(e&&(_r(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return q1(i)}o(H1,"_possibleConstructorReturn");function q1(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}o(q1,"_assertThisInitialized");function V1(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&Gs(i,e)}o(V1,"_inherits");function zl(i){var e=typeof Map=="function"?new Map:void 0;return zl=o(function(r){if(r===null||!W1(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,s)}function s(){return $1(r,arguments,Xs(this).constructor)}return o(s,"Wrapper"),s.prototype=Object.create(r.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),Gs(s,r)},"_wrapNativeSuper"),zl(i)}o(zl,"_wrapNativeSuper");function $1(i,e,t){if(Hl())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var s=new(i.bind.apply(i,r));return t&&Gs(s,t.prototype),s}o($1,"_construct");function Hl(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hl=o(function(){return!!i},"_isNativeReflectConstruct"))()}o(Hl,"_isNativeReflectConstruct");function W1(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}o(W1,"_isNativeFunction");function Gs(i,e){return Gs=Object.setPrototypeOf?Object.setPrototypeOf.bind():o(function(r,s){return r.__proto__=s,r},"_setPrototypeOf"),Gs(i,e)}o(Gs,"_setPrototypeOf");function Xs(i){return Xs=Object.setPrototypeOf?Object.getPrototypeOf.bind():o(function(t){return t.__proto__||Object.getPrototypeOf(t)},"_getPrototypeOf"),Xs(i)}o(Xs,"_getPrototypeOf");var G1=(function(i){function e(t){var r,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(j1(this,e),r=z1(this,e,[t]),r.originalRequest=n,r.originalResponse=a,r.causingError=s,s!=null&&(t+=", caused by ".concat(s.toString())),n!=null){var u=n.getHeader("X-Request-ID")||"n/a",c=n.getMethod(),p=n.getURL(),f=a?a.getStatus():"n/a",d=a?a.getBody()||"":"n/a";t+=", originated from request (method: ".concat(c,", url: ").concat(p,", response code: ").concat(f,", response text: ").concat(d,", request id: ").concat(u,")")}return r.message=t,r}return o(e,"DetailedError"),V1(e,i),M1(e)})(zl(Error)),kr=G1;var X1=!1;function hi(i){X1&&console.log(i)}o(hi,"log");function Ks(i){"@babel/helpers - typeof";return Ks=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ks(i)}o(Ks,"_typeof");function K1(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(K1,"_classCallCheck");function Nf(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,J1(r.key),r)}}o(Nf,"_defineProperties");function Y1(i,e,t){return e&&Nf(i.prototype,e),t&&Nf(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(Y1,"_createClass");function J1(i){var e=Q1(i,"string");return Ks(e)=="symbol"?e:e+""}o(J1,"_toPropertyKey");function Q1(i,e){if(Ks(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Ks(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(Q1,"_toPrimitive");var Mf=(function(){function i(){K1(this,i)}return o(i,"NoopUrlStorage"),Y1(i,[{key:"listAllUploads",value:o(function(){return Promise.resolve([])},"listAllUploads")},{key:"findUploadsByFingerprint",value:o(function(t){return Promise.resolve([])},"findUploadsByFingerprint")},{key:"removeUpload",value:o(function(t){return Promise.resolve()},"removeUpload")},{key:"addUpload",value:o(function(t,r){return Promise.resolve(null)},"addUpload")}])})();var qf="3.7.7",Z1=qf,Fr=typeof Buffer=="function",Lf=typeof TextDecoder=="function"?new TextDecoder:void 0,Bf=typeof TextEncoder=="function"?new TextEncoder:void 0,ew="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Ys=Array.prototype.slice.call(ew),mn=(i=>{let e={};return i.forEach((t,r)=>e[t]=r),e})(Ys),tw=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Qe=String.fromCharCode.bind(String),jf=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):i=>new Uint8Array(Array.prototype.slice.call(i,0)),Vf=o(i=>i.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),"_mkUriSafe"),$f=o(i=>i.replace(/[^A-Za-z0-9\+\/]/g,""),"_tidyB64"),Wf=o(i=>{let e,t,r,s,n="",a=i.length%3;for(let u=0;u<i.length;){if((t=i.charCodeAt(u++))>255||(r=i.charCodeAt(u++))>255||(s=i.charCodeAt(u++))>255)throw new TypeError("invalid character found");e=t<<16|r<<8|s,n+=Ys[e>>18&63]+Ys[e>>12&63]+Ys[e>>6&63]+Ys[e&63]}return a?n.slice(0,a-3)+"===".substring(a):n},"btoaPolyfill"),$l=typeof btoa=="function"?i=>btoa(i):Fr?i=>Buffer.from(i,"binary").toString("base64"):Wf,ql=Fr?i=>Buffer.from(i).toString("base64"):i=>{let t=[];for(let r=0,s=i.length;r<s;r+=4096)t.push(Qe.apply(null,i.subarray(r,r+4096)));return $l(t.join(""))},gn=o((i,e=!1)=>e?Vf(ql(i)):ql(i),"fromUint8Array"),iw=o(i=>{if(i.length<2){var e=i.charCodeAt(0);return e<128?i:e<2048?Qe(192|e>>>6)+Qe(128|e&63):Qe(224|e>>>12&15)+Qe(128|e>>>6&63)+Qe(128|e&63)}else{var e=65536+(i.charCodeAt(0)-55296)*1024+(i.charCodeAt(1)-56320);return Qe(240|e>>>18&7)+Qe(128|e>>>12&63)+Qe(128|e>>>6&63)+Qe(128|e&63)}},"cb_utob"),rw=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Gf=o(i=>i.replace(rw,iw),"utob"),zf=Fr?i=>Buffer.from(i,"utf8").toString("base64"):Bf?i=>ql(Bf.encode(i)):i=>$l(Gf(i)),Er=o((i,e=!1)=>e?Vf(zf(i)):zf(i),"encode"),Hf=o(i=>Er(i,!0),"encodeURI"),sw=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,ow=o(i=>{switch(i.length){case 4:var e=(7&i.charCodeAt(0))<<18|(63&i.charCodeAt(1))<<12|(63&i.charCodeAt(2))<<6|63&i.charCodeAt(3),t=e-65536;return Qe((t>>>10)+55296)+Qe((t&1023)+56320);case 3:return Qe((15&i.charCodeAt(0))<<12|(63&i.charCodeAt(1))<<6|63&i.charCodeAt(2));default:return Qe((31&i.charCodeAt(0))<<6|63&i.charCodeAt(1))}},"cb_btou"),Xf=o(i=>i.replace(sw,ow),"btou"),Kf=o(i=>{if(i=i.replace(/\s+/g,""),!tw.test(i))throw new TypeError("malformed base64.");i+="==".slice(2-(i.length&3));let e,t="",r,s;for(let n=0;n<i.length;)e=mn[i.charAt(n++)]<<18|mn[i.charAt(n++)]<<12|(r=mn[i.charAt(n++)])<<6|(s=mn[i.charAt(n++)]),t+=r===64?Qe(e>>16&255):s===64?Qe(e>>16&255,e>>8&255):Qe(e>>16&255,e>>8&255,e&255);return t},"atobPolyfill"),Wl=typeof atob=="function"?i=>atob($f(i)):Fr?i=>Buffer.from(i,"base64").toString("binary"):Kf,Yf=Fr?i=>jf(Buffer.from(i,"base64")):i=>jf(Wl(i).split("").map(e=>e.charCodeAt(0))),Jf=o(i=>Yf(Qf(i)),"toUint8Array"),nw=Fr?i=>Buffer.from(i,"base64").toString("utf8"):Lf?i=>Lf.decode(Yf(i)):i=>Xf(Wl(i)),Qf=o(i=>$f(i.replace(/[-_]/g,e=>e=="-"?"+":"/")),"_unURI"),Vl=o(i=>nw(Qf(i)),"decode"),aw=o(i=>{if(typeof i!="string")return!1;let e=i.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},"isValid"),Zf=o(i=>({value:i,enumerable:!1,writable:!0,configurable:!0}),"_noEnum"),em=o(function(){let i=o((e,t)=>Object.defineProperty(String.prototype,e,Zf(t)),"_add");i("fromBase64",function(){return Vl(this)}),i("toBase64",function(e){return Er(this,e)}),i("toBase64URI",function(){return Er(this,!0)}),i("toBase64URL",function(){return Er(this,!0)}),i("toUint8Array",function(){return Jf(this)})},"extendString"),tm=o(function(){let i=o((e,t)=>Object.defineProperty(Uint8Array.prototype,e,Zf(t)),"_add");i("toBase64",function(e){return gn(this,e)}),i("toBase64URI",function(){return gn(this,!0)}),i("toBase64URL",function(){return gn(this,!0)})},"extendUint8Array"),lw=o(()=>{em(),tm()},"extendBuiltins"),im={version:qf,VERSION:Z1,atob:Wl,atobPolyfill:Kf,btoa:$l,btoaPolyfill:Wf,fromBase64:Vl,toBase64:Er,encode:Er,encodeURI:Hf,encodeURL:Hf,utob:Gf,btou:Xf,decode:Vl,isValid:aw,fromUint8Array:gn,toUint8Array:Jf,extendString:em,extendUint8Array:tm,extendBuiltins:lw};var Tm=ae(mm());function Yl(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var e=Math.random()*16|0,t=i==="x"?e:e&3|8;return t.toString(16)})}o(Yl,"uuid");function Jl(){"use strict";Jl=o(function(){return e},"_regeneratorRuntime");var i,e={},t=Object.prototype,r=t.hasOwnProperty,s=Object.defineProperty||function(E,w,S){E[w]=S.value},n=typeof Symbol=="function"?Symbol:{},a=n.iterator||"@@iterator",u=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function p(E,w,S){return Object.defineProperty(E,w,{value:S,enumerable:!0,configurable:!0,writable:!0}),E[w]}o(p,"define");try{p({},"")}catch{p=o(function(S,B,q){return S[B]=q},"define")}function f(E,w,S,B){var q=w&&w.prototype instanceof R?w:R,j=Object.create(q.prototype),I=new _e(B||[]);return s(j,"_invoke",{value:ye(E,S,I)}),j}o(f,"wrap");function d(E,w,S){try{return{type:"normal",arg:E.call(w,S)}}catch(B){return{type:"throw",arg:B}}}o(d,"tryCatch"),e.wrap=f;var v="suspendedStart",_="suspendedYield",k="executing",A="completed",F={};function R(){}o(R,"Generator");function U(){}o(U,"GeneratorFunction");function C(){}o(C,"GeneratorFunctionPrototype");var Y={};p(Y,a,function(){return this});var $=Object.getPrototypeOf,H=$&&$($(ve([])));H&&H!==t&&r.call(H,a)&&(Y=H);var Q=C.prototype=R.prototype=Object.create(Y);function X(E){["next","throw","return"].forEach(function(w){p(E,w,function(S){return this._invoke(w,S)})})}o(X,"defineIteratorMethods");function Z(E,w){function S(q,j,I,T){var O=d(E[q],E,j);if(O.type!=="throw"){var L=O.arg,K=L.value;return K&&Mi(K)=="object"&&r.call(K,"__await")?w.resolve(K.__await).then(function(J){S("next",J,I,T)},function(J){S("throw",J,I,T)}):w.resolve(K).then(function(J){L.value=J,I(L)},function(J){return S("throw",J,I,T)})}T(O.arg)}o(S,"invoke");var B;s(this,"_invoke",{value:o(function(j,I){function T(){return new w(function(O,L){S(j,I,O,L)})}return o(T,"callInvokeWithMethodAndArg"),B=B?B.then(T,T):T()},"value")})}o(Z,"AsyncIterator");function ye(E,w,S){var B=v;return function(q,j){if(B===k)throw Error("Generator is already running");if(B===A){if(q==="throw")throw j;return{value:i,done:!0}}for(S.method=q,S.arg=j;;){var I=S.delegate;if(I){var T=se(I,S);if(T){if(T===F)continue;return T}}if(S.method==="next")S.sent=S._sent=S.arg;else if(S.method==="throw"){if(B===v)throw B=A,S.arg;S.dispatchException(S.arg)}else S.method==="return"&&S.abrupt("return",S.arg);B=k;var O=d(E,w,S);if(O.type==="normal"){if(B=S.done?A:_,O.arg===F)continue;return{value:O.arg,done:S.done}}O.type==="throw"&&(B=A,S.method="throw",S.arg=O.arg)}}}o(ye,"makeInvokeMethod");function se(E,w){var S=w.method,B=E.iterator[S];if(B===i)return w.delegate=null,S==="throw"&&E.iterator.return&&(w.method="return",w.arg=i,se(E,w),w.method==="throw")||S!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+S+"' method")),F;var q=d(B,E.iterator,w.arg);if(q.type==="throw")return w.method="throw",w.arg=q.arg,w.delegate=null,F;var j=q.arg;return j?j.done?(w[E.resultName]=j.value,w.next=E.nextLoc,w.method!=="return"&&(w.method="next",w.arg=i),w.delegate=null,F):j:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,F)}o(se,"maybeInvokeDelegate");function we(E){var w={tryLoc:E[0]};1 in E&&(w.catchLoc=E[1]),2 in E&&(w.finallyLoc=E[2],w.afterLoc=E[3]),this.tryEntries.push(w)}o(we,"pushTryEntry");function me(E){var w=E.completion||{};w.type="normal",delete w.arg,E.completion=w}o(me,"resetTryEntry");function _e(E){this.tryEntries=[{tryLoc:"root"}],E.forEach(we,this),this.reset(!0)}o(_e,"Context");function ve(E){if(E||E===""){var w=E[a];if(w)return w.call(E);if(typeof E.next=="function")return E;if(!isNaN(E.length)){var S=-1,B=o(function q(){for(;++S<E.length;)if(r.call(E,S))return q.value=E[S],q.done=!1,q;return q.value=i,q.done=!0,q},"next");return B.next=B}}throw new TypeError(Mi(E)+" is not iterable")}return o(ve,"values"),U.prototype=C,s(Q,"constructor",{value:C,configurable:!0}),s(C,"constructor",{value:U,configurable:!0}),U.displayName=p(C,c,"GeneratorFunction"),e.isGeneratorFunction=function(E){var w=typeof E=="function"&&E.constructor;return!!w&&(w===U||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(E){return Object.setPrototypeOf?Object.setPrototypeOf(E,C):(E.__proto__=C,p(E,c,"GeneratorFunction")),E.prototype=Object.create(Q),E},e.awrap=function(E){return{__await:E}},X(Z.prototype),p(Z.prototype,u,function(){return this}),e.AsyncIterator=Z,e.async=function(E,w,S,B,q){q===void 0&&(q=Promise);var j=new Z(f(E,w,S,B),q);return e.isGeneratorFunction(w)?j:j.next().then(function(I){return I.done?I.value:j.next()})},X(Q),p(Q,c,"Generator"),p(Q,a,function(){return this}),p(Q,"toString",function(){return"[object Generator]"}),e.keys=function(E){var w=Object(E),S=[];for(var B in w)S.push(B);return S.reverse(),o(function q(){for(;S.length;){var j=S.pop();if(j in w)return q.value=j,q.done=!1,q}return q.done=!0,q},"next")},e.values=ve,_e.prototype={constructor:_e,reset:o(function(w){if(this.prev=0,this.next=0,this.sent=this._sent=i,this.done=!1,this.delegate=null,this.method="next",this.arg=i,this.tryEntries.forEach(me),!w)for(var S in this)S.charAt(0)==="t"&&r.call(this,S)&&!isNaN(+S.slice(1))&&(this[S]=i)},"reset"),stop:o(function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},"stop"),dispatchException:o(function(w){if(this.done)throw w;var S=this;function B(L,K){return I.type="throw",I.arg=w,S.next=L,K&&(S.method="next",S.arg=i),!!K}o(B,"handle");for(var q=this.tryEntries.length-1;q>=0;--q){var j=this.tryEntries[q],I=j.completion;if(j.tryLoc==="root")return B("end");if(j.tryLoc<=this.prev){var T=r.call(j,"catchLoc"),O=r.call(j,"finallyLoc");if(T&&O){if(this.prev<j.catchLoc)return B(j.catchLoc,!0);if(this.prev<j.finallyLoc)return B(j.finallyLoc)}else if(T){if(this.prev<j.catchLoc)return B(j.catchLoc,!0)}else{if(!O)throw Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return B(j.finallyLoc)}}}},"dispatchException"),abrupt:o(function(w,S){for(var B=this.tryEntries.length-1;B>=0;--B){var q=this.tryEntries[B];if(q.tryLoc<=this.prev&&r.call(q,"finallyLoc")&&this.prev<q.finallyLoc){var j=q;break}}j&&(w==="break"||w==="continue")&&j.tryLoc<=S&&S<=j.finallyLoc&&(j=null);var I=j?j.completion:{};return I.type=w,I.arg=S,j?(this.method="next",this.next=j.finallyLoc,F):this.complete(I)},"abrupt"),complete:o(function(w,S){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&S&&(this.next=S),F},"complete"),finish:o(function(w){for(var S=this.tryEntries.length-1;S>=0;--S){var B=this.tryEntries[S];if(B.finallyLoc===w)return this.complete(B.completion,B.afterLoc),me(B),F}},"finish"),catch:o(function(w){for(var S=this.tryEntries.length-1;S>=0;--S){var B=this.tryEntries[S];if(B.tryLoc===w){var q=B.completion;if(q.type==="throw"){var j=q.arg;me(B)}return j}}throw Error("illegal catch attempt")},"_catch"),delegateYield:o(function(w,S,B){return this.delegate={iterator:ve(w),resultName:S,nextLoc:B},this.method==="next"&&(this.arg=i),F},"delegateYield")},e}o(Jl,"_regeneratorRuntime");function gm(i,e,t,r,s,n,a){try{var u=i[n](a),c=u.value}catch(p){t(p);return}u.done?e(c):Promise.resolve(c).then(r,s)}o(gm,"asyncGeneratorStep");function ww(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function a(c){gm(n,r,s,a,u,"next",c)}o(a,"_next");function u(c){gm(n,r,s,a,u,"throw",c)}o(u,"_throw"),a(void 0)})}}o(ww,"_asyncToGenerator");function km(i,e){return Pw(i)||xw(i,e)||Em(i,e)||Sw()}o(km,"_slicedToArray");function Sw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}o(Sw,"_nonIterableRest");function xw(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var r,s,n,a,u=[],c=!0,p=!1;try{if(n=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=n.call(t)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(f){p=!0,s=f}finally{try{if(!c&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(p)throw s}}return u}}o(xw,"_iterableToArrayLimit");function Pw(i){if(Array.isArray(i))return i}o(Pw,"_arrayWithHoles");function Mi(i){"@babel/helpers - typeof";return Mi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mi(i)}o(Mi,"_typeof");function _w(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=Em(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var r=0,s=o(function(){},"F");return{s,n:o(function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},"n"),e:o(function(p){throw p},"e"),f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,a=!1,u;return{s:o(function(){t=t.call(i)},"s"),n:o(function(){var p=t.next();return n=p.done,p},"n"),e:o(function(p){a=!0,u=p},"e"),f:o(function(){try{!n&&t.return!=null&&t.return()}finally{if(a)throw u}},"f")}}o(_w,"_createForOfIteratorHelper");function Em(i,e){if(i){if(typeof i=="string")return ym(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ym(i,e)}}o(Em,"_unsupportedIterableToArray");function ym(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}o(ym,"_arrayLikeToArray");function vm(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}o(vm,"ownKeys");function Tr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vm(Object(t),!0).forEach(function(r){kw(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):vm(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}o(Tr,"_objectSpread");function kw(i,e,t){return e=Fm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}o(kw,"_defineProperty");function Ew(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(Ew,"_classCallCheck");function bm(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Fm(r.key),r)}}o(bm,"_defineProperties");function Fw(i,e,t){return e&&bm(i.prototype,e),t&&bm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(Fw,"_createClass");function Fm(i){var e=Tw(i,"string");return Mi(e)=="symbol"?e:e+""}o(Fm,"_toPropertyKey");function Tw(i,e){if(Mi(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Mi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(Tw,"_toPrimitive");var vn="tus-v1",bn="ietf-draft-03",Js="ietf-draft-05",Cw={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:Am,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:vn},Cm=(function(){function i(e,t){Ew(this,i),"resume"in t&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=t,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return o(i,"BaseUpload"),Fw(i,[{key:"findPreviousUploads",value:o(function(){var t=this;return this.options.fingerprint(this.file,this.options).then(function(r){return t._urlStorage.findUploadsByFingerprint(r)})},"findPreviousUploads")},{key:"resumeFromPreviousUpload",value:o(function(t){this.url=t.uploadUrl||null,this._parallelUploadUrls=t.parallelUploadUrls||null,this._urlStorageKey=t.urlStorageKey},"resumeFromPreviousUpload")},{key:"start",value:o(function(){var t=this,r=this.file;if(!r){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![vn,bn,Js].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var s=this.options.retryDelays;if(s!=null&&Object.prototype.toString.call(s)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var n=0,a=["uploadUrl","uploadSize","uploadLengthDeferred"];n<a.length;n++){var u=a[n];if(this.options[u]){this._emitError(new Error("tus: cannot use the ".concat(u," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(r,this.options).then(function(c){return c==null?hi("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):hi("Calculated fingerprint: ".concat(c)),t._fingerprint=c,t._source?t._source:t.options.fileReader.openFile(r,t.options.chunkSize)}).then(function(c){if(t._source=c,t.options.uploadLengthDeferred)t._size=null;else if(t.options.uploadSize!=null){if(t._size=Number(t.options.uploadSize),Number.isNaN(t._size)){t._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(t._size=t._source.size,t._size==null){t._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}t.options.parallelUploads>1||t._parallelUploadUrls!=null?t._startParallelUpload():t._startSingleUpload()}).catch(function(c){t._emitError(c)})},"start")},{key:"_startParallelUpload",value:o(function(){var t,r=this,s=this._size,n=0;this._parallelUploads=[];var a=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,u=(t=this.options.parallelUploadBoundaries)!==null&&t!==void 0?t:Rw(this._source.size,a);this._parallelUploadUrls&&u.forEach(function(f,d){f.uploadUrl=r._parallelUploadUrls[d]||null}),this._parallelUploadUrls=new Array(u.length);var c=u.map(function(f,d){var v=0;return r._source.slice(f.start,f.end).then(function(_){var k=_.value;return new Promise(function(A,F){var R=Tr(Tr({},r.options),{},{uploadUrl:f.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:r.options.metadataForPartialUploads,headers:Tr(Tr({},r.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:A,onError:F,onProgress:o(function(Y){n=n-v+Y,v=Y,r._emitProgress(n,s)},"onProgress"),onUploadUrlAvailable:o(function(){r._parallelUploadUrls[d]=U.url,r._parallelUploadUrls.filter(function(Y){return!!Y}).length===u.length&&r._saveUploadInUrlStorage()},"onUploadUrlAvailable")}),U=new i(k,R);U.start(),r._parallelUploads.push(U)})})}),p;Promise.all(c).then(function(){p=r._openRequest("POST",r.options.endpoint),p.setHeader("Upload-Concat","final;".concat(r._parallelUploadUrls.join(" ")));var f=wm(r.options.metadata);return f!==""&&p.setHeader("Upload-Metadata",f),r._sendRequest(p,null)}).then(function(f){if(!Cr(f.getStatus(),200)){r._emitHttpError(p,f,"tus: unexpected response while creating upload");return}var d=f.getHeader("Location");if(d==null){r._emitHttpError(p,f,"tus: invalid or missing Location header");return}r.url=_m(r.options.endpoint,d),hi("Created upload at ".concat(r.url)),r._emitSuccess(f)}).catch(function(f){r._emitError(f)})},"_startParallelUpload")},{key:"_startSingleUpload",value:o(function(){if(this._aborted=!1,this.url!=null){hi("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){hi("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}hi("Creating a new upload"),this._createUpload()},"_startSingleUpload")},{key:"abort",value:o(function(t){var r=this;if(this._parallelUploads!=null){var s=_w(this._parallelUploads),n;try{for(s.s();!(n=s.n()).done;){var a=n.value;a.abort(t)}}catch(u){s.e(u)}finally{s.f()}}return this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!t||this.url==null?Promise.resolve():i.terminate(this.url,this.options).then(function(){return r._removeFromUrlStorage()})},"abort")},{key:"_emitHttpError",value:o(function(t,r,s,n){this._emitError(new kr(s,n,t,r))},"_emitHttpError")},{key:"_emitError",value:o(function(t){var r=this;if(!this._aborted){if(this.options.retryDelays!=null){var s=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(s&&(this._retryAttempt=0),Pm(t,this._retryAttempt,this.options)){var n=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){r.start()},n);return}}if(typeof this.options.onError=="function")this.options.onError(t);else throw t}},"_emitError")},{key:"_emitSuccess",value:o(function(t){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:t})},"_emitSuccess")},{key:"_emitProgress",value:o(function(t,r){typeof this.options.onProgress=="function"&&this.options.onProgress(t,r)},"_emitProgress")},{key:"_emitChunkComplete",value:o(function(t,r,s){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(t,r,s)},"_emitChunkComplete")},{key:"_createUpload",value:o(function(){var t=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var r=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?r.setHeader("Upload-Defer-Length","1"):r.setHeader("Upload-Length","".concat(this._size));var s=wm(this.options.metadata);s!==""&&r.setHeader("Upload-Metadata",s);var n;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,n=this._addChunkToRequest(r)):((this.options.protocol===bn||this.options.protocol===Js)&&r.setHeader("Upload-Complete","?0"),n=this._sendRequest(r,null)),n.then(function(a){if(!Cr(a.getStatus(),200)){t._emitHttpError(r,a,"tus: unexpected response while creating upload");return}var u=a.getHeader("Location");if(u==null){t._emitHttpError(r,a,"tus: invalid or missing Location header");return}if(t.url=_m(t.options.endpoint,u),hi("Created upload at ".concat(t.url)),typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._size===0){t._emitSuccess(a),t._source.close();return}t._saveUploadInUrlStorage().then(function(){t.options.uploadDataDuringCreation?t._handleUploadResponse(r,a):(t._offset=0,t._performUpload())})}).catch(function(a){t._emitHttpError(r,null,"tus: failed to create upload",a)})},"_createUpload")},{key:"_resumeUpload",value:o(function(){var t=this,r=this._openRequest("HEAD",this.url),s=this._sendRequest(r,null);s.then(function(n){var a=n.getStatus();if(!Cr(a,200)){if(a===423){t._emitHttpError(r,n,"tus: upload is currently locked; retry later");return}if(Cr(a,400)&&t._removeFromUrlStorage(),!t.options.endpoint){t._emitHttpError(r,n,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}t.url=null,t._createUpload();return}var u=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(u)){t._emitHttpError(r,n,"tus: invalid or missing offset value");return}var c=Number.parseInt(n.getHeader("Upload-Length"),10);if(Number.isNaN(c)&&!t.options.uploadLengthDeferred&&t.options.protocol===vn){t._emitHttpError(r,n,"tus: invalid or missing length value");return}typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._saveUploadInUrlStorage().then(function(){if(u===c){t._emitProgress(c,c),t._emitSuccess(n);return}t._offset=u,t._performUpload()})}).catch(function(n){t._emitHttpError(r,null,"tus: failed to resume upload",n)})},"_resumeUpload")},{key:"_performUpload",value:o(function(){var t=this;if(!this._aborted){var r;this.options.overridePatchMethod?(r=this._openRequest("POST",this.url),r.setHeader("X-HTTP-Method-Override","PATCH")):r=this._openRequest("PATCH",this.url),r.setHeader("Upload-Offset","".concat(this._offset));var s=this._addChunkToRequest(r);s.then(function(n){if(!Cr(n.getStatus(),200)){t._emitHttpError(r,n,"tus: unexpected response while uploading chunk");return}t._handleUploadResponse(r,n)}).catch(function(n){t._aborted||t._emitHttpError(r,null,"tus: failed to upload chunk at offset ".concat(t._offset),n)})}},"_performUpload")},{key:"_addChunkToRequest",value:o(function(t){var r=this,s=this._offset,n=this._offset+this.options.chunkSize;return t.setProgressHandler(function(a){r._emitProgress(s+a,r._size)}),this.options.protocol===vn?t.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Js&&t.setHeader("Content-Type","application/partial-upload"),(n===Number.POSITIVE_INFINITY||n>this._size)&&!this.options.uploadLengthDeferred&&(n=this._size),this._source.slice(s,n).then(function(a){var u=a.value,c=a.done,p=u!=null&&u.size?u.size:0;r.options.uploadLengthDeferred&&c&&(r._size=r._offset+p,t.setHeader("Upload-Length","".concat(r._size)));var f=r._offset+p;return!r.options.uploadLengthDeferred&&c&&f!==r._size?Promise.reject(new Error("upload was configured with a size of ".concat(r._size," bytes, but the source is done after ").concat(f," bytes"))):u===null?r._sendRequest(t):((r.options.protocol===bn||r.options.protocol===Js)&&t.setHeader("Upload-Complete",c?"?1":"?0"),r._emitProgress(r._offset,r._size),r._sendRequest(t,u))})},"_addChunkToRequest")},{key:"_handleUploadResponse",value:o(function(t,r){var s=Number.parseInt(r.getHeader("Upload-Offset"),10);if(Number.isNaN(s)){this._emitHttpError(t,r,"tus: invalid or missing offset value");return}if(this._emitProgress(s,this._size),this._emitChunkComplete(s-this._offset,s,this._size),this._offset=s,s===this._size){this._emitSuccess(r),this._source.close();return}this._performUpload()},"_handleUploadResponse")},{key:"_openRequest",value:o(function(t,r){var s=Sm(t,r,this.options);return this._req=s,s},"_openRequest")},{key:"_removeFromUrlStorage",value:o(function(){var t=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(r){t._emitError(r)}),this._urlStorageKey=null)},"_removeFromUrlStorage")},{key:"_saveUploadInUrlStorage",value:o(function(){var t=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var r={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?r.parallelUploadUrls=this._parallelUploadUrls:r.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,r).then(function(s){t._urlStorageKey=s})},"_saveUploadInUrlStorage")},{key:"_sendRequest",value:o(function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return xm(t,r,this.options)},"_sendRequest")}],[{key:"terminate",value:o(function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=Sm("DELETE",t,r);return xm(s,null,r).then(function(n){if(n.getStatus()!==204)throw new kr("tus: unexpected response while terminating upload",null,s,n)}).catch(function(n){if(n instanceof kr||(n=new kr("tus: failed to terminate upload",n,s,null)),!Pm(n,0,r))throw n;var a=r.retryDelays[0],u=r.retryDelays.slice(1),c=Tr(Tr({},r),{},{retryDelays:u});return new Promise(function(p){return setTimeout(p,a)}).then(function(){return i.terminate(t,c)})})},"terminate")}])})();function wm(i){return Object.entries(i).map(function(e){var t=km(e,2),r=t[0],s=t[1];return"".concat(r," ").concat(im.encode(String(s)))}).join(",")}o(wm,"encodeMetadata");function Cr(i,e){return i>=e&&i<e+100}o(Cr,"inStatusCategory");function Sm(i,e,t){var r=t.httpStack.createRequest(i,e);t.protocol===bn?r.setHeader("Upload-Draft-Interop-Version","5"):t.protocol===Js?r.setHeader("Upload-Draft-Interop-Version","6"):r.setHeader("Tus-Resumable","1.0.0");for(var s=t.headers||{},n=0,a=Object.entries(s);n<a.length;n++){var u=km(a[n],2),c=u[0],p=u[1];r.setHeader(c,p)}if(t.addRequestId){var f=Yl();r.setHeader("X-Request-ID",f)}return r}o(Sm,"openRequest");function xm(i,e,t){return Ql.apply(this,arguments)}o(xm,"sendRequest");function Ql(){return Ql=ww(Jl().mark(o(function i(e,t,r){var s;return Jl().wrap(o(function(a){for(;;)switch(a.prev=a.next){case 0:if(typeof r.onBeforeRequest!="function"){a.next=3;break}return a.next=3,r.onBeforeRequest(e);case 3:return a.next=5,e.send(t);case 5:if(s=a.sent,typeof r.onAfterResponse!="function"){a.next=9;break}return a.next=9,r.onAfterResponse(e,s);case 9:return a.abrupt("return",s);case 10:case"end":return a.stop()}},"_callee$"),i)},"_callee"))),Ql.apply(this,arguments)}o(Ql,"_sendRequest2");function Aw(){var i=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(i=!1),i}o(Aw,"isOnline");function Pm(i,e,t){return t.retryDelays==null||e>=t.retryDelays.length||i.originalRequest==null?!1:t&&typeof t.onShouldRetry=="function"?t.onShouldRetry(i,e,t):Am(i)}o(Pm,"shouldRetry");function Am(i){var e=i.originalResponse?i.originalResponse.getStatus():0;return(!Cr(e,400)||e===409||e===423)&&Aw()}o(Am,"defaultOnShouldRetry");function _m(i,e){return new Tm.default(e,i).toString()}o(_m,"resolveUrl");function Rw(i,e){for(var t=Math.floor(i/e),r=[],s=0;s<e;s++)r.push({start:t*s,end:t*(s+1)});return r[e-1].end=i,r}o(Rw,"splitSizeIntoParts");Cm.defaultOptions=Cw;var wn=Cm;var Uw=o(function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"},"isReactNative"),Sn=Uw;function Zl(i){return new Promise(function(e,t){var r=new XMLHttpRequest;r.responseType="blob",r.onload=function(){var s=r.response;e(s)},r.onerror=function(s){t(s)},r.open("GET",i),r.send()})}o(Zl,"uriToBlob");var Ow=o(function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")},"isCordova"),Rm=Ow;function eu(i){return new Promise(function(e,t){var r=new FileReader;r.onload=function(){var s=new Uint8Array(r.result);e({value:s})},r.onerror=function(s){t(s)},r.readAsArrayBuffer(i)})}o(eu,"readAsByteArray");function Qs(i){"@babel/helpers - typeof";return Qs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qs(i)}o(Qs,"_typeof");function Dw(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(Dw,"_classCallCheck");function Um(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Nw(r.key),r)}}o(Um,"_defineProperties");function Iw(i,e,t){return e&&Um(i.prototype,e),t&&Um(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(Iw,"_createClass");function Nw(i){var e=Mw(i,"string");return Qs(e)=="symbol"?e:e+""}o(Nw,"_toPropertyKey");function Mw(i,e){if(Qs(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Qs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(Mw,"_toPrimitive");var tu=(function(){function i(e){Dw(this,i),this._file=e,this.size=e.size}return o(i,"FileSource"),Iw(i,[{key:"slice",value:o(function(t,r){if(Rm())return eu(this._file.slice(t,r));var s=this._file.slice(t,r),n=r>=this.size;return Promise.resolve({value:s,done:n})},"slice")},{key:"close",value:o(function(){},"close")}])})();function Zs(i){"@babel/helpers - typeof";return Zs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zs(i)}o(Zs,"_typeof");function Lw(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(Lw,"_classCallCheck");function Om(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,jw(r.key),r)}}o(Om,"_defineProperties");function Bw(i,e,t){return e&&Om(i.prototype,e),t&&Om(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(Bw,"_createClass");function jw(i){var e=zw(i,"string");return Zs(e)=="symbol"?e:e+""}o(jw,"_toPropertyKey");function zw(i,e){if(Zs(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Zs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(zw,"_toPrimitive");function Dm(i){return i===void 0?0:i.size!==void 0?i.size:i.length}o(Dm,"len");function Hw(i,e){if(i.concat)return i.concat(e);if(i instanceof Blob)return new Blob([i,e],{type:i.type});if(i.set){var t=new i.constructor(i.length+e.length);return t.set(i),t.set(e,i.length),t}throw new Error("Unknown data type")}o(Hw,"concat");var Im=(function(){function i(e){Lw(this,i),this._buffer=void 0,this._bufferOffset=0,this._reader=e,this._done=!1}return o(i,"StreamSource"),Bw(i,[{key:"slice",value:o(function(t,r){return t<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(t,r)},"slice")},{key:"_readUntilEnoughDataOrDone",value:o(function(t,r){var s=this,n=r<=this._bufferOffset+Dm(this._buffer);if(this._done||n){var a=this._getDataFromBuffer(t,r),u=a==null?this._done:!1;return Promise.resolve({value:a,done:u})}return this._reader.read().then(function(c){var p=c.value,f=c.done;return f?s._done=!0:s._buffer===void 0?s._buffer=p:s._buffer=Hw(s._buffer,p),s._readUntilEnoughDataOrDone(t,r)})},"_readUntilEnoughDataOrDone")},{key:"_getDataFromBuffer",value:o(function(t,r){t>this._bufferOffset&&(this._buffer=this._buffer.slice(t-this._bufferOffset),this._bufferOffset=t);var s=Dm(this._buffer)===0;return this._done&&s?null:this._buffer.slice(0,r-t)},"_getDataFromBuffer")},{key:"close",value:o(function(){this._reader.cancel&&this._reader.cancel()},"close")}])})();function Li(i){"@babel/helpers - typeof";return Li=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Li(i)}o(Li,"_typeof");function iu(){"use strict";iu=o(function(){return e},"_regeneratorRuntime");var i,e={},t=Object.prototype,r=t.hasOwnProperty,s=Object.defineProperty||function(E,w,S){E[w]=S.value},n=typeof Symbol=="function"?Symbol:{},a=n.iterator||"@@iterator",u=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function p(E,w,S){return Object.defineProperty(E,w,{value:S,enumerable:!0,configurable:!0,writable:!0}),E[w]}o(p,"define");try{p({},"")}catch{p=o(function(S,B,q){return S[B]=q},"define")}function f(E,w,S,B){var q=w&&w.prototype instanceof R?w:R,j=Object.create(q.prototype),I=new _e(B||[]);return s(j,"_invoke",{value:ye(E,S,I)}),j}o(f,"wrap");function d(E,w,S){try{return{type:"normal",arg:E.call(w,S)}}catch(B){return{type:"throw",arg:B}}}o(d,"tryCatch"),e.wrap=f;var v="suspendedStart",_="suspendedYield",k="executing",A="completed",F={};function R(){}o(R,"Generator");function U(){}o(U,"GeneratorFunction");function C(){}o(C,"GeneratorFunctionPrototype");var Y={};p(Y,a,function(){return this});var $=Object.getPrototypeOf,H=$&&$($(ve([])));H&&H!==t&&r.call(H,a)&&(Y=H);var Q=C.prototype=R.prototype=Object.create(Y);function X(E){["next","throw","return"].forEach(function(w){p(E,w,function(S){return this._invoke(w,S)})})}o(X,"defineIteratorMethods");function Z(E,w){function S(q,j,I,T){var O=d(E[q],E,j);if(O.type!=="throw"){var L=O.arg,K=L.value;return K&&Li(K)=="object"&&r.call(K,"__await")?w.resolve(K.__await).then(function(J){S("next",J,I,T)},function(J){S("throw",J,I,T)}):w.resolve(K).then(function(J){L.value=J,I(L)},function(J){return S("throw",J,I,T)})}T(O.arg)}o(S,"invoke");var B;s(this,"_invoke",{value:o(function(j,I){function T(){return new w(function(O,L){S(j,I,O,L)})}return o(T,"callInvokeWithMethodAndArg"),B=B?B.then(T,T):T()},"value")})}o(Z,"AsyncIterator");function ye(E,w,S){var B=v;return function(q,j){if(B===k)throw Error("Generator is already running");if(B===A){if(q==="throw")throw j;return{value:i,done:!0}}for(S.method=q,S.arg=j;;){var I=S.delegate;if(I){var T=se(I,S);if(T){if(T===F)continue;return T}}if(S.method==="next")S.sent=S._sent=S.arg;else if(S.method==="throw"){if(B===v)throw B=A,S.arg;S.dispatchException(S.arg)}else S.method==="return"&&S.abrupt("return",S.arg);B=k;var O=d(E,w,S);if(O.type==="normal"){if(B=S.done?A:_,O.arg===F)continue;return{value:O.arg,done:S.done}}O.type==="throw"&&(B=A,S.method="throw",S.arg=O.arg)}}}o(ye,"makeInvokeMethod");function se(E,w){var S=w.method,B=E.iterator[S];if(B===i)return w.delegate=null,S==="throw"&&E.iterator.return&&(w.method="return",w.arg=i,se(E,w),w.method==="throw")||S!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+S+"' method")),F;var q=d(B,E.iterator,w.arg);if(q.type==="throw")return w.method="throw",w.arg=q.arg,w.delegate=null,F;var j=q.arg;return j?j.done?(w[E.resultName]=j.value,w.next=E.nextLoc,w.method!=="return"&&(w.method="next",w.arg=i),w.delegate=null,F):j:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,F)}o(se,"maybeInvokeDelegate");function we(E){var w={tryLoc:E[0]};1 in E&&(w.catchLoc=E[1]),2 in E&&(w.finallyLoc=E[2],w.afterLoc=E[3]),this.tryEntries.push(w)}o(we,"pushTryEntry");function me(E){var w=E.completion||{};w.type="normal",delete w.arg,E.completion=w}o(me,"resetTryEntry");function _e(E){this.tryEntries=[{tryLoc:"root"}],E.forEach(we,this),this.reset(!0)}o(_e,"Context");function ve(E){if(E||E===""){var w=E[a];if(w)return w.call(E);if(typeof E.next=="function")return E;if(!isNaN(E.length)){var S=-1,B=o(function q(){for(;++S<E.length;)if(r.call(E,S))return q.value=E[S],q.done=!1,q;return q.value=i,q.done=!0,q},"next");return B.next=B}}throw new TypeError(Li(E)+" is not iterable")}return o(ve,"values"),U.prototype=C,s(Q,"constructor",{value:C,configurable:!0}),s(C,"constructor",{value:U,configurable:!0}),U.displayName=p(C,c,"GeneratorFunction"),e.isGeneratorFunction=function(E){var w=typeof E=="function"&&E.constructor;return!!w&&(w===U||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(E){return Object.setPrototypeOf?Object.setPrototypeOf(E,C):(E.__proto__=C,p(E,c,"GeneratorFunction")),E.prototype=Object.create(Q),E},e.awrap=function(E){return{__await:E}},X(Z.prototype),p(Z.prototype,u,function(){return this}),e.AsyncIterator=Z,e.async=function(E,w,S,B,q){q===void 0&&(q=Promise);var j=new Z(f(E,w,S,B),q);return e.isGeneratorFunction(w)?j:j.next().then(function(I){return I.done?I.value:j.next()})},X(Q),p(Q,c,"Generator"),p(Q,a,function(){return this}),p(Q,"toString",function(){return"[object Generator]"}),e.keys=function(E){var w=Object(E),S=[];for(var B in w)S.push(B);return S.reverse(),o(function q(){for(;S.length;){var j=S.pop();if(j in w)return q.value=j,q.done=!1,q}return q.done=!0,q},"next")},e.values=ve,_e.prototype={constructor:_e,reset:o(function(w){if(this.prev=0,this.next=0,this.sent=this._sent=i,this.done=!1,this.delegate=null,this.method="next",this.arg=i,this.tryEntries.forEach(me),!w)for(var S in this)S.charAt(0)==="t"&&r.call(this,S)&&!isNaN(+S.slice(1))&&(this[S]=i)},"reset"),stop:o(function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},"stop"),dispatchException:o(function(w){if(this.done)throw w;var S=this;function B(L,K){return I.type="throw",I.arg=w,S.next=L,K&&(S.method="next",S.arg=i),!!K}o(B,"handle");for(var q=this.tryEntries.length-1;q>=0;--q){var j=this.tryEntries[q],I=j.completion;if(j.tryLoc==="root")return B("end");if(j.tryLoc<=this.prev){var T=r.call(j,"catchLoc"),O=r.call(j,"finallyLoc");if(T&&O){if(this.prev<j.catchLoc)return B(j.catchLoc,!0);if(this.prev<j.finallyLoc)return B(j.finallyLoc)}else if(T){if(this.prev<j.catchLoc)return B(j.catchLoc,!0)}else{if(!O)throw Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return B(j.finallyLoc)}}}},"dispatchException"),abrupt:o(function(w,S){for(var B=this.tryEntries.length-1;B>=0;--B){var q=this.tryEntries[B];if(q.tryLoc<=this.prev&&r.call(q,"finallyLoc")&&this.prev<q.finallyLoc){var j=q;break}}j&&(w==="break"||w==="continue")&&j.tryLoc<=S&&S<=j.finallyLoc&&(j=null);var I=j?j.completion:{};return I.type=w,I.arg=S,j?(this.method="next",this.next=j.finallyLoc,F):this.complete(I)},"abrupt"),complete:o(function(w,S){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&S&&(this.next=S),F},"complete"),finish:o(function(w){for(var S=this.tryEntries.length-1;S>=0;--S){var B=this.tryEntries[S];if(B.finallyLoc===w)return this.complete(B.completion,B.afterLoc),me(B),F}},"finish"),catch:o(function(w){for(var S=this.tryEntries.length-1;S>=0;--S){var B=this.tryEntries[S];if(B.tryLoc===w){var q=B.completion;if(q.type==="throw"){var j=q.arg;me(B)}return j}}throw Error("illegal catch attempt")},"_catch"),delegateYield:o(function(w,S,B){return this.delegate={iterator:ve(w),resultName:S,nextLoc:B},this.method==="next"&&(this.arg=i),F},"delegateYield")},e}o(iu,"_regeneratorRuntime");function Nm(i,e,t,r,s,n,a){try{var u=i[n](a),c=u.value}catch(p){t(p);return}u.done?e(c):Promise.resolve(c).then(r,s)}o(Nm,"asyncGeneratorStep");function qw(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function a(c){Nm(n,r,s,a,u,"next",c)}o(a,"_next");function u(c){Nm(n,r,s,a,u,"throw",c)}o(u,"_throw"),a(void 0)})}}o(qw,"_asyncToGenerator");function Vw(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(Vw,"_classCallCheck");function Mm(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Ww(r.key),r)}}o(Mm,"_defineProperties");function $w(i,e,t){return e&&Mm(i.prototype,e),t&&Mm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o($w,"_createClass");function Ww(i){var e=Gw(i,"string");return Li(e)=="symbol"?e:e+""}o(Ww,"_toPropertyKey");function Gw(i,e){if(Li(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Li(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(Gw,"_toPrimitive");var Lm=(function(){function i(){Vw(this,i)}return o(i,"FileReader"),$w(i,[{key:"openFile",value:(function(){var e=qw(iu().mark(o(function r(s,n){var a;return iu().wrap(o(function(c){for(;;)switch(c.prev=c.next){case 0:if(!(Sn()&&s&&typeof s.uri<"u")){c.next=11;break}return c.prev=1,c.next=4,Zl(s.uri);case 4:return a=c.sent,c.abrupt("return",new tu(a));case 8:throw c.prev=8,c.t0=c.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(c.t0));case 11:if(!(typeof s.slice=="function"&&typeof s.size<"u")){c.next=13;break}return c.abrupt("return",Promise.resolve(new tu(s)));case 13:if(typeof s.read!="function"){c.next=18;break}if(n=Number(n),Number.isFinite(n)){c.next=17;break}return c.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return c.abrupt("return",Promise.resolve(new Im(s,n)));case 18:return c.abrupt("return",Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));case 19:case"end":return c.stop()}},"_callee$"),r,null,[[1,8]])},"_callee")));function t(r,s){return e.apply(this,arguments)}return o(t,"openFile"),t})()}])})();function ru(i,e){return Sn()?Promise.resolve(Xw(i,e)):Promise.resolve(["tus-br",i.name,i.type,i.size,i.lastModified,e.endpoint].join("-"))}o(ru,"fingerprint");function Xw(i,e){var t=i.exif?Kw(JSON.stringify(i.exif)):"noexif";return["tus-rn",i.name||"noname",i.size||"nosize",t,e.endpoint].join("/")}o(Xw,"reactNativeFingerprint");function Kw(i){var e=0;if(i.length===0)return e;for(var t=0;t<i.length;t++){var r=i.charCodeAt(t);e=(e<<5)-e+r,e&=e}return e}o(Kw,"hashCode");function eo(i){"@babel/helpers - typeof";return eo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eo(i)}o(eo,"_typeof");function su(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(su,"_classCallCheck");function Bm(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Yw(r.key),r)}}o(Bm,"_defineProperties");function ou(i,e,t){return e&&Bm(i.prototype,e),t&&Bm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(ou,"_createClass");function Yw(i){var e=Jw(i,"string");return eo(e)=="symbol"?e:e+""}o(Yw,"_toPropertyKey");function Jw(i,e){if(eo(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(eo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(Jw,"_toPrimitive");var jm=(function(){function i(){su(this,i)}return o(i,"XHRHttpStack"),ou(i,[{key:"createRequest",value:o(function(t,r){return new Qw(t,r)},"createRequest")},{key:"getName",value:o(function(){return"XHRHttpStack"},"getName")}])})();var Qw=(function(){function i(e,t){su(this,i),this._xhr=new XMLHttpRequest,this._xhr.open(e,t,!0),this._method=e,this._url=t,this._headers={}}return o(i,"Request"),ou(i,[{key:"getMethod",value:o(function(){return this._method},"getMethod")},{key:"getURL",value:o(function(){return this._url},"getURL")},{key:"setHeader",value:o(function(t,r){this._xhr.setRequestHeader(t,r),this._headers[t]=r},"setHeader")},{key:"getHeader",value:o(function(t){return this._headers[t]},"getHeader")},{key:"setProgressHandler",value:o(function(t){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(r){r.lengthComputable&&t(r.loaded)})},"setProgressHandler")},{key:"send",value:o(function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(s,n){t._xhr.onload=function(){s(new Zw(t._xhr))},t._xhr.onerror=function(a){n(a)},t._xhr.send(r)})},"send")},{key:"abort",value:o(function(){return this._xhr.abort(),Promise.resolve()},"abort")},{key:"getUnderlyingObject",value:o(function(){return this._xhr},"getUnderlyingObject")}])})(),Zw=(function(){function i(e){su(this,i),this._xhr=e}return o(i,"Response"),ou(i,[{key:"getStatus",value:o(function(){return this._xhr.status},"getStatus")},{key:"getHeader",value:o(function(t){return this._xhr.getResponseHeader(t)},"getHeader")},{key:"getBody",value:o(function(){return this._xhr.responseText},"getBody")},{key:"getUnderlyingObject",value:o(function(){return this._xhr},"getUnderlyingObject")}])})();function to(i){"@babel/helpers - typeof";return to=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},to(i)}o(to,"_typeof");function e2(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(e2,"_classCallCheck");function zm(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,i2(r.key),r)}}o(zm,"_defineProperties");function t2(i,e,t){return e&&zm(i.prototype,e),t&&zm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(t2,"_createClass");function i2(i){var e=r2(i,"string");return to(e)=="symbol"?e:e+""}o(i2,"_toPropertyKey");function r2(i,e){if(to(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(to(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(r2,"_toPrimitive");var au=!1;try{au="localStorage"in window,xn="tusSupport",nu=localStorage.getItem(xn),localStorage.setItem(xn,nu),nu===null&&localStorage.removeItem(xn)}catch(i){if(i.code===i.SECURITY_ERR||i.code===i.QUOTA_EXCEEDED_ERR)au=!1;else throw i}var xn,nu,Hm=au,qm=(function(){function i(){e2(this,i)}return o(i,"WebStorageUrlStorage"),t2(i,[{key:"findAllUploads",value:o(function(){var t=this._findEntries("tus::");return Promise.resolve(t)},"findAllUploads")},{key:"findUploadsByFingerprint",value:o(function(t){var r=this._findEntries("tus::".concat(t,"::"));return Promise.resolve(r)},"findUploadsByFingerprint")},{key:"removeUpload",value:o(function(t){return localStorage.removeItem(t),Promise.resolve()},"removeUpload")},{key:"addUpload",value:o(function(t,r){var s=Math.round(Math.random()*1e12),n="tus::".concat(t,"::").concat(s);return localStorage.setItem(n,JSON.stringify(r)),Promise.resolve(n)},"addUpload")},{key:"_findEntries",value:o(function(t){for(var r=[],s=0;s<localStorage.length;s++){var n=localStorage.key(s);if(n.indexOf(t)===0)try{var a=JSON.parse(localStorage.getItem(n));a.urlStorageKey=n,r.push(a)}catch{}}return r},"_findEntries")}])})();function Rr(i){"@babel/helpers - typeof";return Rr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rr(i)}o(Rr,"_typeof");function s2(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}o(s2,"_classCallCheck");function Vm(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,Gm(r.key),r)}}o(Vm,"_defineProperties");function o2(i,e,t){return e&&Vm(i.prototype,e),t&&Vm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}o(o2,"_createClass");function n2(i,e,t){return e=Pn(e),a2(i,Wm()?Reflect.construct(e,t||[],Pn(i).constructor):e.apply(i,t))}o(n2,"_callSuper");function a2(i,e){if(e&&(Rr(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return l2(i)}o(a2,"_possibleConstructorReturn");function l2(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}o(l2,"_assertThisInitialized");function Wm(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Wm=o(function(){return!!i},"_isNativeReflectConstruct"))()}o(Wm,"_isNativeReflectConstruct");function Pn(i){return Pn=Object.setPrototypeOf?Object.getPrototypeOf.bind():o(function(t){return t.__proto__||Object.getPrototypeOf(t)},"_getPrototypeOf"),Pn(i)}o(Pn,"_getPrototypeOf");function u2(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&lu(i,e)}o(u2,"_inherits");function lu(i,e){return lu=Object.setPrototypeOf?Object.setPrototypeOf.bind():o(function(r,s){return r.__proto__=s,r},"_setPrototypeOf"),lu(i,e)}o(lu,"_setPrototypeOf");function $m(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}o($m,"ownKeys");function Ar(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$m(Object(t),!0).forEach(function(r){c2(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):$m(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}o(Ar,"_objectSpread");function c2(i,e,t){return e=Gm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}o(c2,"_defineProperty");function Gm(i){var e=p2(i,"string");return Rr(e)=="symbol"?e:e+""}o(Gm,"_toPropertyKey");function p2(i,e){if(Rr(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e||"default");if(Rr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}o(p2,"_toPrimitive");var _n=Ar(Ar({},wn.defaultOptions),{},{httpStack:new jm,fileReader:new Lm,urlStorage:Hm?new qm:new Mf,fingerprint:ru}),Xm=(function(i){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s2(this,e),r=Ar(Ar({},_n),r),n2(this,e,[t,r])}return o(e,"Upload"),u2(e,i),o2(e,null,[{key:"terminate",value:o(function(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s=Ar(Ar({},_n),s),wn.terminate(r,s)},"terminate")}])})(wn),yD=typeof XMLHttpRequest=="function"&&typeof Blob=="function"&&typeof Blob.prototype.slice=="function";var Ym={name:"@uppy/tus",description:"Resumable uploads for Uppy using Tus.io",version:"5.1.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","upload","resumable","tus"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/utils":"workspace:^","tus-js-client":"^4.2.3"},devDependencies:{"@uppy/core":"workspace:^",jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};function h2(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")}o(h2,"isCordova");function f2(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"}o(f2,"isReactNative");function uu(i){return(e,t)=>{if(h2()||f2())return _n.fingerprint(e,t);let r=["tus",i.id,t.endpoint].join("-");return Promise.resolve(r)}}o(uu,"getFingerprint");var Jm={endpoint:"",uploadUrl:null,metadata:{},uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,overridePatchMethod:!1,headers:{},addRequestId:!1,chunkSize:1/0,retryDelays:[100,1e3,3e3,5e3],parallelUploads:1,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1},m2={limit:20,retryDelays:Jm.retryDelays,withCredentials:!1,allowedMetaFields:!0},fi=class extends xe{static{o(this,"Tus")}static VERSION=Ym.version;#e;requests;uploaders;uploaderEvents;constructor(e,t){if(super(e,{...m2,...t}),this.type="uploader",this.id=this.opts.id||"Tus",t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");if("autoRetry"in t)throw new Error("The `autoRetry` option was deprecated and has been removed.");this.requests=this.opts.rateLimitedQueue??new ft(this.opts.limit),this.#e=this.opts.retryDelays?.values(),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null)}resetUploaderReferences(e,t){let r=this.uploaders[e];r&&(r.abort(),t?.abort&&r.abort(!0),this.uploaders[e]=null),this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null)}async#t(e){return this.resetUploaderReferences(e.id),new Promise((t,r)=>{let s,n,a,u={...this.opts,...e.tus||{}};typeof u.headers=="function"&&(u.headers=u.headers(e));let{onShouldRetry:c,onBeforeRequest:p,...f}=u,d={...Jm,...f};d.fingerprint=uu(e),d.onBeforeRequest=async R=>{let U=R.getUnderlyingObject();U.withCredentials=!!u.withCredentials;let C;if(typeof p=="function"&&(C=p(R,e)),ut(s,"shouldBeRequeued")){if(!s.shouldBeRequeued)return Promise.reject();let Y,$=new Promise(H=>{Y=H});s=this.requests.run(()=>(e.isPaused&&s.abort(),Y(),()=>{})),await Promise.all([$,C]);return}return C},d.onError=R=>{this.uppy.log(R);let U=R.originalRequest!=null?R.originalRequest.getUnderlyingObject():null;Gr(U)&&(R=new St(R,U)),this.resetUploaderReferences(e.id),s?.abort(),typeof u.onError=="function"&&u.onError(R),r(R)},d.onProgress=(R,U)=>{this.onReceiveUploadUrl(e,a.url),typeof u.onProgress=="function"&&u.onProgress(R,U);let C=this.uppy.getFile(e.id);this.uppy.emit("upload-progress",C,{uploadStarted:C.progress.uploadStarted??0,bytesUploaded:R,bytesTotal:U})},d.onSuccess=R=>{let U={uploadURL:a.url??void 0,status:200,body:{xhr:R.lastResponse.getUnderlyingObject()}};this.uppy.emit("upload-success",this.uppy.getFile(e.id),U),this.resetUploaderReferences(e.id),s.done(),a.url&&this.uppy.log(`Download ${a.url}`),typeof u.onSuccess=="function"&&u.onSuccess(R),t(a)};let v=o(R=>{let U=R?.originalResponse?.getStatus();if(U===429){if(!this.requests.isPaused){let C=this.#e?.next();if(C==null||C.done)return!1;this.requests.rateLimit(C.value)}}else{if(U!=null&&U>=400&&U<500&&U!==409&&U!==423)return!1;typeof navigator<"u"&&navigator.onLine===!1&&(this.requests.isPaused||(this.requests.pause(),window.addEventListener("online",()=>{this.requests.resume()},{once:!0})))}return s.abort(),s={shouldBeRequeued:!0,abort(){this.shouldBeRequeued=!1},done(){throw new Error("Cannot mark a queued request as done: this indicates a bug")},fn(){throw new Error("Cannot run a queued request: this indicates a bug")}},!0},"defaultOnShouldRetry");c!=null?d.onShouldRetry=(R,U)=>c(R,U,u,v):d.onShouldRetry=v;let _=o((R,U,C)=>{ut(R,U)&&!ut(R,C)&&(R[C]=R[U])},"copyProp"),k={};if(At(u.allowedMetaFields,e.meta).forEach(R=>{k[R]=String(e.meta[R])}),_(k,"type","filetype"),_(k,"name","filename"),d.metadata=k,e.data==null)throw new Error("File data is empty");a=new Xm(e.data,d),this.uploaders[e.id]=a;let F=new Ot(this.uppy);this.uploaderEvents[e.id]=F,n=o(()=>(e.isPaused||a.start(),()=>{}),"qRequest"),a.findPreviousUploads().then(R=>{let U=R[0];U&&(this.uppy.log(`[Tus] Resuming upload of ${e.id} started at ${U.creationTime}`),a.resumeFromPreviousUpload(U)),s=this.requests.run(n)}),F.onFileRemove(e.id,R=>{s.abort(),this.resetUploaderReferences(e.id,{abort:!!a.url}),t(`upload ${R} was removed`)}),F.onPause(e.id,R=>{s.abort(),R?a.abort():s=this.requests.run(n)}),F.onPauseAll(e.id,()=>{s.abort(),a.abort()}),F.onCancelAll(e.id,()=>{s.abort(),this.resetUploaderReferences(e.id,{abort:!!a.url}),t(`upload ${e.id} was canceled`)}),F.onResumeAll(e.id,()=>{s.abort(),e.error&&a.abort(),s=this.requests.run(n)})}).catch(t=>{throw this.uppy.emit("upload-error",e,t),t})}onReceiveUploadUrl(e,t){let r=this.uppy.getFile(e.id);r&&(!r.tus||r.tus.uploadUrl!==t)&&(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(r.id,{tus:{...r.tus,uploadUrl:t}}))}#r(e){let t={...this.opts};return e.tus&&Object.assign(t,e.tus),typeof t.headers=="function"&&(t.headers=t.headers(e)),{..."remote"in e&&e.remote.body,endpoint:t.endpoint,uploadUrl:t.uploadUrl,protocol:"tus",size:e.data.size,headers:t.headers,metadata:e.meta}}async#i(e){let t=Pi(e),r=_i(t);this.uppy.emit("upload-start",r),await Promise.allSettled(t.map(s=>{if(s.isRemote){let n=o(()=>this.requests,"getQueue"),a=new AbortController,u=o(p=>{p.id===s.id&&a.abort()},"removedHandler");this.uppy.on("file-removed",u);let c=this.uppy.getRequestClientForFile(s).uploadRemoteFile(s,this.#r(s),{signal:a.signal,getQueue:n});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",u)},{priority:-1})(),c}return this.#t(s)}))}#s=o(async e=>{if(e.length===0){this.uppy.log("[Tus] No files to upload");return}this.opts.limit===0&&this.uppy.log("[Tus] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/tus/#limit-0","warning"),this.uppy.log("[Tus] Uploading...");let t=this.uppy.getFilesByIds(e);await this.#i(t)},"#handleUpload");install(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!0}}),this.uppy.addUploader(this.#s)}uninstall(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!1}}),this.uppy.removeUploader(this.#s)}};var Qm={name:"@uppy/transloadit",description:"The Transloadit plugin can be used to upload files to Transloadit for all kinds of processing, such as transcoding video, resizing images, zipping/unzipping, and more",version:"5.4.0",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","transloadit","file encoding","encoding","file processing","video encoding","crop","resize","watermark","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/tus":"workspace:^","@uppy/utils":"workspace:^","component-emitter":"^2.0.0",transloadit:"^4.0.2"},peerDependencies:{"@uppy/core":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",jsdom:"^26.1.0",msw:"^2.10.4",typescript:"^5.8.3",vitest:"^3.2.4","whatwg-fetch":"^3.6.2"}};var eg=ae(pu(),1);var v2="ASSEMBLY_UPLOADING",du="ASSEMBLY_EXECUTING",hu="ASSEMBLY_COMPLETED",Zm=[v2,du,hu];function kn(i,e){return typeof i!="string"?!1:Zm.indexOf(i)>=Zm.indexOf(e)}o(kn,"isStatus");var fu=class extends eg.default{static{o(this,"TransloaditAssembly")}#e;#t;#r=!1;#i=null;#s;pollInterval;closed;constructor(e,t){super(),this.#s=e,this.pollInterval=null,this.closed=!1,this.#e=t,this.#t=t.wrapPromiseFunction(Zt)}connect(){this.#o(),this.#a()}#l(){this.emit("finished"),this.close()}get status(){return this.#s}set status(e){this.#s=e,this.emit("status",e)}#o(){this.#i=new EventSource(`${this.status.websocket_url}?assembly=${this.status.assembly_id}`),this.#i.addEventListener("open",()=>{clearInterval(this.pollInterval),this.pollInterval=null}),this.#i.addEventListener("message",e=>{e.data==="assembly_finished"&&this.#l(),e.data==="assembly_uploading_finished"&&this.emit("executing"),e.data==="assembly_upload_meta_data_extracted"&&(this.emit("metadata"),this.#c({diff:!1}))}),this.#i.addEventListener("assembly_upload_finished",e=>{let t=JSON.parse(e.data);this.status={...this.status,uploads:[...this.status.uploads??[],t]},this.emit("upload",t)}),this.#i.addEventListener("assembly_result_finished",e=>{let[t,r]=JSON.parse(e.data);this.status={...this.status,results:{...this.status.results,[t]:[...this.status.results?.[t]??[],r]}},this.emit("result",t,r)}),this.#i.addEventListener("assembly_execution_progress",e=>{let t=JSON.parse(e.data);this.emit("execution-progress",t)}),this.#i.addEventListener("assembly_error",e=>{try{this.#n(JSON.parse(e.data))}catch{this.#n(new Error(e.data))}this.#c({diff:!1})})}#n(e){this.emit("error",Object.assign(new Error(e.message),e)),this.close()}#a(){this.pollInterval=setInterval(()=>{this.#c()},2e3)}async#c({diff:e=!0}={}){if(!(this.closed||this.#e.isPaused||this.#r))try{this.#r=!0;let t=Bi(this.status),r=await this.#t(t);if(this.#r=!1,this.closed)return;if(r.status===429){this.#e.rateLimit(2e3);return}if(!r.ok){this.#n(new St(r.statusText));return}let s=await r.json();if(this.closed)return;e?this.updateStatus(s):this.status=s}catch(t){this.#n(t)}}update(){return this.#c({diff:!0})}updateStatus(e){this.#u(this.status,e),this.status=e}#u(e,t){let r=e.ok,s=t.ok;if(t.error&&!e.error)return this.#n(t);let n=kn(s,du)&&!kn(r,du);n&&this.emit("executing");let a=e.uploads,u=t.uploads;u!=null&&a!=null&&Object.keys(u).filter(f=>!ut(a,f)).forEach(f=>{this.emit("upload",u[f])}),n&&this.emit("metadata");let c=t.results,p=e.results;c!=null&&p!=null&&Object.keys(c).forEach(f=>{let d=c[f]??[],v=p[f]??[];d.filter(_=>!v||!v.some(k=>k.id===_.id)).forEach(_=>{this.emit("result",f,_)})}),kn(s,hu)&&!kn(r,hu)&&this.emit("finished")}close(){this.closed=!0,this.#i&&(this.#i.close(),this.#i=null),clearInterval(this.pollInterval),this.pollInterval=null}},mu=fu;var tg=ae(pu(),1);var gu=class extends tg.default{static{o(this,"TransloaditAssemblyWatcher")}#e;#t;promise;#r;#i;#s;constructor(e,t){super(),this.#s=e,this.#e=t,this.#t=t.length,this.promise=new Promise((r,s)=>{this.#r=r,this.#i=s}),this.#p()}#l(e){return this.#e.indexOf(e)!==-1}#o=o(e=>{let t=e.assembly_id;t==null||!this.#l(t)||(this.#s.log(`[Transloadit] AssemblyWatcher: Got Assembly finish ${t}`),this.emit("assembly-complete",t),this.#u())},"#onAssemblyComplete");#n=o(e=>{let t=e.assembly_id;t==null||!this.#l(t)||this.#u()},"#onAssemblyCancel");#a=o((e,t)=>{let r=e.assembly_id;r==null||!this.#l(r)||(this.#s.log(`[Transloadit] AssemblyWatcher: Got Assembly error ${r}`),this.#s.log(t),this.emit("assembly-error",r,t),this.#u())},"#onAssemblyError");#c=o((e,t,r)=>{let s=e.assembly_id;s==null||!this.#l(s)||this.#a(e,r)},"#onImportError");#u(){this.#t-=1,this.#t===0&&(this.#d(),this.#r())}#d(){this.#s.off("transloadit:complete",this.#o),this.#s.off("transloadit:assembly-cancel",this.#n),this.#s.off("transloadit:assembly-error",this.#a),this.#s.off("transloadit:import-error",this.#c)}#p(){this.#s.on("transloadit:complete",this.#o),this.#s.on("transloadit:assembly-cancel",this.#n),this.#s.on("transloadit:assembly-error",this.#a),this.#s.on("transloadit:import-error",this.#c)}},ig=gu;var rg="/assemblies",yu=class extends Error{static{o(this,"AssemblyError")}details;assembly;constructor(e,t,r){super(e),this.details=t,this.assembly=r}},io=class{static{o(this,"Client")}#e={};#t;opts;constructor(e){this.opts=e,this.opts.client!=null&&(this.#e["Transloadit-Client"]=this.opts.client),this.#t=this.opts.rateLimitedQueue.wrapPromiseFunction(Zt)}async#r(...e){let t=await this.#t(...e);if(t.status===429)return this.opts.rateLimitedQueue.rateLimit(2e3),this.#r(...e);if(!t.ok){let r=new Error(t.statusText);return r.statusCode=t.status,`${e[0]}`.endsWith(rg)?t.json().then(s=>{if(!s.error)throw r;let n=new yu(s.error,s.message,s);throw s.assembly_id&&(n.details+=` Assembly ID: ${s.assembly_id}`),n},s=>{throw s.cause=r,s}):Promise.reject(r)}return t.json()}async createAssembly({params:e,fields:t,signature:r,expectedFiles:s}){let n=new FormData;n.append("params",typeof e=="string"?e:JSON.stringify(e)),r&&n.append("signature",r),Object.keys(t).forEach(u=>{n.append(u,String(t[u]))}),n.append("num_expected_upload_files",String(s));let a=new URL(rg,`${this.opts.service}`).href;return this.#r(a,{method:"POST",headers:this.#e,body:n}).catch(u=>this.#i(u,{url:a,type:"API_ERROR"}))}async reserveFile(e,t){let r=encodeURIComponent(t.size),n=`${Bi(e)}/reserve_file?size=${r}`;return this.#r(n,{method:"POST",headers:this.#e}).catch(a=>this.#i(a,{assembly:e,file:t,url:n,type:"API_ERROR"}))}async addFile(e,t){if(!t.uploadURL)return Promise.reject(new Error("File does not have an `uploadURL`."));let r=encodeURIComponent(t.size),s=encodeURIComponent(t.uploadURL),n=encodeURIComponent(t.name??"Unnamed"),u=`size=${r}&filename=${n}&fieldname=file&s3Url=${s}`,p=`${Bi(e)}/add_file?${u}`;return this.#r(p,{method:"POST",headers:this.#e}).catch(f=>this.#i(f,{assembly:e,file:t,url:p,type:"API_ERROR"}))}async cancelAssembly(e){let t=Bi(e);await this.#t(t,{method:"DELETE",headers:this.#e}).catch(r=>this.#i(r,{url:t,type:"API_ERROR"}))}async getAssemblyStatus(e){return this.#r(e,{headers:this.#e}).catch(t=>this.#i(t,{url:e,type:"STATUS_ERROR"}))}async submitError(e,{endpoint:t,instance:r,assembly:s}={}){let n=e.details?`${e.message} (${e.details})`:e.message;return this.#r("https://transloaditstatus.com/client_error",{method:"POST",body:JSON.stringify({endpoint:t,instance:r,assembly_id:s,agent:typeof navigator<"u"?navigator.userAgent:"",client:this.opts.client,error:n})})}#i=o((e,t)=>{if(this.opts.errorReporting===!1)throw e;let r={type:t.type};throw t.assembly&&(r.assembly=t.assembly.assembly_id,r.instance=t.assembly.instance),t.url&&(r.endpoint=t.url),this.submitError(e,r).catch(()=>{}),e},"#reportError")};var sg={strings:{creatingAssembly:"Preparing upload...",creatingAssemblyFailed:"Transloadit: Could not create Assembly",encoding:"Encoding..."}};var b2={service:"https://api2.transloadit.com",errorReporting:!0,waitForEncoding:!1,waitForMetadata:!1,alwaysRunAssembly:!1,importFromUploadURLs:!1,limit:20,retryDelays:[7e3,1e4,15e3,2e4],clientName:null},og=o(i=>e=>{let t=new xi("Failed to send error to the client",{cause:e});console.error(t,i)},"sendErrorToConsole");function w2(i){if(i==null)throw new Error("Transloadit: The `params` option is required.");let e;if(typeof i=="string")try{e=JSON.parse(i)}catch(t){throw new xi("Transloadit: The `params` option is a malformed JSON string.",{cause:t})}else e=i;if(!e.auth||!e.auth.key)throw new Error("Transloadit: The `params.auth.key` option is required. You can find your Transloadit API key at https://transloadit.com/c/template-credentials")}o(w2,"validateParams");function ji(i){if(!i.assembly_id)throw console.warn("Assembly status is missing `assembly_id`.",i),new Error("Transloadit: Assembly status is missing `assembly_id`.");return i.assembly_id}o(ji,"ensureAssemblyId");function vu(i,...e){for(let t of e)if(typeof t=="string"&&t.length>0)return t;throw new Error(`Transloadit: Assembly status is missing ${i}.`)}o(vu,"ensureUrl");function S2(i){return vu("`assembly_url`",i.assembly_url,i.assembly_ssl_url)}o(S2,"getAssemblyUrl");function Bi(i){return vu("`assembly_ssl_url`",i.assembly_ssl_url,i.assembly_url)}o(Bi,"getAssemblyUrlSsl");var ng="https://api2.transloadit.com/companion",ag=/\.transloadit\.com$/,x2=/https?:\/\/api2(?:-\w+)?\.transloadit\.com\/companion/,mi=class extends xe{static{o(this,"Transloadit")}static VERSION=Qm.version;#e;client;#t;#r;completedFiles;restored=null;constructor(e,t){super(e,{...b2,...t}),this.type="uploader",this.id=this.opts.id||"Transloadit",this.defaultLocale=sg,this.#e=new ft(this.opts.limit),this.i18nInit(),this.client=new io({service:this.opts.service,client:this.#i(),errorReporting:this.opts.errorReporting,rateLimitedQueue:this.#e}),this.completedFiles=Object.create(null)}#i(){let e=[`uppy-core:${this.uppy.constructor.VERSION}`,`uppy-transloadit:${this.constructor.VERSION}`,`uppy-tus:${fi.VERSION}`],t=o((r,s)=>{let n=this.uppy.getPlugin(r);n&&e.push(`${s}:${n.constructor.VERSION}`)},"addPluginVersion");return this.opts.importFromUploadURLs&&(t("XHRUpload","uppy-xhr-upload"),t("AwsS3","uppy-aws-s3"),t("AwsS3Multipart","uppy-aws-s3-multipart")),t("Dropbox","uppy-dropbox"),t("Box","uppy-box"),t("Facebook","uppy-facebook"),t("GoogleDrive","uppy-google-drive"),t("GoogleDrivePicker","uppy-google-drive-picker"),t("GooglePhotosPicker","uppy-google-photos-picker"),t("Instagram","uppy-instagram"),t("OneDrive","uppy-onedrive"),t("Zoom","uppy-zoom"),t("Url","uppy-url"),this.opts.clientName!=null&&e.push(this.opts.clientName),e.join(",")}#s(e,t){let r=S2(t),s=vu("`tus_url`",t.tus_url),n=ji(t),a={...e.meta,assembly_url:r,filename:e.name,fieldname:"file"},u={...e.tus,endpoint:s,addRequestId:!0},c;if("remote"in e&&e.remote&&({remote:c}=e,t.companion_url&&x2.test(e.remote.companionUrl))){let f=t.companion_url.replace(/\/$/,""),d=e.remote.url.replace(e.remote.companionUrl,"").replace(/^\//,"");c={...e.remote,companionUrl:f,url:`${f}/${d}`}}let p={...e,transloadit:{assembly:n}};return this.opts.importFromUploadURLs||Object.assign(p,{meta:a,tus:u,remote:c}),p}async#l(e,t){this.uppy.log("[Transloadit] Create Assembly");try{let r=await this.client.createAssembly({...t,expectedFiles:e.length}),s=this.uppy.getFiles().filter(({id:p})=>e.includes(p));if(s.length===0&&e.length!==0)return await this.client.cancelAssembly(r),null;let n=new mu(r,this.#e),{status:a}=n,u=ji(a),c={};return s.forEach(p=>{c[p.id]=this.#s(p,a)}),this.uppy.setState({files:{...this.uppy.getState().files,...c}}),this.uppy.emit("transloadit:assembly-created",a,e),this.uppy.log(`[Transloadit] Created Assembly ${u}`),n}catch(r){let s=new xi(`${this.i18n("creatingAssemblyFailed")}: ${r.message}`,{cause:r});throw"details"in r&&(s.details=r.details),"assembly"in r&&(s.assembly=r.assembly),s}}#o(e){let t=Array.isArray(e)?e:[e],r=new ig(this.uppy,t);r.on("assembly-complete",s=>{this.getAssemblyFiles(s).forEach(a=>{this.completedFiles[a.id]=!0,this.uppy.emit("postprocess-complete",a)})}),r.on("assembly-error",(s,n)=>{let a=this.getAssemblyFiles(s);a.forEach(c=>{this.uppy.emit("upload-error",c,n),this.uppy.emit("postprocess-complete",c)});let u={...this.uppy.getState().files};a.forEach(c=>delete u[c.id].tus),this.uppy.setState({files:u}),this.uppy.emit("error",n)}),this.#r=r}#n(){return this.opts.waitForEncoding||this.opts.waitForMetadata}#a(e,t){return Promise.all(t.map(r=>{let s=this.uppy.getFile(r);return this.client.reserveFile(e.status,s)}))}#c=o(e=>{this.uppy.emit("restore:plugin-data-changed",{[this.id]:e?{assemblyResponse:e}:void 0})},"#handleAssemblyStatusUpdate");get assembly(){return this.#t}set assembly(e){!e&&this.assembly&&this.assembly.off("status",this.#c),this.#t=e,this.#c(e?.status),e&&e.on("status",this.#c)}#u=o(e=>{let t=this.uppy.getFile(e.id);if(!t?.transloadit?.assembly)return;let{status:r}=this.assembly;this.client.addFile(r,t).catch(s=>{this.uppy.log(s),this.uppy.emit("transloadit:import-error",r,t.id,s)})},"#onFileUploadURLAvailable");#d(e){let t=this.uppy.getFiles();for(let r=0;r<t.length;r++){let s=t[r];if(s.uploadURL===e.tus_upload_url||s.tus&&s.tus.uploadUrl===e.tus_upload_url||!e.is_tus_file&&s.name===e.name&&s.size===e.size)return s}}#p(e,t){let r=this.getPluginState(),s=this.#d(t);if(!s){this.uppy.log("[Transloadit] Couldn\u2019t find the file, it was likely removed in the process");return}this.setPluginState({files:{...r.files,[t.id]:{assembly:e,id:s.id,uploadedFile:t}}}),this.uppy.emit("transloadit:upload",t,this.getAssembly())}#h(e,t,r){let s=this.getPluginState();if(!("id"in r)){console.warn("Result has no id",r);return}if(typeof r.id!="string"){console.warn("Result has no id of type string",r);return}let n={result:r,stepName:t,id:r.id,assembly:e};this.setPluginState({results:[...s.results,n]}),this.uppy.emit("transloadit:result",t,n.result,this.getAssembly())}#f(e){let t=Bi(e.status);this.client.getAssemblyStatus(t).then(r=>{e.status=r,this.uppy.emit("transloadit:complete",r)})}async#g(e){await this.client.cancelAssembly(e),this.uppy.emit("transloadit:assembly-cancelled",e),this.assembly=void 0}#b=o(async()=>{if(this.assembly)try{await this.#g(this.assembly.status)}catch(e){this.uppy.log(e)}},"#onCancelAll");#m=o(e=>{let r=(e?.[this.id]?e[this.id]:{}).assemblyResponse;if(!r)return;let s=o(()=>{let u={},c=[],p=ji(r);r.uploads?.forEach(_=>{let k=this.#d(_);u[_.id]={id:k.id,assembly:p,uploadedFile:_}});let f=this.getPluginState(),d=r.results??{};Object.keys(d).forEach(_=>{let k=d[_]??[];for(let A of k){if(!("id"in A)){console.warn("Result has no id",A);continue}if(typeof A.id!="string"){console.warn("Result has no id of type string",A);continue}if(!("original_id"in A)){console.warn("Result has no original_id",A);continue}if(typeof A.original_id!="string"){console.warn("Result has no original_id of type string",A);continue}let F=f.files[A.original_id];c.push({id:A.id,result:{...A,localId:F?F.id:null},stepName:_,assembly:p})}});let v=new mu(r,this.#e);return v.status=r,this.assembly=v,this.setPluginState({files:u,results:c}),u},"restoreState"),n=o(u=>{this.#o(ji(r)),this.#y(this.assembly,u)},"restoreAssemblies"),a=o(()=>this.assembly?.update(),"updateAssembly");this.restored=(async()=>{let u=s();n(Object.keys(u)),await a(),this.restored=null})(),this.restored.catch(u=>{this.uppy.log("Failed to restore",u)})},"#onRestored");#y(e,t){let{status:r}=e,s=ji(r);return e.on("upload",n=>{this.#p(s,n)}),e.on("error",n=>{n.assembly=e.status,this.uppy.emit("transloadit:assembly-error",e.status,n)}),e.on("executing",()=>{this.uppy.emit("transloadit:assembly-executing",e.status)}),e.on("execution-progress",n=>{if(this.uppy.emit("transloadit:execution-progress",n),n.progress_combined!=null)for(let a of this.uppy.getFilesByIds(t))this.uppy.emit("postprocess-progress",a,{mode:"determinate",value:n.progress_combined/100,message:this.i18n("encoding")})}),this.opts.waitForEncoding&&e.on("result",(n,a)=>{this.#h(s,n,a)}),this.opts.waitForEncoding?e.on("finished",()=>{this.#f(e)}):this.opts.waitForMetadata&&e.on("metadata",()=>{this.#f(e)}),e.ok==="ASSEMBLY_COMPLETE"||e.connect(),e}#P=o(async e=>{let t=typeof this.opts.assemblyOptions=="function"?await this.opts.assemblyOptions():this.opts.assemblyOptions;t.fields={...t.fields??{}},w2(t.params);try{let r=this.assembly??await this.#l(e,t);if(r==null)throw new Error("All files were canceled after assembly was created");this.opts.importFromUploadURLs&&await this.#a(r,e),e.forEach(s=>{let n=this.uppy.getFile(s);this.uppy.emit("preprocess-complete",n)}),this.#o(ji(r.status)),this.assembly=r,this.#y(r,e)}catch(r){throw e.forEach(s=>{let n=this.uppy.getFile(s);this.uppy.emit("preprocess-complete",n),this.uppy.emit("upload-error",n,r)}),r}},"#prepareUpload");#S=o(async(e,t)=>{try{await this.restored;let r=e.map(c=>this.uppy.getFile(c)).filter(c=>!c.error),s=this.assembly?ji(this.assembly.status):void 0,n=o(()=>{this.assembly?.close()},"closeSocketConnections");if(!this.#n()){n();let c=this.assembly?.status;c!=null&&this.uppy.addResultData(t,{transloadit:[c]});return}if(!s){this.uppy.addResultData(t,{transloadit:[]});return}r.filter(c=>!ut(this.completedFiles,c.id)).forEach(c=>{this.uppy.emit("postprocess-progress",c,{mode:"indeterminate",message:this.i18n("encoding")})}),await this.#r.promise,n();let u=this.assembly?.status;u!=null&&this.uppy.addResultData(t,{transloadit:[u]})}finally{this.assembly=void 0}},"#afterUpload");#v=o(()=>{this.assembly?.close()},"#closeAssemblyIfExists");#x=o(e=>{this.#v(),this.assembly=void 0,this.client.submitError(e).catch(og(e))},"#onError");#w=o((e,t)=>{if(this.#v(),t?.message?.startsWith("tus: ")){let r=t.originalRequest?.getUnderlyingObject()?.responseURL;this.client.submitError(t,{endpoint:r}).catch(og(t))}},"#onTusError");install(){this.uppy.addPreProcessor(this.#P),this.uppy.addPostProcessor(this.#S),this.uppy.on("error",this.#x),this.uppy.on("cancel-all",this.#b),this.uppy.on("upload-error",this.#w),this.opts.importFromUploadURLs?this.uppy.on("upload-success",this.#u):this.uppy.use(fi,{storeFingerprintForResuming:!1,allowedMetaFields:!0,limit:this.opts.limit,rateLimitedQueue:this.#e,retryDelays:this.opts.retryDelays}),this.uppy.on("restored",this.#m),this.setPluginState({files:{},results:[]});let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}uninstall(){this.uppy.removePreProcessor(this.#P),this.uppy.removePostProcessor(this.#S),this.uppy.off("error",this.#x),this.opts.importFromUploadURLs&&this.uppy.off("upload-success",this.#u);let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}getAssembly(){return this.assembly?.status}getAssemblyFiles(e){return this.uppy.getFiles().filter(t=>t?.transloadit?.assembly===e)}};var mg=ae(lg(),1);var ug={name:"@uppy/webcam",description:"Uppy plugin that takes photos or records videos using the device's camera.",version:"5.1.0",license:"MIT",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","webcam","picture","photo","video","record","mediarecorder"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},dependencies:{"@uppy/utils":"workspace:^","is-mobile":"^4.0.0",preact:"^10.5.13"},devDependencies:{cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};function ro(){return l("svg",{"aria-hidden":"true",focusable:"false",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55",children:l("path",{d:"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z",fillRule:"evenodd"})})}o(ro,"CameraIcon");function F2({onDiscard:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--discard",type:"button",title:e("discardRecordedFile"),"aria-label":e("discardRecordedFile"),onClick:i,"data-uppy-super-focusable":!0,children:l("svg",{width:"13",height:"13",viewBox:"0 0 13 13",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon",children:l("g",{fill:"#FFF",fillRule:"evenodd",children:[l("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),l("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"})]})})})}o(F2,"DiscardButton");var cg=F2;function wu({recording:i,onStartRecording:e,onStopRecording:t,i18n:r}){return i?l("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:r("stopRecording"),"aria-label":r("stopRecording"),onClick:t,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:l("rect",{x:"15",y:"15",width:"70",height:"70"})})}):l("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:r("startRecording"),"aria-label":r("startRecording"),onClick:e,"data-uppy-super-focusable":!0,children:l("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:l("circle",{cx:"50",cy:"50",r:"40"})})})}o(wu,"RecordButton");function Su(i){return`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}o(Su,"formatSeconds");function xu({recordingLengthSeconds:i}){let e=Su(i);return l("span",{children:e})}o(xu,"RecordingLength");function Pu({onSnapshot:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:e("takePicture"),"aria-label":e("takePicture"),onClick:i,"data-uppy-super-focusable":!0,children:ro()})}o(Pu,"SnapshotButton");function T2({onSubmit:i,i18n:e}){return l("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit",type:"button",title:e("submitRecordedFile"),"aria-label":e("submitRecordedFile"),onClick:i,"data-uppy-super-focusable":!0,children:l("svg",{width:"12",height:"9",viewBox:"0 0 12 9",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon",children:l("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})})}o(T2,"SubmitButton");var pg=T2;function _u({currentDeviceId:i,videoSources:e,onChangeVideoSource:t}){return l("div",{className:"uppy-Webcam-videoSource",children:l("select",{className:"uppy-u-reset uppy-Webcam-videoSource-select",onChange:o(r=>{t(r.target.value)},"onChange"),children:e.map(r=>l("option",{value:r.deviceId,selected:r.deviceId===i,children:r.label},r.deviceId))})})}o(_u,"VideoSourceSelect");function Fn(i,e){return i.includes(e)}o(Fn,"isModeAvailable");var ku=class extends Se{static{o(this,"CameraScreen")}videoElement;refs;componentDidMount(){let{onFocus:e}=this.props;e()}componentWillUnmount(){let{onStop:e}=this.props;e()}render(){let{src:e,recordedVideo:t,capturedSnapshot:r,recording:s,modes:n,supportsRecording:a,videoSources:u,showVideoSourceDropdown:c,showRecordingLength:p,onSubmit:f,i18n:d,mirror:v,onSnapshot:_,onStartRecording:k,onStopRecording:A,onDiscardRecordedMedia:F,recordingLengthSeconds:R}=this.props,U=!!t,C=!!r,Y=U||C,$=!Y&&a&&(Fn(n,"video-only")||Fn(n,"audio-only")||Fn(n,"video-audio")),H=!Y&&Fn(n,"picture"),Q=a&&p&&!U,X=c&&u&&u.length>1,Z={playsInline:!0};return t?(Z.muted=!1,Z.controls=!0,Z.src=t,this.videoElement&&(this.videoElement.srcObject=null)):(Z.muted=!0,Z.autoPlay=!0,Z.srcObject=e),l("div",{className:"uppy uppy-Webcam-container",children:[l("div",{className:"uppy-Webcam-videoContainer",children:r&&!s&&!t?l("div",{className:"uppy-Webcam-imageContainer",children:l("img",{src:r,className:"uppy-Webcam-video",alt:"capturedSnapshot"})}):l("video",{ref:o(ye=>{this.videoElement=ye},"ref"),className:`uppy-Webcam-video ${v?"uppy-Webcam-video--mirrored":""}`,...Z})}),l("div",{className:"uppy-Webcam-footer",children:[l("div",{className:"uppy-Webcam-videoSourceContainer",children:X?_u(this.props):null}),l("div",{className:"uppy-Webcam-buttonContainer",children:[H&&l(Pu,{onSnapshot:_,i18n:d}),$&&l(wu,{recording:s,onStartRecording:k,onStopRecording:A,i18n:d}),(U||C)&&l(pg,{onSubmit:f,i18n:d}),(U||C)&&l(cg,{onDiscard:F,i18n:d})]}),l("div",{className:"uppy-Webcam-recordingLength",children:Q&&l(xu,{recordingLengthSeconds:R})})]})]})}},dg=ku;var hg={strings:{pluginNameCamera:"Camera",noCameraTitle:"Camera Not Available",noCameraDescription:"In order to take pictures or record video, please connect a camera device",recordingStoppedMaxSize:"Recording stopped because the file size is about to exceed the limit",submitRecordedFile:"Submit recorded file",discardRecordedFile:"Discard recorded file",smile:"Smile!",takePicture:"Take a picture",startRecording:"Begin video recording",stopRecording:"Stop video recording",recordingLength:"Recording length %{recording_length}",allowAccessTitle:"Please allow access to your camera",allowAccessDescription:"In order to take pictures or record video with your camera, please allow camera access for this site."}};function Eu({icon:i,i18n:e,hasCamera:t}){return l("div",{className:"uppy-Webcam-permissons",children:[l("div",{className:"uppy-Webcam-permissonsIcon",children:i()}),l("div",{className:"uppy-Webcam-title",children:e(t?"allowAccessTitle":"noCameraTitle")}),l("p",{children:e(t?"allowAccessDescription":"noCameraDescription")})]})}o(Eu,"PermissionsScreen");function Fu(){return typeof MediaRecorder=="function"&&!!MediaRecorder.prototype&&typeof MediaRecorder.prototype.start=="function"}o(Fu,"supportsMediaRecorder");function fg(i){return i[0]==="."?Gi[i.slice(1)]:i}o(fg,"toMimeType");function C2(i){return/^video\/[^*]+$/.test(i)}o(C2,"isVideoMimeType");function A2(i){return/^image\/[^*]+$/.test(i)}o(A2,"isImageMimeType");function R2(){return navigator.mediaDevices}o(R2,"getMediaDevices");function Tu(i,e){return i.includes(e)}o(Tu,"isModeAvailable");var gg={onBeforeSnapshot:o(()=>Promise.resolve(),"onBeforeSnapshot"),countdown:!1,modes:["video-audio","video-only","audio-only","picture"],mirror:!0,showVideoSourceDropdown:!1,preferredImageMimeType:null,preferredVideoMimeType:null,showRecordingLength:!1,mobileNativeCamera:(0,mg.isMobile)({tablet:!0})},Ur=class extends re{static{o(this,"Webcam")}static VERSION=ug.version;#e;mediaDevices;supportsUserMedia;protocol;capturedMediaFile;icon;webcamActive;stream=null;recorder=null;recordingChunks=null;recordingLengthTimer;captureInProgress=!1;constructor(e,t){super(e,{...gg,...t}),this.mediaDevices=R2(),this.supportsUserMedia=!!this.mediaDevices,this.protocol=location.protocol.match(/https/i)?"https":"http",this.id=this.opts.id||"Webcam",this.type="acquirer",this.capturedMediaFile=null,this.icon=()=>l("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:l("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383",fillRule:"nonzero"})}),this.defaultLocale=hg,this.i18nInit(),this.title=this.i18n("pluginNameCamera"),this.#e=this.opts.mirror,this.install=this.install.bind(this),this.setPluginState=this.setPluginState.bind(this),this.render=this.render.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.takeSnapshot=this.takeSnapshot.bind(this),this.startRecording=this.startRecording.bind(this),this.stopRecording=this.stopRecording.bind(this),this.discardRecordedMedia=this.discardRecordedMedia.bind(this),this.submit=this.submit.bind(this),this.oneTwoThreeSmile=this.oneTwoThreeSmile.bind(this),this.focus=this.focus.bind(this),this.changeVideoSource=this.changeVideoSource.bind(this),this.webcamActive=!1,this.opts.countdown&&(this.opts.onBeforeSnapshot=this.oneTwoThreeSmile),this.setPluginState({hasCamera:!1,cameraReady:!1,cameraError:null,recordingLengthSeconds:0,videoSources:[],currentDeviceId:null,capturedSnapshot:null})}getStatus(){let{recordedVideo:e,capturedSnapshot:t,isRecording:r,cameraReady:s,cameraError:n}=this.getPluginState();return r?"recording":e!=null||t!=null?"captured":s?"ready":n?"error":"init"}setOptions(e){super.setOptions({...e,videoConstraints:{...this.opts.videoConstraints,...e?.videoConstraints}})}hasCameraCheck(){return this.mediaDevices?this.mediaDevices.enumerateDevices().then(e=>e.some(t=>t.kind==="videoinput")):Promise.resolve(!1)}isAudioOnly(){return this.opts.modes.length===1&&this.opts.modes[0]==="audio-only"}getConstraints(e=null){let t=this.opts.modes.indexOf("video-audio")!==-1||this.opts.modes.indexOf("audio-only")!==-1,r=!this.isAudioOnly()&&(this.opts.modes.indexOf("video-audio")!==-1||this.opts.modes.indexOf("video-only")!==-1||this.opts.modes.indexOf("picture")!==-1),s={...this.opts.videoConstraints||{},...e!=null&&{deviceId:e}};return{audio:t,video:r?s:!1}}start(e=null){if(!this.supportsUserMedia)return Promise.reject(new Error("Webcam access not supported"));this.webcamActive=!0,this.opts.mirror&&(this.#e=!0);let t=this.getConstraints(e?.deviceId);this.hasCameraCheck().then(r=>(this.setPluginState({hasCamera:r}),this.mediaDevices.getUserMedia(t).then(s=>{this.stream=s;let n=null,a=this.isAudioOnly()?s.getAudioTracks():s.getVideoTracks();!e||!e.deviceId?n=a[0].getSettings().deviceId:a.forEach(u=>{u.getSettings().deviceId===e.deviceId&&(n=u.getSettings().deviceId)}),this.updateVideoSources(),this.setPluginState({currentDeviceId:n,cameraReady:!0})}).catch(s=>{this.setPluginState({cameraReady:!1,cameraError:s}),this.uppy.info(s.message,"error")})))}getMediaRecorderOptions(){let e={};if(MediaRecorder.isTypeSupported){let{restrictions:t}=this.uppy.opts,r=[];this.opts.preferredVideoMimeType?r=[this.opts.preferredVideoMimeType]:t.allowedFileTypes&&(r=t.allowedFileTypes.map(fg).filter(C2));let s=o(a=>MediaRecorder.isTypeSupported(a)&&xt(a),"filterSupportedTypes"),n=r.filter(s);n.length>0&&(e.mimeType=n[0])}return e}startRecording(){this.recorder=new MediaRecorder(this.stream,this.getMediaRecorderOptions()),this.recordingChunks=[];let e=!1;this.recorder.addEventListener("dataavailable",t=>{this.recordingChunks.push(t.data);let{restrictions:r}=this.uppy.opts;if(this.recordingChunks.length>1&&r.maxFileSize!=null&&!e){let s=this.recordingChunks.reduce((c,p)=>c+p.size,0),a=(s-this.recordingChunks[0].size)/(this.recordingChunks.length-1)*3,u=Math.max(0,r.maxFileSize-a);s>u&&(e=!0,this.uppy.info(this.i18n("recordingStoppedMaxSize"),"warning",4e3),this.stopRecording())}}),this.recorder.start(500),this.opts.showRecordingLength&&(this.recordingLengthTimer=setInterval(()=>{let t=this.getPluginState().recordingLengthSeconds;this.setPluginState({recordingLengthSeconds:t+1})},1e3)),this.setPluginState({isRecording:!0})}stopRecording(){return new Promise(t=>{this.recorder.addEventListener("stop",()=>{t()}),this.recorder.stop(),this.opts.showRecordingLength&&(clearInterval(this.recordingLengthTimer),this.setPluginState({recordingLengthSeconds:0}))}).then(()=>(this.setPluginState({isRecording:!1}),this.getVideo())).then(t=>{try{this.capturedMediaFile=t,this.setPluginState({recordedVideo:URL.createObjectURL(t.data)}),this.#e=!1}catch(r){r.isRestriction||this.uppy.log(r)}}).then(()=>{this.recordingChunks=null,this.recorder=null},t=>{throw this.recordingChunks=null,this.recorder=null,t})}discardRecordedMedia(){let{recordedVideo:e,capturedSnapshot:t}=this.getPluginState();e&&URL.revokeObjectURL(e),t&&URL.revokeObjectURL(t),this.setPluginState({recordedVideo:null,capturedSnapshot:null}),this.opts.mirror&&(this.#e=!0),this.capturedMediaFile=null}submit(){try{this.capturedMediaFile&&this.uppy.addFile(this.capturedMediaFile)}catch(e){e.isRestriction||this.uppy.log(e,"error")}}async stop(){if(this.stream){let e=this.stream.getAudioTracks(),t=this.stream.getVideoTracks();e.concat(t).forEach(r=>r.stop())}this.recorder&&await new Promise(e=>{this.recorder.addEventListener("stop",e,{once:!0}),this.recorder.stop(),this.opts.showRecordingLength&&clearInterval(this.recordingLengthTimer)}),this.recordingChunks=null,this.recorder=null,this.webcamActive=!1,this.stream=null,this.setPluginState({recordedVideo:null,capturedSnapshot:null,isRecording:!1,recordingLengthSeconds:0})}getVideoElement(){return this.el.querySelector(".uppy-Webcam-video")}oneTwoThreeSmile(){return new Promise((e,t)=>{let r=this.opts.countdown,s=setInterval(()=>{if(!this.webcamActive)return clearInterval(s),this.captureInProgress=!1,t(new Error("Webcam is not active"));r?(this.uppy.info(`${r}...`,"warning",800),r--):(clearInterval(s),this.uppy.info(this.i18n("smile"),"success",1500),setTimeout(()=>e(),1500))},1e3)})}async takeSnapshot(){if(!this.captureInProgress){this.captureInProgress=!0;try{await this.opts.onBeforeSnapshot()}catch(e){let t=typeof e=="object"?e.message:e;throw this.uppy.info(t,"error",5e3),new Error(`onBeforeSnapshot: ${t}`)}try{let e=await this.getImage();if(this.capturedMediaFile=e,e.data==null)throw new Error("File data is empty");let t=URL.createObjectURL(e.data);this.setPluginState({capturedSnapshot:t}),this.captureInProgress=!1}catch(e){this.captureInProgress=!1,e.isRestriction||this.uppy.log(e)}}}async getImage(){let e=this.getVideoElement();if(!e)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));let t=e.videoWidth,r=e.videoHeight,s=document.createElement("canvas");s.width=t,s.height=r,s.getContext("2d").drawImage(e,0,0);let{restrictions:a}=this.uppy.opts,u=[];this.opts.preferredImageMimeType?u=[this.opts.preferredImageMimeType]:a.allowedFileTypes&&(u=a.allowedFileTypes.map(fg).filter(A2));let c=u[0]||"image/jpeg",p=xt(c)||"jpg",f=`cam-${Date.now()}.${p}`;return fo(s,c).then(d=>({source:this.id,name:f,data:new Blob([d],{type:c}),type:c}))}getVideo(){let e=this.recordingChunks.find(a=>a.type?.length>0).type,t=xt(e);if(!t)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${e}"`));let r=`webcam-${Date.now()}.${t}`,s=new Blob(this.recordingChunks,{type:e}),n={source:this.id,name:r,data:new Blob([s],{type:e}),type:e};return Promise.resolve(n)}focus(){this.opts.countdown&&setTimeout(()=>{this.uppy.info(this.i18n("smile"),"success",1500)},1e3)}changeVideoSource(e){this.stop(),this.start({deviceId:e})}updateVideoSources(){this.mediaDevices.enumerateDevices().then(e=>{this.setPluginState({videoSources:e.filter(t=>t.kind==="videoinput")})})}render(){this.webcamActive||this.start();let e=this.getPluginState();return!e.cameraReady||!e.hasCamera?l(Eu,{icon:ro,i18n:this.i18n,hasCamera:e.hasCamera}):l(dg,{...e,onChangeVideoSource:this.changeVideoSource,onSnapshot:this.takeSnapshot,onStartRecording:this.startRecording,onStopRecording:this.stopRecording,onDiscardRecordedMedia:this.discardRecordedMedia,onSubmit:this.submit,onFocus:this.focus,onStop:this.stop,i18n:this.i18n,modes:this.opts.modes,showRecordingLength:this.opts.showRecordingLength,showVideoSourceDropdown:this.opts.showVideoSourceDropdown,supportsRecording:Fu(),recording:e.isRecording,mirror:this.#e,src:this.stream})}install(){let{mobileNativeCamera:e,modes:t,videoConstraints:r}=this.opts,{target:s}=this.opts;if(e&&s){this.getTargetPlugin(s)?.setOptions({showNativeVideoCameraButton:Tu(t,"video-only")||Tu(t,"video-audio"),showNativePhotoCameraButton:Tu(t,"picture"),nativeCameraFacingMode:r?.facingMode});return}this.setPluginState({cameraReady:!1,recordingLengthSeconds:0}),s&&this.mount(s,this),this.mediaDevices&&(this.updateVideoSources(),this.mediaDevices.ondevicechange=()=>{if(this.updateVideoSources(),this.stream){let n=!0,{videoSources:a,currentDeviceId:u}=this.getPluginState();a.forEach(c=>{u===c.deviceId&&(n=!1)}),n&&(this.stop(),this.start())}})}uninstall(){this.stop(),this.unmount()}onUnmount(){this.stop()}};var yg={name:"@uppy/xhr-upload",description:"Plain and simple classic HTML multipart form uploads with Uppy, as well as uploads using the HTTP PUT method.",version:"5.1.1",license:"MIT",type:"module",sideEffects:!1,scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","xhr","xhr upload","XMLHttpRequest","ajax","fetch","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],exports:{".":"./lib/index.js","./package.json":"./package.json"},dependencies:{"@uppy/companion-client":"workspace:^","@uppy/utils":"workspace:^"},devDependencies:{"@uppy/core":"workspace:^",jsdom:"^26.1.0",nock:"^13.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"workspace:^"}};var vg={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function O2(i,e){let t=e;return t||(t=new Error("Upload error")),typeof t=="string"&&(t=new Error(t)),t instanceof Error||(t=Object.assign(new Error("Upload error"),{data:t})),Gr(i)?(t=new St(t,i),t):(t.request=i,t)}o(O2,"buildResponseError");function bg(i){return i.data.slice(0,i.data.size,i.meta.type)}o(bg,"setTypeInBlob");var D2={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""},so=class extends xe{static{o(this,"XHRUpload")}static VERSION=yg.version;#e;requests;uploaderEvents;constructor(e,t){if(super(e,{...D2,fieldName:t.bundle?"files[]":"file",...t}),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=vg,this.i18nInit(),Yr in this.opts?this.requests=this.opts[Yr]:this.requests=new ft(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");if(this.opts.bundle&&typeof this.opts.headers=="function")throw new Error("`opts.headers` can not be a function when the `bundle: true` option is set.");if(t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");this.uploaderEvents=Object.create(null),this.#e=r=>async(s,n)=>{try{let a=await Mn(s,{...n,onBeforeRequest:o((p,f)=>this.opts.onBeforeRequest?.(p,f,r),"onBeforeRequest"),shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:o(p=>{let f=Math.ceil(p/1e3),d=new Error(this.i18n("uploadStalled",{seconds:f}));this.uppy.emit("upload-stalled",d,r)},"onTimeout"),onUploadProgress:o(p=>{if(p.lengthComputable)for(let{id:f}of r){let d=this.uppy.getFile(f);d!=null&&this.uppy.emit("upload-progress",d,{uploadStarted:d.progress.uploadStarted??0,bytesUploaded:p.loaded/p.total*d.size,bytesTotal:d.size})}},"onUploadProgress")}),u=await this.opts.getResponseData?.(a);if(a.responseType==="json")u??=a.response;else try{u??=JSON.parse(a.responseText)}catch(p){throw new Error("@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.",{cause:p})}let c=typeof u?.url=="string"?u.url:void 0;for(let{id:p}of r)this.uppy.emit("upload-success",this.uppy.getFile(p),{status:a.status,body:u,uploadURL:c});return a}catch(a){if(a.name==="AbortError")return;let u=a.request;for(let c of r)this.uppy.emit("upload-error",this.uppy.getFile(c.id),O2(u,a),u);throw a}}}getOptions(e){let t=this.uppy.getState().xhrUpload,{headers:r}=this.opts,s={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return typeof r=="function"?s.headers=r(e):Object.assign(s.headers,this.opts.headers),t&&Object.assign(s.headers,t.headers),e.xhrUpload&&Object.assign(s.headers,e.xhrUpload.headers),s}addMetadata(e,t,r){At(r.allowedMetaFields,t).forEach(n=>{let a=t[n];Array.isArray(a)?a.forEach(u=>e.append(n,u)):e.append(n,a)})}createFormDataUpload(e,t){let r=new FormData;this.addMetadata(r,e.meta,t);let s=bg(e);return e.name?r.append(t.fieldName,s,e.meta.name):r.append(t.fieldName,s),r}createBundledUpload(e,t){let r=new FormData,{meta:s}=this.uppy.getState();return this.addMetadata(r,s,t),e.forEach(n=>{let a=this.getOptions(n),u=bg(n);n.name?r.append(a.fieldName,u,n.name):r.append(a.fieldName,u)}),r}async#t(e){let t=new Ot(this.uppy),r=new AbortController,s=this.requests.wrapPromiseFunction(async()=>{let n=this.getOptions(e),a=this.#e([e]),u=n.formData?this.createFormDataUpload(e,n):e.data,c=typeof n.endpoint=="string"?n.endpoint:await n.endpoint(e);return a(c,{...n,body:u,signal:r.signal})});t.onFileRemove(e.id,()=>r.abort()),t.onCancelAll(e.id,()=>{r.abort()});try{await s()}catch(n){if(n.message!=="Cancelled")throw n}finally{t.remove()}}async#r(e){let t=new AbortController,r=this.requests.wrapPromiseFunction(async()=>{let n=this.uppy.getState().xhrUpload??{},a=this.#e(e),u=this.createBundledUpload(e,{...this.opts,...n}),c=typeof this.opts.endpoint=="string"?this.opts.endpoint:await this.opts.endpoint(e);return a(c,{...this.opts,body:u,signal:t.signal})});function s(){t.abort()}o(s,"abort"),this.uppy.once("cancel-all",s);try{await r()}catch(n){if(n.message!=="Cancelled")throw n}finally{this.uppy.off("cancel-all",s)}}#i(e){let t=this.getOptions(e),r=At(t.allowedMetaFields,e.meta);return{...e.remote?.body,protocol:"multipart",endpoint:t.endpoint,size:e.data.size,fieldname:t.fieldName,metadata:Object.fromEntries(r.map(s=>[s,e.meta[s]])),httpMethod:t.method,useFormData:t.formData,headers:t.headers}}async#s(e){await Promise.allSettled(e.map(t=>{if(t.isRemote){let r=o(()=>this.requests,"getQueue"),s=new AbortController,n=o(u=>{u.id===t.id&&s.abort()},"removedHandler");this.uppy.on("file-removed",n);let a=this.uppy.getRequestClientForFile(t).uploadRemoteFile(t,this.#i(t),{signal:s.signal,getQueue:r});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",n)},{priority:-1})(),a}return this.#t(t)}))}#l=o(async e=>{if(e.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&!this.opts[Yr]&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");let t=this.uppy.getFilesByIds(e),r=Pi(t),s=_i(r);if(this.uppy.emit("upload-start",s),this.opts.bundle){if(r.some(a=>a.isRemote))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");await this.#r(r)}else await this.#s(r)},"#handleUpload");install(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(this.#l)}uninstall(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(this.#l)}};function I2(){throw new Error("Core has been renamed to Uppy")}o(I2,"Core");var N2={ProviderView:Fa};mi.COMPANION_URL=ng;mi.COMPANION_ALLOWED_HOSTS=ag;var M2={};globalThis.Uppy=Cu;})();
/**
* Takes a string with placeholder variables like `%{smart_count} file selected`
* and replaces it with values from options `{smart_count: 5}`
*
* @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
* taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
*
* @param phrase that needs interpolation, with placeholders
* @param options with values that will be used to replace placeholders
*/
/*! Bundled license information:
classnames/index.js:
(*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*)
compressorjs/dist/compressor.js:
(*!
* Compressor.js v1.2.1
* https://fengyuanchen.github.io/compressorjs
*
* Copyright 2018-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2023-02-28T14:09:41.732Z
*)
cropperjs/dist/cropper.js:
(*!
* Cropper.js v1.6.2
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2024-04-21T07:43:05.335Z
*)
tus-js-client/lib.esm/upload.js:
tus-js-client/lib.esm/browser/fileReader.js:
(*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *)
*/
//# sourceMappingURL=uppy.min.js.map