@jari-ace/element-plus-component 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.umd.cjs CHANGED
@@ -7,14 +7,14 @@
7
7
  *
8
8
  * @param phrase that needs interpolation, with placeholders
9
9
  * @param options with values that will be used to replace placeholders
10
- */function Iu(e,l){const t=/\$/g,d="$$$$";let n=[e];if(l==null)return n;for(const a of Object.keys(l))if(a!=="_"){let i=l[a];typeof i=="string"&&(i=t[Symbol.replace](i,d)),n=Ay(n,new RegExp(`%\\{${a}\\}`,"g"),i)}return n}const _y=e=>{throw new Error(`missing string: ${e}`)};class Du{constructor(l,{onMissingKey:t=_y}={}){dl(this,B0);E(this,"locale");dl(this,y0);this.locale={strings:{},pluralize(d){return d===1?0:1}},Array.isArray(l)?l.forEach(cl(this,B0,Uu),this):cl(this,B0,Uu).call(this,l),Fl(this,y0,t)}translate(l,t){return this.translateArray(l,t).join("")}translateArray(l,t){let d=this.locale.strings[l];if(d==null&&(j(this,y0).call(this,l),d=l),typeof d=="object"){if(t&&typeof t.smart_count<"u"){const a=this.locale.pluralize(t.smart_count);return Iu(d[a],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof d!="string")throw new Error("string was not a string");return Iu(d,t)}}y0=new WeakMap,B0=new WeakSet,Uu=function(l){if(!(l!=null&&l.strings))return;const t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...l.strings},pluralize:l.pluralize||t.pluralize})};const QQ="...";function wu(e,l){if(l===0)return"";if(e.length<=l)return e;if(l<=QQ.length+1)return`${e.slice(0,l-1)}…`;const t=l-QQ.length,d=Math.ceil(t/2),n=Math.floor(t/2);return e.slice(0,d)+QQ+e.slice(-n)}var BU,El,Eu,Ea,Cu,xu,gu,ju,mQ,RQ,NQ,YU={},Ou=[],qy=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,kU=Array.isArray;function Qd(e,l){for(var t in l)e[t]=l[t];return e}function bQ(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function uQ(e,l,t){var d,n,a,i={};for(a in l)a=="key"?d=l[a]:a=="ref"?n=l[a]:i[a]=l[a];if(arguments.length>2&&(i.children=arguments.length>3?BU.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)i[a]===void 0&&(i[a]=e.defaultProps[a]);return zU(e,i,d,n,null)}function zU(e,l,t,d,n){var a={type:e,props:l,key:t,ref:d,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++Eu,__i:-1,__u:0};return n==null&&El.vnode!=null&&El.vnode(a),a}function $y(){return{current:null}}function Pe(e){return e.children}function se(e,l){this.props=e,this.context=l}function Vs(e,l){if(l==null)return e.__?Vs(e.__,e.__i+1):null;for(var t;l<e.__k.length;l++)if((t=e.__k[l])!=null&&t.__e!=null)return t.__e;return typeof e.type=="function"?Vs(e):null}function vu(e){var l,t;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,l=0;l<e.__k.length;l++)if((t=e.__k[l])!=null&&t.__e!=null){e.__e=e.__c.base=t.__e;break}return vu(e)}}function Ku(e){(!e.__d&&(e.__d=!0)&&Ea.push(e)&&!A0.__r++||Cu!=El.debounceRendering)&&((Cu=El.debounceRendering)||xu)(A0)}function A0(){for(var e,l,t,d,n,a,i,s=1;Ea.length;)Ea.length>s&&Ea.sort(gu),e=Ea.shift(),s=Ea.length,e.__d&&(t=void 0,d=void 0,n=(d=(l=e).__v).__e,a=[],i=[],l.__P&&((t=Qd({},d)).__v=d.__v+1,El.vnode&&El.vnode(t),rQ(l.__P,t,d,l.__n,l.__P.namespaceURI,32&d.__u?[n]:null,a,n??Vs(d),!!(32&d.__u),i),t.__v=d.__v,t.__.__k[t.__i]=t,_u(a,t,i),d.__e=d.__=null,t.__e!=n&&vu(t)));A0.__r=0}function fu(e,l,t,d,n,a,i,s,c,F,h){var o,V,W,Q,m,R,r,b=d&&d.__k||Ou,u=l.length;for(c=lB(t,l,b,c,u),o=0;o<u;o++)(W=t.__k[o])!=null&&(V=W.__i==-1?YU:b[W.__i]||YU,W.__i=o,R=rQ(e,W,V,n,a,i,s,c,F,h),Q=W.__e,W.ref&&V.ref!=W.ref&&(V.ref&&MQ(V.ref,null,W),h.push(W.ref,W.__c||Q,W)),m==null&&Q!=null&&(m=Q),(r=!!(4&W.__u))||V.__k===W.__k?c=Hu(W,c,e,r):typeof W.type=="function"&&R!==void 0?c=R:Q&&(c=Q.nextSibling),W.__u&=-7);return t.__e=m,c}function lB(e,l,t,d,n){var a,i,s,c,F,h=t.length,o=h,V=0;for(e.__k=new Array(n),a=0;a<n;a++)(i=l[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[a]=zU(null,i,null,null,null):kU(i)?i=e.__k[a]=zU(Pe,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[a]=zU(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[a]=i,c=a+V,i.__=e,i.__b=e.__b+1,s=null,(F=i.__i=tB(i,t,c,o))!=-1&&(o--,(s=t[F])&&(s.__u|=2)),s==null||s.__v==null?(F==-1&&(n>h?V--:n<h&&V++),typeof i.type!="function"&&(i.__u|=4)):F!=c&&(F==c-1?V--:F==c+1?V++:(F>c?V--:V++,i.__u|=4))):e.__k[a]=null;if(o)for(a=0;a<h;a++)(s=t[a])!=null&&(2&s.__u)==0&&(s.__e==d&&(d=Vs(s)),$u(s,s));return d}function Hu(e,l,t,d){var n,a;if(typeof e.type=="function"){for(n=e.__k,a=0;n&&a<n.length;a++)n[a]&&(n[a].__=e,l=Hu(n[a],l,t,d));return l}e.__e!=l&&(d&&(l&&e.type&&!l.parentNode&&(l=Vs(e)),t.insertBefore(e.__e,l||null)),l=e.__e);do l=l&&l.nextSibling;while(l!=null&&l.nodeType==8);return l}function kn(e,l){return l=l||[],e==null||typeof e=="boolean"||(kU(e)?e.some(function(t){kn(t,l)}):l.push(e)),l}function tB(e,l,t,d){var n,a,i,s=e.key,c=e.type,F=l[t],h=F!=null&&(2&F.__u)==0;if(F===null&&s==null||h&&s==F.key&&c==F.type)return t;if(d>(h?1:0)){for(n=t-1,a=t+1;n>=0||a<l.length;)if((F=l[i=n>=0?n--:a++])!=null&&(2&F.__u)==0&&s==F.key&&c==F.type)return i}return-1}function Pu(e,l,t){l[0]=="-"?e.setProperty(l,t??""):e[l]=t==null?"":typeof t!="number"||qy.test(l)?t:t+"px"}function _0(e,l,t,d,n){var a,i;l:if(l=="style")if(typeof t=="string")e.style.cssText=t;else{if(typeof d=="string"&&(e.style.cssText=d=""),d)for(l in d)t&&l in t||Pu(e.style,l,"");if(t)for(l in t)d&&t[l]==d[l]||Pu(e.style,l,t[l])}else if(l[0]=="o"&&l[1]=="n")a=l!=(l=l.replace(ju,"$1")),i=l.toLowerCase(),l=i in e||l=="onFocusOut"||l=="onFocusIn"?i.slice(2):l.slice(2),e.l||(e.l={}),e.l[l+a]=t,t?d?t.u=d.u:(t.u=mQ,e.addEventListener(l,a?NQ:RQ,a)):e.removeEventListener(l,a?NQ:RQ,a);else{if(n=="http://www.w3.org/2000/svg")l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(l!="width"&&l!="height"&&l!="href"&&l!="list"&&l!="form"&&l!="tabIndex"&&l!="download"&&l!="rowSpan"&&l!="colSpan"&&l!="role"&&l!="popover"&&l in e)try{e[l]=t??"";break l}catch{}typeof t=="function"||(t==null||t===!1&&l[4]!="-"?e.removeAttribute(l):e.setAttribute(l,l=="popover"&&t==1?"":t))}}function Au(e){return function(l){if(this.l){var t=this.l[l.type+e];if(l.t==null)l.t=mQ++;else if(l.t<t.u)return;return t(El.event?El.event(l):l)}}}function rQ(e,l,t,d,n,a,i,s,c,F){var h,o,V,W,Q,m,R,r,b,u,J,G,T,y,k,X,L,D=l.type;if(l.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),a=[s=l.__e=t.__e]),(h=El.__b)&&h(l);l:if(typeof D=="function")try{if(r=l.props,b="prototype"in D&&D.prototype.render,u=(h=D.contextType)&&d[h.__c],J=h?u?u.props.value:h.__:d,t.__c?R=(o=l.__c=t.__c).__=o.__E:(b?l.__c=o=new D(r,J):(l.__c=o=new se(r,J),o.constructor=D,o.render=dB),u&&u.sub(o),o.state||(o.state={}),o.__n=d,V=o.__d=!0,o.__h=[],o._sb=[]),b&&o.__s==null&&(o.__s=o.state),b&&D.getDerivedStateFromProps!=null&&(o.__s==o.state&&(o.__s=Qd({},o.__s)),Qd(o.__s,D.getDerivedStateFromProps(r,o.__s))),W=o.props,Q=o.state,o.__v=l,V)b&&D.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),b&&o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else{if(b&&D.getDerivedStateFromProps==null&&r!==W&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(r,J),l.__v==t.__v||!o.__e&&o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(r,o.__s,J)===!1){for(l.__v!=t.__v&&(o.props=r,o.state=o.__s,o.__d=!1),l.__e=t.__e,l.__k=t.__k,l.__k.some(function(C){C&&(C.__=l)}),G=0;G<o._sb.length;G++)o.__h.push(o._sb[G]);o._sb=[],o.__h.length&&i.push(o);break l}o.componentWillUpdate!=null&&o.componentWillUpdate(r,o.__s,J),b&&o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(W,Q,m)})}if(o.context=J,o.props=r,o.__P=e,o.__e=!1,T=El.__r,y=0,b){for(o.state=o.__s,o.__d=!1,T&&T(l),h=o.render(o.props,o.state,o.context),k=0;k<o._sb.length;k++)o.__h.push(o._sb[k]);o._sb=[]}else do o.__d=!1,T&&T(l),h=o.render(o.props,o.state,o.context),o.state=o.__s;while(o.__d&&++y<25);o.state=o.__s,o.getChildContext!=null&&(d=Qd(Qd({},d),o.getChildContext())),b&&!V&&o.getSnapshotBeforeUpdate!=null&&(m=o.getSnapshotBeforeUpdate(W,Q)),X=h,h!=null&&h.type===Pe&&h.key==null&&(X=qu(h.props.children)),s=fu(e,kU(X)?X:[X],l,t,d,n,a,i,s,c,F),o.base=l.__e,l.__u&=-161,o.__h.length&&i.push(o),R&&(o.__E=o.__=null)}catch(C){if(l.__v=null,c||a!=null)if(C.then){for(l.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,l.__e=s}else{for(L=a.length;L--;)bQ(a[L]);pQ(l)}else l.__e=t.__e,l.__k=t.__k,C.then||pQ(l);El.__e(C,l,t)}else a==null&&l.__v==t.__v?(l.__k=t.__k,l.__e=t.__e):s=l.__e=eB(t.__e,l,t,d,n,a,i,c,F);return(h=El.diffed)&&h(l),128&l.__u?void 0:s}function pQ(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(pQ)}function _u(e,l,t){for(var d=0;d<t.length;d++)MQ(t[d],t[++d],t[++d]);El.__c&&El.__c(l,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(a){a.call(n)})}catch(a){El.__e(a,n.__v)}})}function qu(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:kU(e)?e.map(qu):Qd({},e)}function eB(e,l,t,d,n,a,i,s,c){var F,h,o,V,W,Q,m,R=t.props||YU,r=l.props,b=l.type;if(b=="svg"?n="http://www.w3.org/2000/svg":b=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),a!=null){for(F=0;F<a.length;F++)if((W=a[F])&&"setAttribute"in W==!!b&&(b?W.localName==b:W.nodeType==3)){e=W,a[F]=null;break}}if(e==null){if(b==null)return document.createTextNode(r);e=document.createElementNS(n,b,r.is&&r),s&&(El.__m&&El.__m(l,a),s=!1),a=null}if(b==null)R===r||s&&e.data==r||(e.data=r);else{if(a=a&&BU.call(e.childNodes),!s&&a!=null)for(R={},F=0;F<e.attributes.length;F++)R[(W=e.attributes[F]).name]=W.value;for(F in R)if(W=R[F],F!="children"){if(F=="dangerouslySetInnerHTML")o=W;else if(!(F in r)){if(F=="value"&&"defaultValue"in r||F=="checked"&&"defaultChecked"in r)continue;_0(e,F,null,W,n)}}for(F in r)W=r[F],F=="children"?V=W:F=="dangerouslySetInnerHTML"?h=W:F=="value"?Q=W:F=="checked"?m=W:s&&typeof W!="function"||R[F]===W||_0(e,F,W,R[F],n);if(h)s||o&&(h.__html==o.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),l.__k=[];else if(o&&(e.innerHTML=""),fu(l.type=="template"?e.content:e,kU(V)?V:[V],l,t,d,b=="foreignObject"?"http://www.w3.org/1999/xhtml":n,a,i,a?a[0]:t.__k&&Vs(t,0),s,c),a!=null)for(F=a.length;F--;)bQ(a[F]);s||(F="value",b=="progress"&&Q==null?e.removeAttribute("value"):Q!=null&&(Q!==e[F]||b=="progress"&&!Q||b=="option"&&Q!=R[F])&&_0(e,F,Q,R[F],n),F="checked",m!=null&&m!=e[F]&&_0(e,F,m,R[F],n))}return e}function MQ(e,l,t){try{if(typeof e=="function"){var d=typeof e.__u=="function";d&&e.__u(),d&&l==null||(e.__u=e(l))}else e.current=l}catch(n){El.__e(n,t)}}function $u(e,l,t){var d,n;if(El.unmount&&El.unmount(e),(d=e.ref)&&(d.current&&d.current!=e.__e||MQ(d,null,l)),(d=e.__c)!=null){if(d.componentWillUnmount)try{d.componentWillUnmount()}catch(a){El.__e(a,l)}d.base=d.__P=null}if(d=e.__k)for(n=0;n<d.length;n++)d[n]&&$u(d[n],l,t||typeof e.type!="function");t||bQ(e.__e),e.__c=e.__=e.__e=void 0}function dB(e,l,t){return this.constructor(e,t)}function lr(e,l,t){var d,n,a,i;l==document&&(l=document.documentElement),El.__&&El.__(e,l),n=(d=!1)?null:l.__k,a=[],i=[],rQ(l,e=l.__k=uQ(Pe,null,[e]),n||YU,YU,l.namespaceURI,n?null:l.firstChild?BU.call(l.childNodes):null,a,n?n.__e:l.firstChild,d,i),_u(a,e,i)}function tr(e,l,t){var d,n,a,i,s=Qd({},e.props);for(a in e.type&&e.type.defaultProps&&(i=e.type.defaultProps),l)a=="key"?d=l[a]:a=="ref"?n=l[a]:s[a]=l[a]===void 0&&i!=null?i[a]:l[a];return arguments.length>2&&(s.children=arguments.length>3?BU.call(arguments,2):t),zU(e.type,s,d||e.key,n||e.ref,null)}BU=Ou.slice,El={__e:function(e,l,t,d){for(var n,a,i;l=l.__;)if((n=l.__c)&&!n.__)try{if((a=n.constructor)&&a.getDerivedStateFromError!=null&&(n.setState(a.getDerivedStateFromError(e)),i=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,d||{}),i=n.__d),i)return n.__E=n}catch(s){e=s}throw e}},Eu=0,se.prototype.setState=function(e,l){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Qd({},this.state),typeof e=="function"&&(e=e(Qd({},t),this.props)),e&&Qd(t,e),e!=null&&this.__v&&(l&&this._sb.push(l),Ku(this))},se.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ku(this))},se.prototype.render=Pe,Ea=[],xu=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,gu=function(e,l){return e.__v.__b-l.__v.__b},A0.__r=0,ju=/(PointerCapture)$|Capture$/i,mQ=0,RQ=Au(!1),NQ=Au(!0);var nB=0;function S(e,l,t,d,n,a){l||(l={});var i,s,c=l;if("ref"in c)for(s in c={},l)s=="ref"?i=l[s]:c[s]=l[s];var F={type:e,props:c,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--nB,__i:-1,__u:0,__source:n,__self:a};if(typeof e=="function"&&(i=e.defaultProps))for(s in i)c[s]===void 0&&(c[s]=i[s]);return El.vnode&&El.vnode(F),F}var LU,tt,SQ,er,IU=0,dr=[],at=El,nr=at.__b,ar=at.__r,ir=at.diffed,sr=at.__c,cr=at.unmount,Ur=at.__;function JQ(e,l){at.__h&&at.__h(tt,e,IU||l),IU=0;var t=tt.__H||(tt.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function Ws(e){return IU=1,aB(hr,e)}function aB(e,l,t){var d=JQ(LU++,2);if(d.t=e,!d.__c&&(d.__=[hr(void 0,l),function(s){var c=d.__N?d.__N[0]:d.__[0],F=d.t(c,s);c!==F&&(d.__N=[F,d.__[1]],d.__c.setState({}))}],d.__c=tt,!tt.__f)){var n=function(s,c,F){if(!d.__c.__H)return!0;var h=d.__c.__H.__.filter(function(V){return!!V.__c});if(h.every(function(V){return!V.__N}))return!a||a.call(this,s,c,F);var o=d.__c.props!==s;return h.forEach(function(V){if(V.__N){var W=V.__[0];V.__=V.__N,V.__N=void 0,W!==V.__[0]&&(o=!0)}}),a&&a.call(this,s,c,F)||o};tt.__f=!0;var a=tt.shouldComponentUpdate,i=tt.componentWillUpdate;tt.componentWillUpdate=function(s,c,F){if(this.__e){var h=a;a=void 0,n(s,c,F),a=h}i&&i.call(this,s,c,F)},tt.shouldComponentUpdate=n}return d.__N||d.__}function Qs(e,l){var t=JQ(LU++,3);!at.__s&&Fr(t.__H,l)&&(t.__=e,t.u=l,tt.__H.__h.push(t))}function zn(e){return IU=5,TQ(function(){return{current:e}},[])}function TQ(e,l){var t=JQ(LU++,7);return Fr(t.__H,l)&&(t.__=e(),t.__H=l,t.__h=e),t.__}function q0(e,l){return IU=8,TQ(function(){return e},l)}function iB(){for(var e;e=dr.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach($0),e.__H.__h.forEach(GQ),e.__H.__h=[]}catch(l){e.__H.__h=[],at.__e(l,e.__v)}}at.__b=function(e){tt=null,nr&&nr(e)},at.__=function(e,l){e&&l.__k&&l.__k.__m&&(e.__m=l.__k.__m),Ur&&Ur(e,l)},at.__r=function(e){ar&&ar(e),LU=0;var l=(tt=e.__c).__H;l&&(SQ===tt?(l.__h=[],tt.__h=[],l.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(l.__h.forEach($0),l.__h.forEach(GQ),l.__h=[],LU=0)),SQ=tt},at.diffed=function(e){ir&&ir(e);var l=e.__c;l&&l.__H&&(l.__H.__h.length&&(dr.push(l)!==1&&er===at.requestAnimationFrame||((er=at.requestAnimationFrame)||sB)(iB)),l.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),SQ=tt=null},at.__c=function(e,l){l.some(function(t){try{t.__h.forEach($0),t.__h=t.__h.filter(function(d){return!d.__||GQ(d)})}catch(d){l.some(function(n){n.__h&&(n.__h=[])}),l=[],at.__e(d,t.__v)}}),sr&&sr(e,l)},at.unmount=function(e){cr&&cr(e);var l,t=e.__c;t&&t.__H&&(t.__H.__.forEach(function(d){try{$0(d)}catch(n){l=n}}),t.__H=void 0,l&&at.__e(l,t.__v))};var Zr=typeof requestAnimationFrame=="function";function sB(e){var l,t=function(){clearTimeout(d),Zr&&cancelAnimationFrame(l),setTimeout(e)},d=setTimeout(t,35);Zr&&(l=requestAnimationFrame(t))}function $0(e){var l=tt,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),tt=l}function GQ(e){var l=tt;e.__c=e.__(),tt=l}function Fr(e,l){return!e||e.length!==l.length||l.some(function(t,d){return t!==e[d]})}function hr(e,l){return typeof l=="function"?l(e):l}const cB={position:"relative",width:"100%",minHeight:"100%"},UB={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};function ZB({data:e,rowHeight:l,renderRow:t,overscanCount:d=10,padding:n=4,...a}){const i=zn(null),[s,c]=Ws(0),[F,h]=Ws(0);Qs(()=>{function b(){i.current!=null&&F!==i.current.offsetHeight&&h(i.current.offsetHeight)}return b(),window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[F]);const o=q0(()=>{i.current&&c(i.current.scrollTop)},[]);let V=Math.floor(s/l),W=Math.floor(F/l);d&&(V=Math.max(0,V-V%d),W+=d);const Q=V+W+n,m=e.slice(V,Q),R={...cB,height:e.length*l},r={...UB,top:V*l};return S("div",{onScroll:o,ref:i,...a,children:S("div",{role:"presentation",style:R,children:S("div",{role:"presentation",style:r,children:m.map(t)})})})}class or{constructor(l,t){E(this,"uppy");E(this,"opts");E(this,"id");E(this,"defaultLocale");E(this,"i18n");E(this,"i18nArray");E(this,"type");E(this,"VERSION");this.uppy=l,this.opts=t??{}}getPluginState(){const{plugins:l}=this.uppy.getState();return(l==null?void 0:l[this.id])||{}}setPluginState(l){const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...l}}})}setOptions(l){this.opts={...this.opts,...l},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const l=new Du([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=l.translate.bind(l),this.i18nArray=l.translateArray.bind(l),this.setPluginState(void 0)}addTarget(l){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(l){}afterUpdate(){}}class FB{constructor(l){dl(this,Kd);dl(this,Y0,[]);Fl(this,Kd,l)}on(l,t){return j(this,Y0).push([l,t]),j(this,Kd).on(l,t)}remove(){for(const[l,t]of j(this,Y0).splice(0))j(this,Kd).off(l,t)}onFilePause(l,t){this.on("upload-pause",(d,n)=>{l===(d==null?void 0:d.id)&&t(n)})}onFileRemove(l,t){this.on("file-removed",d=>{l===d.id&&t(d.id)})}onPause(l,t){this.on("upload-pause",(d,n)=>{l===(d==null?void 0:d.id)&&t(n)})}onRetry(l,t){this.on("upload-retry",d=>{l===(d==null?void 0:d.id)&&t()})}onRetryAll(l,t){this.on("retry-all",()=>{j(this,Kd).getFile(l)&&t()})}onPauseAll(l,t){this.on("pause-all",()=>{j(this,Kd).getFile(l)&&t()})}onCancelAll(l,t){this.on("cancel-all",(...d)=>{j(this,Kd).getFile(l)&&t(...d)})}onResumeAll(l,t){this.on("resume-all",()=>{j(this,Kd).getFile(l)&&t()})}}Kd=new WeakMap,Y0=new WeakMap;const hB={debug:()=>{},warn:()=>{},error:(...e)=>console.error(`[Uppy] [${P0()}]`,...e)},oB={debug:(...e)=>console.debug(`[Uppy] [${P0()}]`,...e),warn:(...e)=>console.warn(`[Uppy] [${P0()}]`,...e),error:(...e)=>console.error(`[Uppy] [${P0()}]`,...e)};var ms=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ca(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var XQ,Vr;function VB(){return Vr||(Vr=1,XQ=function(l){if(typeof l!="number"||Number.isNaN(l))throw new TypeError(`Expected a number, got ${typeof l}`);const t=l<0;let d=Math.abs(l);if(t&&(d=-d),d===0)return"0 B";const n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],a=Math.min(Math.floor(Math.log(d)/Math.log(1024)),n.length-1),i=Number(d/1024**a),s=n[a];return`${i>=10||i%1===0?Math.round(i):i.toFixed(1)} ${s}`}),XQ}var WB=VB();const xa=Ca(WB);var yQ,Wr;function QB(){if(Wr)return yQ;Wr=1;function e(l,t){this.text=l=l||"",this.hasWild=~l.indexOf("*"),this.separator=t,this.parts=l.split(t)}return e.prototype.match=function(l){var t=!0,d=this.parts,n,a=d.length,i;if(typeof l=="string"||l instanceof String)if(!this.hasWild&&this.text!=l)t=!1;else{for(i=(l||"").split(this.separator),n=0;t&&n<a;n++)d[n]!=="*"&&(n<i.length?t=d[n]===i[n]:t=!1);t=t&&i}else if(typeof l.splice=="function")for(t=[],n=l.length;n--;)this.match(l[n])&&(t[t.length]=l[n]);else if(typeof l=="object"){t={};for(var s in l)this.match(s)&&(t[s]=l[s])}return t},yQ=function(l,t,d){var n=new e(l,d||/[\/\.]/);return typeof t<"u"?n.match(t):n},yQ}var BQ,Qr;function mB(){if(Qr)return BQ;Qr=1;var e=QB(),l=/[\/\+\.]/;return BQ=function(t,d){function n(a){var i=e(a,t,l);return i&&i.length>=2}return d?n(d.split(";")[0]):n},BQ}var RB=mB();const NB=Ca(RB),bB={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class Ae extends Error{constructor(t,d){super(t);E(this,"isUserFacing");E(this,"file");E(this,"isRestriction",!0);this.isUserFacing=(d==null?void 0:d.isUserFacing)??!0,d!=null&&d.file&&(this.file=d.file)}}class uB{constructor(l,t){E(this,"getI18n");E(this,"getOpts");this.getI18n=t,this.getOpts=()=>{var n;const d=l();if(((n=d.restrictions)==null?void 0:n.allowedFileTypes)!=null&&!Array.isArray(d.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return d}}validateAggregateRestrictions(l,t){const{maxTotalFileSize:d,maxNumberOfFiles:n}=this.getOpts().restrictions;if(n&&l.filter(i=>!i.isGhost).length+t.length>n)throw new Ae(`${this.getI18n()("youCanOnlyUploadX",{smart_count:n})}`);if(d){const a=[...l,...t].reduce((i,s)=>i+(s.size??0),0);if(a>d)throw new Ae(this.getI18n()("aggregateExceedsSize",{sizeAllowed:xa(d),size:xa(a)}))}}validateSingleFile(l){const{maxFileSize:t,minFileSize:d,allowedFileTypes:n}=this.getOpts().restrictions;if(n&&!n.some(i=>i.includes("/")?l.type?NB(l.type.replace(/;.*?$/,""),i):!1:i[0]==="."&&l.extension?l.extension.toLowerCase()===i.slice(1).toLowerCase():!1)){const i=n.join(", ");throw new Ae(this.getI18n()("youCanOnlyUploadFileTypes",{types:i}),{file:l})}if(t&&l.size!=null&&l.size>t)throw new Ae(this.getI18n()("exceedsSize",{size:xa(t),file:l.name??this.getI18n()("unnamed")}),{file:l});if(d&&l.size!=null&&l.size<d)throw new Ae(this.getI18n()("inferiorSize",{size:xa(d)}),{file:l})}validate(l,t){t.forEach(d=>{this.validateSingleFile(d)}),this.validateAggregateRestrictions(l,t)}validateMinNumberOfFiles(l){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(l).length<t)throw new Ae(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(l){const t=new Ae(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:l.name??this.getI18n()("unnamed")})),{requiredMetaFields:d}=this.getOpts().restrictions,n=[];for(const a of d)(!Object.hasOwn(l.meta,a)||l.meta[a]==="")&&n.push(a);return{missingFields:n,error:t}}}function rB(e){let l=null,t;return(...d)=>(t=d,l||(l=Promise.resolve().then(()=>(l=null,e(...t)))),l)}const PW=class PW extends or{constructor(){super(...arguments);dl(this,k0);E(this,"isTargetDOMEl");E(this,"el");E(this,"parent");E(this,"title")}getTargetPlugin(t){let d;if(typeof(t==null?void 0:t.addTarget)=="function")d=t,d instanceof PW||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:d,UIPlugin:PW}}));else if(typeof t=="function"){const n=t;this.uppy.iteratePlugins(a=>{a instanceof n&&(d=a)})}return d}mount(t,d){const n=d.id,a=ky(t);if(a){this.isTargetDOMEl=!0;const c=document.createElement("div");return c.classList.add("uppy-Root"),Fl(this,k0,rB(F=>{this.uppy.getPlugin(this.id)&&(lr(this.render(F,c),c),this.afterUpdate())})),this.uppy.log(`Installing ${n} to a DOM element '${t}'`),this.opts.replaceTargetContent&&(a.innerHTML=""),lr(this.render(this.uppy.getState(),c),c),this.el=c,a.appendChild(c),c.dir=this.opts.direction||jy(c)||"ltr",this.onMount(),this.el}const i=this.getTargetPlugin(t);if(i)return this.uppy.log(`Installing ${n} to ${i.id}`),this.parent=i,this.el=i.addTarget(d),this.onMount(),this.el;this.uppy.log(`Not installing ${n}`);let s=`Invalid target option given to ${n}.`;throw typeof t=="function"?s+=" 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.":s+="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(s)}render(t,d){throw new Error("Extend the render method to add your plugin to a DOM element")}update(t){var d;this.el!=null&&((d=j(this,k0))==null||d.call(this,t))}unmount(){var t;this.isTargetDOMEl&&((t=this.el)==null||t.remove()),this.onUnmount()}onMount(){}onUnmount(){}};k0=new WeakMap;let Ln=PW;const pB={version:"5.0.0"};class mr{constructor(){dl(this,AW);E(this,"state",{});dl(this,mU,new Set)}getState(){return this.state}setState(l){const t={...this.state},d={...this.state,...l};this.state=d,cl(this,AW,ly).call(this,t,d,l)}subscribe(l){return j(this,mU).add(l),()=>{j(this,mU).delete(l)}}}mU=new WeakMap,AW=new WeakSet,ly=function(...l){j(this,mU).forEach(t=>{t(...l)})},E(mr,"VERSION",pB.version);var YQ,Rr;function kQ(){if(Rr)return YQ;Rr=1;function e(l){var t=typeof l;return l!=null&&(t=="object"||t=="function")}return YQ=e,YQ}var zQ,Nr;function MB(){if(Nr)return zQ;Nr=1;var e=typeof ms=="object"&&ms&&ms.Object===Object&&ms;return zQ=e,zQ}var LQ,br;function ur(){if(br)return LQ;br=1;var e=MB(),l=typeof self=="object"&&self&&self.Object===Object&&self,t=e||l||Function("return this")();return LQ=t,LQ}var IQ,rr;function SB(){if(rr)return IQ;rr=1;var e=ur(),l=function(){return e.Date.now()};return IQ=l,IQ}var DQ,pr;function JB(){if(pr)return DQ;pr=1;var e=/\s/;function l(t){for(var d=t.length;d--&&e.test(t.charAt(d)););return d}return DQ=l,DQ}var wQ,Mr;function TB(){if(Mr)return wQ;Mr=1;var e=JB(),l=/^\s+/;function t(d){return d&&d.slice(0,e(d)+1).replace(l,"")}return wQ=t,wQ}var EQ,Sr;function Jr(){if(Sr)return EQ;Sr=1;var e=ur(),l=e.Symbol;return EQ=l,EQ}var CQ,Tr;function GB(){if(Tr)return CQ;Tr=1;var e=Jr(),l=Object.prototype,t=l.hasOwnProperty,d=l.toString,n=e?e.toStringTag:void 0;function a(i){var s=t.call(i,n),c=i[n];try{i[n]=void 0;var F=!0}catch{}var h=d.call(i);return F&&(s?i[n]=c:delete i[n]),h}return CQ=a,CQ}var xQ,Gr;function XB(){if(Gr)return xQ;Gr=1;var e=Object.prototype,l=e.toString;function t(d){return l.call(d)}return xQ=t,xQ}var gQ,Xr;function yB(){if(Xr)return gQ;Xr=1;var e=Jr(),l=GB(),t=XB(),d="[object Null]",n="[object Undefined]",a=e?e.toStringTag:void 0;function i(s){return s==null?s===void 0?n:d:a&&a in Object(s)?l(s):t(s)}return gQ=i,gQ}var jQ,yr;function BB(){if(yr)return jQ;yr=1;function e(l){return l!=null&&typeof l=="object"}return jQ=e,jQ}var OQ,Br;function YB(){if(Br)return OQ;Br=1;var e=yB(),l=BB(),t="[object Symbol]";function d(n){return typeof n=="symbol"||l(n)&&e(n)==t}return OQ=d,OQ}var vQ,Yr;function kB(){if(Yr)return vQ;Yr=1;var e=TB(),l=kQ(),t=YB(),d=NaN,n=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,i=/^0o[0-7]+$/i,s=parseInt;function c(F){if(typeof F=="number")return F;if(t(F))return d;if(l(F)){var h=typeof F.valueOf=="function"?F.valueOf():F;F=l(h)?h+"":h}if(typeof F!="string")return F===0?F:+F;F=e(F);var o=a.test(F);return o||i.test(F)?s(F.slice(2),o?2:8):n.test(F)?d:+F}return vQ=c,vQ}var KQ,kr;function zr(){if(kr)return KQ;kr=1;var e=kQ(),l=SB(),t=kB(),d="Expected a function",n=Math.max,a=Math.min;function i(s,c,F){var h,o,V,W,Q,m,R=0,r=!1,b=!1,u=!0;if(typeof s!="function")throw new TypeError(d);c=t(c)||0,e(F)&&(r=!!F.leading,b="maxWait"in F,V=b?n(t(F.maxWait)||0,c):V,u="trailing"in F?!!F.trailing:u);function J(I){var P=h,H=o;return h=o=void 0,R=I,W=s.apply(H,P),W}function G(I){return R=I,Q=setTimeout(k,c),r?J(I):W}function T(I){var P=I-m,H=I-R,Y=c-P;return b?a(Y,V-H):Y}function y(I){var P=I-m,H=I-R;return m===void 0||P>=c||P<0||b&&H>=V}function k(){var I=l();if(y(I))return X(I);Q=setTimeout(k,T(I))}function X(I){return Q=void 0,u&&h?J(I):(h=o=void 0,W)}function L(){Q!==void 0&&clearTimeout(Q),R=0,h=m=o=Q=void 0}function D(){return Q===void 0?W:X(l())}function C(){var I=l(),P=y(I);if(h=arguments,o=this,m=I,P){if(Q===void 0)return G(m);if(b)return clearTimeout(Q),Q=setTimeout(k,c),J(m)}return Q===void 0&&(Q=setTimeout(k,c)),W}return C.cancel=L,C.flush=D,C}return KQ=i,KQ}var fQ,Lr;function zB(){if(Lr)return fQ;Lr=1;var e=zr(),l=kQ(),t="Expected a function";function d(n,a,i){var s=!0,c=!0;if(typeof n!="function")throw new TypeError(t);return l(i)&&(s="leading"in i?!!i.leading:s,c="trailing"in i?!!i.trailing:c),e(n,a,{leading:s,maxWait:a,trailing:c})}return fQ=d,fQ}var LB=zB();const IB=Ca(LB);var HQ,Ir;function DB(){return Ir||(Ir=1,HQ=function(){var l={},t=l._fns={};l.emit=function(i,s,c,F,h,o,V){var W=d(i);W.length&&n(i,W,[s,c,F,h,o,V])},l.on=function(i,s){t[i]||(t[i]=[]),t[i].push(s)},l.once=function(i,s){function c(){s.apply(this,arguments),l.off(i,c)}this.on(i,c)},l.off=function(i,s){var c=[];if(i&&s){var F=this._fns[i],h=0,o=F?F.length:0;for(h;h<o;h++)F[h]!==s&&c.push(F[h])}c.length?this._fns[i]=c:delete this._fns[i]};function d(a){var i=t[a]?t[a]:[],s=a.indexOf(":"),c=s===-1?[a]:[a.substring(0,s),a.substring(s+1)],F=Object.keys(t),h=0,o=F.length;for(h;h<o;h++){var V=F[h];if(V==="*"&&(i=i.concat(t[V])),c.length===2&&c[0]===V){i=i.concat(t[V]);break}}return i}function n(a,i,s){var c=0,F=i.length;for(c;c<F&&i[c];c++)i[c].event=a,i[c].apply(i[c],s)}return l}),HQ}var wB=DB();const EB=Ca(wB);let CB="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",PQ=(e=21)=>{let l="",t=e|0;for(;t--;)l+=CB[Math.random()*64|0];return l};const xB={version:"5.2.0"};function gB(e,l){return l.name?l.name:e.split("/")[0]==="image"?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}const jB={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 OB(e){if(e==null&&typeof navigator<"u"&&(e=navigator.userAgent),!e)return!0;const l=/Edge\/(\d+\.\d+)/.exec(e);if(!l)return!0;const d=l[1].split(".",2),n=parseInt(d[0],10),a=parseInt(d[1],10);return n<15||n===15&&a<15063||n>18||n===18&&a>=18218}const lh={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},qW=class qW{constructor(l){dl(this,ol);dl(this,hd,Object.create(null));dl(this,od);dl(this,z0);dl(this,ns,EB());dl(this,RU,new Set);dl(this,NU,new Set);dl(this,as,new Set);E(this,"defaultLocale");E(this,"locale");E(this,"opts");E(this,"store");E(this,"i18n");E(this,"i18nArray");E(this,"scheduledAutoProceed",null);E(this,"wasOffline",!1);dl(this,_W,(l,t)=>{const d=l?this.getFile(l.id):void 0;if(l==null||!d){this.log(`Not setting progress for a file that has been removed: ${l==null?void 0:l.id}`);return}if(d.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${l.id}`);return}const n={bytesTotal:t.bytesTotal,percentage:t.bytesTotal!=null&&Number.isFinite(t.bytesTotal)&&t.bytesTotal>0?Math.round(t.bytesUploaded/t.bytesTotal*100):void 0};d.progress.uploadStarted!=null?this.setFileState(l.id,{progress:{...d.progress,...n,bytesUploaded:t.bytesUploaded}}):this.setFileState(l.id,{progress:{...d.progress,...n}}),j(this,is).call(this)});dl(this,is,IB(()=>cl(this,ol,Wu).call(this),500,{leading:!0,trailing:!0}));dl(this,Ya,this.updateOnlineStatus.bind(this));dl(this,L0,new Map);this.defaultLocale=jB;const t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:bB,meta:{},onBeforeFileAdded:(n,a)=>!Object.hasOwn(a,n.id),onBeforeUpload:n=>n,store:new mr,logger:hB,infoTimeout:5e3},d={...t,...l};this.opts={...d,restrictions:{...t.restrictions,...l==null?void 0:l.restrictions}},l!=null&&l.logger&&l.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"):l!=null&&l.debug&&(this.opts.logger=oB),this.log(`Using Core v${qW.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...lh,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:OB(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),Fl(this,od,new uB(()=>this.opts,()=>this.i18n)),Fl(this,z0,this.store.subscribe((n,a,i)=>{this.emit("state-update",n,a,i),this.updateAll(a)})),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),cl(this,ol,ay).call(this)}emit(l,...t){j(this,ns).emit(l,...t)}on(l,t){return j(this,ns).on(l,t),this}once(l,t){return j(this,ns).once(l,t),this}off(l,t){return j(this,ns).off(l,t),this}updateAll(l){this.iteratePlugins(t=>{t.update(l)})}setState(l){this.store.setState(l)}getState(){return this.store.getState()}patchFilesState(l){const t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(l).map(([d,n])=>[d,{...t[d],...n}]))}})}setFileState(l,t){if(!this.getState().files[l])throw new Error(`Can’t set state for ${l} (the file could have been removed)`);this.patchFilesState({[l]:t})}i18nInit(){const l=d=>this.log(`Missing i18n string: ${d}`,"error"),t=new Du([this.defaultLocale,this.opts.locale],{onMissingKey:l});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(l){this.opts={...this.opts,...l,restrictions:{...this.opts.restrictions,...l==null?void 0:l.restrictions}},l.meta&&this.setMeta(l.meta),this.i18nInit(),l.locale&&this.iteratePlugins(t=>{t.setOptions(l)}),this.setState(void 0)}resetProgress(){const l={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},d=Object.create(null);Object.keys(t).forEach(n=>{d[n]={...t[n],progress:{...t[n].progress,...l},tus:void 0,transloadit:void 0}}),this.setState({files:d,...lh})}clear(){const{capabilities:l,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!l.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...lh,files:{}})}addPreProcessor(l){j(this,RU).add(l)}removePreProcessor(l){return j(this,RU).delete(l)}addPostProcessor(l){j(this,as).add(l)}removePostProcessor(l){return j(this,as).delete(l)}addUploader(l){j(this,NU).add(l)}removeUploader(l){return j(this,NU).delete(l)}setMeta(l){const t={...this.getState().meta,...l},d={...this.getState().files};Object.keys(d).forEach(n=>{d[n]={...d[n],meta:{...d[n].meta,...l}}}),this.log("Adding metadata:"),this.log(l),this.setState({meta:t,files:d})}setFileMeta(l,t){const d={...this.getState().files};if(!d[l]){this.log(`Was trying to set metadata for a file that has been removed: ${l}`);return}const n={...d[l].meta,...t};d[l]={...d[l],meta:n},this.setState({files:d})}getFile(l){return this.getState().files[l]}getFiles(){const{files:l}=this.getState();return Object.values(l)}getFilesByIds(l){return l.map(t=>this.getFile(t))}getObjectOfFilesPerState(){const{files:l,totalProgress:t,error:d}=this.getState(),n=Object.values(l),a=[],i=[],s=[],c=[],F=[],h=[],o=[],V=[],W=[];for(const Q of n){const{progress:m}=Q;!m.uploadComplete&&m.uploadStarted&&(a.push(Q),Q.isPaused||V.push(Q)),m.uploadStarted||i.push(Q),(m.uploadStarted||m.preprocess||m.postprocess)&&s.push(Q),m.uploadStarted&&c.push(Q),Q.isPaused&&F.push(Q),m.uploadComplete&&h.push(Q),Q.error&&o.push(Q),(m.preprocess||m.postprocess)&&W.push(Q)}return{newFiles:i,startedFiles:s,uploadStartedFiles:c,pausedFiles:F,completeFiles:h,erroredFiles:o,inProgressFiles:a,inProgressNotPausedFiles:V,processingFiles:W,isUploadStarted:c.length>0,isAllComplete:t===100&&h.length===n.length&&W.length===0,isAllErrored:!!d&&o.length===n.length,isAllPaused:a.length!==0&&F.length===a.length,isUploadInProgress:a.length>0,isSomeGhost:n.some(Q=>Q.isGhost)}}validateRestrictions(l,t=this.getFiles()){try{j(this,od).validate(t,[l])}catch(d){return d}return null}validateSingleFile(l){try{j(this,od).validateSingleFile(l)}catch(t){return t.message}return null}validateAggregateRestrictions(l){const t=this.getFiles();try{j(this,od).validateAggregateRestrictions(t,l)}catch(d){return d.message}return null}checkIfFileAlreadyExists(l){const{files:t}=this.getState();return!!(t[l]&&!t[l].isGhost)}addFile(l){const{nextFilesState:t,validFilesToAdd:d,errors:n}=cl(this,ol,hu).call(this,[l]),a=n.filter(s=>s.isRestriction);if(cl(this,ol,hs).call(this,a),n.length>0)throw n[0];this.setState({files:t});const[i]=d;return this.emit("file-added",i),this.emit("files-added",d),this.log(`Added file: ${i.name}, ${i.id}, mime type: ${i.type}`),cl(this,ol,Fu).call(this),i.id}addFiles(l){const{nextFilesState:t,validFilesToAdd:d,errors:n}=cl(this,ol,hu).call(this,l),a=n.filter(s=>s.isRestriction);cl(this,ol,hs).call(this,a);const i=n.filter(s=>!s.isRestriction);if(i.length>0){let s=`Multiple errors occurred while adding files:
10
+ */function Iu(e,l){const t=/\$/g,d="$$$$";let n=[e];if(l==null)return n;for(const a of Object.keys(l))if(a!=="_"){let i=l[a];typeof i=="string"&&(i=t[Symbol.replace](i,d)),n=Ay(n,new RegExp(`%\\{${a}\\}`,"g"),i)}return n}const _y=e=>{throw new Error(`missing string: ${e}`)};class Du{constructor(l,{onMissingKey:t=_y}={}){dl(this,B0);E(this,"locale");dl(this,y0);this.locale={strings:{},pluralize(d){return d===1?0:1}},Array.isArray(l)?l.forEach(cl(this,B0,Uu),this):cl(this,B0,Uu).call(this,l),Fl(this,y0,t)}translate(l,t){return this.translateArray(l,t).join("")}translateArray(l,t){let d=this.locale.strings[l];if(d==null&&(j(this,y0).call(this,l),d=l),typeof d=="object"){if(t&&typeof t.smart_count<"u"){const a=this.locale.pluralize(t.smart_count);return Iu(d[a],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof d!="string")throw new Error("string was not a string");return Iu(d,t)}}y0=new WeakMap,B0=new WeakSet,Uu=function(l){if(!(l!=null&&l.strings))return;const t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...l.strings},pluralize:l.pluralize||t.pluralize})};const QQ="...";function wu(e,l){if(l===0)return"";if(e.length<=l)return e;if(l<=QQ.length+1)return`${e.slice(0,l-1)}…`;const t=l-QQ.length,d=Math.ceil(t/2),n=Math.floor(t/2);return e.slice(0,d)+QQ+e.slice(-n)}var BU,El,Eu,Ea,Cu,xu,gu,ju,mQ,RQ,NQ,YU={},Ou=[],qy=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,kU=Array.isArray;function Qd(e,l){for(var t in l)e[t]=l[t];return e}function bQ(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function uQ(e,l,t){var d,n,a,i={};for(a in l)a=="key"?d=l[a]:a=="ref"?n=l[a]:i[a]=l[a];if(arguments.length>2&&(i.children=arguments.length>3?BU.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)i[a]===void 0&&(i[a]=e.defaultProps[a]);return zU(e,i,d,n,null)}function zU(e,l,t,d,n){var a={type:e,props:l,key:t,ref:d,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++Eu,__i:-1,__u:0};return n==null&&El.vnode!=null&&El.vnode(a),a}function $y(){return{current:null}}function Pe(e){return e.children}function se(e,l){this.props=e,this.context=l}function Vs(e,l){if(l==null)return e.__?Vs(e.__,e.__i+1):null;for(var t;l<e.__k.length;l++)if((t=e.__k[l])!=null&&t.__e!=null)return t.__e;return typeof e.type=="function"?Vs(e):null}function vu(e){var l,t;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,l=0;l<e.__k.length;l++)if((t=e.__k[l])!=null&&t.__e!=null){e.__e=e.__c.base=t.__e;break}return vu(e)}}function Ku(e){(!e.__d&&(e.__d=!0)&&Ea.push(e)&&!A0.__r++||Cu!=El.debounceRendering)&&((Cu=El.debounceRendering)||xu)(A0)}function A0(){for(var e,l,t,d,n,a,i,s=1;Ea.length;)Ea.length>s&&Ea.sort(gu),e=Ea.shift(),s=Ea.length,e.__d&&(t=void 0,d=void 0,n=(d=(l=e).__v).__e,a=[],i=[],l.__P&&((t=Qd({},d)).__v=d.__v+1,El.vnode&&El.vnode(t),rQ(l.__P,t,d,l.__n,l.__P.namespaceURI,32&d.__u?[n]:null,a,n??Vs(d),!!(32&d.__u),i),t.__v=d.__v,t.__.__k[t.__i]=t,_u(a,t,i),d.__e=d.__=null,t.__e!=n&&vu(t)));A0.__r=0}function fu(e,l,t,d,n,a,i,s,c,F,h){var o,V,W,Q,m,R,r,b=d&&d.__k||Ou,u=l.length;for(c=lB(t,l,b,c,u),o=0;o<u;o++)(W=t.__k[o])!=null&&(V=W.__i==-1?YU:b[W.__i]||YU,W.__i=o,R=rQ(e,W,V,n,a,i,s,c,F,h),Q=W.__e,W.ref&&V.ref!=W.ref&&(V.ref&&MQ(V.ref,null,W),h.push(W.ref,W.__c||Q,W)),m==null&&Q!=null&&(m=Q),(r=!!(4&W.__u))||V.__k===W.__k?c=Hu(W,c,e,r):typeof W.type=="function"&&R!==void 0?c=R:Q&&(c=Q.nextSibling),W.__u&=-7);return t.__e=m,c}function lB(e,l,t,d,n){var a,i,s,c,F,h=t.length,o=h,V=0;for(e.__k=new Array(n),a=0;a<n;a++)(i=l[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[a]=zU(null,i,null,null,null):kU(i)?i=e.__k[a]=zU(Pe,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[a]=zU(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[a]=i,c=a+V,i.__=e,i.__b=e.__b+1,s=null,(F=i.__i=tB(i,t,c,o))!=-1&&(o--,(s=t[F])&&(s.__u|=2)),s==null||s.__v==null?(F==-1&&(n>h?V--:n<h&&V++),typeof i.type!="function"&&(i.__u|=4)):F!=c&&(F==c-1?V--:F==c+1?V++:(F>c?V--:V++,i.__u|=4))):e.__k[a]=null;if(o)for(a=0;a<h;a++)(s=t[a])!=null&&(2&s.__u)==0&&(s.__e==d&&(d=Vs(s)),$u(s,s));return d}function Hu(e,l,t,d){var n,a;if(typeof e.type=="function"){for(n=e.__k,a=0;n&&a<n.length;a++)n[a]&&(n[a].__=e,l=Hu(n[a],l,t,d));return l}e.__e!=l&&(d&&(l&&e.type&&!l.parentNode&&(l=Vs(e)),t.insertBefore(e.__e,l||null)),l=e.__e);do l=l&&l.nextSibling;while(l!=null&&l.nodeType==8);return l}function kn(e,l){return l=l||[],e==null||typeof e=="boolean"||(kU(e)?e.some(function(t){kn(t,l)}):l.push(e)),l}function tB(e,l,t,d){var n,a,i,s=e.key,c=e.type,F=l[t],h=F!=null&&(2&F.__u)==0;if(F===null&&s==null||h&&s==F.key&&c==F.type)return t;if(d>(h?1:0)){for(n=t-1,a=t+1;n>=0||a<l.length;)if((F=l[i=n>=0?n--:a++])!=null&&(2&F.__u)==0&&s==F.key&&c==F.type)return i}return-1}function Pu(e,l,t){l[0]=="-"?e.setProperty(l,t??""):e[l]=t==null?"":typeof t!="number"||qy.test(l)?t:t+"px"}function _0(e,l,t,d,n){var a,i;l:if(l=="style")if(typeof t=="string")e.style.cssText=t;else{if(typeof d=="string"&&(e.style.cssText=d=""),d)for(l in d)t&&l in t||Pu(e.style,l,"");if(t)for(l in t)d&&t[l]==d[l]||Pu(e.style,l,t[l])}else if(l[0]=="o"&&l[1]=="n")a=l!=(l=l.replace(ju,"$1")),i=l.toLowerCase(),l=i in e||l=="onFocusOut"||l=="onFocusIn"?i.slice(2):l.slice(2),e.l||(e.l={}),e.l[l+a]=t,t?d?t.u=d.u:(t.u=mQ,e.addEventListener(l,a?NQ:RQ,a)):e.removeEventListener(l,a?NQ:RQ,a);else{if(n=="http://www.w3.org/2000/svg")l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(l!="width"&&l!="height"&&l!="href"&&l!="list"&&l!="form"&&l!="tabIndex"&&l!="download"&&l!="rowSpan"&&l!="colSpan"&&l!="role"&&l!="popover"&&l in e)try{e[l]=t??"";break l}catch{}typeof t=="function"||(t==null||t===!1&&l[4]!="-"?e.removeAttribute(l):e.setAttribute(l,l=="popover"&&t==1?"":t))}}function Au(e){return function(l){if(this.l){var t=this.l[l.type+e];if(l.t==null)l.t=mQ++;else if(l.t<t.u)return;return t(El.event?El.event(l):l)}}}function rQ(e,l,t,d,n,a,i,s,c,F){var h,o,V,W,Q,m,R,r,b,u,J,G,T,y,k,X,L,D=l.type;if(l.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),a=[s=l.__e=t.__e]),(h=El.__b)&&h(l);l:if(typeof D=="function")try{if(r=l.props,b="prototype"in D&&D.prototype.render,u=(h=D.contextType)&&d[h.__c],J=h?u?u.props.value:h.__:d,t.__c?R=(o=l.__c=t.__c).__=o.__E:(b?l.__c=o=new D(r,J):(l.__c=o=new se(r,J),o.constructor=D,o.render=dB),u&&u.sub(o),o.state||(o.state={}),o.__n=d,V=o.__d=!0,o.__h=[],o._sb=[]),b&&o.__s==null&&(o.__s=o.state),b&&D.getDerivedStateFromProps!=null&&(o.__s==o.state&&(o.__s=Qd({},o.__s)),Qd(o.__s,D.getDerivedStateFromProps(r,o.__s))),W=o.props,Q=o.state,o.__v=l,V)b&&D.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),b&&o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else{if(b&&D.getDerivedStateFromProps==null&&r!==W&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(r,J),l.__v==t.__v||!o.__e&&o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(r,o.__s,J)===!1){for(l.__v!=t.__v&&(o.props=r,o.state=o.__s,o.__d=!1),l.__e=t.__e,l.__k=t.__k,l.__k.some(function(C){C&&(C.__=l)}),G=0;G<o._sb.length;G++)o.__h.push(o._sb[G]);o._sb=[],o.__h.length&&i.push(o);break l}o.componentWillUpdate!=null&&o.componentWillUpdate(r,o.__s,J),b&&o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(W,Q,m)})}if(o.context=J,o.props=r,o.__P=e,o.__e=!1,T=El.__r,y=0,b){for(o.state=o.__s,o.__d=!1,T&&T(l),h=o.render(o.props,o.state,o.context),k=0;k<o._sb.length;k++)o.__h.push(o._sb[k]);o._sb=[]}else do o.__d=!1,T&&T(l),h=o.render(o.props,o.state,o.context),o.state=o.__s;while(o.__d&&++y<25);o.state=o.__s,o.getChildContext!=null&&(d=Qd(Qd({},d),o.getChildContext())),b&&!V&&o.getSnapshotBeforeUpdate!=null&&(m=o.getSnapshotBeforeUpdate(W,Q)),X=h,h!=null&&h.type===Pe&&h.key==null&&(X=qu(h.props.children)),s=fu(e,kU(X)?X:[X],l,t,d,n,a,i,s,c,F),o.base=l.__e,l.__u&=-161,o.__h.length&&i.push(o),R&&(o.__E=o.__=null)}catch(C){if(l.__v=null,c||a!=null)if(C.then){for(l.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,l.__e=s}else{for(L=a.length;L--;)bQ(a[L]);pQ(l)}else l.__e=t.__e,l.__k=t.__k,C.then||pQ(l);El.__e(C,l,t)}else a==null&&l.__v==t.__v?(l.__k=t.__k,l.__e=t.__e):s=l.__e=eB(t.__e,l,t,d,n,a,i,c,F);return(h=El.diffed)&&h(l),128&l.__u?void 0:s}function pQ(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(pQ)}function _u(e,l,t){for(var d=0;d<t.length;d++)MQ(t[d],t[++d],t[++d]);El.__c&&El.__c(l,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(a){a.call(n)})}catch(a){El.__e(a,n.__v)}})}function qu(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:kU(e)?e.map(qu):Qd({},e)}function eB(e,l,t,d,n,a,i,s,c){var F,h,o,V,W,Q,m,R=t.props||YU,r=l.props,b=l.type;if(b=="svg"?n="http://www.w3.org/2000/svg":b=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),a!=null){for(F=0;F<a.length;F++)if((W=a[F])&&"setAttribute"in W==!!b&&(b?W.localName==b:W.nodeType==3)){e=W,a[F]=null;break}}if(e==null){if(b==null)return document.createTextNode(r);e=document.createElementNS(n,b,r.is&&r),s&&(El.__m&&El.__m(l,a),s=!1),a=null}if(b==null)R===r||s&&e.data==r||(e.data=r);else{if(a=a&&BU.call(e.childNodes),!s&&a!=null)for(R={},F=0;F<e.attributes.length;F++)R[(W=e.attributes[F]).name]=W.value;for(F in R)if(W=R[F],F!="children"){if(F=="dangerouslySetInnerHTML")o=W;else if(!(F in r)){if(F=="value"&&"defaultValue"in r||F=="checked"&&"defaultChecked"in r)continue;_0(e,F,null,W,n)}}for(F in r)W=r[F],F=="children"?V=W:F=="dangerouslySetInnerHTML"?h=W:F=="value"?Q=W:F=="checked"?m=W:s&&typeof W!="function"||R[F]===W||_0(e,F,W,R[F],n);if(h)s||o&&(h.__html==o.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),l.__k=[];else if(o&&(e.innerHTML=""),fu(l.type=="template"?e.content:e,kU(V)?V:[V],l,t,d,b=="foreignObject"?"http://www.w3.org/1999/xhtml":n,a,i,a?a[0]:t.__k&&Vs(t,0),s,c),a!=null)for(F=a.length;F--;)bQ(a[F]);s||(F="value",b=="progress"&&Q==null?e.removeAttribute("value"):Q!=null&&(Q!==e[F]||b=="progress"&&!Q||b=="option"&&Q!=R[F])&&_0(e,F,Q,R[F],n),F="checked",m!=null&&m!=e[F]&&_0(e,F,m,R[F],n))}return e}function MQ(e,l,t){try{if(typeof e=="function"){var d=typeof e.__u=="function";d&&e.__u(),d&&l==null||(e.__u=e(l))}else e.current=l}catch(n){El.__e(n,t)}}function $u(e,l,t){var d,n;if(El.unmount&&El.unmount(e),(d=e.ref)&&(d.current&&d.current!=e.__e||MQ(d,null,l)),(d=e.__c)!=null){if(d.componentWillUnmount)try{d.componentWillUnmount()}catch(a){El.__e(a,l)}d.base=d.__P=null}if(d=e.__k)for(n=0;n<d.length;n++)d[n]&&$u(d[n],l,t||typeof e.type!="function");t||bQ(e.__e),e.__c=e.__=e.__e=void 0}function dB(e,l,t){return this.constructor(e,t)}function lr(e,l,t){var d,n,a,i;l==document&&(l=document.documentElement),El.__&&El.__(e,l),n=(d=!1)?null:l.__k,a=[],i=[],rQ(l,e=l.__k=uQ(Pe,null,[e]),n||YU,YU,l.namespaceURI,n?null:l.firstChild?BU.call(l.childNodes):null,a,n?n.__e:l.firstChild,d,i),_u(a,e,i)}function tr(e,l,t){var d,n,a,i,s=Qd({},e.props);for(a in e.type&&e.type.defaultProps&&(i=e.type.defaultProps),l)a=="key"?d=l[a]:a=="ref"?n=l[a]:s[a]=l[a]===void 0&&i!=null?i[a]:l[a];return arguments.length>2&&(s.children=arguments.length>3?BU.call(arguments,2):t),zU(e.type,s,d||e.key,n||e.ref,null)}BU=Ou.slice,El={__e:function(e,l,t,d){for(var n,a,i;l=l.__;)if((n=l.__c)&&!n.__)try{if((a=n.constructor)&&a.getDerivedStateFromError!=null&&(n.setState(a.getDerivedStateFromError(e)),i=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,d||{}),i=n.__d),i)return n.__E=n}catch(s){e=s}throw e}},Eu=0,se.prototype.setState=function(e,l){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Qd({},this.state),typeof e=="function"&&(e=e(Qd({},t),this.props)),e&&Qd(t,e),e!=null&&this.__v&&(l&&this._sb.push(l),Ku(this))},se.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ku(this))},se.prototype.render=Pe,Ea=[],xu=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,gu=function(e,l){return e.__v.__b-l.__v.__b},A0.__r=0,ju=/(PointerCapture)$|Capture$/i,mQ=0,RQ=Au(!1),NQ=Au(!0);var nB=0;function S(e,l,t,d,n,a){l||(l={});var i,s,c=l;if("ref"in c)for(s in c={},l)s=="ref"?i=l[s]:c[s]=l[s];var F={type:e,props:c,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--nB,__i:-1,__u:0,__source:n,__self:a};if(typeof e=="function"&&(i=e.defaultProps))for(s in i)c[s]===void 0&&(c[s]=i[s]);return El.vnode&&El.vnode(F),F}var LU,tt,SQ,er,IU=0,dr=[],at=El,nr=at.__b,ar=at.__r,ir=at.diffed,sr=at.__c,cr=at.unmount,Ur=at.__;function JQ(e,l){at.__h&&at.__h(tt,e,IU||l),IU=0;var t=tt.__H||(tt.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function Ws(e){return IU=1,aB(hr,e)}function aB(e,l,t){var d=JQ(LU++,2);if(d.t=e,!d.__c&&(d.__=[hr(void 0,l),function(s){var c=d.__N?d.__N[0]:d.__[0],F=d.t(c,s);c!==F&&(d.__N=[F,d.__[1]],d.__c.setState({}))}],d.__c=tt,!tt.__f)){var n=function(s,c,F){if(!d.__c.__H)return!0;var h=d.__c.__H.__.filter(function(V){return!!V.__c});if(h.every(function(V){return!V.__N}))return!a||a.call(this,s,c,F);var o=d.__c.props!==s;return h.forEach(function(V){if(V.__N){var W=V.__[0];V.__=V.__N,V.__N=void 0,W!==V.__[0]&&(o=!0)}}),a&&a.call(this,s,c,F)||o};tt.__f=!0;var a=tt.shouldComponentUpdate,i=tt.componentWillUpdate;tt.componentWillUpdate=function(s,c,F){if(this.__e){var h=a;a=void 0,n(s,c,F),a=h}i&&i.call(this,s,c,F)},tt.shouldComponentUpdate=n}return d.__N||d.__}function Qs(e,l){var t=JQ(LU++,3);!at.__s&&Fr(t.__H,l)&&(t.__=e,t.u=l,tt.__H.__h.push(t))}function zn(e){return IU=5,TQ(function(){return{current:e}},[])}function TQ(e,l){var t=JQ(LU++,7);return Fr(t.__H,l)&&(t.__=e(),t.__H=l,t.__h=e),t.__}function q0(e,l){return IU=8,TQ(function(){return e},l)}function iB(){for(var e;e=dr.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach($0),e.__H.__h.forEach(GQ),e.__H.__h=[]}catch(l){e.__H.__h=[],at.__e(l,e.__v)}}at.__b=function(e){tt=null,nr&&nr(e)},at.__=function(e,l){e&&l.__k&&l.__k.__m&&(e.__m=l.__k.__m),Ur&&Ur(e,l)},at.__r=function(e){ar&&ar(e),LU=0;var l=(tt=e.__c).__H;l&&(SQ===tt?(l.__h=[],tt.__h=[],l.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(l.__h.forEach($0),l.__h.forEach(GQ),l.__h=[],LU=0)),SQ=tt},at.diffed=function(e){ir&&ir(e);var l=e.__c;l&&l.__H&&(l.__H.__h.length&&(dr.push(l)!==1&&er===at.requestAnimationFrame||((er=at.requestAnimationFrame)||sB)(iB)),l.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),SQ=tt=null},at.__c=function(e,l){l.some(function(t){try{t.__h.forEach($0),t.__h=t.__h.filter(function(d){return!d.__||GQ(d)})}catch(d){l.some(function(n){n.__h&&(n.__h=[])}),l=[],at.__e(d,t.__v)}}),sr&&sr(e,l)},at.unmount=function(e){cr&&cr(e);var l,t=e.__c;t&&t.__H&&(t.__H.__.forEach(function(d){try{$0(d)}catch(n){l=n}}),t.__H=void 0,l&&at.__e(l,t.__v))};var Zr=typeof requestAnimationFrame=="function";function sB(e){var l,t=function(){clearTimeout(d),Zr&&cancelAnimationFrame(l),setTimeout(e)},d=setTimeout(t,35);Zr&&(l=requestAnimationFrame(t))}function $0(e){var l=tt,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),tt=l}function GQ(e){var l=tt;e.__c=e.__(),tt=l}function Fr(e,l){return!e||e.length!==l.length||l.some(function(t,d){return t!==e[d]})}function hr(e,l){return typeof l=="function"?l(e):l}const cB={position:"relative",width:"100%",minHeight:"100%"},UB={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};function ZB({data:e,rowHeight:l,renderRow:t,overscanCount:d=10,padding:n=4,...a}){const i=zn(null),[s,c]=Ws(0),[F,h]=Ws(0);Qs(()=>{function b(){i.current!=null&&F!==i.current.offsetHeight&&h(i.current.offsetHeight)}return b(),window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[F]);const o=q0(()=>{i.current&&c(i.current.scrollTop)},[]);let V=Math.floor(s/l),W=Math.floor(F/l);d&&(V=Math.max(0,V-V%d),W+=d);const Q=V+W+n,m=e.slice(V,Q),R={...cB,height:e.length*l},r={...UB,top:V*l};return S("div",{onScroll:o,ref:i,...a,children:S("div",{role:"presentation",style:R,children:S("div",{role:"presentation",style:r,children:m.map(t)})})})}class or{constructor(l,t){E(this,"uppy");E(this,"opts");E(this,"id");E(this,"defaultLocale");E(this,"i18n");E(this,"i18nArray");E(this,"type");E(this,"VERSION");this.uppy=l,this.opts=t??{}}getPluginState(){const{plugins:l}=this.uppy.getState();return(l==null?void 0:l[this.id])||{}}setPluginState(l){const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...l}}})}setOptions(l){this.opts={...this.opts,...l},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const l=new Du([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=l.translate.bind(l),this.i18nArray=l.translateArray.bind(l),this.setPluginState(void 0)}addTarget(l){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(l){}afterUpdate(){}}class FB{constructor(l){dl(this,Kd);dl(this,Y0,[]);Fl(this,Kd,l)}on(l,t){return j(this,Y0).push([l,t]),j(this,Kd).on(l,t)}remove(){for(const[l,t]of j(this,Y0).splice(0))j(this,Kd).off(l,t)}onFilePause(l,t){this.on("upload-pause",(d,n)=>{l===(d==null?void 0:d.id)&&t(n)})}onFileRemove(l,t){this.on("file-removed",d=>{l===d.id&&t(d.id)})}onPause(l,t){this.on("upload-pause",(d,n)=>{l===(d==null?void 0:d.id)&&t(n)})}onRetry(l,t){this.on("upload-retry",d=>{l===(d==null?void 0:d.id)&&t()})}onRetryAll(l,t){this.on("retry-all",()=>{j(this,Kd).getFile(l)&&t()})}onPauseAll(l,t){this.on("pause-all",()=>{j(this,Kd).getFile(l)&&t()})}onCancelAll(l,t){this.on("cancel-all",(...d)=>{j(this,Kd).getFile(l)&&t(...d)})}onResumeAll(l,t){this.on("resume-all",()=>{j(this,Kd).getFile(l)&&t()})}}Kd=new WeakMap,Y0=new WeakMap;const hB={debug:()=>{},warn:()=>{},error:(...e)=>console.error(`[Uppy] [${P0()}]`,...e)},oB={debug:(...e)=>console.debug(`[Uppy] [${P0()}]`,...e),warn:(...e)=>console.warn(`[Uppy] [${P0()}]`,...e),error:(...e)=>console.error(`[Uppy] [${P0()}]`,...e)};var ms=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ca(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var XQ,Vr;function VB(){return Vr||(Vr=1,XQ=function(l){if(typeof l!="number"||Number.isNaN(l))throw new TypeError(`Expected a number, got ${typeof l}`);const t=l<0;let d=Math.abs(l);if(t&&(d=-d),d===0)return"0 B";const n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],a=Math.min(Math.floor(Math.log(d)/Math.log(1024)),n.length-1),i=Number(d/1024**a),s=n[a];return`${i>=10||i%1===0?Math.round(i):i.toFixed(1)} ${s}`}),XQ}var WB=VB();const xa=Ca(WB);var yQ,Wr;function QB(){if(Wr)return yQ;Wr=1;function e(l,t){this.text=l=l||"",this.hasWild=~l.indexOf("*"),this.separator=t,this.parts=l.split(t)}return e.prototype.match=function(l){var t=!0,d=this.parts,n,a=d.length,i;if(typeof l=="string"||l instanceof String)if(!this.hasWild&&this.text!=l)t=!1;else{for(i=(l||"").split(this.separator),n=0;t&&n<a;n++)d[n]!=="*"&&(n<i.length?t=d[n]===i[n]:t=!1);t=t&&i}else if(typeof l.splice=="function")for(t=[],n=l.length;n--;)this.match(l[n])&&(t[t.length]=l[n]);else if(typeof l=="object"){t={};for(var s in l)this.match(s)&&(t[s]=l[s])}return t},yQ=function(l,t,d){var n=new e(l,d||/[\/\.]/);return typeof t<"u"?n.match(t):n},yQ}var BQ,Qr;function mB(){if(Qr)return BQ;Qr=1;var e=QB(),l=/[\/\+\.]/;return BQ=function(t,d){function n(a){var i=e(a,t,l);return i&&i.length>=2}return d?n(d.split(";")[0]):n},BQ}var RB=mB();const NB=Ca(RB),bB={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class Ae extends Error{constructor(t,d){super(t);E(this,"isUserFacing");E(this,"file");E(this,"isRestriction",!0);this.isUserFacing=(d==null?void 0:d.isUserFacing)??!0,d!=null&&d.file&&(this.file=d.file)}}class uB{constructor(l,t){E(this,"getI18n");E(this,"getOpts");this.getI18n=t,this.getOpts=()=>{var n;const d=l();if(((n=d.restrictions)==null?void 0:n.allowedFileTypes)!=null&&!Array.isArray(d.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return d}}validateAggregateRestrictions(l,t){const{maxTotalFileSize:d,maxNumberOfFiles:n}=this.getOpts().restrictions;if(n&&l.filter(i=>!i.isGhost).length+t.length>n)throw new Ae(`${this.getI18n()("youCanOnlyUploadX",{smart_count:n})}`);if(d){const a=[...l,...t].reduce((i,s)=>i+(s.size??0),0);if(a>d)throw new Ae(this.getI18n()("aggregateExceedsSize",{sizeAllowed:xa(d),size:xa(a)}))}}validateSingleFile(l){const{maxFileSize:t,minFileSize:d,allowedFileTypes:n}=this.getOpts().restrictions;if(n&&!n.some(i=>i.includes("/")?l.type?NB(l.type.replace(/;.*?$/,""),i):!1:i[0]==="."&&l.extension?l.extension.toLowerCase()===i.slice(1).toLowerCase():!1)){const i=n.join(", ");throw new Ae(this.getI18n()("youCanOnlyUploadFileTypes",{types:i}),{file:l})}if(t&&l.size!=null&&l.size>t)throw new Ae(this.getI18n()("exceedsSize",{size:xa(t),file:l.name??this.getI18n()("unnamed")}),{file:l});if(d&&l.size!=null&&l.size<d)throw new Ae(this.getI18n()("inferiorSize",{size:xa(d)}),{file:l})}validate(l,t){t.forEach(d=>{this.validateSingleFile(d)}),this.validateAggregateRestrictions(l,t)}validateMinNumberOfFiles(l){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(l).length<t)throw new Ae(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(l){const t=new Ae(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:l.name??this.getI18n()("unnamed")})),{requiredMetaFields:d}=this.getOpts().restrictions,n=[];for(const a of d)(!Object.hasOwn(l.meta,a)||l.meta[a]==="")&&n.push(a);return{missingFields:n,error:t}}}function rB(e){let l=null,t;return(...d)=>(t=d,l||(l=Promise.resolve().then(()=>(l=null,e(...t)))),l)}const PW=class PW extends or{constructor(){super(...arguments);dl(this,k0);E(this,"isTargetDOMEl");E(this,"el");E(this,"parent");E(this,"title")}getTargetPlugin(t){let d;if(typeof(t==null?void 0:t.addTarget)=="function")d=t,d instanceof PW||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:d,UIPlugin:PW}}));else if(typeof t=="function"){const n=t;this.uppy.iteratePlugins(a=>{a instanceof n&&(d=a)})}return d}mount(t,d){const n=d.id,a=ky(t);if(a){this.isTargetDOMEl=!0;const c=document.createElement("div");return c.classList.add("uppy-Root"),Fl(this,k0,rB(F=>{this.uppy.getPlugin(this.id)&&(lr(this.render(F,c),c),this.afterUpdate())})),this.uppy.log(`Installing ${n} to a DOM element '${t}'`),this.opts.replaceTargetContent&&(a.innerHTML=""),lr(this.render(this.uppy.getState(),c),c),this.el=c,a.appendChild(c),c.dir=this.opts.direction||jy(c)||"ltr",this.onMount(),this.el}const i=this.getTargetPlugin(t);if(i)return this.uppy.log(`Installing ${n} to ${i.id}`),this.parent=i,this.el=i.addTarget(d),this.onMount(),this.el;this.uppy.log(`Not installing ${n}`);let s=`Invalid target option given to ${n}.`;throw typeof t=="function"?s+=" 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.":s+="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(s)}render(t,d){throw new Error("Extend the render method to add your plugin to a DOM element")}update(t){var d;this.el!=null&&((d=j(this,k0))==null||d.call(this,t))}unmount(){var t;this.isTargetDOMEl&&((t=this.el)==null||t.remove()),this.onUnmount()}onMount(){}onUnmount(){}};k0=new WeakMap;let Ln=PW;const pB={version:"5.0.0"};class mr{constructor(){dl(this,AW);E(this,"state",{});dl(this,mU,new Set)}getState(){return this.state}setState(l){const t={...this.state},d={...this.state,...l};this.state=d,cl(this,AW,ly).call(this,t,d,l)}subscribe(l){return j(this,mU).add(l),()=>{j(this,mU).delete(l)}}}mU=new WeakMap,AW=new WeakSet,ly=function(...l){j(this,mU).forEach(t=>{t(...l)})},E(mr,"VERSION",pB.version);var YQ,Rr;function kQ(){if(Rr)return YQ;Rr=1;function e(l){var t=typeof l;return l!=null&&(t=="object"||t=="function")}return YQ=e,YQ}var zQ,Nr;function MB(){if(Nr)return zQ;Nr=1;var e=typeof ms=="object"&&ms&&ms.Object===Object&&ms;return zQ=e,zQ}var LQ,br;function ur(){if(br)return LQ;br=1;var e=MB(),l=typeof self=="object"&&self&&self.Object===Object&&self,t=e||l||Function("return this")();return LQ=t,LQ}var IQ,rr;function SB(){if(rr)return IQ;rr=1;var e=ur(),l=function(){return e.Date.now()};return IQ=l,IQ}var DQ,pr;function JB(){if(pr)return DQ;pr=1;var e=/\s/;function l(t){for(var d=t.length;d--&&e.test(t.charAt(d)););return d}return DQ=l,DQ}var wQ,Mr;function TB(){if(Mr)return wQ;Mr=1;var e=JB(),l=/^\s+/;function t(d){return d&&d.slice(0,e(d)+1).replace(l,"")}return wQ=t,wQ}var EQ,Sr;function Jr(){if(Sr)return EQ;Sr=1;var e=ur(),l=e.Symbol;return EQ=l,EQ}var CQ,Tr;function GB(){if(Tr)return CQ;Tr=1;var e=Jr(),l=Object.prototype,t=l.hasOwnProperty,d=l.toString,n=e?e.toStringTag:void 0;function a(i){var s=t.call(i,n),c=i[n];try{i[n]=void 0;var F=!0}catch{}var h=d.call(i);return F&&(s?i[n]=c:delete i[n]),h}return CQ=a,CQ}var xQ,Gr;function XB(){if(Gr)return xQ;Gr=1;var e=Object.prototype,l=e.toString;function t(d){return l.call(d)}return xQ=t,xQ}var gQ,Xr;function yB(){if(Xr)return gQ;Xr=1;var e=Jr(),l=GB(),t=XB(),d="[object Null]",n="[object Undefined]",a=e?e.toStringTag:void 0;function i(s){return s==null?s===void 0?n:d:a&&a in Object(s)?l(s):t(s)}return gQ=i,gQ}var jQ,yr;function BB(){if(yr)return jQ;yr=1;function e(l){return l!=null&&typeof l=="object"}return jQ=e,jQ}var OQ,Br;function YB(){if(Br)return OQ;Br=1;var e=yB(),l=BB(),t="[object Symbol]";function d(n){return typeof n=="symbol"||l(n)&&e(n)==t}return OQ=d,OQ}var vQ,Yr;function kB(){if(Yr)return vQ;Yr=1;var e=TB(),l=kQ(),t=YB(),d=NaN,n=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,i=/^0o[0-7]+$/i,s=parseInt;function c(F){if(typeof F=="number")return F;if(t(F))return d;if(l(F)){var h=typeof F.valueOf=="function"?F.valueOf():F;F=l(h)?h+"":h}if(typeof F!="string")return F===0?F:+F;F=e(F);var o=a.test(F);return o||i.test(F)?s(F.slice(2),o?2:8):n.test(F)?d:+F}return vQ=c,vQ}var KQ,kr;function zr(){if(kr)return KQ;kr=1;var e=kQ(),l=SB(),t=kB(),d="Expected a function",n=Math.max,a=Math.min;function i(s,c,F){var h,o,V,W,Q,m,R=0,r=!1,b=!1,u=!0;if(typeof s!="function")throw new TypeError(d);c=t(c)||0,e(F)&&(r=!!F.leading,b="maxWait"in F,V=b?n(t(F.maxWait)||0,c):V,u="trailing"in F?!!F.trailing:u);function J(I){var H=h,f=o;return h=o=void 0,R=I,W=s.apply(f,H),W}function G(I){return R=I,Q=setTimeout(k,c),r?J(I):W}function T(I){var H=I-m,f=I-R,Y=c-H;return b?a(Y,V-f):Y}function y(I){var H=I-m,f=I-R;return m===void 0||H>=c||H<0||b&&f>=V}function k(){var I=l();if(y(I))return X(I);Q=setTimeout(k,T(I))}function X(I){return Q=void 0,u&&h?J(I):(h=o=void 0,W)}function L(){Q!==void 0&&clearTimeout(Q),R=0,h=m=o=Q=void 0}function D(){return Q===void 0?W:X(l())}function C(){var I=l(),H=y(I);if(h=arguments,o=this,m=I,H){if(Q===void 0)return G(m);if(b)return clearTimeout(Q),Q=setTimeout(k,c),J(m)}return Q===void 0&&(Q=setTimeout(k,c)),W}return C.cancel=L,C.flush=D,C}return KQ=i,KQ}var fQ,Lr;function zB(){if(Lr)return fQ;Lr=1;var e=zr(),l=kQ(),t="Expected a function";function d(n,a,i){var s=!0,c=!0;if(typeof n!="function")throw new TypeError(t);return l(i)&&(s="leading"in i?!!i.leading:s,c="trailing"in i?!!i.trailing:c),e(n,a,{leading:s,maxWait:a,trailing:c})}return fQ=d,fQ}var LB=zB();const IB=Ca(LB);var HQ,Ir;function DB(){return Ir||(Ir=1,HQ=function(){var l={},t=l._fns={};l.emit=function(i,s,c,F,h,o,V){var W=d(i);W.length&&n(i,W,[s,c,F,h,o,V])},l.on=function(i,s){t[i]||(t[i]=[]),t[i].push(s)},l.once=function(i,s){function c(){s.apply(this,arguments),l.off(i,c)}this.on(i,c)},l.off=function(i,s){var c=[];if(i&&s){var F=this._fns[i],h=0,o=F?F.length:0;for(h;h<o;h++)F[h]!==s&&c.push(F[h])}c.length?this._fns[i]=c:delete this._fns[i]};function d(a){var i=t[a]?t[a]:[],s=a.indexOf(":"),c=s===-1?[a]:[a.substring(0,s),a.substring(s+1)],F=Object.keys(t),h=0,o=F.length;for(h;h<o;h++){var V=F[h];if(V==="*"&&(i=i.concat(t[V])),c.length===2&&c[0]===V){i=i.concat(t[V]);break}}return i}function n(a,i,s){var c=0,F=i.length;for(c;c<F&&i[c];c++)i[c].event=a,i[c].apply(i[c],s)}return l}),HQ}var wB=DB();const EB=Ca(wB);let CB="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",PQ=(e=21)=>{let l="",t=e|0;for(;t--;)l+=CB[Math.random()*64|0];return l};const xB={version:"5.2.0"};function gB(e,l){return l.name?l.name:e.split("/")[0]==="image"?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}const jB={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 OB(e){if(e==null&&typeof navigator<"u"&&(e=navigator.userAgent),!e)return!0;const l=/Edge\/(\d+\.\d+)/.exec(e);if(!l)return!0;const d=l[1].split(".",2),n=parseInt(d[0],10),a=parseInt(d[1],10);return n<15||n===15&&a<15063||n>18||n===18&&a>=18218}const lh={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},qW=class qW{constructor(l){dl(this,ol);dl(this,hd,Object.create(null));dl(this,od);dl(this,z0);dl(this,ns,EB());dl(this,RU,new Set);dl(this,NU,new Set);dl(this,as,new Set);E(this,"defaultLocale");E(this,"locale");E(this,"opts");E(this,"store");E(this,"i18n");E(this,"i18nArray");E(this,"scheduledAutoProceed",null);E(this,"wasOffline",!1);dl(this,_W,(l,t)=>{const d=l?this.getFile(l.id):void 0;if(l==null||!d){this.log(`Not setting progress for a file that has been removed: ${l==null?void 0:l.id}`);return}if(d.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${l.id}`);return}const n={bytesTotal:t.bytesTotal,percentage:t.bytesTotal!=null&&Number.isFinite(t.bytesTotal)&&t.bytesTotal>0?Math.round(t.bytesUploaded/t.bytesTotal*100):void 0};d.progress.uploadStarted!=null?this.setFileState(l.id,{progress:{...d.progress,...n,bytesUploaded:t.bytesUploaded}}):this.setFileState(l.id,{progress:{...d.progress,...n}}),j(this,is).call(this)});dl(this,is,IB(()=>cl(this,ol,Wu).call(this),500,{leading:!0,trailing:!0}));dl(this,Ya,this.updateOnlineStatus.bind(this));dl(this,L0,new Map);this.defaultLocale=jB;const t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:bB,meta:{},onBeforeFileAdded:(n,a)=>!Object.hasOwn(a,n.id),onBeforeUpload:n=>n,store:new mr,logger:hB,infoTimeout:5e3},d={...t,...l};this.opts={...d,restrictions:{...t.restrictions,...l==null?void 0:l.restrictions}},l!=null&&l.logger&&l.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"):l!=null&&l.debug&&(this.opts.logger=oB),this.log(`Using Core v${qW.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...lh,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:OB(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),Fl(this,od,new uB(()=>this.opts,()=>this.i18n)),Fl(this,z0,this.store.subscribe((n,a,i)=>{this.emit("state-update",n,a,i),this.updateAll(a)})),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),cl(this,ol,ay).call(this)}emit(l,...t){j(this,ns).emit(l,...t)}on(l,t){return j(this,ns).on(l,t),this}once(l,t){return j(this,ns).once(l,t),this}off(l,t){return j(this,ns).off(l,t),this}updateAll(l){this.iteratePlugins(t=>{t.update(l)})}setState(l){this.store.setState(l)}getState(){return this.store.getState()}patchFilesState(l){const t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(l).map(([d,n])=>[d,{...t[d],...n}]))}})}setFileState(l,t){if(!this.getState().files[l])throw new Error(`Can’t set state for ${l} (the file could have been removed)`);this.patchFilesState({[l]:t})}i18nInit(){const l=d=>this.log(`Missing i18n string: ${d}`,"error"),t=new Du([this.defaultLocale,this.opts.locale],{onMissingKey:l});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(l){this.opts={...this.opts,...l,restrictions:{...this.opts.restrictions,...l==null?void 0:l.restrictions}},l.meta&&this.setMeta(l.meta),this.i18nInit(),l.locale&&this.iteratePlugins(t=>{t.setOptions(l)}),this.setState(void 0)}resetProgress(){const l={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},d=Object.create(null);Object.keys(t).forEach(n=>{d[n]={...t[n],progress:{...t[n].progress,...l},tus:void 0,transloadit:void 0}}),this.setState({files:d,...lh})}clear(){const{capabilities:l,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!l.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...lh,files:{}})}addPreProcessor(l){j(this,RU).add(l)}removePreProcessor(l){return j(this,RU).delete(l)}addPostProcessor(l){j(this,as).add(l)}removePostProcessor(l){return j(this,as).delete(l)}addUploader(l){j(this,NU).add(l)}removeUploader(l){return j(this,NU).delete(l)}setMeta(l){const t={...this.getState().meta,...l},d={...this.getState().files};Object.keys(d).forEach(n=>{d[n]={...d[n],meta:{...d[n].meta,...l}}}),this.log("Adding metadata:"),this.log(l),this.setState({meta:t,files:d})}setFileMeta(l,t){const d={...this.getState().files};if(!d[l]){this.log(`Was trying to set metadata for a file that has been removed: ${l}`);return}const n={...d[l].meta,...t};d[l]={...d[l],meta:n},this.setState({files:d})}getFile(l){return this.getState().files[l]}getFiles(){const{files:l}=this.getState();return Object.values(l)}getFilesByIds(l){return l.map(t=>this.getFile(t))}getObjectOfFilesPerState(){const{files:l,totalProgress:t,error:d}=this.getState(),n=Object.values(l),a=[],i=[],s=[],c=[],F=[],h=[],o=[],V=[],W=[];for(const Q of n){const{progress:m}=Q;!m.uploadComplete&&m.uploadStarted&&(a.push(Q),Q.isPaused||V.push(Q)),m.uploadStarted||i.push(Q),(m.uploadStarted||m.preprocess||m.postprocess)&&s.push(Q),m.uploadStarted&&c.push(Q),Q.isPaused&&F.push(Q),m.uploadComplete&&h.push(Q),Q.error&&o.push(Q),(m.preprocess||m.postprocess)&&W.push(Q)}return{newFiles:i,startedFiles:s,uploadStartedFiles:c,pausedFiles:F,completeFiles:h,erroredFiles:o,inProgressFiles:a,inProgressNotPausedFiles:V,processingFiles:W,isUploadStarted:c.length>0,isAllComplete:t===100&&h.length===n.length&&W.length===0,isAllErrored:!!d&&o.length===n.length,isAllPaused:a.length!==0&&F.length===a.length,isUploadInProgress:a.length>0,isSomeGhost:n.some(Q=>Q.isGhost)}}validateRestrictions(l,t=this.getFiles()){try{j(this,od).validate(t,[l])}catch(d){return d}return null}validateSingleFile(l){try{j(this,od).validateSingleFile(l)}catch(t){return t.message}return null}validateAggregateRestrictions(l){const t=this.getFiles();try{j(this,od).validateAggregateRestrictions(t,l)}catch(d){return d.message}return null}checkIfFileAlreadyExists(l){const{files:t}=this.getState();return!!(t[l]&&!t[l].isGhost)}addFile(l){const{nextFilesState:t,validFilesToAdd:d,errors:n}=cl(this,ol,hu).call(this,[l]),a=n.filter(s=>s.isRestriction);if(cl(this,ol,hs).call(this,a),n.length>0)throw n[0];this.setState({files:t});const[i]=d;return this.emit("file-added",i),this.emit("files-added",d),this.log(`Added file: ${i.name}, ${i.id}, mime type: ${i.type}`),cl(this,ol,Fu).call(this),i.id}addFiles(l){const{nextFilesState:t,validFilesToAdd:d,errors:n}=cl(this,ol,hu).call(this,l),a=n.filter(s=>s.isRestriction);cl(this,ol,hs).call(this,a);const i=n.filter(s=>!s.isRestriction);if(i.length>0){let s=`Multiple errors occurred while adding files:
11
11
  `;if(i.forEach(c=>{s+=`
12
12
  * ${c.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:i.length}),details:s},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(i,s);{const c=new Error(s);throw c.errors=i,c}}this.setState({files:t}),d.forEach(s=>{this.emit("file-added",s)}),this.emit("files-added",d),d.length>5?this.log(`Added batch of ${d.length} files`):Object.values(d).forEach(s=>{this.log(`Added file: ${s.name}
13
13
  id: ${s.id}
14
14
  type: ${s.type}`)}),d.length>0&&cl(this,ol,Fu).call(this)}removeFiles(l){const{files:t,currentUploads:d}=this.getState(),n={...t},a={...d},i=Object.create(null);l.forEach(h=>{t[h]&&(i[h]=t[h],delete n[h])});function s(h){return i[h]===void 0}Object.keys(a).forEach(h=>{const o=d[h].fileIDs.filter(s);if(o.length===0){delete a[h];return}const{capabilities:V}=this.getState();if(o.length!==d[h].fileIDs.length&&!V.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");a[h]={...d[h],fileIDs:o}});const c={currentUploads:a,files:n};Object.keys(n).length===0&&(c.allowNewUpload=!0,c.error=null,c.recoveredState=null),this.setState(c),j(this,is).call(this);const F=Object.keys(i);F.forEach(h=>{this.emit("file-removed",i[h])}),F.length>5?this.log(`Removed ${F.length} files`):this.log(`Removed files: ${F.join(", ")}`)}removeFile(l){this.removeFiles([l])}pauseResume(l){if(!this.getState().capabilities.resumableUploads||this.getFile(l).progress.uploadComplete)return;const t=this.getFile(l),n=!(t.isPaused||!1);return this.setFileState(l,{isPaused:n}),this.emit("upload-pause",t,n),n}pauseAll(){const l={...this.getState().files};Object.keys(l).filter(d=>!l[d].progress.uploadComplete&&l[d].progress.uploadStarted).forEach(d=>{const n={...l[d],isPaused:!0};l[d]=n}),this.setState({files:l}),this.emit("pause-all")}resumeAll(){const l={...this.getState().files};Object.keys(l).filter(d=>!l[d].progress.uploadComplete&&l[d].progress.uploadStarted).forEach(d=>{const n={...l[d],isPaused:!1,error:null};l[d]=n}),this.setState({files:l}),this.emit("resume-all")}async retryAll(){const l=await cl(this,ol,Vu).call(this);return this.emit("complete",l),l}cancelAll(){this.emit("cancel-all");const{files:l}=this.getState(),t=Object.keys(l);t.length&&this.removeFiles(t),this.setState(lh)}retryUpload(l){this.setFileState(l,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(l));const t=cl(this,ol,O0).call(this,[l],{forceAllowNewUpload:!0});return cl(this,ol,v0).call(this,t)}logout(){this.iteratePlugins(l=>{var t,d;(d=(t=l.provider)==null?void 0:t.logout)==null||d.call(t)})}[Symbol.for("uppy test: updateTotalProgress")](){return cl(this,ol,Wu).call(this)}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)}getID(){return this.opts.id}use(l,...t){if(typeof l!="function"){const i=`Expected a plugin class, but got ${l===null?"null":typeof l}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(i)}const d=new l(this,...t),n=d.id;if(!n)throw new Error("Your plugin must have an id");if(!d.type)throw new Error("Your plugin must have a type");const a=this.getPlugin(n);if(a){const i=`Already found a plugin named '${a.id}'. Tried to use: '${n}'.
15
- Uppy plugins must have unique \`id\` options.`;throw new Error(i)}return l.VERSION&&this.log(`Using ${n} v${l.VERSION}`),d.type in j(this,hd)?j(this,hd)[d.type].push(d):j(this,hd)[d.type]=[d],d.install(),this.emit("plugin-added",d),this}getPlugin(l){for(const t of Object.values(j(this,hd))){const d=t.find(n=>n.id===l);if(d!=null)return d}}[Symbol.for("uppy test: getPlugins")](l){return j(this,hd)[l]}iteratePlugins(l){Object.values(j(this,hd)).flat(1).forEach(l)}removePlugin(l){this.log(`Removing plugin ${l.id}`),this.emit("plugin-remove",l),l.uninstall&&l.uninstall();const t=j(this,hd)[l.type],d=t.findIndex(i=>i.id===l.id);d!==-1&&t.splice(d,1);const a={plugins:{...this.getState().plugins,[l.id]:void 0}};this.setState(a)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),j(this,z0).call(this),this.iteratePlugins(l=>{this.removePlugin(l)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",j(this,Ya)),window.removeEventListener("offline",j(this,Ya)))}hideInfo(){const{info:l}=this.getState();this.setState({info:l.slice(1)}),this.emit("info-hidden")}info(l,t="info",d=3e3){const n=typeof l=="object";this.setState({info:[...this.getState().info,{type:t,message:n?l.message:l,details:n?l.details:null}]}),setTimeout(()=>this.hideInfo(),d),this.emit("info-visible")}log(l,t){const{logger:d}=this.opts;switch(t){case"error":d.error(l);break;case"warning":d.warn(l);break;default:d.debug(l);break}}registerRequestClient(l,t){j(this,L0).set(l,t)}getRequestClientForFile(l){if(!("remote"in l&&l.remote))throw new Error(`Tried to get RequestClient for a non-remote file ${l.id}`);const t=j(this,L0).get(l.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${l.remote.requestClientId}" not registered for file "${l.id}"`);return t}async restore(l){this.log(`Core: Running restored upload "${l}"`);const t=await cl(this,ol,v0).call(this,l);return this.emit("complete",t),t}[Symbol.for("uppy test: createUpload")](...l){return cl(this,ol,O0).call(this,...l)}addResultData(l,t){if(!cl(this,ol,iy).call(this,l)){this.log(`Not setting result for an upload that has been removed: ${l}`);return}const{currentUploads:d}=this.getState(),n={...d[l],result:{...d[l].result,...t}};this.setState({currentUploads:{...d,[l]:n}})}async upload(){var n;(n=j(this,hd).uploader)!=null&&n.length||this.log("No uploader type plugins are used","warning");let{files:l}=this.getState();if(cl(this,ol,ou).call(this).length>0){const a=await cl(this,ol,Vu).call(this);if(!(this.getFiles().filter(s=>s.progress.uploadStarted==null).length>0))return this.emit("complete",a),a;({files:l}=this.getState())}const d=this.opts.onBeforeUpload(l);if(d===!1)throw new Error("Not starting the upload because onBeforeUpload returned false");d&&typeof d=="object"&&(l=d,this.setState({files:l}));try{if(j(this,od).validateMinNumberOfFiles(l),!cl(this,ol,ty).call(this,l))throw new Ae(this.i18n("missingRequiredMetaField"));const{currentUploads:a}=this.getState(),i=Object.values(a).flatMap(h=>h.fileIDs),s=Object.keys(l).filter(h=>{const o=this.getFile(h);return o&&!o.progress.uploadStarted&&!i.includes(h)}),c=cl(this,ol,O0).call(this,s),F=await cl(this,ol,v0).call(this,c);return this.emit("complete",F),F}catch(a){throw cl(this,ol,hs).call(this,[a]),a}}};hd=new WeakMap,od=new WeakMap,z0=new WeakMap,ns=new WeakMap,RU=new WeakMap,NU=new WeakMap,as=new WeakMap,ol=new WeakSet,hs=function(l){for(const i of l)i.isRestriction?this.emit("restriction-failed",i.file,i):this.emit("error",i,i.file),this.log(i,"warning");const t=l.filter(i=>i.isUserFacing),d=4,n=t.slice(0,d),a=t.slice(d);n.forEach(({message:i,details:s=""})=>{this.info({message:i,details:s},"error",this.opts.infoTimeout)}),a.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:a.length})})},Zu=function(l){const{missingFields:t,error:d}=j(this,od).getMissingRequiredMetaFields(l);return t.length>0?(this.setFileState(l.id,{missingRequiredMetaFields:t,error:d.message}),this.log(d.message),this.emit("restriction-failed",l,d),!1):(t.length===0&&l.missingRequiredMetaFields&&this.setFileState(l.id,{missingRequiredMetaFields:[]}),!0)},ty=function(l){let t=!0;for(const d of Object.values(l))cl(this,ol,Zu).call(this,d)||(t=!1);return t},ey=function(l){const{allowNewUpload:t}=this.getState();if(t===!1){const d=new Ae(this.i18n("noMoreFilesAllowed"),{file:l});throw cl(this,ol,hs).call(this,[d]),d}},dy=function(l){const t=l instanceof File?{name:l.name,type:l.type,size:l.size,data:l,meta:{},isRemote:!1,source:void 0,preview:void 0}:l,d=Gu(t),n=gB(d,t),a=Tu(n).extension,i=Dy(t,this.getID()),s={...t.meta,name:n,type:d},c=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:i,name:n,extension:a||"",meta:{...this.getState().meta,...s},type:d,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}},Fu=function(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(l=>{l.isRestriction||this.log(l.stack||l.message||l)})},4))},hu=function(l){let{files:t}=this.getState(),d={...t};const n=[],a=[];for(const i of l)try{let s=cl(this,ol,dy).call(this,i);cl(this,ol,ey).call(this,s);const c=t[s.id],F=c==null?void 0:c.isGhost;if(F&&!s.isRemote){if(s.data==null)throw new Error("File data is missing");s={...c,isGhost:!1,data:s.data},this.log(`Replaced the blob in the restored ghost file: ${s.name}, ${s.id}`)}const h=this.opts.onBeforeFileAdded(s,d);if(t=this.getState().files,d={...t,...d},!h&&this.checkIfFileAlreadyExists(s.id))throw new Ae(this.i18n("noDuplicates",{fileName:s.name??this.i18n("unnamed")}),{file:s});if(h===!1&&!F)throw new Ae("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:s});typeof h=="object"&&h!==null&&(s=h),j(this,od).validateSingleFile(s),d[s.id]=s,n.push(s)}catch(s){a.push(s)}try{j(this,od).validateAggregateRestrictions(Object.values(t),n)}catch(i){return a.push(i),{nextFilesState:t,validFilesToAdd:[],errors:a}}return{nextFilesState:d,validFilesToAdd:n,errors:a}},ou=function(){const{files:l}=this.getState();return Object.keys(l).filter(t=>{const d=l[t];return d.error&&(!d.missingRequiredMetaFields||d.missingRequiredMetaFields.length===0)})},Vu=async function(){const l=cl(this,ol,ou).call(this),t={...this.getState().files};if(l.forEach(n=>{t[n]={...t[n],isPaused:!1,error:null}}),this.setState({files:t,error:null}),this.emit("retry-all",this.getFilesByIds(l)),l.length===0)return{successful:[],failed:[]};const d=cl(this,ol,O0).call(this,l,{forceAllowNewUpload:!0});return cl(this,ol,v0).call(this,d)},_W=new WeakMap,Wu=function(){const l=cl(this,ol,ny).call(this);let t=null;l!=null&&(t=Math.round(l*100),t>100?t=100:t<0&&(t=0)),this.emit("progress",t??0),this.setState({totalProgress:t??0})},is=new WeakMap,ny=function(){const 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;const d=c=>c.progress.bytesTotal!=null&&c.progress.bytesTotal!==0,n=t.filter(d),a=t.filter(c=>!d(c));if(n.every(c=>c.progress.uploadComplete)&&a.length>0&&!a.every(c=>c.progress.uploadComplete))return null;const i=n.reduce((c,F)=>c+(F.progress.bytesTotal??0),0),s=n.reduce((c,F)=>c+(F.progress.bytesUploaded||0),0);return i===0?0:s/i},ay=function(){const l=(n,a,i)=>{let s=n.message||"Unknown error";n.details&&(s+=` ${n.details}`),this.setState({error:s}),a!=null&&a.id in this.getState().files&&this.setFileState(a.id,{error:s,response:i})};this.on("error",l),this.on("upload-error",(n,a,i)=>{if(l(a,n,i),typeof a=="object"&&a.message){this.log(a.message,"error");const s=new Error(this.i18n("failedToUpload",{file:(n==null?void 0:n.name)??""}));s.isUserFacing=!0,s.details=a.message,a.details&&(s.details+=` ${a.details}`),cl(this,ol,hs).call(this,[s])}else cl(this,ol,hs).call(this,[a])});let t=null;this.on("upload-stalled",(n,a)=>{const{message:i}=n,s=a.map(c=>c.meta.name).join(", ");t||(this.info({message:i,details:s},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${i} ${s}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});const d=n=>{const a=n.filter(s=>{const c=s!=null&&this.getFile(s.id);return c||this.log(`Not setting progress for a file that has been removed: ${s==null?void 0:s.id}`),c}),i=Object.fromEntries(a.map(s=>[s.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:s.size}}]));this.patchFilesState(i)};this.on("upload-start",d),this.on("upload-progress",j(this,_W)),this.on("upload-success",(n,a)=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}const i=this.getFile(n.id).progress,s=j(this,as).size>0;this.setFileState(n.id,{progress:{...i,postprocess:s?{mode:"indeterminate"}:void 0,uploadComplete:!0,...!s&&{complete:!0},percentage:100,bytesUploaded:i.bytesTotal},response:a,uploadURL:a.uploadURL,isPaused:!1}),n.size==null&&this.setFileState(n.id,{size:a.bytesUploaded||i.bytesTotal}),j(this,is).call(this)}),this.on("preprocess-progress",(n,a)=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}this.setFileState(n.id,{progress:{...this.getFile(n.id).progress,preprocess:a}})}),this.on("preprocess-complete",n=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}const a={...this.getState().files};a[n.id]={...a[n.id],progress:{...a[n.id].progress}},delete a[n.id].progress.preprocess,this.setState({files:a})}),this.on("postprocess-progress",(n,a)=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}this.setFileState(n.id,{progress:{...this.getState().files[n.id].progress,postprocess:a}})}),this.on("postprocess-complete",n=>{const a=n&&this.getFile(n.id);if(a==null){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}const{postprocess:i,...s}=a.progress;this.patchFilesState({[a.id]:{progress:{...s,complete:!0}}})}),this.on("restored",()=>{j(this,is).call(this)}),this.on("dashboard:file-edit-complete",n=>{n&&cl(this,ol,Zu).call(this,n)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",j(this,Ya)),window.addEventListener("offline",j(this,Ya)),setTimeout(j(this,Ya),3e3))},Ya=new WeakMap,L0=new WeakMap,O0=function(l,t={}){const{forceAllowNewUpload:d=!1}=t,{allowNewUpload:n,currentUploads:a}=this.getState();if(!n&&!d)throw new Error("Cannot create a new upload: already uploading.");const i=PQ();return this.emit("upload",i,this.getFilesByIds(l)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...a,[i]:{fileIDs:l,step:0,result:{}}}}),i},iy=function(l){const{currentUploads:t}=this.getState();return t[l]},Qu=function(l){const{[l]:t,...d}=this.getState().currentUploads;this.setState({currentUploads:d})},v0=async function(l){const t=()=>{const{currentUploads:i}=this.getState();return i[l]};let d=t();if(!d)throw new Error("Nonexistent upload");const n=[...j(this,RU),...j(this,NU),...j(this,as)];try{for(let i=d.step||0;i<n.length;i++){const s=n[i];this.setState({currentUploads:{...this.getState().currentUploads,[l]:{...d,step:i}}});const{fileIDs:c}=d;if(await s(c,l),d=t(),!d)break}}catch(i){throw cl(this,ol,Qu).call(this,l),i}if(d){d.fileIDs.forEach(F=>{const h=this.getFile(F);h!=null&&h.progress.postprocess&&this.emit("postprocess-complete",h)});const i=d.fileIDs.map(F=>this.getFile(F)),s=i.filter(F=>!F.error),c=i.filter(F=>F.error);this.addResultData(l,{successful:s,failed:c,uploadID:l}),d=t()}let a;return d&&(a=d.result,cl(this,ol,Qu).call(this,l)),a==null&&(this.log(`Not setting result for an upload that has been removed: ${l}`),a={successful:[],failed:[],uploadID:l}),a},E(qW,"VERSION",xB.version);let AQ=qW;function _Q(e){"@babel/helpers - typeof";return _Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},_Q(e)}function vB(e,l,t){return Object.defineProperty(e,"prototype",{writable:!1}),e}function KB(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function fB(e,l,t){return l=wU(l),HB(e,$Q()?Reflect.construct(l,t||[],wU(e).constructor):l.apply(e,t))}function HB(e,l){if(l&&(_Q(l)==="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return PB(e)}function PB(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function AB(e,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(l&&l.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),l&&DU(e,l)}function qQ(e){var l=typeof Map=="function"?new Map:void 0;return qQ=function(d){if(d===null||!qB(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof l<"u"){if(l.has(d))return l.get(d);l.set(d,n)}function n(){return _B(d,arguments,wU(this).constructor)}return n.prototype=Object.create(d.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),DU(n,d)},qQ(e)}function _B(e,l,t){if($Q())return Reflect.construct.apply(null,arguments);var d=[null];d.push.apply(d,l);var n=new(e.bind.apply(e,d));return t&&DU(n,t.prototype),n}function $Q(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($Q=function(){return!!e})()}function qB(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function DU(e,l){return DU=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(d,n){return d.__proto__=n,d},DU(e,l)}function wU(e){return wU=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wU(e)}var th=function(e){function l(t){var d,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(KB(this,l),d=fB(this,l,[t]),d.originalRequest=a,d.originalResponse=i,d.causingError=n,n!=null&&(t+=", caused by ".concat(n.toString())),a!=null){var s=a.getHeader("X-Request-ID")||"n/a",c=a.getMethod(),F=a.getURL(),h=i?i.getStatus():"n/a",o=i?i.getBody()||"":"n/a";t+=", originated from request (method: ".concat(c,", url: ").concat(F,", response code: ").concat(h,", response text: ").concat(o,", request id: ").concat(s,")")}return d.message=t,d}return AB(l,e),vB(l)}(qQ(Error));function Px(e){}function EU(e){"@babel/helpers - typeof";return EU=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},EU(e)}function $B(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function lY(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,eY(d.key),d)}}function tY(e,l,t){return l&&lY(e.prototype,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function eY(e){var l=dY(e,"string");return EU(l)=="symbol"?l:l+""}function dY(e,l){if(EU(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(EU(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var nY=function(){function e(){$B(this,e)}return tY(e,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(t){return Promise.resolve([])}},{key:"removeUpload",value:function(t){return Promise.resolve()}},{key:"addUpload",value:function(t,d){return Promise.resolve(null)}}])}();const Dr="3.7.8",aY=Dr,Rs=typeof Buffer=="function",wr=typeof TextDecoder=="function"?new TextDecoder:void 0,Er=typeof TextEncoder=="function"?new TextEncoder:void 0,CU=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),eh=(e=>{let l={};return e.forEach((t,d)=>l[t]=d),l})(CU),iY=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Gt=String.fromCharCode.bind(String),Cr=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),xr=e=>e.replace(/=/g,"").replace(/[+\/]/g,l=>l=="+"?"-":"_"),gr=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),jr=e=>{let l,t,d,n,a="";const i=e.length%3;for(let s=0;s<e.length;){if((t=e.charCodeAt(s++))>255||(d=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");l=t<<16|d<<8|n,a+=CU[l>>18&63]+CU[l>>12&63]+CU[l>>6&63]+CU[l&63]}return i?a.slice(0,i-3)+"===".substring(i):a},lm=typeof btoa=="function"?e=>btoa(e):Rs?e=>Buffer.from(e,"binary").toString("base64"):jr,tm=Rs?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let d=0,n=e.length;d<n;d+=4096)t.push(Gt.apply(null,e.subarray(d,d+4096)));return lm(t.join(""))},dh=(e,l=!1)=>l?xr(tm(e)):tm(e),sY=e=>{if(e.length<2){var l=e.charCodeAt(0);return l<128?e:l<2048?Gt(192|l>>>6)+Gt(128|l&63):Gt(224|l>>>12&15)+Gt(128|l>>>6&63)+Gt(128|l&63)}else{var l=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return Gt(240|l>>>18&7)+Gt(128|l>>>12&63)+Gt(128|l>>>6&63)+Gt(128|l&63)}},cY=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Or=e=>e.replace(cY,sY),vr=Rs?e=>Buffer.from(e,"utf8").toString("base64"):Er?e=>tm(Er.encode(e)):e=>lm(Or(e)),Ns=(e,l=!1)=>l?xr(vr(e)):vr(e),Kr=e=>Ns(e,!0),UY=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,ZY=e=>{switch(e.length){case 4:var l=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),t=l-65536;return Gt((t>>>10)+55296)+Gt((t&1023)+56320);case 3:return Gt((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return Gt((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},fr=e=>e.replace(UY,ZY),Hr=e=>{if(e=e.replace(/\s+/g,""),!iY.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let l,t,d,n=[];for(let a=0;a<e.length;)l=eh[e.charAt(a++)]<<18|eh[e.charAt(a++)]<<12|(t=eh[e.charAt(a++)])<<6|(d=eh[e.charAt(a++)]),t===64?n.push(Gt(l>>16&255)):d===64?n.push(Gt(l>>16&255,l>>8&255)):n.push(Gt(l>>16&255,l>>8&255,l&255));return n.join("")},em=typeof atob=="function"?e=>atob(gr(e)):Rs?e=>Buffer.from(e,"base64").toString("binary"):Hr,Pr=Rs?e=>Cr(Buffer.from(e,"base64")):e=>Cr(em(e).split("").map(l=>l.charCodeAt(0))),Ar=e=>Pr(_r(e)),FY=Rs?e=>Buffer.from(e,"base64").toString("utf8"):wr?e=>wr.decode(Pr(e)):e=>fr(em(e)),_r=e=>gr(e.replace(/[-_]/g,l=>l=="-"?"+":"/")),dm=e=>FY(_r(e)),hY=e=>{if(typeof e!="string")return!1;const l=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(l)||!/[^\s0-9a-zA-Z\-_]/.test(l)},qr=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),$r=function(){const e=(l,t)=>Object.defineProperty(String.prototype,l,qr(t));e("fromBase64",function(){return dm(this)}),e("toBase64",function(l){return Ns(this,l)}),e("toBase64URI",function(){return Ns(this,!0)}),e("toBase64URL",function(){return Ns(this,!0)}),e("toUint8Array",function(){return Ar(this)})},lp=function(){const e=(l,t)=>Object.defineProperty(Uint8Array.prototype,l,qr(t));e("toBase64",function(l){return dh(this,l)}),e("toBase64URI",function(){return dh(this,!0)}),e("toBase64URL",function(){return dh(this,!0)})},oY={version:Dr,VERSION:aY,atob:em,atobPolyfill:Hr,btoa:lm,btoaPolyfill:jr,fromBase64:dm,toBase64:Ns,encode:Ns,encodeURI:Kr,encodeURL:Kr,utob:Or,btou:fr,decode:dm,isValid:hY,fromUint8Array:dh,toUint8Array:Ar,extendString:$r,extendUint8Array:lp,extendBuiltins:()=>{$r(),lp()}};var nm,tp;function VY(){return tp||(tp=1,nm=function(l,t){if(t=t.split(":")[0],l=+l,!l)return!1;switch(t){case"http":case"ws":return l!==80;case"https":case"wss":return l!==443;case"ftp":return l!==21;case"gopher":return l!==70;case"file":return!1}return l!==0}),nm}var nh={},ep;function WY(){if(ep)return nh;ep=1;var e=Object.prototype.hasOwnProperty,l;function t(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}function d(i){try{return encodeURIComponent(i)}catch{return null}}function n(i){for(var s=/([^=?#&]+)=?([^&]*)/g,c={},F;F=s.exec(i);){var h=t(F[1]),o=t(F[2]);h===null||o===null||h in c||(c[h]=o)}return c}function a(i,s){s=s||"";var c=[],F,h;typeof s!="string"&&(s="?");for(h in i)if(e.call(i,h)){if(F=i[h],!F&&(F===null||F===l||isNaN(F))&&(F=""),h=d(h),F=d(F),h===null||F===null)continue;c.push(h+"="+F)}return c.length?s+c.join("&"):""}return nh.stringify=a,nh.parse=n,nh}var am,dp;function QY(){if(dp)return am;dp=1;var e=VY(),l=WY(),t=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,d=/[\n\r\t]/g,n=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,a=/:\d+$/,i=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,s=/^[a-zA-Z]:/;function c(b){return(b||"").toString().replace(t,"")}var F=[["#","hash"],["?","query"],function(u,J){return V(J.protocol)?u.replace(/\\/g,"/"):u},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],h={hash:1,query:1};function o(b){var u;typeof window<"u"?u=window:typeof ms<"u"?u=ms:typeof self<"u"?u=self:u={};var J=u.location||{};b=b||J;var G={},T=typeof b,y;if(b.protocol==="blob:")G=new m(unescape(b.pathname),{});else if(T==="string"){G=new m(b,{});for(y in h)delete G[y]}else if(T==="object"){for(y in b)y in h||(G[y]=b[y]);G.slashes===void 0&&(G.slashes=n.test(b.href))}return G}function V(b){return b==="file:"||b==="ftp:"||b==="http:"||b==="https:"||b==="ws:"||b==="wss:"}function W(b,u){b=c(b),b=b.replace(d,""),u=u||{};var J=i.exec(b),G=J[1]?J[1].toLowerCase():"",T=!!J[2],y=!!J[3],k=0,X;return T?y?(X=J[2]+J[3]+J[4],k=J[2].length+J[3].length):(X=J[2]+J[4],k=J[2].length):y?(X=J[3]+J[4],k=J[3].length):X=J[4],G==="file:"?k>=2&&(X=X.slice(2)):V(G)?X=J[4]:G?T&&(X=X.slice(2)):k>=2&&V(u.protocol)&&(X=J[4]),{protocol:G,slashes:T||V(G),slashesCount:k,rest:X}}function Q(b,u){if(b==="")return u;for(var J=(u||"/").split("/").slice(0,-1).concat(b.split("/")),G=J.length,T=J[G-1],y=!1,k=0;G--;)J[G]==="."?J.splice(G,1):J[G]===".."?(J.splice(G,1),k++):k&&(G===0&&(y=!0),J.splice(G,1),k--);return y&&J.unshift(""),(T==="."||T==="..")&&J.push(""),J.join("/")}function m(b,u,J){if(b=c(b),b=b.replace(d,""),!(this instanceof m))return new m(b,u,J);var G,T,y,k,X,L,D=F.slice(),C=typeof u,I=this,P=0;for(C!=="object"&&C!=="string"&&(J=u,u=null),J&&typeof J!="function"&&(J=l.parse),u=o(u),T=W(b||"",u),G=!T.protocol&&!T.slashes,I.slashes=T.slashes||G&&u.slashes,I.protocol=T.protocol||u.protocol||"",b=T.rest,(T.protocol==="file:"&&(T.slashesCount!==2||s.test(b))||!T.slashes&&(T.protocol||T.slashesCount<2||!V(I.protocol)))&&(D[3]=[/(.*)/,"pathname"]);P<D.length;P++){if(k=D[P],typeof k=="function"){b=k(b,I);continue}y=k[0],L=k[1],y!==y?I[L]=b:typeof y=="string"?(X=y==="@"?b.lastIndexOf(y):b.indexOf(y),~X&&(typeof k[2]=="number"?(I[L]=b.slice(0,X),b=b.slice(X+k[2])):(I[L]=b.slice(X),b=b.slice(0,X)))):(X=y.exec(b))&&(I[L]=X[1],b=b.slice(0,X.index)),I[L]=I[L]||G&&k[3]&&u[L]||"",k[4]&&(I[L]=I[L].toLowerCase())}J&&(I.query=J(I.query)),G&&u.slashes&&I.pathname.charAt(0)!=="/"&&(I.pathname!==""||u.pathname!=="")&&(I.pathname=Q(I.pathname,u.pathname)),I.pathname.charAt(0)!=="/"&&V(I.protocol)&&(I.pathname="/"+I.pathname),e(I.port,I.protocol)||(I.host=I.hostname,I.port=""),I.username=I.password="",I.auth&&(X=I.auth.indexOf(":"),~X?(I.username=I.auth.slice(0,X),I.username=encodeURIComponent(decodeURIComponent(I.username)),I.password=I.auth.slice(X+1),I.password=encodeURIComponent(decodeURIComponent(I.password))):I.username=encodeURIComponent(decodeURIComponent(I.auth)),I.auth=I.password?I.username+":"+I.password:I.username),I.origin=I.protocol!=="file:"&&V(I.protocol)&&I.host?I.protocol+"//"+I.host:"null",I.href=I.toString()}function R(b,u,J){var G=this;switch(b){case"query":typeof u=="string"&&u.length&&(u=(J||l.parse)(u)),G[b]=u;break;case"port":G[b]=u,e(u,G.protocol)?u&&(G.host=G.hostname+":"+u):(G.host=G.hostname,G[b]="");break;case"hostname":G[b]=u,G.port&&(u+=":"+G.port),G.host=u;break;case"host":G[b]=u,a.test(u)?(u=u.split(":"),G.port=u.pop(),G.hostname=u.join(":")):(G.hostname=u,G.port="");break;case"protocol":G.protocol=u.toLowerCase(),G.slashes=!J;break;case"pathname":case"hash":if(u){var T=b==="pathname"?"/":"#";G[b]=u.charAt(0)!==T?T+u:u}else G[b]=u;break;case"username":case"password":G[b]=encodeURIComponent(u);break;case"auth":var y=u.indexOf(":");~y?(G.username=u.slice(0,y),G.username=encodeURIComponent(decodeURIComponent(G.username)),G.password=u.slice(y+1),G.password=encodeURIComponent(decodeURIComponent(G.password))):G.username=encodeURIComponent(decodeURIComponent(u))}for(var k=0;k<F.length;k++){var X=F[k];X[4]&&(G[X[1]]=G[X[1]].toLowerCase())}return G.auth=G.password?G.username+":"+G.password:G.username,G.origin=G.protocol!=="file:"&&V(G.protocol)&&G.host?G.protocol+"//"+G.host:"null",G.href=G.toString(),G}function r(b){(!b||typeof b!="function")&&(b=l.stringify);var u,J=this,G=J.host,T=J.protocol;T&&T.charAt(T.length-1)!==":"&&(T+=":");var y=T+(J.protocol&&J.slashes||V(J.protocol)?"//":"");return J.username?(y+=J.username,J.password&&(y+=":"+J.password),y+="@"):J.password?(y+=":"+J.password,y+="@"):J.protocol!=="file:"&&V(J.protocol)&&!G&&J.pathname!=="/"&&(y+="@"),(G[G.length-1]===":"||a.test(J.hostname)&&!J.port)&&(G+=":"),y+=G+J.pathname,u=typeof J.query=="object"?b(J.query):J.query,u&&(y+=u.charAt(0)!=="?"?"?"+u:u),J.hash&&(y+=J.hash),y}return m.prototype={set:R,toString:r},m.extractProtocol=W,m.location=o,m.trimLeft=c,m.qs=l,am=m,am}var mY=QY();const RY=Ca(mY);function NY(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var l=Math.random()*16|0,t=e==="x"?l:l&3|8;return t.toString(16)})}function im(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */im=function(){return l};var e,l={},t=Object.prototype,d=t.hasOwnProperty,n=Object.defineProperty||function(Y,B,z){Y[B]=z.value},a=typeof Symbol=="function"?Symbol:{},i=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function F(Y,B,z){return Object.defineProperty(Y,B,{value:z,enumerable:!0,configurable:!0,writable:!0}),Y[B]}try{F({},"")}catch{F=function(z,g,w){return z[g]=w}}function h(Y,B,z,g){var w=B&&B.prototype instanceof r?B:r,O=Object.create(w.prototype),f=new P(g||[]);return n(O,"_invoke",{value:L(Y,z,f)}),O}function o(Y,B,z){try{return{type:"normal",arg:Y.call(B,z)}}catch(g){return{type:"throw",arg:g}}}l.wrap=h;var V="suspendedStart",W="suspendedYield",Q="executing",m="completed",R={};function r(){}function b(){}function u(){}var J={};F(J,i,function(){return this});var G=Object.getPrototypeOf,T=G&&G(G(H([])));T&&T!==t&&d.call(T,i)&&(J=T);var y=u.prototype=r.prototype=Object.create(J);function k(Y){["next","throw","return"].forEach(function(B){F(Y,B,function(z){return this._invoke(B,z)})})}function X(Y,B){function z(w,O,f,x){var A=o(Y[w],Y,O);if(A.type!=="throw"){var al=A.arg,_=al.value;return _&&ga(_)=="object"&&d.call(_,"__await")?B.resolve(_.__await).then(function(K){z("next",K,f,x)},function(K){z("throw",K,f,x)}):B.resolve(_).then(function(K){al.value=K,f(al)},function(K){return z("throw",K,f,x)})}x(A.arg)}var g;n(this,"_invoke",{value:function(O,f){function x(){return new B(function(A,al){z(O,f,A,al)})}return g=g?g.then(x,x):x()}})}function L(Y,B,z){var g=V;return function(w,O){if(g===Q)throw Error("Generator is already running");if(g===m){if(w==="throw")throw O;return{value:e,done:!0}}for(z.method=w,z.arg=O;;){var f=z.delegate;if(f){var x=D(f,z);if(x){if(x===R)continue;return x}}if(z.method==="next")z.sent=z._sent=z.arg;else if(z.method==="throw"){if(g===V)throw g=m,z.arg;z.dispatchException(z.arg)}else z.method==="return"&&z.abrupt("return",z.arg);g=Q;var A=o(Y,B,z);if(A.type==="normal"){if(g=z.done?m:W,A.arg===R)continue;return{value:A.arg,done:z.done}}A.type==="throw"&&(g=m,z.method="throw",z.arg=A.arg)}}}function D(Y,B){var z=B.method,g=Y.iterator[z];if(g===e)return B.delegate=null,z==="throw"&&Y.iterator.return&&(B.method="return",B.arg=e,D(Y,B),B.method==="throw")||z!=="return"&&(B.method="throw",B.arg=new TypeError("The iterator does not provide a '"+z+"' method")),R;var w=o(g,Y.iterator,B.arg);if(w.type==="throw")return B.method="throw",B.arg=w.arg,B.delegate=null,R;var O=w.arg;return O?O.done?(B[Y.resultName]=O.value,B.next=Y.nextLoc,B.method!=="return"&&(B.method="next",B.arg=e),B.delegate=null,R):O:(B.method="throw",B.arg=new TypeError("iterator result is not an object"),B.delegate=null,R)}function C(Y){var B={tryLoc:Y[0]};1 in Y&&(B.catchLoc=Y[1]),2 in Y&&(B.finallyLoc=Y[2],B.afterLoc=Y[3]),this.tryEntries.push(B)}function I(Y){var B=Y.completion||{};B.type="normal",delete B.arg,Y.completion=B}function P(Y){this.tryEntries=[{tryLoc:"root"}],Y.forEach(C,this),this.reset(!0)}function H(Y){if(Y||Y===""){var B=Y[i];if(B)return B.call(Y);if(typeof Y.next=="function")return Y;if(!isNaN(Y.length)){var z=-1,g=function w(){for(;++z<Y.length;)if(d.call(Y,z))return w.value=Y[z],w.done=!1,w;return w.value=e,w.done=!0,w};return g.next=g}}throw new TypeError(ga(Y)+" is not iterable")}return b.prototype=u,n(y,"constructor",{value:u,configurable:!0}),n(u,"constructor",{value:b,configurable:!0}),b.displayName=F(u,c,"GeneratorFunction"),l.isGeneratorFunction=function(Y){var B=typeof Y=="function"&&Y.constructor;return!!B&&(B===b||(B.displayName||B.name)==="GeneratorFunction")},l.mark=function(Y){return Object.setPrototypeOf?Object.setPrototypeOf(Y,u):(Y.__proto__=u,F(Y,c,"GeneratorFunction")),Y.prototype=Object.create(y),Y},l.awrap=function(Y){return{__await:Y}},k(X.prototype),F(X.prototype,s,function(){return this}),l.AsyncIterator=X,l.async=function(Y,B,z,g,w){w===void 0&&(w=Promise);var O=new X(h(Y,B,z,g),w);return l.isGeneratorFunction(B)?O:O.next().then(function(f){return f.done?f.value:O.next()})},k(y),F(y,c,"Generator"),F(y,i,function(){return this}),F(y,"toString",function(){return"[object Generator]"}),l.keys=function(Y){var B=Object(Y),z=[];for(var g in B)z.push(g);return z.reverse(),function w(){for(;z.length;){var O=z.pop();if(O in B)return w.value=O,w.done=!1,w}return w.done=!0,w}},l.values=H,P.prototype={constructor:P,reset:function(B){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!B)for(var z in this)z.charAt(0)==="t"&&d.call(this,z)&&!isNaN(+z.slice(1))&&(this[z]=e)},stop:function(){this.done=!0;var B=this.tryEntries[0].completion;if(B.type==="throw")throw B.arg;return this.rval},dispatchException:function(B){if(this.done)throw B;var z=this;function g(al,_){return f.type="throw",f.arg=B,z.next=al,_&&(z.method="next",z.arg=e),!!_}for(var w=this.tryEntries.length-1;w>=0;--w){var O=this.tryEntries[w],f=O.completion;if(O.tryLoc==="root")return g("end");if(O.tryLoc<=this.prev){var x=d.call(O,"catchLoc"),A=d.call(O,"finallyLoc");if(x&&A){if(this.prev<O.catchLoc)return g(O.catchLoc,!0);if(this.prev<O.finallyLoc)return g(O.finallyLoc)}else if(x){if(this.prev<O.catchLoc)return g(O.catchLoc,!0)}else{if(!A)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return g(O.finallyLoc)}}}},abrupt:function(B,z){for(var g=this.tryEntries.length-1;g>=0;--g){var w=this.tryEntries[g];if(w.tryLoc<=this.prev&&d.call(w,"finallyLoc")&&this.prev<w.finallyLoc){var O=w;break}}O&&(B==="break"||B==="continue")&&O.tryLoc<=z&&z<=O.finallyLoc&&(O=null);var f=O?O.completion:{};return f.type=B,f.arg=z,O?(this.method="next",this.next=O.finallyLoc,R):this.complete(f)},complete:function(B,z){if(B.type==="throw")throw B.arg;return B.type==="break"||B.type==="continue"?this.next=B.arg:B.type==="return"?(this.rval=this.arg=B.arg,this.method="return",this.next="end"):B.type==="normal"&&z&&(this.next=z),R},finish:function(B){for(var z=this.tryEntries.length-1;z>=0;--z){var g=this.tryEntries[z];if(g.finallyLoc===B)return this.complete(g.completion,g.afterLoc),I(g),R}},catch:function(B){for(var z=this.tryEntries.length-1;z>=0;--z){var g=this.tryEntries[z];if(g.tryLoc===B){var w=g.completion;if(w.type==="throw"){var O=w.arg;I(g)}return O}}throw Error("illegal catch attempt")},delegateYield:function(B,z,g){return this.delegate={iterator:H(B),resultName:z,nextLoc:g},this.method==="next"&&(this.arg=e),R}},l}function np(e,l,t,d,n,a,i){try{var s=e[a](i),c=s.value}catch(F){t(F);return}s.done?l(c):Promise.resolve(c).then(d,n)}function bY(e){return function(){var l=this,t=arguments;return new Promise(function(d,n){var a=e.apply(l,t);function i(c){np(a,d,n,i,s,"next",c)}function s(c){np(a,d,n,i,s,"throw",c)}i(void 0)})}}function ap(e,l){return pY(e)||rY(e,l)||ip(e,l)||uY()}function uY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
15
+ Uppy plugins must have unique \`id\` options.`;throw new Error(i)}return l.VERSION&&this.log(`Using ${n} v${l.VERSION}`),d.type in j(this,hd)?j(this,hd)[d.type].push(d):j(this,hd)[d.type]=[d],d.install(),this.emit("plugin-added",d),this}getPlugin(l){for(const t of Object.values(j(this,hd))){const d=t.find(n=>n.id===l);if(d!=null)return d}}[Symbol.for("uppy test: getPlugins")](l){return j(this,hd)[l]}iteratePlugins(l){Object.values(j(this,hd)).flat(1).forEach(l)}removePlugin(l){this.log(`Removing plugin ${l.id}`),this.emit("plugin-remove",l),l.uninstall&&l.uninstall();const t=j(this,hd)[l.type],d=t.findIndex(i=>i.id===l.id);d!==-1&&t.splice(d,1);const a={plugins:{...this.getState().plugins,[l.id]:void 0}};this.setState(a)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),j(this,z0).call(this),this.iteratePlugins(l=>{this.removePlugin(l)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",j(this,Ya)),window.removeEventListener("offline",j(this,Ya)))}hideInfo(){const{info:l}=this.getState();this.setState({info:l.slice(1)}),this.emit("info-hidden")}info(l,t="info",d=3e3){const n=typeof l=="object";this.setState({info:[...this.getState().info,{type:t,message:n?l.message:l,details:n?l.details:null}]}),setTimeout(()=>this.hideInfo(),d),this.emit("info-visible")}log(l,t){const{logger:d}=this.opts;switch(t){case"error":d.error(l);break;case"warning":d.warn(l);break;default:d.debug(l);break}}registerRequestClient(l,t){j(this,L0).set(l,t)}getRequestClientForFile(l){if(!("remote"in l&&l.remote))throw new Error(`Tried to get RequestClient for a non-remote file ${l.id}`);const t=j(this,L0).get(l.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${l.remote.requestClientId}" not registered for file "${l.id}"`);return t}async restore(l){this.log(`Core: Running restored upload "${l}"`);const t=await cl(this,ol,v0).call(this,l);return this.emit("complete",t),t}[Symbol.for("uppy test: createUpload")](...l){return cl(this,ol,O0).call(this,...l)}addResultData(l,t){if(!cl(this,ol,iy).call(this,l)){this.log(`Not setting result for an upload that has been removed: ${l}`);return}const{currentUploads:d}=this.getState(),n={...d[l],result:{...d[l].result,...t}};this.setState({currentUploads:{...d,[l]:n}})}async upload(){var n;(n=j(this,hd).uploader)!=null&&n.length||this.log("No uploader type plugins are used","warning");let{files:l}=this.getState();if(cl(this,ol,ou).call(this).length>0){const a=await cl(this,ol,Vu).call(this);if(!(this.getFiles().filter(s=>s.progress.uploadStarted==null).length>0))return this.emit("complete",a),a;({files:l}=this.getState())}const d=this.opts.onBeforeUpload(l);if(d===!1)throw new Error("Not starting the upload because onBeforeUpload returned false");d&&typeof d=="object"&&(l=d,this.setState({files:l}));try{if(j(this,od).validateMinNumberOfFiles(l),!cl(this,ol,ty).call(this,l))throw new Ae(this.i18n("missingRequiredMetaField"));const{currentUploads:a}=this.getState(),i=Object.values(a).flatMap(h=>h.fileIDs),s=Object.keys(l).filter(h=>{const o=this.getFile(h);return o&&!o.progress.uploadStarted&&!i.includes(h)}),c=cl(this,ol,O0).call(this,s),F=await cl(this,ol,v0).call(this,c);return this.emit("complete",F),F}catch(a){throw cl(this,ol,hs).call(this,[a]),a}}};hd=new WeakMap,od=new WeakMap,z0=new WeakMap,ns=new WeakMap,RU=new WeakMap,NU=new WeakMap,as=new WeakMap,ol=new WeakSet,hs=function(l){for(const i of l)i.isRestriction?this.emit("restriction-failed",i.file,i):this.emit("error",i,i.file),this.log(i,"warning");const t=l.filter(i=>i.isUserFacing),d=4,n=t.slice(0,d),a=t.slice(d);n.forEach(({message:i,details:s=""})=>{this.info({message:i,details:s},"error",this.opts.infoTimeout)}),a.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:a.length})})},Zu=function(l){const{missingFields:t,error:d}=j(this,od).getMissingRequiredMetaFields(l);return t.length>0?(this.setFileState(l.id,{missingRequiredMetaFields:t,error:d.message}),this.log(d.message),this.emit("restriction-failed",l,d),!1):(t.length===0&&l.missingRequiredMetaFields&&this.setFileState(l.id,{missingRequiredMetaFields:[]}),!0)},ty=function(l){let t=!0;for(const d of Object.values(l))cl(this,ol,Zu).call(this,d)||(t=!1);return t},ey=function(l){const{allowNewUpload:t}=this.getState();if(t===!1){const d=new Ae(this.i18n("noMoreFilesAllowed"),{file:l});throw cl(this,ol,hs).call(this,[d]),d}},dy=function(l){const t=l instanceof File?{name:l.name,type:l.type,size:l.size,data:l,meta:{},isRemote:!1,source:void 0,preview:void 0}:l,d=Gu(t),n=gB(d,t),a=Tu(n).extension,i=Dy(t,this.getID()),s={...t.meta,name:n,type:d},c=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:i,name:n,extension:a||"",meta:{...this.getState().meta,...s},type:d,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}},Fu=function(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(l=>{l.isRestriction||this.log(l.stack||l.message||l)})},4))},hu=function(l){let{files:t}=this.getState(),d={...t};const n=[],a=[];for(const i of l)try{let s=cl(this,ol,dy).call(this,i);cl(this,ol,ey).call(this,s);const c=t[s.id],F=c==null?void 0:c.isGhost;if(F&&!s.isRemote){if(s.data==null)throw new Error("File data is missing");s={...c,isGhost:!1,data:s.data},this.log(`Replaced the blob in the restored ghost file: ${s.name}, ${s.id}`)}const h=this.opts.onBeforeFileAdded(s,d);if(t=this.getState().files,d={...t,...d},!h&&this.checkIfFileAlreadyExists(s.id))throw new Ae(this.i18n("noDuplicates",{fileName:s.name??this.i18n("unnamed")}),{file:s});if(h===!1&&!F)throw new Ae("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:s});typeof h=="object"&&h!==null&&(s=h),j(this,od).validateSingleFile(s),d[s.id]=s,n.push(s)}catch(s){a.push(s)}try{j(this,od).validateAggregateRestrictions(Object.values(t),n)}catch(i){return a.push(i),{nextFilesState:t,validFilesToAdd:[],errors:a}}return{nextFilesState:d,validFilesToAdd:n,errors:a}},ou=function(){const{files:l}=this.getState();return Object.keys(l).filter(t=>{const d=l[t];return d.error&&(!d.missingRequiredMetaFields||d.missingRequiredMetaFields.length===0)})},Vu=async function(){const l=cl(this,ol,ou).call(this),t={...this.getState().files};if(l.forEach(n=>{t[n]={...t[n],isPaused:!1,error:null}}),this.setState({files:t,error:null}),this.emit("retry-all",this.getFilesByIds(l)),l.length===0)return{successful:[],failed:[]};const d=cl(this,ol,O0).call(this,l,{forceAllowNewUpload:!0});return cl(this,ol,v0).call(this,d)},_W=new WeakMap,Wu=function(){const l=cl(this,ol,ny).call(this);let t=null;l!=null&&(t=Math.round(l*100),t>100?t=100:t<0&&(t=0)),this.emit("progress",t??0),this.setState({totalProgress:t??0})},is=new WeakMap,ny=function(){const 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;const d=c=>c.progress.bytesTotal!=null&&c.progress.bytesTotal!==0,n=t.filter(d),a=t.filter(c=>!d(c));if(n.every(c=>c.progress.uploadComplete)&&a.length>0&&!a.every(c=>c.progress.uploadComplete))return null;const i=n.reduce((c,F)=>c+(F.progress.bytesTotal??0),0),s=n.reduce((c,F)=>c+(F.progress.bytesUploaded||0),0);return i===0?0:s/i},ay=function(){const l=(n,a,i)=>{let s=n.message||"Unknown error";n.details&&(s+=` ${n.details}`),this.setState({error:s}),a!=null&&a.id in this.getState().files&&this.setFileState(a.id,{error:s,response:i})};this.on("error",l),this.on("upload-error",(n,a,i)=>{if(l(a,n,i),typeof a=="object"&&a.message){this.log(a.message,"error");const s=new Error(this.i18n("failedToUpload",{file:(n==null?void 0:n.name)??""}));s.isUserFacing=!0,s.details=a.message,a.details&&(s.details+=` ${a.details}`),cl(this,ol,hs).call(this,[s])}else cl(this,ol,hs).call(this,[a])});let t=null;this.on("upload-stalled",(n,a)=>{const{message:i}=n,s=a.map(c=>c.meta.name).join(", ");t||(this.info({message:i,details:s},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${i} ${s}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});const d=n=>{const a=n.filter(s=>{const c=s!=null&&this.getFile(s.id);return c||this.log(`Not setting progress for a file that has been removed: ${s==null?void 0:s.id}`),c}),i=Object.fromEntries(a.map(s=>[s.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:s.size}}]));this.patchFilesState(i)};this.on("upload-start",d),this.on("upload-progress",j(this,_W)),this.on("upload-success",(n,a)=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}const i=this.getFile(n.id).progress,s=j(this,as).size>0;this.setFileState(n.id,{progress:{...i,postprocess:s?{mode:"indeterminate"}:void 0,uploadComplete:!0,...!s&&{complete:!0},percentage:100,bytesUploaded:i.bytesTotal},response:a,uploadURL:a.uploadURL,isPaused:!1}),n.size==null&&this.setFileState(n.id,{size:a.bytesUploaded||i.bytesTotal}),j(this,is).call(this)}),this.on("preprocess-progress",(n,a)=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}this.setFileState(n.id,{progress:{...this.getFile(n.id).progress,preprocess:a}})}),this.on("preprocess-complete",n=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}const a={...this.getState().files};a[n.id]={...a[n.id],progress:{...a[n.id].progress}},delete a[n.id].progress.preprocess,this.setState({files:a})}),this.on("postprocess-progress",(n,a)=>{if(n==null||!this.getFile(n.id)){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}this.setFileState(n.id,{progress:{...this.getState().files[n.id].progress,postprocess:a}})}),this.on("postprocess-complete",n=>{const a=n&&this.getFile(n.id);if(a==null){this.log(`Not setting progress for a file that has been removed: ${n==null?void 0:n.id}`);return}const{postprocess:i,...s}=a.progress;this.patchFilesState({[a.id]:{progress:{...s,complete:!0}}})}),this.on("restored",()=>{j(this,is).call(this)}),this.on("dashboard:file-edit-complete",n=>{n&&cl(this,ol,Zu).call(this,n)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",j(this,Ya)),window.addEventListener("offline",j(this,Ya)),setTimeout(j(this,Ya),3e3))},Ya=new WeakMap,L0=new WeakMap,O0=function(l,t={}){const{forceAllowNewUpload:d=!1}=t,{allowNewUpload:n,currentUploads:a}=this.getState();if(!n&&!d)throw new Error("Cannot create a new upload: already uploading.");const i=PQ();return this.emit("upload",i,this.getFilesByIds(l)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...a,[i]:{fileIDs:l,step:0,result:{}}}}),i},iy=function(l){const{currentUploads:t}=this.getState();return t[l]},Qu=function(l){const{[l]:t,...d}=this.getState().currentUploads;this.setState({currentUploads:d})},v0=async function(l){const t=()=>{const{currentUploads:i}=this.getState();return i[l]};let d=t();if(!d)throw new Error("Nonexistent upload");const n=[...j(this,RU),...j(this,NU),...j(this,as)];try{for(let i=d.step||0;i<n.length;i++){const s=n[i];this.setState({currentUploads:{...this.getState().currentUploads,[l]:{...d,step:i}}});const{fileIDs:c}=d;if(await s(c,l),d=t(),!d)break}}catch(i){throw cl(this,ol,Qu).call(this,l),i}if(d){d.fileIDs.forEach(F=>{const h=this.getFile(F);h!=null&&h.progress.postprocess&&this.emit("postprocess-complete",h)});const i=d.fileIDs.map(F=>this.getFile(F)),s=i.filter(F=>!F.error),c=i.filter(F=>F.error);this.addResultData(l,{successful:s,failed:c,uploadID:l}),d=t()}let a;return d&&(a=d.result,cl(this,ol,Qu).call(this,l)),a==null&&(this.log(`Not setting result for an upload that has been removed: ${l}`),a={successful:[],failed:[],uploadID:l}),a},E(qW,"VERSION",xB.version);let AQ=qW;function _Q(e){"@babel/helpers - typeof";return _Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},_Q(e)}function vB(e,l,t){return Object.defineProperty(e,"prototype",{writable:!1}),e}function KB(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function fB(e,l,t){return l=wU(l),HB(e,$Q()?Reflect.construct(l,t||[],wU(e).constructor):l.apply(e,t))}function HB(e,l){if(l&&(_Q(l)==="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return PB(e)}function PB(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function AB(e,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(l&&l.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),l&&DU(e,l)}function qQ(e){var l=typeof Map=="function"?new Map:void 0;return qQ=function(d){if(d===null||!qB(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof l<"u"){if(l.has(d))return l.get(d);l.set(d,n)}function n(){return _B(d,arguments,wU(this).constructor)}return n.prototype=Object.create(d.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),DU(n,d)},qQ(e)}function _B(e,l,t){if($Q())return Reflect.construct.apply(null,arguments);var d=[null];d.push.apply(d,l);var n=new(e.bind.apply(e,d));return t&&DU(n,t.prototype),n}function $Q(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($Q=function(){return!!e})()}function qB(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function DU(e,l){return DU=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(d,n){return d.__proto__=n,d},DU(e,l)}function wU(e){return wU=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wU(e)}var th=function(e){function l(t){var d,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(KB(this,l),d=fB(this,l,[t]),d.originalRequest=a,d.originalResponse=i,d.causingError=n,n!=null&&(t+=", caused by ".concat(n.toString())),a!=null){var s=a.getHeader("X-Request-ID")||"n/a",c=a.getMethod(),F=a.getURL(),h=i?i.getStatus():"n/a",o=i?i.getBody()||"":"n/a";t+=", originated from request (method: ".concat(c,", url: ").concat(F,", response code: ").concat(h,", response text: ").concat(o,", request id: ").concat(s,")")}return d.message=t,d}return AB(l,e),vB(l)}(qQ(Error));function Px(e){}function EU(e){"@babel/helpers - typeof";return EU=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},EU(e)}function $B(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function lY(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,eY(d.key),d)}}function tY(e,l,t){return l&&lY(e.prototype,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function eY(e){var l=dY(e,"string");return EU(l)=="symbol"?l:l+""}function dY(e,l){if(EU(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(EU(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var nY=function(){function e(){$B(this,e)}return tY(e,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(t){return Promise.resolve([])}},{key:"removeUpload",value:function(t){return Promise.resolve()}},{key:"addUpload",value:function(t,d){return Promise.resolve(null)}}])}();const Dr="3.7.8",aY=Dr,Rs=typeof Buffer=="function",wr=typeof TextDecoder=="function"?new TextDecoder:void 0,Er=typeof TextEncoder=="function"?new TextEncoder:void 0,CU=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),eh=(e=>{let l={};return e.forEach((t,d)=>l[t]=d),l})(CU),iY=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Gt=String.fromCharCode.bind(String),Cr=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),xr=e=>e.replace(/=/g,"").replace(/[+\/]/g,l=>l=="+"?"-":"_"),gr=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),jr=e=>{let l,t,d,n,a="";const i=e.length%3;for(let s=0;s<e.length;){if((t=e.charCodeAt(s++))>255||(d=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");l=t<<16|d<<8|n,a+=CU[l>>18&63]+CU[l>>12&63]+CU[l>>6&63]+CU[l&63]}return i?a.slice(0,i-3)+"===".substring(i):a},lm=typeof btoa=="function"?e=>btoa(e):Rs?e=>Buffer.from(e,"binary").toString("base64"):jr,tm=Rs?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let d=0,n=e.length;d<n;d+=4096)t.push(Gt.apply(null,e.subarray(d,d+4096)));return lm(t.join(""))},dh=(e,l=!1)=>l?xr(tm(e)):tm(e),sY=e=>{if(e.length<2){var l=e.charCodeAt(0);return l<128?e:l<2048?Gt(192|l>>>6)+Gt(128|l&63):Gt(224|l>>>12&15)+Gt(128|l>>>6&63)+Gt(128|l&63)}else{var l=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return Gt(240|l>>>18&7)+Gt(128|l>>>12&63)+Gt(128|l>>>6&63)+Gt(128|l&63)}},cY=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Or=e=>e.replace(cY,sY),vr=Rs?e=>Buffer.from(e,"utf8").toString("base64"):Er?e=>tm(Er.encode(e)):e=>lm(Or(e)),Ns=(e,l=!1)=>l?xr(vr(e)):vr(e),Kr=e=>Ns(e,!0),UY=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,ZY=e=>{switch(e.length){case 4:var l=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),t=l-65536;return Gt((t>>>10)+55296)+Gt((t&1023)+56320);case 3:return Gt((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return Gt((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},fr=e=>e.replace(UY,ZY),Hr=e=>{if(e=e.replace(/\s+/g,""),!iY.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let l,t,d,n=[];for(let a=0;a<e.length;)l=eh[e.charAt(a++)]<<18|eh[e.charAt(a++)]<<12|(t=eh[e.charAt(a++)])<<6|(d=eh[e.charAt(a++)]),t===64?n.push(Gt(l>>16&255)):d===64?n.push(Gt(l>>16&255,l>>8&255)):n.push(Gt(l>>16&255,l>>8&255,l&255));return n.join("")},em=typeof atob=="function"?e=>atob(gr(e)):Rs?e=>Buffer.from(e,"base64").toString("binary"):Hr,Pr=Rs?e=>Cr(Buffer.from(e,"base64")):e=>Cr(em(e).split("").map(l=>l.charCodeAt(0))),Ar=e=>Pr(_r(e)),FY=Rs?e=>Buffer.from(e,"base64").toString("utf8"):wr?e=>wr.decode(Pr(e)):e=>fr(em(e)),_r=e=>gr(e.replace(/[-_]/g,l=>l=="-"?"+":"/")),dm=e=>FY(_r(e)),hY=e=>{if(typeof e!="string")return!1;const l=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(l)||!/[^\s0-9a-zA-Z\-_]/.test(l)},qr=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),$r=function(){const e=(l,t)=>Object.defineProperty(String.prototype,l,qr(t));e("fromBase64",function(){return dm(this)}),e("toBase64",function(l){return Ns(this,l)}),e("toBase64URI",function(){return Ns(this,!0)}),e("toBase64URL",function(){return Ns(this,!0)}),e("toUint8Array",function(){return Ar(this)})},lp=function(){const e=(l,t)=>Object.defineProperty(Uint8Array.prototype,l,qr(t));e("toBase64",function(l){return dh(this,l)}),e("toBase64URI",function(){return dh(this,!0)}),e("toBase64URL",function(){return dh(this,!0)})},oY={version:Dr,VERSION:aY,atob:em,atobPolyfill:Hr,btoa:lm,btoaPolyfill:jr,fromBase64:dm,toBase64:Ns,encode:Ns,encodeURI:Kr,encodeURL:Kr,utob:Or,btou:fr,decode:dm,isValid:hY,fromUint8Array:dh,toUint8Array:Ar,extendString:$r,extendUint8Array:lp,extendBuiltins:()=>{$r(),lp()}};var nm,tp;function VY(){return tp||(tp=1,nm=function(l,t){if(t=t.split(":")[0],l=+l,!l)return!1;switch(t){case"http":case"ws":return l!==80;case"https":case"wss":return l!==443;case"ftp":return l!==21;case"gopher":return l!==70;case"file":return!1}return l!==0}),nm}var nh={},ep;function WY(){if(ep)return nh;ep=1;var e=Object.prototype.hasOwnProperty,l;function t(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}function d(i){try{return encodeURIComponent(i)}catch{return null}}function n(i){for(var s=/([^=?#&]+)=?([^&]*)/g,c={},F;F=s.exec(i);){var h=t(F[1]),o=t(F[2]);h===null||o===null||h in c||(c[h]=o)}return c}function a(i,s){s=s||"";var c=[],F,h;typeof s!="string"&&(s="?");for(h in i)if(e.call(i,h)){if(F=i[h],!F&&(F===null||F===l||isNaN(F))&&(F=""),h=d(h),F=d(F),h===null||F===null)continue;c.push(h+"="+F)}return c.length?s+c.join("&"):""}return nh.stringify=a,nh.parse=n,nh}var am,dp;function QY(){if(dp)return am;dp=1;var e=VY(),l=WY(),t=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,d=/[\n\r\t]/g,n=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,a=/:\d+$/,i=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,s=/^[a-zA-Z]:/;function c(b){return(b||"").toString().replace(t,"")}var F=[["#","hash"],["?","query"],function(u,J){return V(J.protocol)?u.replace(/\\/g,"/"):u},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],h={hash:1,query:1};function o(b){var u;typeof window<"u"?u=window:typeof ms<"u"?u=ms:typeof self<"u"?u=self:u={};var J=u.location||{};b=b||J;var G={},T=typeof b,y;if(b.protocol==="blob:")G=new m(unescape(b.pathname),{});else if(T==="string"){G=new m(b,{});for(y in h)delete G[y]}else if(T==="object"){for(y in b)y in h||(G[y]=b[y]);G.slashes===void 0&&(G.slashes=n.test(b.href))}return G}function V(b){return b==="file:"||b==="ftp:"||b==="http:"||b==="https:"||b==="ws:"||b==="wss:"}function W(b,u){b=c(b),b=b.replace(d,""),u=u||{};var J=i.exec(b),G=J[1]?J[1].toLowerCase():"",T=!!J[2],y=!!J[3],k=0,X;return T?y?(X=J[2]+J[3]+J[4],k=J[2].length+J[3].length):(X=J[2]+J[4],k=J[2].length):y?(X=J[3]+J[4],k=J[3].length):X=J[4],G==="file:"?k>=2&&(X=X.slice(2)):V(G)?X=J[4]:G?T&&(X=X.slice(2)):k>=2&&V(u.protocol)&&(X=J[4]),{protocol:G,slashes:T||V(G),slashesCount:k,rest:X}}function Q(b,u){if(b==="")return u;for(var J=(u||"/").split("/").slice(0,-1).concat(b.split("/")),G=J.length,T=J[G-1],y=!1,k=0;G--;)J[G]==="."?J.splice(G,1):J[G]===".."?(J.splice(G,1),k++):k&&(G===0&&(y=!0),J.splice(G,1),k--);return y&&J.unshift(""),(T==="."||T==="..")&&J.push(""),J.join("/")}function m(b,u,J){if(b=c(b),b=b.replace(d,""),!(this instanceof m))return new m(b,u,J);var G,T,y,k,X,L,D=F.slice(),C=typeof u,I=this,H=0;for(C!=="object"&&C!=="string"&&(J=u,u=null),J&&typeof J!="function"&&(J=l.parse),u=o(u),T=W(b||"",u),G=!T.protocol&&!T.slashes,I.slashes=T.slashes||G&&u.slashes,I.protocol=T.protocol||u.protocol||"",b=T.rest,(T.protocol==="file:"&&(T.slashesCount!==2||s.test(b))||!T.slashes&&(T.protocol||T.slashesCount<2||!V(I.protocol)))&&(D[3]=[/(.*)/,"pathname"]);H<D.length;H++){if(k=D[H],typeof k=="function"){b=k(b,I);continue}y=k[0],L=k[1],y!==y?I[L]=b:typeof y=="string"?(X=y==="@"?b.lastIndexOf(y):b.indexOf(y),~X&&(typeof k[2]=="number"?(I[L]=b.slice(0,X),b=b.slice(X+k[2])):(I[L]=b.slice(X),b=b.slice(0,X)))):(X=y.exec(b))&&(I[L]=X[1],b=b.slice(0,X.index)),I[L]=I[L]||G&&k[3]&&u[L]||"",k[4]&&(I[L]=I[L].toLowerCase())}J&&(I.query=J(I.query)),G&&u.slashes&&I.pathname.charAt(0)!=="/"&&(I.pathname!==""||u.pathname!=="")&&(I.pathname=Q(I.pathname,u.pathname)),I.pathname.charAt(0)!=="/"&&V(I.protocol)&&(I.pathname="/"+I.pathname),e(I.port,I.protocol)||(I.host=I.hostname,I.port=""),I.username=I.password="",I.auth&&(X=I.auth.indexOf(":"),~X?(I.username=I.auth.slice(0,X),I.username=encodeURIComponent(decodeURIComponent(I.username)),I.password=I.auth.slice(X+1),I.password=encodeURIComponent(decodeURIComponent(I.password))):I.username=encodeURIComponent(decodeURIComponent(I.auth)),I.auth=I.password?I.username+":"+I.password:I.username),I.origin=I.protocol!=="file:"&&V(I.protocol)&&I.host?I.protocol+"//"+I.host:"null",I.href=I.toString()}function R(b,u,J){var G=this;switch(b){case"query":typeof u=="string"&&u.length&&(u=(J||l.parse)(u)),G[b]=u;break;case"port":G[b]=u,e(u,G.protocol)?u&&(G.host=G.hostname+":"+u):(G.host=G.hostname,G[b]="");break;case"hostname":G[b]=u,G.port&&(u+=":"+G.port),G.host=u;break;case"host":G[b]=u,a.test(u)?(u=u.split(":"),G.port=u.pop(),G.hostname=u.join(":")):(G.hostname=u,G.port="");break;case"protocol":G.protocol=u.toLowerCase(),G.slashes=!J;break;case"pathname":case"hash":if(u){var T=b==="pathname"?"/":"#";G[b]=u.charAt(0)!==T?T+u:u}else G[b]=u;break;case"username":case"password":G[b]=encodeURIComponent(u);break;case"auth":var y=u.indexOf(":");~y?(G.username=u.slice(0,y),G.username=encodeURIComponent(decodeURIComponent(G.username)),G.password=u.slice(y+1),G.password=encodeURIComponent(decodeURIComponent(G.password))):G.username=encodeURIComponent(decodeURIComponent(u))}for(var k=0;k<F.length;k++){var X=F[k];X[4]&&(G[X[1]]=G[X[1]].toLowerCase())}return G.auth=G.password?G.username+":"+G.password:G.username,G.origin=G.protocol!=="file:"&&V(G.protocol)&&G.host?G.protocol+"//"+G.host:"null",G.href=G.toString(),G}function r(b){(!b||typeof b!="function")&&(b=l.stringify);var u,J=this,G=J.host,T=J.protocol;T&&T.charAt(T.length-1)!==":"&&(T+=":");var y=T+(J.protocol&&J.slashes||V(J.protocol)?"//":"");return J.username?(y+=J.username,J.password&&(y+=":"+J.password),y+="@"):J.password?(y+=":"+J.password,y+="@"):J.protocol!=="file:"&&V(J.protocol)&&!G&&J.pathname!=="/"&&(y+="@"),(G[G.length-1]===":"||a.test(J.hostname)&&!J.port)&&(G+=":"),y+=G+J.pathname,u=typeof J.query=="object"?b(J.query):J.query,u&&(y+=u.charAt(0)!=="?"?"?"+u:u),J.hash&&(y+=J.hash),y}return m.prototype={set:R,toString:r},m.extractProtocol=W,m.location=o,m.trimLeft=c,m.qs=l,am=m,am}var mY=QY();const RY=Ca(mY);function NY(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var l=Math.random()*16|0,t=e==="x"?l:l&3|8;return t.toString(16)})}function im(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */im=function(){return l};var e,l={},t=Object.prototype,d=t.hasOwnProperty,n=Object.defineProperty||function(Y,B,z){Y[B]=z.value},a=typeof Symbol=="function"?Symbol:{},i=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function F(Y,B,z){return Object.defineProperty(Y,B,{value:z,enumerable:!0,configurable:!0,writable:!0}),Y[B]}try{F({},"")}catch{F=function(z,g,w){return z[g]=w}}function h(Y,B,z,g){var w=B&&B.prototype instanceof r?B:r,O=Object.create(w.prototype),K=new H(g||[]);return n(O,"_invoke",{value:L(Y,z,K)}),O}function o(Y,B,z){try{return{type:"normal",arg:Y.call(B,z)}}catch(g){return{type:"throw",arg:g}}}l.wrap=h;var V="suspendedStart",W="suspendedYield",Q="executing",m="completed",R={};function r(){}function b(){}function u(){}var J={};F(J,i,function(){return this});var G=Object.getPrototypeOf,T=G&&G(G(f([])));T&&T!==t&&d.call(T,i)&&(J=T);var y=u.prototype=r.prototype=Object.create(J);function k(Y){["next","throw","return"].forEach(function(B){F(Y,B,function(z){return this._invoke(B,z)})})}function X(Y,B){function z(w,O,K,x){var _=o(Y[w],Y,O);if(_.type!=="throw"){var al=_.arg,P=al.value;return P&&ga(P)=="object"&&d.call(P,"__await")?B.resolve(P.__await).then(function(A){z("next",A,K,x)},function(A){z("throw",A,K,x)}):B.resolve(P).then(function(A){al.value=A,K(al)},function(A){return z("throw",A,K,x)})}x(_.arg)}var g;n(this,"_invoke",{value:function(O,K){function x(){return new B(function(_,al){z(O,K,_,al)})}return g=g?g.then(x,x):x()}})}function L(Y,B,z){var g=V;return function(w,O){if(g===Q)throw Error("Generator is already running");if(g===m){if(w==="throw")throw O;return{value:e,done:!0}}for(z.method=w,z.arg=O;;){var K=z.delegate;if(K){var x=D(K,z);if(x){if(x===R)continue;return x}}if(z.method==="next")z.sent=z._sent=z.arg;else if(z.method==="throw"){if(g===V)throw g=m,z.arg;z.dispatchException(z.arg)}else z.method==="return"&&z.abrupt("return",z.arg);g=Q;var _=o(Y,B,z);if(_.type==="normal"){if(g=z.done?m:W,_.arg===R)continue;return{value:_.arg,done:z.done}}_.type==="throw"&&(g=m,z.method="throw",z.arg=_.arg)}}}function D(Y,B){var z=B.method,g=Y.iterator[z];if(g===e)return B.delegate=null,z==="throw"&&Y.iterator.return&&(B.method="return",B.arg=e,D(Y,B),B.method==="throw")||z!=="return"&&(B.method="throw",B.arg=new TypeError("The iterator does not provide a '"+z+"' method")),R;var w=o(g,Y.iterator,B.arg);if(w.type==="throw")return B.method="throw",B.arg=w.arg,B.delegate=null,R;var O=w.arg;return O?O.done?(B[Y.resultName]=O.value,B.next=Y.nextLoc,B.method!=="return"&&(B.method="next",B.arg=e),B.delegate=null,R):O:(B.method="throw",B.arg=new TypeError("iterator result is not an object"),B.delegate=null,R)}function C(Y){var B={tryLoc:Y[0]};1 in Y&&(B.catchLoc=Y[1]),2 in Y&&(B.finallyLoc=Y[2],B.afterLoc=Y[3]),this.tryEntries.push(B)}function I(Y){var B=Y.completion||{};B.type="normal",delete B.arg,Y.completion=B}function H(Y){this.tryEntries=[{tryLoc:"root"}],Y.forEach(C,this),this.reset(!0)}function f(Y){if(Y||Y===""){var B=Y[i];if(B)return B.call(Y);if(typeof Y.next=="function")return Y;if(!isNaN(Y.length)){var z=-1,g=function w(){for(;++z<Y.length;)if(d.call(Y,z))return w.value=Y[z],w.done=!1,w;return w.value=e,w.done=!0,w};return g.next=g}}throw new TypeError(ga(Y)+" is not iterable")}return b.prototype=u,n(y,"constructor",{value:u,configurable:!0}),n(u,"constructor",{value:b,configurable:!0}),b.displayName=F(u,c,"GeneratorFunction"),l.isGeneratorFunction=function(Y){var B=typeof Y=="function"&&Y.constructor;return!!B&&(B===b||(B.displayName||B.name)==="GeneratorFunction")},l.mark=function(Y){return Object.setPrototypeOf?Object.setPrototypeOf(Y,u):(Y.__proto__=u,F(Y,c,"GeneratorFunction")),Y.prototype=Object.create(y),Y},l.awrap=function(Y){return{__await:Y}},k(X.prototype),F(X.prototype,s,function(){return this}),l.AsyncIterator=X,l.async=function(Y,B,z,g,w){w===void 0&&(w=Promise);var O=new X(h(Y,B,z,g),w);return l.isGeneratorFunction(B)?O:O.next().then(function(K){return K.done?K.value:O.next()})},k(y),F(y,c,"Generator"),F(y,i,function(){return this}),F(y,"toString",function(){return"[object Generator]"}),l.keys=function(Y){var B=Object(Y),z=[];for(var g in B)z.push(g);return z.reverse(),function w(){for(;z.length;){var O=z.pop();if(O in B)return w.value=O,w.done=!1,w}return w.done=!0,w}},l.values=f,H.prototype={constructor:H,reset:function(B){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!B)for(var z in this)z.charAt(0)==="t"&&d.call(this,z)&&!isNaN(+z.slice(1))&&(this[z]=e)},stop:function(){this.done=!0;var B=this.tryEntries[0].completion;if(B.type==="throw")throw B.arg;return this.rval},dispatchException:function(B){if(this.done)throw B;var z=this;function g(al,P){return K.type="throw",K.arg=B,z.next=al,P&&(z.method="next",z.arg=e),!!P}for(var w=this.tryEntries.length-1;w>=0;--w){var O=this.tryEntries[w],K=O.completion;if(O.tryLoc==="root")return g("end");if(O.tryLoc<=this.prev){var x=d.call(O,"catchLoc"),_=d.call(O,"finallyLoc");if(x&&_){if(this.prev<O.catchLoc)return g(O.catchLoc,!0);if(this.prev<O.finallyLoc)return g(O.finallyLoc)}else if(x){if(this.prev<O.catchLoc)return g(O.catchLoc,!0)}else{if(!_)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return g(O.finallyLoc)}}}},abrupt:function(B,z){for(var g=this.tryEntries.length-1;g>=0;--g){var w=this.tryEntries[g];if(w.tryLoc<=this.prev&&d.call(w,"finallyLoc")&&this.prev<w.finallyLoc){var O=w;break}}O&&(B==="break"||B==="continue")&&O.tryLoc<=z&&z<=O.finallyLoc&&(O=null);var K=O?O.completion:{};return K.type=B,K.arg=z,O?(this.method="next",this.next=O.finallyLoc,R):this.complete(K)},complete:function(B,z){if(B.type==="throw")throw B.arg;return B.type==="break"||B.type==="continue"?this.next=B.arg:B.type==="return"?(this.rval=this.arg=B.arg,this.method="return",this.next="end"):B.type==="normal"&&z&&(this.next=z),R},finish:function(B){for(var z=this.tryEntries.length-1;z>=0;--z){var g=this.tryEntries[z];if(g.finallyLoc===B)return this.complete(g.completion,g.afterLoc),I(g),R}},catch:function(B){for(var z=this.tryEntries.length-1;z>=0;--z){var g=this.tryEntries[z];if(g.tryLoc===B){var w=g.completion;if(w.type==="throw"){var O=w.arg;I(g)}return O}}throw Error("illegal catch attempt")},delegateYield:function(B,z,g){return this.delegate={iterator:f(B),resultName:z,nextLoc:g},this.method==="next"&&(this.arg=e),R}},l}function np(e,l,t,d,n,a,i){try{var s=e[a](i),c=s.value}catch(F){t(F);return}s.done?l(c):Promise.resolve(c).then(d,n)}function bY(e){return function(){var l=this,t=arguments;return new Promise(function(d,n){var a=e.apply(l,t);function i(c){np(a,d,n,i,s,"next",c)}function s(c){np(a,d,n,i,s,"throw",c)}i(void 0)})}}function ap(e,l){return pY(e)||rY(e,l)||ip(e,l)||uY()}function uY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
16
16
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rY(e,l){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var d,n,a,i,s=[],c=!0,F=!1;try{if(a=(t=t.call(e)).next,l!==0)for(;!(c=(d=a.call(t)).done)&&(s.push(d.value),s.length!==l);c=!0);}catch(h){F=!0,n=h}finally{try{if(!c&&t.return!=null&&(i=t.return(),Object(i)!==i))return}finally{if(F)throw n}}return s}}function pY(e){if(Array.isArray(e))return e}function ga(e){"@babel/helpers - typeof";return ga=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},ga(e)}function MY(e,l){var t=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=ip(e))||l){t&&(e=t);var d=0,n=function(){};return{s:n,n:function(){return d>=e.length?{done:!0}:{done:!1,value:e[d++]}},e:function(F){throw F},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
17
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,i=!1,s;return{s:function(){t=t.call(e)},n:function(){var F=t.next();return a=F.done,F},e:function(F){i=!0,s=F},f:function(){try{!a&&t.return!=null&&t.return()}finally{if(i)throw s}}}}function ip(e,l){if(e){if(typeof e=="string")return sp(e,l);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return sp(e,l)}}function sp(e,l){(l==null||l>e.length)&&(l=e.length);for(var t=0,d=new Array(l);t<l;t++)d[t]=e[t];return d}function cp(e,l){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);l&&(d=d.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,d)}return t}function bs(e){for(var l=1;l<arguments.length;l++){var t=arguments[l]!=null?arguments[l]:{};l%2?cp(Object(t),!0).forEach(function(d){SY(e,d,t[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):cp(Object(t)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(t,d))})}return e}function SY(e,l,t){return l=Zp(l),l in e?Object.defineProperty(e,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[l]=t,e}function JY(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function Up(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,Zp(d.key),d)}}function TY(e,l,t){return l&&Up(e.prototype,l),t&&Up(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Zp(e){var l=GY(e,"string");return ga(l)=="symbol"?l:l+""}function GY(e,l){if(ga(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(ga(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ah="tus-v1",ih="ietf-draft-03",xU="ietf-draft-05",XY={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:Wp,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:ah},sh=function(){function e(l,t){JY(this,e),"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=l,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 TY(e,[{key:"findPreviousUploads",value:function(){var t=this;return this.options.fingerprint(this.file,this.options).then(function(d){return t._urlStorage.findUploadsByFingerprint(d)})}},{key:"resumeFromPreviousUpload",value:function(t){this.url=t.uploadUrl||null,this._parallelUploadUrls=t.parallelUploadUrls||null,this._urlStorageKey=t.urlStorageKey}},{key:"start",value:function(){var t=this,d=this.file;if(!d){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![ah,ih,xU].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 n=this.options.retryDelays;if(n!=null&&Object.prototype.toString.call(n)!=="[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 a=0,i=["uploadUrl","uploadSize","uploadLengthDeferred"];a<i.length;a++){var s=i[a];if(this.options[s]){this._emitError(new Error("tus: cannot use the ".concat(s," 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(d,this.options).then(function(c){return t._fingerprint=c,t._source?t._source:t.options.fileReader.openFile(d,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)})}},{key:"_startParallelUpload",value:function(){var t,d=this,n=this._size,a=0;this._parallelUploads=[];var i=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,s=(t=this.options.parallelUploadBoundaries)!==null&&t!==void 0?t:BY(this._source.size,i);this._parallelUploadUrls&&s.forEach(function(h,o){h.uploadUrl=d._parallelUploadUrls[o]||null}),this._parallelUploadUrls=new Array(s.length);var c=s.map(function(h,o){var V=0;return d._source.slice(h.start,h.end).then(function(W){var Q=W.value;return new Promise(function(m,R){var r=bs(bs({},d.options),{},{uploadUrl:h.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:d.options.metadataForPartialUploads,headers:bs(bs({},d.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:m,onError:R,onProgress:function(J){a=a-V+J,V=J,d._emitProgress(a,n)},onUploadUrlAvailable:function(){d._parallelUploadUrls[o]=b.url,d._parallelUploadUrls.filter(function(J){return!!J}).length===s.length&&d._saveUploadInUrlStorage()}}),b=new e(Q,r);b.start(),d._parallelUploads.push(b)})})}),F;Promise.all(c).then(function(){F=d._openRequest("POST",d.options.endpoint),F.setHeader("Upload-Concat","final;".concat(d._parallelUploadUrls.join(" ")));var h=Fp(d.options.metadata);return h!==""&&F.setHeader("Upload-Metadata",h),d._sendRequest(F,null)}).then(function(h){if(!us(h.getStatus(),200)){d._emitHttpError(F,h,"tus: unexpected response while creating upload");return}var o=h.getHeader("Location");if(o==null){d._emitHttpError(F,h,"tus: invalid or missing Location header");return}d.url=Qp(d.options.endpoint,o),"Created upload at ".concat(d.url),d._emitSuccess(h)}).catch(function(h){d._emitError(h)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){"Resuming upload from previous URL: ".concat(this.url),this._resumeUpload();return}if(this.options.uploadUrl!=null){"Resuming upload from provided URL: ".concat(this.options.uploadUrl),this.url=this.options.uploadUrl,this._resumeUpload();return}this._createUpload()}},{key:"abort",value:function(t){var d=this;if(this._parallelUploads!=null){var n=MY(this._parallelUploads),a;try{for(n.s();!(a=n.n()).done;){var i=a.value;i.abort(t)}}catch(s){n.e(s)}finally{n.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():e.terminate(this.url,this.options).then(function(){return d._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(t,d,n,a){this._emitError(new th(n,a,t,d))}},{key:"_emitError",value:function(t){var d=this;if(!this._aborted){if(this.options.retryDelays!=null){var n=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(n&&(this._retryAttempt=0),Vp(t,this._retryAttempt,this.options)){var a=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){d.start()},a);return}}if(typeof this.options.onError=="function")this.options.onError(t);else throw t}}},{key:"_emitSuccess",value:function(t){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:t})}},{key:"_emitProgress",value:function(t,d){typeof this.options.onProgress=="function"&&this.options.onProgress(t,d)}},{key:"_emitChunkComplete",value:function(t,d,n){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(t,d,n)}},{key:"_createUpload",value:function(){var t=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var d=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?d.setHeader("Upload-Defer-Length","1"):d.setHeader("Upload-Length","".concat(this._size));var n=Fp(this.options.metadata);n!==""&&d.setHeader("Upload-Metadata",n);var a;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,a=this._addChunkToRequest(d)):((this.options.protocol===ih||this.options.protocol===xU)&&d.setHeader("Upload-Complete","?0"),a=this._sendRequest(d,null)),a.then(function(i){if(!us(i.getStatus(),200)){t._emitHttpError(d,i,"tus: unexpected response while creating upload");return}var s=i.getHeader("Location");if(s==null){t._emitHttpError(d,i,"tus: invalid or missing Location header");return}if(t.url=Qp(t.options.endpoint,s),"Created upload at ".concat(t.url),typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._size===0){t._emitSuccess(i),t._source.close();return}t._saveUploadInUrlStorage().then(function(){t.options.uploadDataDuringCreation?t._handleUploadResponse(d,i):(t._offset=0,t._performUpload())})}).catch(function(i){t._emitHttpError(d,null,"tus: failed to create upload",i)})}},{key:"_resumeUpload",value:function(){var t=this,d=this._openRequest("HEAD",this.url),n=this._sendRequest(d,null);n.then(function(a){var i=a.getStatus();if(!us(i,200)){if(i===423){t._emitHttpError(d,a,"tus: upload is currently locked; retry later");return}if(us(i,400)&&t._removeFromUrlStorage(),!t.options.endpoint){t._emitHttpError(d,a,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}t.url=null,t._createUpload();return}var s=Number.parseInt(a.getHeader("Upload-Offset"),10);if(Number.isNaN(s)){t._emitHttpError(d,a,"tus: invalid or missing offset value");return}var c=Number.parseInt(a.getHeader("Upload-Length"),10);if(Number.isNaN(c)&&!t.options.uploadLengthDeferred&&t.options.protocol===ah){t._emitHttpError(d,a,"tus: invalid or missing length value");return}typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._saveUploadInUrlStorage().then(function(){if(s===c){t._emitProgress(c,c),t._emitSuccess(a);return}t._offset=s,t._performUpload()})}).catch(function(a){t._emitHttpError(d,null,"tus: failed to resume upload",a)})}},{key:"_performUpload",value:function(){var t=this;if(!this._aborted){var d;this.options.overridePatchMethod?(d=this._openRequest("POST",this.url),d.setHeader("X-HTTP-Method-Override","PATCH")):d=this._openRequest("PATCH",this.url),d.setHeader("Upload-Offset","".concat(this._offset));var n=this._addChunkToRequest(d);n.then(function(a){if(!us(a.getStatus(),200)){t._emitHttpError(d,a,"tus: unexpected response while uploading chunk");return}t._handleUploadResponse(d,a)}).catch(function(a){t._aborted||t._emitHttpError(d,null,"tus: failed to upload chunk at offset ".concat(t._offset),a)})}}},{key:"_addChunkToRequest",value:function(t){var d=this,n=this._offset,a=this._offset+this.options.chunkSize;return t.setProgressHandler(function(i){d._emitProgress(n+i,d._size)}),this.options.protocol===ah?t.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===xU&&t.setHeader("Content-Type","application/partial-upload"),(a===Number.POSITIVE_INFINITY||a>this._size)&&!this.options.uploadLengthDeferred&&(a=this._size),this._source.slice(n,a).then(function(i){var s=i.value,c=i.done,F=s!=null&&s.size?s.size:0;d.options.uploadLengthDeferred&&c&&(d._size=d._offset+F,t.setHeader("Upload-Length","".concat(d._size)));var h=d._offset+F;return!d.options.uploadLengthDeferred&&c&&h!==d._size?Promise.reject(new Error("upload was configured with a size of ".concat(d._size," bytes, but the source is done after ").concat(h," bytes"))):s===null?d._sendRequest(t):((d.options.protocol===ih||d.options.protocol===xU)&&t.setHeader("Upload-Complete",c?"?1":"?0"),d._emitProgress(d._offset,d._size),d._sendRequest(t,s))})}},{key:"_handleUploadResponse",value:function(t,d){var n=Number.parseInt(d.getHeader("Upload-Offset"),10);if(Number.isNaN(n)){this._emitHttpError(t,d,"tus: invalid or missing offset value");return}if(this._emitProgress(n,this._size),this._emitChunkComplete(n-this._offset,n,this._size),this._offset=n,n===this._size){this._emitSuccess(d),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(t,d){var n=hp(t,d,this.options);return this._req=n,n}},{key:"_removeFromUrlStorage",value:function(){var t=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(d){t._emitError(d)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var t=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var d={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?d.parallelUploadUrls=this._parallelUploadUrls:d.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,d).then(function(n){t._urlStorageKey=n})}},{key:"_sendRequest",value:function(t){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return op(t,d,this.options)}}],[{key:"terminate",value:function(t){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=hp("DELETE",t,d);return op(n,null,d).then(function(a){if(a.getStatus()!==204)throw new th("tus: unexpected response while terminating upload",null,n,a)}).catch(function(a){if(a instanceof th||(a=new th("tus: failed to terminate upload",a,n,null)),!Vp(a,0,d))throw a;var i=d.retryDelays[0],s=d.retryDelays.slice(1),c=bs(bs({},d),{},{retryDelays:s});return new Promise(function(F){return setTimeout(F,i)}).then(function(){return e.terminate(t,c)})})}}])}();function Fp(e){return Object.entries(e).map(function(l){var t=ap(l,2),d=t[0],n=t[1];return"".concat(d," ").concat(oY.encode(String(n)))}).join(",")}function us(e,l){return e>=l&&e<l+100}function hp(e,l,t){var d=t.httpStack.createRequest(e,l);t.protocol===ih?d.setHeader("Upload-Draft-Interop-Version","5"):t.protocol===xU?d.setHeader("Upload-Draft-Interop-Version","6"):d.setHeader("Tus-Resumable","1.0.0");for(var n=t.headers||{},a=0,i=Object.entries(n);a<i.length;a++){var s=ap(i[a],2),c=s[0],F=s[1];d.setHeader(c,F)}if(t.addRequestId){var h=NY();d.setHeader("X-Request-ID",h)}return d}function op(e,l,t){return sm.apply(this,arguments)}function sm(){return sm=bY(im().mark(function e(l,t,d){var n;return im().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(typeof d.onBeforeRequest!="function"){i.next=3;break}return i.next=3,d.onBeforeRequest(l);case 3:return i.next=5,l.send(t);case 5:if(n=i.sent,typeof d.onAfterResponse!="function"){i.next=9;break}return i.next=9,d.onAfterResponse(l,n);case 9:return i.abrupt("return",n);case 10:case"end":return i.stop()}},e)})),sm.apply(this,arguments)}function yY(){var e=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(e=!1),e}function Vp(e,l,t){return t.retryDelays==null||l>=t.retryDelays.length||e.originalRequest==null?!1:t&&typeof t.onShouldRetry=="function"?t.onShouldRetry(e,l,t):Wp(e)}function Wp(e){var l=e.originalResponse?e.originalResponse.getStatus():0;return(!us(l,400)||l===409||l===423)&&yY()}function Qp(e,l){return new RY(l,e).toString()}function BY(e,l){for(var t=Math.floor(e/l),d=[],n=0;n<l;n++)d.push({start:t*n,end:t*(n+1)});return d[l-1].end=e,d}sh.defaultOptions=XY;var mp=function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"};function YY(e){return new Promise(function(l,t){var d=new XMLHttpRequest;d.responseType="blob",d.onload=function(){var n=d.response;l(n)},d.onerror=function(n){t(n)},d.open("GET",e),d.send()})}var kY=function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")};function zY(e){return new Promise(function(l,t){var d=new FileReader;d.onload=function(){var n=new Uint8Array(d.result);l({value:n})},d.onerror=function(n){t(n)},d.readAsArrayBuffer(e)})}function gU(e){"@babel/helpers - typeof";return gU=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},gU(e)}function LY(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function IY(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,wY(d.key),d)}}function DY(e,l,t){return l&&IY(e.prototype,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function wY(e){var l=EY(e,"string");return gU(l)=="symbol"?l:l+""}function EY(e,l){if(gU(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(gU(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Rp=function(){function e(l){LY(this,e),this._file=l,this.size=l.size}return DY(e,[{key:"slice",value:function(t,d){if(kY())return zY(this._file.slice(t,d));var n=this._file.slice(t,d),a=d>=this.size;return Promise.resolve({value:n,done:a})}},{key:"close",value:function(){}}])}();function jU(e){"@babel/helpers - typeof";return jU=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},jU(e)}function CY(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function xY(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,jY(d.key),d)}}function gY(e,l,t){return l&&xY(e.prototype,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function jY(e){var l=OY(e,"string");return jU(l)=="symbol"?l:l+""}function OY(e,l){if(jU(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(jU(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Np(e){return e===void 0?0:e.size!==void 0?e.size:e.length}function vY(e,l){if(e.concat)return e.concat(l);if(e instanceof Blob)return new Blob([e,l],{type:e.type});if(e.set){var t=new e.constructor(e.length+l.length);return t.set(e),t.set(l,e.length),t}throw new Error("Unknown data type")}var KY=function(){function e(l){CY(this,e),this._buffer=void 0,this._bufferOffset=0,this._reader=l,this._done=!1}return gY(e,[{key:"slice",value:function(t,d){return t<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(t,d)}},{key:"_readUntilEnoughDataOrDone",value:function(t,d){var n=this,a=d<=this._bufferOffset+Np(this._buffer);if(this._done||a){var i=this._getDataFromBuffer(t,d),s=i==null?this._done:!1;return Promise.resolve({value:i,done:s})}return this._reader.read().then(function(c){var F=c.value,h=c.done;return h?n._done=!0:n._buffer===void 0?n._buffer=F:n._buffer=vY(n._buffer,F),n._readUntilEnoughDataOrDone(t,d)})}},{key:"_getDataFromBuffer",value:function(t,d){t>this._bufferOffset&&(this._buffer=this._buffer.slice(t-this._bufferOffset),this._bufferOffset=t);var n=Np(this._buffer)===0;return this._done&&n?null:this._buffer.slice(0,d-t)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}])}();function ja(e){"@babel/helpers - typeof";return ja=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},ja(e)}function cm(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */cm=function(){return l};var e,l={},t=Object.prototype,d=t.hasOwnProperty,n=Object.defineProperty||function(Y,B,z){Y[B]=z.value},a=typeof Symbol=="function"?Symbol:{},i=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function F(Y,B,z){return Object.defineProperty(Y,B,{value:z,enumerable:!0,configurable:!0,writable:!0}),Y[B]}try{F({},"")}catch{F=function(z,g,w){return z[g]=w}}function h(Y,B,z,g){var w=B&&B.prototype instanceof r?B:r,O=Object.create(w.prototype),f=new P(g||[]);return n(O,"_invoke",{value:L(Y,z,f)}),O}function o(Y,B,z){try{return{type:"normal",arg:Y.call(B,z)}}catch(g){return{type:"throw",arg:g}}}l.wrap=h;var V="suspendedStart",W="suspendedYield",Q="executing",m="completed",R={};function r(){}function b(){}function u(){}var J={};F(J,i,function(){return this});var G=Object.getPrototypeOf,T=G&&G(G(H([])));T&&T!==t&&d.call(T,i)&&(J=T);var y=u.prototype=r.prototype=Object.create(J);function k(Y){["next","throw","return"].forEach(function(B){F(Y,B,function(z){return this._invoke(B,z)})})}function X(Y,B){function z(w,O,f,x){var A=o(Y[w],Y,O);if(A.type!=="throw"){var al=A.arg,_=al.value;return _&&ja(_)=="object"&&d.call(_,"__await")?B.resolve(_.__await).then(function(K){z("next",K,f,x)},function(K){z("throw",K,f,x)}):B.resolve(_).then(function(K){al.value=K,f(al)},function(K){return z("throw",K,f,x)})}x(A.arg)}var g;n(this,"_invoke",{value:function(O,f){function x(){return new B(function(A,al){z(O,f,A,al)})}return g=g?g.then(x,x):x()}})}function L(Y,B,z){var g=V;return function(w,O){if(g===Q)throw Error("Generator is already running");if(g===m){if(w==="throw")throw O;return{value:e,done:!0}}for(z.method=w,z.arg=O;;){var f=z.delegate;if(f){var x=D(f,z);if(x){if(x===R)continue;return x}}if(z.method==="next")z.sent=z._sent=z.arg;else if(z.method==="throw"){if(g===V)throw g=m,z.arg;z.dispatchException(z.arg)}else z.method==="return"&&z.abrupt("return",z.arg);g=Q;var A=o(Y,B,z);if(A.type==="normal"){if(g=z.done?m:W,A.arg===R)continue;return{value:A.arg,done:z.done}}A.type==="throw"&&(g=m,z.method="throw",z.arg=A.arg)}}}function D(Y,B){var z=B.method,g=Y.iterator[z];if(g===e)return B.delegate=null,z==="throw"&&Y.iterator.return&&(B.method="return",B.arg=e,D(Y,B),B.method==="throw")||z!=="return"&&(B.method="throw",B.arg=new TypeError("The iterator does not provide a '"+z+"' method")),R;var w=o(g,Y.iterator,B.arg);if(w.type==="throw")return B.method="throw",B.arg=w.arg,B.delegate=null,R;var O=w.arg;return O?O.done?(B[Y.resultName]=O.value,B.next=Y.nextLoc,B.method!=="return"&&(B.method="next",B.arg=e),B.delegate=null,R):O:(B.method="throw",B.arg=new TypeError("iterator result is not an object"),B.delegate=null,R)}function C(Y){var B={tryLoc:Y[0]};1 in Y&&(B.catchLoc=Y[1]),2 in Y&&(B.finallyLoc=Y[2],B.afterLoc=Y[3]),this.tryEntries.push(B)}function I(Y){var B=Y.completion||{};B.type="normal",delete B.arg,Y.completion=B}function P(Y){this.tryEntries=[{tryLoc:"root"}],Y.forEach(C,this),this.reset(!0)}function H(Y){if(Y||Y===""){var B=Y[i];if(B)return B.call(Y);if(typeof Y.next=="function")return Y;if(!isNaN(Y.length)){var z=-1,g=function w(){for(;++z<Y.length;)if(d.call(Y,z))return w.value=Y[z],w.done=!1,w;return w.value=e,w.done=!0,w};return g.next=g}}throw new TypeError(ja(Y)+" is not iterable")}return b.prototype=u,n(y,"constructor",{value:u,configurable:!0}),n(u,"constructor",{value:b,configurable:!0}),b.displayName=F(u,c,"GeneratorFunction"),l.isGeneratorFunction=function(Y){var B=typeof Y=="function"&&Y.constructor;return!!B&&(B===b||(B.displayName||B.name)==="GeneratorFunction")},l.mark=function(Y){return Object.setPrototypeOf?Object.setPrototypeOf(Y,u):(Y.__proto__=u,F(Y,c,"GeneratorFunction")),Y.prototype=Object.create(y),Y},l.awrap=function(Y){return{__await:Y}},k(X.prototype),F(X.prototype,s,function(){return this}),l.AsyncIterator=X,l.async=function(Y,B,z,g,w){w===void 0&&(w=Promise);var O=new X(h(Y,B,z,g),w);return l.isGeneratorFunction(B)?O:O.next().then(function(f){return f.done?f.value:O.next()})},k(y),F(y,c,"Generator"),F(y,i,function(){return this}),F(y,"toString",function(){return"[object Generator]"}),l.keys=function(Y){var B=Object(Y),z=[];for(var g in B)z.push(g);return z.reverse(),function w(){for(;z.length;){var O=z.pop();if(O in B)return w.value=O,w.done=!1,w}return w.done=!0,w}},l.values=H,P.prototype={constructor:P,reset:function(B){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!B)for(var z in this)z.charAt(0)==="t"&&d.call(this,z)&&!isNaN(+z.slice(1))&&(this[z]=e)},stop:function(){this.done=!0;var B=this.tryEntries[0].completion;if(B.type==="throw")throw B.arg;return this.rval},dispatchException:function(B){if(this.done)throw B;var z=this;function g(al,_){return f.type="throw",f.arg=B,z.next=al,_&&(z.method="next",z.arg=e),!!_}for(var w=this.tryEntries.length-1;w>=0;--w){var O=this.tryEntries[w],f=O.completion;if(O.tryLoc==="root")return g("end");if(O.tryLoc<=this.prev){var x=d.call(O,"catchLoc"),A=d.call(O,"finallyLoc");if(x&&A){if(this.prev<O.catchLoc)return g(O.catchLoc,!0);if(this.prev<O.finallyLoc)return g(O.finallyLoc)}else if(x){if(this.prev<O.catchLoc)return g(O.catchLoc,!0)}else{if(!A)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return g(O.finallyLoc)}}}},abrupt:function(B,z){for(var g=this.tryEntries.length-1;g>=0;--g){var w=this.tryEntries[g];if(w.tryLoc<=this.prev&&d.call(w,"finallyLoc")&&this.prev<w.finallyLoc){var O=w;break}}O&&(B==="break"||B==="continue")&&O.tryLoc<=z&&z<=O.finallyLoc&&(O=null);var f=O?O.completion:{};return f.type=B,f.arg=z,O?(this.method="next",this.next=O.finallyLoc,R):this.complete(f)},complete:function(B,z){if(B.type==="throw")throw B.arg;return B.type==="break"||B.type==="continue"?this.next=B.arg:B.type==="return"?(this.rval=this.arg=B.arg,this.method="return",this.next="end"):B.type==="normal"&&z&&(this.next=z),R},finish:function(B){for(var z=this.tryEntries.length-1;z>=0;--z){var g=this.tryEntries[z];if(g.finallyLoc===B)return this.complete(g.completion,g.afterLoc),I(g),R}},catch:function(B){for(var z=this.tryEntries.length-1;z>=0;--z){var g=this.tryEntries[z];if(g.tryLoc===B){var w=g.completion;if(w.type==="throw"){var O=w.arg;I(g)}return O}}throw Error("illegal catch attempt")},delegateYield:function(B,z,g){return this.delegate={iterator:H(B),resultName:z,nextLoc:g},this.method==="next"&&(this.arg=e),R}},l}function bp(e,l,t,d,n,a,i){try{var s=e[a](i),c=s.value}catch(F){t(F);return}s.done?l(c):Promise.resolve(c).then(d,n)}function fY(e){return function(){var l=this,t=arguments;return new Promise(function(d,n){var a=e.apply(l,t);function i(c){bp(a,d,n,i,s,"next",c)}function s(c){bp(a,d,n,i,s,"throw",c)}i(void 0)})}}function HY(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function PY(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,_Y(d.key),d)}}function AY(e,l,t){return l&&PY(e.prototype,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function _Y(e){var l=qY(e,"string");return ja(l)=="symbol"?l:l+""}function qY(e,l){if(ja(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(ja(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var $Y=function(){function e(){HY(this,e)}return AY(e,[{key:"openFile",value:function(){var l=fY(cm().mark(function d(n,a){var i;return cm().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(!(mp()&&n&&typeof n.uri<"u")){c.next=11;break}return c.prev=1,c.next=4,YY(n.uri);case 4:return i=c.sent,c.abrupt("return",new Rp(i));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 n.slice=="function"&&typeof n.size<"u")){c.next=13;break}return c.abrupt("return",Promise.resolve(new Rp(n)));case 13:if(typeof n.read!="function"){c.next=18;break}if(a=Number(a),Number.isFinite(a)){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 KY(n,a)));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()}},d,null,[[1,8]])}));function t(d,n){return l.apply(this,arguments)}return t}()}])}();function l1(e,l){return mp()?Promise.resolve(t1(e,l)):Promise.resolve(["tus-br",e.name,e.type,e.size,e.lastModified,l.endpoint].join("-"))}function t1(e,l){var t=e.exif?e1(JSON.stringify(e.exif)):"noexif";return["tus-rn",e.name||"noname",e.size||"nosize",t,l.endpoint].join("/")}function e1(e){var l=0;if(e.length===0)return l;for(var t=0;t<e.length;t++){var d=e.charCodeAt(t);l=(l<<5)-l+d,l&=l}return l}function OU(e){"@babel/helpers - typeof";return OU=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},OU(e)}function Um(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function d1(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,n1(d.key),d)}}function Zm(e,l,t){return l&&d1(e.prototype,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function n1(e){var l=a1(e,"string");return OU(l)=="symbol"?l:l+""}function a1(e,l){if(OU(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(OU(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var i1=function(){function e(){Um(this,e)}return Zm(e,[{key:"createRequest",value:function(t,d){return new s1(t,d)}},{key:"getName",value:function(){return"XHRHttpStack"}}])}(),s1=function(){function e(l,t){Um(this,e),this._xhr=new XMLHttpRequest,this._xhr.open(l,t,!0),this._method=l,this._url=t,this._headers={}}return Zm(e,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(t,d){this._xhr.setRequestHeader(t,d),this._headers[t]=d}},{key:"getHeader",value:function(t){return this._headers[t]}},{key:"setProgressHandler",value:function(t){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(d){d.lengthComputable&&t(d.loaded)})}},{key:"send",value:function(){var t=this,d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(n,a){t._xhr.onload=function(){n(new c1(t._xhr))},t._xhr.onerror=function(i){a(i)},t._xhr.send(d)})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}(),c1=function(){function e(l){Um(this,e),this._xhr=l}return Zm(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(t){return this._xhr.getResponseHeader(t)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}();function vU(e){"@babel/helpers - typeof";return vU=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},vU(e)}function U1(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function Z1(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,h1(d.key),d)}}function F1(e,l,t){return l&&Z1(e.prototype,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function h1(e){var l=o1(e,"string");return vU(l)=="symbol"?l:l+""}function o1(e,l){if(vU(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(vU(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Fm=!1;try{Fm="localStorage"in window;var hm="tusSupport",up=localStorage.getItem(hm);localStorage.setItem(hm,up),up===null&&localStorage.removeItem(hm)}catch(e){if(e.code===e.SECURITY_ERR||e.code===e.QUOTA_EXCEEDED_ERR)Fm=!1;else throw e}var V1=Fm,W1=function(){function e(){U1(this,e)}return F1(e,[{key:"findAllUploads",value:function(){var t=this._findEntries("tus::");return Promise.resolve(t)}},{key:"findUploadsByFingerprint",value:function(t){var d=this._findEntries("tus::".concat(t,"::"));return Promise.resolve(d)}},{key:"removeUpload",value:function(t){return localStorage.removeItem(t),Promise.resolve()}},{key:"addUpload",value:function(t,d){var n=Math.round(Math.random()*1e12),a="tus::".concat(t,"::").concat(n);return localStorage.setItem(a,JSON.stringify(d)),Promise.resolve(a)}},{key:"_findEntries",value:function(t){for(var d=[],n=0;n<localStorage.length;n++){var a=localStorage.key(n);if(a.indexOf(t)===0)try{var i=JSON.parse(localStorage.getItem(a));i.urlStorageKey=a,d.push(i)}catch{}}return d}}])}();function rs(e){"@babel/helpers - typeof";return rs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},rs(e)}function Q1(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function m1(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,Mp(d.key),d)}}function R1(e,l,t){return t&&m1(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function N1(e,l,t){return l=ch(l),b1(e,rp()?Reflect.construct(l,t||[],ch(e).constructor):l.apply(e,t))}function b1(e,l){if(l&&(rs(l)==="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return u1(e)}function u1(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rp(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rp=function(){return!!e})()}function ch(e){return ch=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ch(e)}function r1(e,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(l&&l.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),l&&om(e,l)}function om(e,l){return om=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(d,n){return d.__proto__=n,d},om(e,l)}function pp(e,l){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);l&&(d=d.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,d)}return t}function ps(e){for(var l=1;l<arguments.length;l++){var t=arguments[l]!=null?arguments[l]:{};l%2?pp(Object(t),!0).forEach(function(d){p1(e,d,t[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):pp(Object(t)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(t,d))})}return e}function p1(e,l,t){return l=Mp(l),l in e?Object.defineProperty(e,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[l]=t,e}function Mp(e){var l=M1(e,"string");return rs(l)=="symbol"?l:l+""}function M1(e,l){if(rs(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(rs(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(e)}var Vm=ps(ps({},sh.defaultOptions),{},{httpStack:new i1,fileReader:new $Y,urlStorage:V1?new W1:new nY,fingerprint:l1}),S1=function(e){function l(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Q1(this,l),d=ps(ps({},Vm),d),N1(this,l,[t,d])}return r1(l,e),R1(l,null,[{key:"terminate",value:function(d){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return n=ps(ps({},Vm),n),sh.terminate(d,n)}}])}(sh);const J1={version:"5.1.0"};function T1(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")}function G1(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"}function X1(e){return(l,t)=>{if(T1()||G1())return Vm.fingerprint(l,t);const d=["tus",e.id,t.endpoint].join("-");return Promise.resolve(d)}}const Sp={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},y1={limit:20,retryDelays:Sp.retryDelays,withCredentials:!1,allowedMetaFields:!0};class Jp extends or{constructor(t,d){var n;super(t,{...y1,...d});dl(this,ka);dl(this,I0);E(this,"requests");E(this,"uploaders");E(this,"uploaderEvents");dl(this,D0,async t=>{if(t.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...");const d=this.uppy.getFilesByIds(t);await cl(this,ka,Uy).call(this,d)});if(this.type="uploader",this.id=this.opts.id||"Tus",(d==null?void 0:d.allowedMetaFields)===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");if("autoRetry"in d)throw new Error("The `autoRetry` option was deprecated and has been removed.");this.requests=this.opts.rateLimitedQueue??new Py(this.opts.limit),Fl(this,I0,(n=this.opts.retryDelays)==null?void 0:n.values()),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null)}resetUploaderReferences(t,d){const n=this.uploaders[t];n&&(n.abort(),d!=null&&d.abort&&n.abort(!0),this.uploaders[t]=null),this.uploaderEvents[t]&&(this.uploaderEvents[t].remove(),this.uploaderEvents[t]=null)}onReceiveUploadUrl(t,d){const n=this.uppy.getFile(t.id);n&&(!n.tus||n.tus.uploadUrl!==d)&&(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(n.id,{tus:{...n.tus,uploadUrl:d}}))}install(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!0}}),this.uppy.addUploader(j(this,D0))}uninstall(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!1}}),this.uppy.removeUploader(j(this,D0))}}I0=new WeakMap,ka=new WeakSet,sy=async function(t){return this.resetUploaderReferences(t.id),new Promise((d,n)=>{let a,i,s;const c={...this.opts,...t.tus||{}};typeof c.headers=="function"&&(c.headers=c.headers(t));const{onShouldRetry:F,onBeforeRequest:h,...o}=c,V={...Sp,...o};V.fingerprint=X1(t),V.onBeforeRequest=async b=>{const u=b.getUnderlyingObject();u.withCredentials=!!c.withCredentials;let J;if(typeof h=="function"&&(J=h(b,t)),oQ(a,"shouldBeRequeued")){if(!a.shouldBeRequeued)return Promise.reject();let G;const T=new Promise(y=>{G=y});a=this.requests.run(()=>(t.isPaused&&a.abort(),G(),()=>{})),await Promise.all([T,J]);return}return J},V.onError=b=>{this.uppy.log(b);const u=b.originalRequest!=null?b.originalRequest.getUnderlyingObject():null;vy(u)&&(b=new Gy(b,u)),this.resetUploaderReferences(t.id),a==null||a.abort(),typeof c.onError=="function"&&c.onError(b),n(b)},V.onProgress=(b,u)=>{this.onReceiveUploadUrl(t,s.url),typeof c.onProgress=="function"&&c.onProgress(b,u);const J=this.uppy.getFile(t.id);this.uppy.emit("upload-progress",J,{uploadStarted:J.progress.uploadStarted??0,bytesUploaded:b,bytesTotal:u})},V.onSuccess=b=>{const u={uploadURL:s.url??void 0,status:200,body:{xhr:b.lastResponse.getUnderlyingObject()}};if(this.uppy.emit("upload-success",this.uppy.getFile(t.id),u),this.resetUploaderReferences(t.id),a.done(),s.url){const{name:J}=s.file;this.uppy.log(`Download ${J} from ${s.url}`)}typeof c.onSuccess=="function"&&c.onSuccess(b),d(s)};const W=b=>{var J,G;const u=(J=b==null?void 0:b.originalResponse)==null?void 0:J.getStatus();if(u===429){if(!this.requests.isPaused){const T=(G=j(this,I0))==null?void 0:G.next();if(T==null||T.done)return!1;this.requests.rateLimit(T.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 a.abort(),a={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};F!=null?V.onShouldRetry=(b,u)=>F(b,u,c,W):V.onShouldRetry=W;const Q=(b,u,J)=>{oQ(b,u)&&!oQ(b,J)&&(b[J]=b[u])},m={};if(wy(c.allowedMetaFields,t.meta).forEach(b=>{m[b]=String(t.meta[b])}),Q(m,"type","filetype"),Q(m,"name","filename"),V.metadata=m,t.data==null)throw new Error("File data is empty");s=new S1(t.data,V),this.uploaders[t.id]=s;const r=new FB(this.uppy);this.uploaderEvents[t.id]=r,i=()=>(t.isPaused||s.start(),()=>{}),s.findPreviousUploads().then(b=>{const u=b[0];u&&(this.uppy.log(`[Tus] Resuming upload of ${t.id} started at ${u.creationTime}`),s.resumeFromPreviousUpload(u)),a=this.requests.run(i)}),r.onFileRemove(t.id,b=>{a.abort(),this.resetUploaderReferences(t.id,{abort:!!s.url}),d(`upload ${b} was removed`)}),r.onPause(t.id,b=>{a.abort(),b?s.abort():a=this.requests.run(i)}),r.onPauseAll(t.id,()=>{a.abort(),s.abort()}),r.onCancelAll(t.id,()=>{a.abort(),this.resetUploaderReferences(t.id,{abort:!!s.url}),d(`upload ${t.id} was canceled`)}),r.onResumeAll(t.id,()=>{a.abort(),t.error&&s.abort(),a=this.requests.run(i)})}).catch(d=>{throw this.uppy.emit("upload-error",t,d),d})},cy=function(t){const d={...this.opts};return t.tus&&Object.assign(d,t.tus),typeof d.headers=="function"&&(d.headers=d.headers(t)),{..."remote"in t&&t.remote.body,endpoint:d.endpoint,uploadUrl:d.uploadUrl,protocol:"tus",size:t.data.size,headers:d.headers,metadata:t.meta}},Uy=async function(t){const d=By(t),n=Yy(d);this.uppy.emit("upload-start",n),await Promise.allSettled(d.map(a=>{if(a.isRemote){const i=()=>this.requests,s=new AbortController,c=h=>{h.id===a.id&&s.abort()};this.uppy.on("file-removed",c);const F=this.uppy.getRequestClientForFile(a).uploadRemoteFile(a,cl(this,ka,cy).call(this,a),{signal:s.signal,getQueue:i});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",c)},{priority:-1})(),F}return cl(this,ka,sy).call(this,a)}))},D0=new WeakMap,E(Jp,"VERSION",J1.version);var KU={exports:{}},Tp;function B1(){if(Tp)return KU.exports;Tp=1,KU.exports=d,KU.exports.isMobile=d,KU.exports.default=d;const e=/(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,l=/CrOS/,t=/android|ipad|playbook|silk/i;function d(n){n||(n={});let a=n.ua;if(!a&&typeof navigator<"u"&&(a=navigator.userAgent),a&&a.headers&&typeof a.headers["user-agent"]=="string"&&(a=a.headers["user-agent"]),typeof a!="string")return!1;let i=e.test(a)&&!l.test(a)||!!n.tablet&&t.test(a);return!i&&n.tablet&&n.featureDetect&&navigator&&navigator.maxTouchPoints>1&&a.indexOf("Macintosh")!==-1&&a.indexOf("Safari")!==-1&&(i=!0),i}return KU.exports}var Y1=B1();const k1={version:"5.1.0"};function Gp(){return S("svg",{"aria-hidden":"true",focusable:"false",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55",children:S("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"})})}function z1({onDiscard:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--discard",type:"button",title:l("discardRecordedFile"),"aria-label":l("discardRecordedFile"),onClick:e,"data-uppy-super-focusable":!0,children:S("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:S("g",{fill:"#FFF",fillRule:"evenodd",children:[S("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),S("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"})]})})})}function L1({recording:e,onStartRecording:l,onStopRecording:t,i18n:d}){return e?S("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:d("stopRecording"),"aria-label":d("stopRecording"),onClick:t,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:S("rect",{x:"15",y:"15",width:"70",height:"70"})})}):S("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:d("startRecording"),"aria-label":d("startRecording"),onClick:l,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:S("circle",{cx:"50",cy:"50",r:"40"})})})}function I1(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`}function D1({recordingLengthSeconds:e}){const l=I1(e);return S("span",{children:l})}function w1({onSnapshot:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:l("takePicture"),"aria-label":l("takePicture"),onClick:e,"data-uppy-super-focusable":!0,children:Gp()})}function E1({onSubmit:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit",type:"button",title:l("submitRecordedFile"),"aria-label":l("submitRecordedFile"),onClick:e,"data-uppy-super-focusable":!0,children:S("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:S("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})})}function C1({currentDeviceId:e,videoSources:l,onChangeVideoSource:t}){return S("div",{className:"uppy-Webcam-videoSource",children:S("select",{className:"uppy-u-reset uppy-Webcam-videoSource-select",onChange:d=>{t(d.target.value)},children:l.map(d=>S("option",{value:d.deviceId,selected:d.deviceId===e,children:d.label},d.deviceId))})})}function Uh(e,l){return e.includes(l)}class x1 extends se{constructor(){super(...arguments);E(this,"videoElement");E(this,"refs")}componentDidMount(){const{onFocus:t}=this.props;t()}componentWillUnmount(){const{onStop:t}=this.props;t()}render(){const{src:t,recordedVideo:d,capturedSnapshot:n,recording:a,modes:i,supportsRecording:s,videoSources:c,showVideoSourceDropdown:F,showRecordingLength:h,onSubmit:o,i18n:V,mirror:W,onSnapshot:Q,onStartRecording:m,onStopRecording:R,onDiscardRecordedMedia:r,recordingLengthSeconds:b}=this.props,u=!!d,J=!!n,G=u||J,T=!G&&s&&(Uh(i,"video-only")||Uh(i,"audio-only")||Uh(i,"video-audio")),y=!G&&Uh(i,"picture"),k=s&&h&&!u,X=F&&c&&c.length>1,L={playsInline:!0};return d?(L.muted=!1,L.controls=!0,L.src=d,this.videoElement&&(this.videoElement.srcObject=null)):(L.muted=!0,L.autoPlay=!0,L.srcObject=t),S("div",{className:"uppy uppy-Webcam-container",children:[S("div",{className:"uppy-Webcam-videoContainer",children:n&&!a&&!d?S("div",{className:"uppy-Webcam-imageContainer",children:S("img",{src:n,className:"uppy-Webcam-video",alt:"capturedSnapshot"})}):S("video",{ref:D=>{this.videoElement=D},className:`uppy-Webcam-video ${W?"uppy-Webcam-video--mirrored":""}`,...L})}),S("div",{className:"uppy-Webcam-footer",children:[S("div",{className:"uppy-Webcam-videoSourceContainer",children:X?C1(this.props):null}),S("div",{className:"uppy-Webcam-buttonContainer",children:[y&&S(w1,{onSnapshot:Q,i18n:V}),T&&S(L1,{recording:a,onStartRecording:m,onStopRecording:R,i18n:V}),(u||J)&&S(E1,{onSubmit:o,i18n:V}),(u||J)&&S(z1,{onDiscard:r,i18n:V})]}),S("div",{className:"uppy-Webcam-recordingLength",children:k&&S(D1,{recordingLengthSeconds:b})})]})]})}}const g1={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 j1({icon:e,i18n:l,hasCamera:t}){return S("div",{className:"uppy-Webcam-permissons",children:[S("div",{className:"uppy-Webcam-permissonsIcon",children:e()}),S("div",{className:"uppy-Webcam-title",children:l(t?"allowAccessTitle":"noCameraTitle")}),S("p",{children:l(t?"allowAccessDescription":"noCameraDescription")})]})}function O1(){return typeof MediaRecorder=="function"&&!!MediaRecorder.prototype&&typeof MediaRecorder.prototype.start=="function"}function Xp(e){return e[0]==="."?VQ[e.slice(1)]:e}function v1(e){return/^video\/[^*]+$/.test(e)}function K1(e){return/^image\/[^*]+$/.test(e)}function f1(){return navigator.mediaDevices}function Wm(e,l){return e.includes(l)}const H1={onBeforeSnapshot:()=>Promise.resolve(),countdown:!1,modes:["video-audio","video-only","audio-only","picture"],mirror:!0,showVideoSourceDropdown:!1,preferredImageMimeType:null,preferredVideoMimeType:null,showRecordingLength:!1,mobileNativeCamera:Y1.isMobile({tablet:!0})};class yp extends Ln{constructor(t,d){super(t,{...H1,...d});dl(this,za);E(this,"mediaDevices");E(this,"supportsUserMedia");E(this,"protocol");E(this,"capturedMediaFile");E(this,"icon");E(this,"webcamActive");E(this,"stream",null);E(this,"recorder",null);E(this,"recordingChunks",null);E(this,"recordingLengthTimer");E(this,"captureInProgress",!1);this.mediaDevices=f1(),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=()=>S("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:S("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=g1,this.i18nInit(),this.title=this.i18n("pluginNameCamera"),Fl(this,za,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(){const{recordedVideo:t,capturedSnapshot:d,isRecording:n,cameraReady:a,cameraError:i}=this.getPluginState();return n?"recording":t!=null||d!=null?"captured":a?"ready":i?"error":"init"}setOptions(t){super.setOptions({...t,videoConstraints:{...this.opts.videoConstraints,...t==null?void 0:t.videoConstraints}})}hasCameraCheck(){return this.mediaDevices?this.mediaDevices.enumerateDevices().then(t=>t.some(d=>d.kind==="videoinput")):Promise.resolve(!1)}isAudioOnly(){return this.opts.modes.length===1&&this.opts.modes[0]==="audio-only"}getConstraints(t=null){const d=this.opts.modes.indexOf("video-audio")!==-1||this.opts.modes.indexOf("audio-only")!==-1,n=!this.isAudioOnly()&&(this.opts.modes.indexOf("video-audio")!==-1||this.opts.modes.indexOf("video-only")!==-1||this.opts.modes.indexOf("picture")!==-1),a={...this.opts.videoConstraints||{},...t!=null&&{deviceId:t}};return{audio:d,video:n?a:!1}}start(t=null){if(!this.supportsUserMedia)return Promise.reject(new Error("Webcam access not supported"));this.webcamActive=!0,this.opts.mirror&&Fl(this,za,!0);const d=this.getConstraints(t==null?void 0:t.deviceId);this.hasCameraCheck().then(n=>(this.setPluginState({hasCamera:n}),this.mediaDevices.getUserMedia(d).then(a=>{this.stream=a;let i=null;const s=this.isAudioOnly()?a.getAudioTracks():a.getVideoTracks();!t||!t.deviceId?i=s[0].getSettings().deviceId:s.forEach(c=>{c.getSettings().deviceId===t.deviceId&&(i=c.getSettings().deviceId)}),this.updateVideoSources(),this.setPluginState({currentDeviceId:i,cameraReady:!0})}).catch(a=>{this.setPluginState({cameraReady:!1,cameraError:a}),this.uppy.info(a.message,"error")})))}getMediaRecorderOptions(){const t={};if(MediaRecorder.isTypeSupported){const{restrictions:d}=this.uppy.opts;let n=[];this.opts.preferredVideoMimeType?n=[this.opts.preferredVideoMimeType]:d.allowedFileTypes&&(n=d.allowedFileTypes.map(Xp).filter(v1));const a=s=>MediaRecorder.isTypeSupported(s)&&wa(s),i=n.filter(a);i.length>0&&(t.mimeType=i[0])}return t}startRecording(){this.recorder=new MediaRecorder(this.stream,this.getMediaRecorderOptions()),this.recordingChunks=[];let t=!1;this.recorder.addEventListener("dataavailable",d=>{this.recordingChunks.push(d.data);const{restrictions:n}=this.uppy.opts;if(this.recordingChunks.length>1&&n.maxFileSize!=null&&!t){const a=this.recordingChunks.reduce((F,h)=>F+h.size,0),s=(a-this.recordingChunks[0].size)/(this.recordingChunks.length-1)*3,c=Math.max(0,n.maxFileSize-s);a>c&&(t=!0,this.uppy.info(this.i18n("recordingStoppedMaxSize"),"warning",4e3),this.stopRecording())}}),this.recorder.start(500),this.opts.showRecordingLength&&(this.recordingLengthTimer=setInterval(()=>{const d=this.getPluginState().recordingLengthSeconds;this.setPluginState({recordingLengthSeconds:d+1})},1e3)),this.setPluginState({isRecording:!0})}stopRecording(){return new Promise(d=>{this.recorder.addEventListener("stop",()=>{d()}),this.recorder.stop(),this.opts.showRecordingLength&&(clearInterval(this.recordingLengthTimer),this.setPluginState({recordingLengthSeconds:0}))}).then(()=>(this.setPluginState({isRecording:!1}),this.getVideo())).then(d=>{try{this.capturedMediaFile=d,this.setPluginState({recordedVideo:URL.createObjectURL(d.data)}),Fl(this,za,!1)}catch(n){n.isRestriction||this.uppy.log(n)}}).then(()=>{this.recordingChunks=null,this.recorder=null},d=>{throw this.recordingChunks=null,this.recorder=null,d})}discardRecordedMedia(){const{recordedVideo:t,capturedSnapshot:d}=this.getPluginState();t&&URL.revokeObjectURL(t),d&&URL.revokeObjectURL(d),this.setPluginState({recordedVideo:null,capturedSnapshot:null}),this.opts.mirror&&Fl(this,za,!0),this.capturedMediaFile=null}submit(){try{this.capturedMediaFile&&this.uppy.addFile(this.capturedMediaFile)}catch(t){t.isRestriction||this.uppy.log(t,"error")}}async stop(){if(this.stream){const t=this.stream.getAudioTracks(),d=this.stream.getVideoTracks();t.concat(d).forEach(n=>n.stop())}this.recorder&&await new Promise(t=>{this.recorder.addEventListener("stop",t,{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((t,d)=>{let n=this.opts.countdown;const a=setInterval(()=>{if(!this.webcamActive)return clearInterval(a),this.captureInProgress=!1,d(new Error("Webcam is not active"));n?(this.uppy.info(`${n}...`,"warning",800),n--):(clearInterval(a),this.uppy.info(this.i18n("smile"),"success",1500),setTimeout(()=>t(),1500))},1e3)})}async takeSnapshot(){if(!this.captureInProgress){this.captureInProgress=!0;try{await this.opts.onBeforeSnapshot()}catch(t){const d=typeof t=="object"?t.message:t;throw this.uppy.info(d,"error",5e3),new Error(`onBeforeSnapshot: ${d}`)}try{const t=await this.getImage();if(this.capturedMediaFile=t,t.data==null)throw new Error("File data is empty");const d=URL.createObjectURL(t.data);this.setPluginState({capturedSnapshot:d}),this.captureInProgress=!1}catch(t){this.captureInProgress=!1,t.isRestriction||this.uppy.log(t)}}}async getImage(){const t=this.getVideoElement();if(!t)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));const d=t.videoWidth,n=t.videoHeight,a=document.createElement("canvas");a.width=d,a.height=n,a.getContext("2d").drawImage(t,0,0);const{restrictions:s}=this.uppy.opts;let c=[];this.opts.preferredImageMimeType?c=[this.opts.preferredImageMimeType]:s.allowedFileTypes&&(c=s.allowedFileTypes.map(Xp).filter(K1));const F=c[0]||"image/jpeg",h=wa(F)||"jpg",o=`cam-${Date.now()}.${h}`;return Sy(a,F).then(V=>({source:this.id,name:o,data:new Blob([V],{type:F}),type:F}))}getVideo(){const t=this.recordingChunks.find(s=>{var c;return((c=s.type)==null?void 0:c.length)>0}).type,d=wa(t);if(!d)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${t}"`));const n=`webcam-${Date.now()}.${d}`,a=new Blob(this.recordingChunks,{type:t}),i={source:this.id,name:n,data:new Blob([a],{type:t}),type:t};return Promise.resolve(i)}focus(){this.opts.countdown&&setTimeout(()=>{this.uppy.info(this.i18n("smile"),"success",1500)},1e3)}changeVideoSource(t){this.stop(),this.start({deviceId:t})}updateVideoSources(){this.mediaDevices.enumerateDevices().then(t=>{this.setPluginState({videoSources:t.filter(d=>d.kind==="videoinput")})})}render(){this.webcamActive||this.start();const t=this.getPluginState();return!t.cameraReady||!t.hasCamera?S(j1,{icon:Gp,i18n:this.i18n,hasCamera:t.hasCamera}):S(x1,{...t,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:O1(),recording:t.isRecording,mirror:j(this,za),src:this.stream})}install(){var i;const{mobileNativeCamera:t,modes:d,videoConstraints:n}=this.opts,{target:a}=this.opts;if(t&&a){(i=this.getTargetPlugin(a))==null||i.setOptions({showNativeVideoCameraButton:Wm(d,"video-only")||Wm(d,"video-audio"),showNativePhotoCameraButton:Wm(d,"picture"),nativeCameraFacingMode:n==null?void 0:n.facingMode});return}this.setPluginState({cameraReady:!1,recordingLengthSeconds:0}),a&&this.mount(a,this),this.mediaDevices&&(this.updateVideoSources(),this.mediaDevices.ondevicechange=()=>{if(this.updateVideoSources(),this.stream){let s=!0;const{videoSources:c,currentDeviceId:F}=this.getPluginState();c.forEach(h=>{F===h.deviceId&&(s=!1)}),s&&(this.stop(),this.start())}})}uninstall(){this.stop(),this.unmount()}onUnmount(){this.stop()}}za=new WeakMap,E(yp,"VERSION",k1.version);const P1={version:"5.1.0"},A1={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 _1({onDiscard:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--discard",type:"button",title:l("discardMediaFile"),"aria-label":l("discardMediaFile"),onClick:e,"data-uppy-super-focusable":!0,children:S("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:[S("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),S("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}function q1({recording:e,onStartRecording:l,onStopRecording:t,i18n:d}){return e?S("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video uppy-ScreenCapture-button--stop-rec",type:"button",title:d("stopCapturing"),"aria-label":d("stopCapturing"),onClick:t,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:S("rect",{x:"15",y:"15",width:"70",height:"70"})})}):S("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video",type:"button",title:d("startCapturing"),"aria-label":d("startCapturing"),onClick:l,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:S("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"})})})}function $1({onScreenshot:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--screenshot",type:"button",title:l("takeScreenshot"),"aria-label":l("takeScreenshot"),onClick:e,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:[S("path",{d:"M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z"}),S("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"})]})})}function lk(e){return(e-(e%=60))/60+(e>9?":":":0")+e}class tk extends se{constructor(t){super(t);E(this,"wrapperStyle",{width:"100%",height:"100%",display:"flex"});E(this,"overlayStyle",{position:"absolute",width:"100%",height:"100%",background:"black",opacity:.7});E(this,"infoContainerStyle",{marginLeft:"auto",marginRight:"auto",marginTop:"auto",marginBottom:"auto",zIndex:1,color:"white"});E(this,"infotextStyle",{marginLeft:"auto",marginRight:"auto",marginBottom:"1rem",fontSize:"1.5rem"});E(this,"timeStyle",{display:"block",fontWeight:"bold",marginLeft:"auto",marginRight:"auto",fontSize:"3rem",fontFamily:"Courier New"});E(this,"timerRunning",!1);E(this,"timer");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(t=>({elapsedTime:t.elapsedTime+1})),this.timerTick()},1e3)}render(){const{recording:t,i18n:d}={...this.props},{elapsedTime:n}=this.state,a=lk(n);return t&&!this.timerRunning&&this.startTimer(),!t&&this.timerRunning&&this.resetTimer(),t?S("div",{style:this.wrapperStyle,children:[S("div",{style:this.overlayStyle}),S("div",{style:this.infoContainerStyle,children:[S("div",{style:this.infotextStyle,children:d("recording")}),S("div",{style:this.timeStyle,children:a})]})]}):null}}function ek({streamActive:e,i18n:l}){return e?S("div",{title:l("streamActive"),className:"uppy-ScreenCapture-icon--stream uppy-ScreenCapture-icon--streamActive",children:S("svg",{"aria-hidden":"true",focusable:"false",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),S("path",{d:"M0 0h24v24H0z",fill:"none"}),S("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"})]})}):S("div",{title:l("streamPassive"),className:"uppy-ScreenCapture-icon--stream",children:S("svg",{"aria-hidden":"true",focusable:"false",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),S("path",{d:"M0 0h24v24H0z",fill:"none"}),S("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"})]})})}function dk({recording:e,recordedVideo:l,onSubmit:t,capturedScreenshotUrl:d,i18n:n}){return(l||d)&&!e?S("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--submit",type:"button",title:n("submitRecordedFile"),"aria-label":n("submitRecordedFile"),onClick:t,"data-uppy-super-focusable":!0,children:S("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:S("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})}):null}class nk extends se{constructor(){super(...arguments);E(this,"videoElement",null)}componentWillUnmount(){const{onStop:t}=this.props;t()}render(){const{recording:t,stream:d,recordedVideo:n,enableScreenshots:a,capturedScreenshotUrl:i}=this.props,s={playsinline:!0};return(t||!n&&!t)&&(s.muted=!0,s.autoplay=!0,s.srcObject=d),n&&!t&&(s.muted=!1,s.controls=!0,s.src=n,this.videoElement&&(this.videoElement.srcObject=null)),S("div",{className:"uppy uppy-ScreenCapture-container",children:[S("div",{className:"uppy-ScreenCapture-mediaContainer",children:[S(ek,{...this.props}),i&&!t&&!n?S("div",{className:"uppy-ScreenCapture-imageContainer",children:S("img",{src:i,className:"uppy-ScreenCapture-media",alt:"screenshotPreview"})}):S("video",{ref:c=>{this.videoElement=c},className:"uppy-ScreenCapture-media",...s}),S("div",{children:S(tk,{...this.props})})]}),S("div",{className:"uppy-ScreenCapture-buttonContainer",children:n||i?S(Pe,{children:[S(dk,{...this.props}),S(_1,{...this.props})]}):S(Pe,{children:[a&&!t&&S($1,{...this.props}),S(q1,{...this.props})]})})]})}}function ak(){return S("svg",{className:"uppy-DashboardTab-iconScreenRec","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:S("g",{fill:"currentcolor",fillRule:"evenodd",children:[S("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"}),S("circle",{cx:"16",cy:"16",r:"2"})]})})}function ik(){var e;return window.MediaRecorder&&((e=navigator.mediaDevices)==null?void 0:e.getDisplayMedia)}function sk(){return window.MediaRecorder&&navigator.mediaDevices}const ck=["image/png","image/jpeg","image/webp"],Uk={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};class Bp extends Ln{constructor(t,d){super(t,{...Uk,...d});E(this,"mediaDevices");E(this,"protocol");E(this,"icon");E(this,"streamInterrupted");E(this,"captureActive");E(this,"capturedMediaFile");E(this,"videoStream",null);E(this,"audioStream",null);E(this,"userDenied",!1);E(this,"recorder",null);E(this,"outputStream",null);E(this,"recordingChunks",null);this.mediaDevices=sk(),this.protocol=location.protocol==="https:"?"https":"http",this.id=this.opts.id||"ScreenCapture",this.type="acquirer",this.icon=ak,this.defaultLocale=A1,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(!ik())return this.uppy.log("Screen recorder access is not supported","warning"),null;this.setPluginState({streamActive:!1,audioStreamActive:!1,status:"init"});const{target:t}=this.opts;t&&this.mount(t,this)}uninstall(){this.videoStream&&this.stop(),this.unmount()}start(){return this.mediaDevices?(this.captureActive=!0,this.selectAudioStreamSource(),this.selectVideoStreamSource().then(t=>{var d;t===!1&&(d=this.parent)!=null&&d.hideAllPanels&&(this.parent.hideAllPanels(),this.captureActive=!1)})):Promise.reject(new Error("Screen recorder access not supported"))}selectVideoStreamSource(){return this.videoStream?new Promise(t=>t(this.videoStream)):this.mediaDevices.getDisplayMedia(this.opts.displayMediaConstraints).then(t=>(this.videoStream=t,this.videoStream.addEventListener("inactive",()=>{this.streamInactivated()}),this.setPluginState({streamActive:!0,status:"ready",screenRecError:null}),t)).catch(t=>(this.setPluginState({screenRecError:t,status:"error"}),this.userDenied=!0,setTimeout(()=>{this.userDenied=!1},1e3),!1))}selectAudioStreamSource(){return this.audioStream?new Promise(t=>t(this.audioStream)):this.mediaDevices.getUserMedia(this.opts.userMediaConstraints).then(t=>(this.audioStream=t,this.setPluginState({audioStreamActive:!0}),t)).catch(t=>(t.name==="NotAllowedError"&&(this.uppy.info(this.i18n("micDisabled"),"error",5e3),this.uppy.log(this.i18n("micDisabled"),"warning")),!1))}startRecording(){const t={};this.capturedMediaFile=null,this.recordingChunks=[];const{preferredVideoMimeType:d}=this.opts;this.selectVideoStreamSource().then(n=>{if(n===!1)throw new Error("No video stream available");d&&MediaRecorder.isTypeSupported(d)&&wa(d)&&(t.mimeType=d);const a=[n.getVideoTracks()[0]];this.audioStream&&a.push(this.audioStream.getAudioTracks()[0]),this.outputStream=new MediaStream(a),this.recorder=new MediaRecorder(this.outputStream,t),this.recorder.addEventListener("dataavailable",i=>{this.recordingChunks.push(i.data)}),this.recorder.start(),this.setPluginState({recording:!0,status:"recording"})}).catch(n=>{this.uppy.log(n,"error"),this.setPluginState({screenRecError:n,status:"error"})})}streamInactivated(){var n;const{recordedVideo:t,recording:d}={...this.getPluginState()};!t&&!d?((n=this.parent)!=null&&n.hideAllPanels&&this.parent.hideAllPanels(),this.setPluginState({status:"init"})):d&&(this.uppy.log("Capture stream inactive — stop recording"),this.stopRecording()),this.videoStream=null,this.audioStream=null,this.setPluginState({streamActive:!1,audioStreamActive:!1})}stopRecording(){return new Promise(d=>{this.recorder.addEventListener("stop",()=>{d()}),this.recorder.stop()}).then(()=>(this.setPluginState({recording:!1}),this.getVideo())).then(d=>{this.capturedMediaFile=d,this.setPluginState({recordedVideo:URL.createObjectURL(d.data),status:"captured"})}).then(()=>{this.recordingChunks=null,this.recorder=null},d=>{throw this.recordingChunks=null,this.recorder=null,d})}discardRecordedMedia(){const{capturedScreenshotUrl:t,recordedVideo:d}=this.getPluginState();t&&URL.revokeObjectURL(t),d&&URL.revokeObjectURL(d),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(t){t.isRestriction||this.uppy.log(t,"warning")}}stop(){this.videoStream&&(this.videoStream.getVideoTracks().forEach(n=>{n.stop()}),this.videoStream.getAudioTracks().forEach(n=>{n.stop()}),this.videoStream=null),this.audioStream&&(this.audioStream.getAudioTracks().forEach(n=>{n.stop()}),this.audioStream.getVideoTracks().forEach(n=>{n.stop()}),this.audioStream=null),this.outputStream&&(this.outputStream.getAudioTracks().forEach(n=>{n.stop()}),this.outputStream.getVideoTracks().forEach(n=>{n.stop()}),this.outputStream=null);const{capturedScreenshotUrl:t,recordedVideo:d}=this.getPluginState();t&&URL.revokeObjectURL(t),d&&URL.revokeObjectURL(d),this.setPluginState({recording:!1,streamActive:!1,audioStreamActive:!1,recordedVideo:null,capturedScreenshotUrl:null,status:"init"}),this.captureActive=!1}getVideo(){const t=this.recordingChunks[0].type,d=wa(t);if(!d)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${t}"`));const n=`screencap-${Date.now()}.${d}`,a=new Blob(this.recordingChunks,{type:t}),i={source:this.id,name:n,data:new Blob([a],{type:t}),type:t};return Promise.resolve(i)}async captureScreenshot(){var t;if(!((t=this.mediaDevices)!=null&&t.getDisplayMedia))throw new Error("Screen capture is not supported");try{let d=this.videoStream;if(!d){const F=await this.selectVideoStreamSource();if(!F)throw new Error("Failed to get screen capture stream");d=F}const n=document.createElement("video");n.srcObject=d,await new Promise(F=>{n.onloadedmetadata=()=>{n.play(),F(null)}});const a=document.createElement("canvas");a.width=n.videoWidth,a.height=n.videoHeight;const i=a.getContext("2d");if(!i)throw new Error("Failed to get canvas context");i.drawImage(n,0,0,a.width,a.height);let s=this.opts.preferredImageMimeType;(!s||!ck.includes(s))&&(this.uppy.log(`Unsupported image type "${s}", falling back to image/png`,"warning"),s="image/png");const c=1;return new Promise((F,h)=>{a.toBlob(o=>{if(!o){h(new Error("Failed to create screenshot blob"));return}const V=wa(s)||"png",W={source:this.id,name:`Screenshot ${new Date().toISOString()}.${V}`,type:s,data:o};try{this.capturedMediaFile=W;const Q=URL.createObjectURL(o);this.setPluginState({capturedScreenshotUrl:Q,status:"captured"}),F()}catch(Q){this.getPluginState().capturedScreenshotUrl&&this.setPluginState({capturedScreenshotUrl:null}),Q.isRestriction||this.uppy.log(Q,"error"),h(Q)}finally{n.srcObject=null,a.remove(),n.remove()}},s,c)})}catch(d){throw this.uppy.log(d,"error"),d}}render(){const t=this.getPluginState();return!t.streamActive&&!this.captureActive&&!this.userDenied&&this.start(),S(nk,{...t,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})}}E(Bp,"VERSION",P1.version);const Zk={version:"3.1.0"},Fk={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"}},hk=e=>{const{icon:l,hasAudio:t,i18n:d}=e;return S("div",{className:"uppy-Audio-permissons",children:[S("div",{className:"uppy-Audio-permissonsIcon",children:l()}),S("div",{className:"uppy-Audio-title",children:d(t?"allowAudioAccessTitle":"noAudioTitle")}),S("p",{children:d(t?"allowAudioAccessDescription":"noAudioDescription")})]})},ok=({currentDeviceId:e,audioSources:l,onChangeSource:t})=>S("div",{className:"uppy-Audio-videoSource",children:S("select",{className:"uppy-u-reset uppy-Audio-audioSource-select",onChange:d=>{t(d.target.value)},children:l.map(d=>S("option",{value:d.deviceId,selected:d.deviceId===e,children:d.label},d.deviceId))})});function Yp(e){return typeof e=="function"}function fU(e){return Yp(e)?e():e}class Vk{constructor(l,t={}){E(this,"canvas");E(this,"canvasContext");E(this,"width");E(this,"height");E(this,"analyser");E(this,"bufferLength");E(this,"dataArray");E(this,"onDrawFrame");E(this,"streamSource");E(this,"audioContext");E(this,"source");dl(this,$W,()=>this.draw());const d=t.canvas||{},n=t.canvasContext||{};this.analyser=null,this.bufferLength=0,this.canvas=l,this.width=fU(d.width)||this.canvas.width,this.height=fU(d.height)||this.canvas.height,this.canvas.width=this.width,this.canvas.height=this.height,this.canvasContext=this.canvas.getContext("2d"),this.canvasContext.fillStyle=fU(n.fillStyle)||"rgb(255, 255, 255)",this.canvasContext.strokeStyle=fU(n.strokeStyle)||"rgb(0, 0, 0)",this.canvasContext.lineWidth=fU(n.lineWidth)||1,this.onDrawFrame=Yp(t.onDrawFrame)?t.onDrawFrame:()=>{}}addSource(l){this.streamSource=l,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(){const{analyser:l,dataArray:t,bufferLength:d}=this,n=this.canvasContext,a=this.width,i=this.height;l&&l.getByteTimeDomainData(t),n.fillRect(0,0,a,i),n.beginPath();const s=a*1/d;let c=0;d||n.moveTo(0,this.height/2);for(let F=0;F<d;F++){const o=t[F]/128*(i/2);F===0?n.moveTo(c,o):n.lineTo(c,o),c+=s}n.lineTo(a,i/2),n.stroke(),this.onDrawFrame(this),requestAnimationFrame(j(this,$W))}}$W=new WeakMap;function Wk({onDiscard:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button",type:"button",title:l("discardRecordedFile"),"aria-label":l("discardRecordedFile"),onClick:e,"data-uppy-super-focusable":!0,children:S("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:S("g",{fill:"#FFF",fillRule:"evenodd",children:[S("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),S("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"})]})})})}function Qk({recording:e,onStartRecording:l,onStopRecording:t,i18n:d}){return e?S("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button",type:"button",title:d("stopAudioRecording"),"aria-label":d("stopAudioRecording"),onClick:t,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:S("rect",{x:"15",y:"15",width:"70",height:"70"})})}):S("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button",type:"button",title:d("startAudioRecording"),"aria-label":d("startAudioRecording"),onClick:l,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14px",height:"20px",viewBox:"0 0 14 20",children:S("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"})})})}function mk(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`}function Rk({recordingLengthSeconds:e}){const l=mk(e);return S("span",{children:l})}function Nk({onSubmit:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button uppy-Audio-button--submit",type:"button",title:l("submitRecordedFile"),"aria-label":l("submitRecordedFile"),onClick:e,"data-uppy-super-focusable":!0,children:S("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:S("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})})}function bk(e){const{stream:l,recordedAudio:t,onStop:d,recording:n,supportsRecording:a,audioSources:i,showAudioSourceDropdown:s,onSubmit:c,i18n:F,onStartRecording:h,onStopRecording:o,onDiscardRecordedAudio:V,recordingLengthSeconds:W}=e,Q=zn(null),m=zn();Qs(()=>()=>{m.current=null,d()},[d]),Qs(()=>{if(!t&&(m.current=new Vk(Q.current,{canvas:{width:600,height:600},canvasContext:{lineWidth:2,fillStyle:"rgb(0,0,0)",strokeStyle:"green"}}),m.current.draw(),l)){const J=new AudioContext().createMediaStreamSource(l);m.current.addSource(J)}},[t,l]);const R=t!=null,r=!R&&a,b=s&&!R&&i&&i.length>1;return S("div",{className:"uppy-Audio-container",children:[S("div",{className:"uppy-Audio-audioContainer",children:R?S("audio",{className:"uppy-Audio-player",controls:!0,src:t}):S("canvas",{ref:Q,className:"uppy-Audio-canvas"})}),S("div",{className:"uppy-Audio-footer",children:[S("div",{className:"uppy-Audio-audioSourceContainer",children:b?ok(e):null}),S("div",{className:"uppy-Audio-buttonContainer",children:[r&&S(Qk,{recording:n,onStartRecording:h,onStopRecording:o,i18n:F}),R&&S(Nk,{onSubmit:c,i18n:F}),R&&S(Wk,{onDiscard:V,i18n:F})]}),S("div",{className:"uppy-Audio-recordingLength",children:!R&&S(Rk,{recordingLengthSeconds:W})})]})]})}function uk(){var e;return typeof MediaRecorder=="function"&&typeof((e=MediaRecorder.prototype)==null?void 0:e.start)=="function"}class kp extends Ln{constructor(t,d){super(t,d);dl(this,rU);dl(this,bU);E(this,"icon");dl(this,Vd,null);dl(this,uU,!1);dl(this,Re,null);dl(this,Ne,null);dl(this,ss,null);dl(this,Wd);dl(this,w0);dl(this,pU,t=>{if(!j(this,w0))return Promise.reject(new Error("Microphone access not supported"));Fl(this,uU,!0),cl(this,rU,Zy).call(this).then(d=>(this.setPluginState({hasAudio:d}),j(this,Wd).getUserMedia({audio:!0}).then(n=>{Fl(this,Vd,n);let a=null;const i=n.getAudioTracks();t!=null&&t.deviceId?a=i.findLast(s=>s.getSettings().deviceId===t.deviceId):a=i[0].getSettings().deviceId,j(this,MU).call(this),this.setPluginState({currentDeviceId:a,audioReady:!0})}).catch(n=>{this.setPluginState({audioReady:!1,cameraError:n}),this.uppy.info(n.message,"error")})))});dl(this,lQ,()=>{Fl(this,Ne,new MediaRecorder(j(this,Vd))),Fl(this,Re,[]);let t=!1;j(this,Ne).addEventListener("dataavailable",d=>{j(this,Re).push(d.data);const{restrictions:n}=this.uppy.opts;if(j(this,Re).length>1&&n.maxFileSize!=null&&!t){const a=j(this,Re).reduce((F,h)=>F+h.size,0),s=(a-j(this,Re)[0].size)/(j(this,Re).length-1)*3,c=Math.max(0,n.maxFileSize-s);a>c&&(t=!0,this.uppy.info(this.i18n("recordingStoppedMaxSize"),"warning",4e3),j(this,E0).call(this))}}),j(this,Ne).start(500),Fl(this,bU,setInterval(()=>{const d=this.getPluginState().recordingLengthSeconds;this.setPluginState({recordingLengthSeconds:d+1})},1e3)),this.setPluginState({isRecording:!0})});dl(this,E0,()=>new Promise(d=>{j(this,Ne).addEventListener("stop",()=>{d()}),j(this,Ne).stop(),clearInterval(j(this,bU)),this.setPluginState({recordingLengthSeconds:0})}).then(()=>(this.setPluginState({isRecording:!1}),cl(this,rU,Fy).call(this))).then(d=>{try{Fl(this,ss,d),this.setPluginState({recordedAudio:URL.createObjectURL(d.data)})}catch(n){n.isRestriction||this.uppy.log(n)}}).then(()=>{Fl(this,Re,null),Fl(this,Ne,null)},d=>{throw Fl(this,Re,null),Fl(this,Ne,null),d}));dl(this,tQ,()=>{this.setPluginState({recordedAudio:null}),Fl(this,ss,null)});dl(this,eQ,()=>{try{j(this,ss)&&this.uppy.addFile(j(this,ss))}catch(t){t.isRestriction||this.uppy.log(t,"warning")}});dl(this,cs,async()=>{j(this,Vd)&&j(this,Vd).getAudioTracks().forEach(d=>d.stop()),j(this,Ne)&&await new Promise(t=>{j(this,Ne).addEventListener("stop",t,{once:!0}),j(this,Ne).stop(),clearInterval(j(this,bU))}),Fl(this,Re,null),Fl(this,Ne,null),Fl(this,uU,!1),Fl(this,Vd,null),this.setPluginState({recordedAudio:null,isRecording:!1,recordingLengthSeconds:0})});dl(this,dQ,t=>{j(this,cs).call(this),j(this,pU).call(this,{deviceId:t})});dl(this,MU,()=>{j(this,Wd).enumerateDevices().then(t=>{this.setPluginState({audioSources:t.filter(d=>d.kind==="audioinput")})})});Fl(this,Wd,navigator.mediaDevices),Fl(this,w0,j(this,Wd)!=null),this.id=this.opts.id||"Audio",this.type="acquirer",this.icon=()=>S("svg",{className:"uppy-DashboardTab-iconAudio","aria-hidden":"true",focusable:"false",width:"32px",height:"32px",viewBox:"0 0 32 32",children:S("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=Fk,this.opts={...d},this.i18nInit(),this.title=this.i18n("pluginNameAudio"),this.setPluginState({hasAudio:!1,audioReady:!1,cameraError:null,recordingLengthSeconds:0,audioSources:[],currentDeviceId:null})}render(){j(this,uU)||j(this,pU).call(this);const t=this.getPluginState();return!t.audioReady||!t.hasAudio?S(hk,{icon:this.icon,i18n:this.i18n,hasAudio:t.hasAudio}):S(bk,{...t,onChangeSource:j(this,dQ),onStartRecording:j(this,lQ),onStopRecording:j(this,E0),onDiscardRecordedAudio:j(this,tQ),onSubmit:j(this,eQ),onStop:j(this,cs),i18n:this.i18n,showAudioSourceDropdown:this.opts.showAudioSourceDropdown,supportsRecording:uk(),recording:t.isRecording,stream:j(this,Vd)})}install(){this.setPluginState({audioReady:!1,recordingLengthSeconds:0});const{target:t}=this.opts;t&&this.mount(t,this),j(this,Wd)&&(j(this,MU).call(this),j(this,Wd).ondevicechange=()=>{if(j(this,MU).call(this),j(this,Vd)){let d=!0;const{audioSources:n,currentDeviceId:a}=this.getPluginState();n.forEach(i=>{a===i.deviceId&&(d=!1)}),d&&(j(this,cs).call(this),j(this,pU).call(this))}})}uninstall(){j(this,Vd)&&j(this,cs).call(this),this.unmount()}}bU=new WeakMap,Vd=new WeakMap,uU=new WeakMap,Re=new WeakMap,Ne=new WeakMap,ss=new WeakMap,Wd=new WeakMap,w0=new WeakMap,rU=new WeakSet,Zy=function(){return j(this,Wd)?j(this,Wd).enumerateDevices().then(t=>t.some(d=>d.kind==="audioinput")):Promise.resolve(!1)},pU=new WeakMap,lQ=new WeakMap,E0=new WeakMap,tQ=new WeakMap,eQ=new WeakMap,cs=new WeakMap,Fy=function(){const t=j(this,Re).find(s=>{var c;return((c=s.type)==null?void 0:c.length)>0}).type,d=wa(t);if(!d)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${t}"`));const n=`audio-${Date.now()}.${d}`,a=new Blob(j(this,Re),{type:t}),i={source:this.id,name:n,data:new Blob([a],{type:t}),type:t};return Promise.resolve(i)},dQ=new WeakMap,MU=new WeakMap,E(kp,"VERSION",Zk.version);const rk={pluralize(){return 0},strings:{addBulkFilesFailed:{0:"因内部错误,添加 %{smart_count} 个文件失败",1:"因内部错误,添加 %{smart_count} 个文件失败"},addedNumFiles:"已添加 %{numFiles} 个文件",addingMoreFiles:"正在添加更多文件",additionalRestrictionsFailed:"%{count} 个附加限制未满足",addMore:"添加更多",addMoreFiles:"添加更多文件",aggregateExceedsSize:"您选择的文件总大小为 %{size},但允许的最大总大小为 %{sizeAllowed}",allFilesFromFolderNamed:"来自文件夹 %{name} 的所有文件",allowAccessDescription:"请允许本站访问您的摄像头,以便拍照或录制视频。",allowAccessTitle:"请允许访问您的摄像头",allowAudioAccessDescription:"请允许本站访问您的麦克风,以便录制音频。",allowAudioAccessTitle:"请允许访问您的麦克风",aspectRatioLandscape:"裁剪为横向 (16:9)",aspectRatioPortrait:"裁剪为纵向 (9:16)",aspectRatioSquare:"裁剪为方形",authAborted:"身份验证已中止",authenticate:"连接",authenticateWith:"连接到 %{pluginName}",authenticateWithTitle:"请通过 %{pluginName} 验证以选择文件",back:"返回",browse:"浏览",browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancel:"取消",cancelUpload:"取消上传",closeModal:"关闭窗口",companionError:"与 Companion 连接失败",companionUnauthorizeHint:"要取消对 %{provider} 帐户的授权,请访问 %{url}",complete:"完成",compressedX:"通过压缩图像节省了 %{size}",compressingImages:"正在压缩图像...",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"请复制下方的 URL",copyLinkToClipboardSuccess:"链接已复制到剪贴板。",creatingAssembly:"正在准备上传...",creatingAssemblyFailed:"Transloadit: 无法创建程序集",dashboardTitle:"Uppy 仪表盘",dashboardWindowTitle:"Uppy 仪表盘窗口 (按 ESC 键关闭)",dataUploadedOfTotal:"%{complete} / %{total}",dataUploadedOfUnknown:"已上传 %{complete}",discardMediaFile:"丢弃媒体文件",discardRecordedFile:"丢弃录制的文件",done:"完成",dropHereOr:"拖放到此处,或%{browse}",dropHint:"将文件拖放到此处",dropPasteBoth:"拖放粘贴文件或文件夹到此处,或者%{browseFiles} / %{browseFolders}",dropPasteFiles:"拖放粘贴文件到此处,或者%{browseFiles}",dropPasteFolders:"拖放粘贴文件到此处,或者%{browseFolders}",dropPasteImportBoth:"拖放粘贴文件到此处,%{browseFiles},%{browseFolders}或从以下位置导入:",dropPasteImportFiles:"拖放粘贴文件到此处,%{browseFiles}或从以下位置导入:",dropPasteImportFolders:"拖放粘贴文件到此处,%{browseFolders}或从以下位置导入:",editFile:"编辑文件",editFileWithFilename:"编辑文件 %{file}",editImage:"编辑图像",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加任何文件",encoding:"正在编码...",enterCorrectUrl:"URL 不正确:请输入文件的直接链接",enterTextToSearch:"输入文本以搜索图像",enterUrlToImport:"输入 URL 以导入文件",error:"错误",exceedsSize:"%{file} 超出了 %{size} 的最大允许大小",failedToFetch:"Companion 无法抓取此 URL,请确保它是正确的",failedToUpload:"上传 %{file} 失败",filesUploadedOfTotal:{0:"%{smart_count} 个文件已上传 %{complete} 个",1:"%{smart_count} 个文件已上传 %{complete} 个"},filter:"筛选",finishEditingFile:"完成文件编辑",flipHorizontal:"水平翻转",folderAdded:{0:"从 %{folder} 添加了 %{smart_count} 个文件",1:"从 %{folder} 添加了 %{smart_count} 个文件"},folderAlreadyAdded:'文件夹 "%{folder}" 已添加',generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",inferiorSize:"此文件小于 %{size} 的最小允许大小",loadedXFiles:"已加载 %{numFiles} 个文件",loading:"加载中...",logIn:"登录",logOut:"登出",micDisabled:"用户已拒绝麦克风访问",missingRequiredMetaField:"缺少必需的元数据字段",missingRequiredMetaFieldOnFile:"%{fileName} 缺少必需的元数据字段",missingRequiredMetaFields:{0:"缺少必需的元数据字段: %{fields}。",1:"缺少必需的元数据字段: %{fields}。"},myDevice:"我的设备",noAudioDescription:"请连接麦克风或其他音频输入设备,以便录制音频",noAudioTitle:"麦克风不可用",noCameraDescription:"请连接摄像头设备,以便拍照或录制视频",noCameraTitle:"摄像头不可用",noDuplicates:"无法添加重复文件“%{fileName}”,该文件已存在",noFilesFound:"此处没有文件或文件夹",noInternetConnection:"无网络连接",noMoreFilesAllowed:"无法添加更多文件",noSearchResults:"抱歉,没有找到相关结果",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",paused:"已暂停",pauseUpload:"暂停上传",pickFiles:"选择文件",pickPhotos:"选择照片",pleaseWait:"请稍候",pluginNameAudio:"音频",pluginNameBox:"Box",pluginNameCamera:"摄像头",pluginNameDropbox:"Dropbox",pluginNameFacebook:"Facebook",pluginNameGoogleDrive:"Google Drive",pluginNameGoogleDrivePicker:"Google Drive",pluginNameGooglePhotosPicker:"Google Photos",pluginNameInstagram:"Instagram",pluginNameOneDrive:"OneDrive",pluginNameScreenCapture:"屏幕录制",pluginNameUnsplash:"Unsplash",pluginNameUrl:"链接",pluginNameWebdav:"WebDAV",pluginNameZoom:"Zoom",pluginWebdavInputLabel:"文件的 WebDAV URL (例如来自 ownCloud 或 Nextcloud)",poweredBy:"由 %{uppy} 驱动",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",recordingLength:"录制时长 %{recording_length}",recordingStoppedMaxSize:"录制已停止,因为文件大小即将超出限制",recordVideoBtn:"录制视频",recoveredAllFiles:"已恢复所有文件。您现在可以继续上传。",recoveredXFiles:{0:"无法完全恢复 1 个文件。请重新选择并继续上传。",1:"无法完全恢复 %{smart_count} 个文件。请重新选择并继续上传。"},removeFile:"移除文件",reSelect:"重新选择",resetFilter:"重置筛选",resetSearch:"重置搜索",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",revert:"重置",rotate:"旋转 90°",save:"保存",saveChanges:"保存更改",search:"搜索",searchImages:"搜索图像",selectX:{0:"选择 %{smart_count} 项",1:"选择 %{smart_count} 项"},sessionRestored:"会话已恢复",showErrorDetails:"显示错误详情",signInWithGoogle:"使用 Google 登录",smile:"笑一笑!",startAudioRecording:"开始音频录制",startCapturing:"开始屏幕录制",startRecording:"开始视频录制",stopAudioRecording:"停止音频录制",stopCapturing:"停止屏幕录制",stopRecording:"停止视频录制",streamActive:"直播流活跃",streamPassive:"直播流空闲",submitRecordedFile:"提交录制的文件",takePicture:"拍照",takePictureBtn:"拍照",takeScreenshot:"截屏",unnamed:"未命名",upload:"上传",uploadComplete:"上传完成",uploadFailed:"上传失败",uploading:"上传中",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},uploadPaused:"上传已暂停",uploadStalled:"上传在 %{seconds} 秒内无任何进展。您可能需要重试。",uploadXFiles:{0:"上传 %{smart_count} 个文件",1:"上传 %{smart_count} 个文件"},uploadXNewFiles:{0:"上传 +%{smart_count} 个文件",1:"上传 +%{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传以下类型:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少要选择 %{smart_count} 个文件",1:"您至少要选择 %{smart_count} 个文件"},zoomIn:"放大",zoomOut:"缩小"}};var Qm={exports:{}};/*!
17
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,i=!1,s;return{s:function(){t=t.call(e)},n:function(){var F=t.next();return a=F.done,F},e:function(F){i=!0,s=F},f:function(){try{!a&&t.return!=null&&t.return()}finally{if(i)throw s}}}}function ip(e,l){if(e){if(typeof e=="string")return sp(e,l);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return sp(e,l)}}function sp(e,l){(l==null||l>e.length)&&(l=e.length);for(var t=0,d=new Array(l);t<l;t++)d[t]=e[t];return d}function cp(e,l){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);l&&(d=d.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,d)}return t}function bs(e){for(var l=1;l<arguments.length;l++){var t=arguments[l]!=null?arguments[l]:{};l%2?cp(Object(t),!0).forEach(function(d){SY(e,d,t[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):cp(Object(t)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(t,d))})}return e}function SY(e,l,t){return l=Zp(l),l in e?Object.defineProperty(e,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[l]=t,e}function JY(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function Up(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,Zp(d.key),d)}}function TY(e,l,t){return l&&Up(e.prototype,l),t&&Up(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Zp(e){var l=GY(e,"string");return ga(l)=="symbol"?l:l+""}function GY(e,l){if(ga(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(ga(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ah="tus-v1",ih="ietf-draft-03",xU="ietf-draft-05",XY={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:Wp,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:ah},sh=function(){function e(l,t){JY(this,e),"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=l,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 TY(e,[{key:"findPreviousUploads",value:function(){var t=this;return this.options.fingerprint(this.file,this.options).then(function(d){return t._urlStorage.findUploadsByFingerprint(d)})}},{key:"resumeFromPreviousUpload",value:function(t){this.url=t.uploadUrl||null,this._parallelUploadUrls=t.parallelUploadUrls||null,this._urlStorageKey=t.urlStorageKey}},{key:"start",value:function(){var t=this,d=this.file;if(!d){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![ah,ih,xU].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 n=this.options.retryDelays;if(n!=null&&Object.prototype.toString.call(n)!=="[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 a=0,i=["uploadUrl","uploadSize","uploadLengthDeferred"];a<i.length;a++){var s=i[a];if(this.options[s]){this._emitError(new Error("tus: cannot use the ".concat(s," 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(d,this.options).then(function(c){return t._fingerprint=c,t._source?t._source:t.options.fileReader.openFile(d,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)})}},{key:"_startParallelUpload",value:function(){var t,d=this,n=this._size,a=0;this._parallelUploads=[];var i=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,s=(t=this.options.parallelUploadBoundaries)!==null&&t!==void 0?t:BY(this._source.size,i);this._parallelUploadUrls&&s.forEach(function(h,o){h.uploadUrl=d._parallelUploadUrls[o]||null}),this._parallelUploadUrls=new Array(s.length);var c=s.map(function(h,o){var V=0;return d._source.slice(h.start,h.end).then(function(W){var Q=W.value;return new Promise(function(m,R){var r=bs(bs({},d.options),{},{uploadUrl:h.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:d.options.metadataForPartialUploads,headers:bs(bs({},d.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:m,onError:R,onProgress:function(J){a=a-V+J,V=J,d._emitProgress(a,n)},onUploadUrlAvailable:function(){d._parallelUploadUrls[o]=b.url,d._parallelUploadUrls.filter(function(J){return!!J}).length===s.length&&d._saveUploadInUrlStorage()}}),b=new e(Q,r);b.start(),d._parallelUploads.push(b)})})}),F;Promise.all(c).then(function(){F=d._openRequest("POST",d.options.endpoint),F.setHeader("Upload-Concat","final;".concat(d._parallelUploadUrls.join(" ")));var h=Fp(d.options.metadata);return h!==""&&F.setHeader("Upload-Metadata",h),d._sendRequest(F,null)}).then(function(h){if(!us(h.getStatus(),200)){d._emitHttpError(F,h,"tus: unexpected response while creating upload");return}var o=h.getHeader("Location");if(o==null){d._emitHttpError(F,h,"tus: invalid or missing Location header");return}d.url=Qp(d.options.endpoint,o),"Created upload at ".concat(d.url),d._emitSuccess(h)}).catch(function(h){d._emitError(h)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){"Resuming upload from previous URL: ".concat(this.url),this._resumeUpload();return}if(this.options.uploadUrl!=null){"Resuming upload from provided URL: ".concat(this.options.uploadUrl),this.url=this.options.uploadUrl,this._resumeUpload();return}this._createUpload()}},{key:"abort",value:function(t){var d=this;if(this._parallelUploads!=null){var n=MY(this._parallelUploads),a;try{for(n.s();!(a=n.n()).done;){var i=a.value;i.abort(t)}}catch(s){n.e(s)}finally{n.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():e.terminate(this.url,this.options).then(function(){return d._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(t,d,n,a){this._emitError(new th(n,a,t,d))}},{key:"_emitError",value:function(t){var d=this;if(!this._aborted){if(this.options.retryDelays!=null){var n=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(n&&(this._retryAttempt=0),Vp(t,this._retryAttempt,this.options)){var a=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){d.start()},a);return}}if(typeof this.options.onError=="function")this.options.onError(t);else throw t}}},{key:"_emitSuccess",value:function(t){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:t})}},{key:"_emitProgress",value:function(t,d){typeof this.options.onProgress=="function"&&this.options.onProgress(t,d)}},{key:"_emitChunkComplete",value:function(t,d,n){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(t,d,n)}},{key:"_createUpload",value:function(){var t=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var d=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?d.setHeader("Upload-Defer-Length","1"):d.setHeader("Upload-Length","".concat(this._size));var n=Fp(this.options.metadata);n!==""&&d.setHeader("Upload-Metadata",n);var a;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,a=this._addChunkToRequest(d)):((this.options.protocol===ih||this.options.protocol===xU)&&d.setHeader("Upload-Complete","?0"),a=this._sendRequest(d,null)),a.then(function(i){if(!us(i.getStatus(),200)){t._emitHttpError(d,i,"tus: unexpected response while creating upload");return}var s=i.getHeader("Location");if(s==null){t._emitHttpError(d,i,"tus: invalid or missing Location header");return}if(t.url=Qp(t.options.endpoint,s),"Created upload at ".concat(t.url),typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._size===0){t._emitSuccess(i),t._source.close();return}t._saveUploadInUrlStorage().then(function(){t.options.uploadDataDuringCreation?t._handleUploadResponse(d,i):(t._offset=0,t._performUpload())})}).catch(function(i){t._emitHttpError(d,null,"tus: failed to create upload",i)})}},{key:"_resumeUpload",value:function(){var t=this,d=this._openRequest("HEAD",this.url),n=this._sendRequest(d,null);n.then(function(a){var i=a.getStatus();if(!us(i,200)){if(i===423){t._emitHttpError(d,a,"tus: upload is currently locked; retry later");return}if(us(i,400)&&t._removeFromUrlStorage(),!t.options.endpoint){t._emitHttpError(d,a,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}t.url=null,t._createUpload();return}var s=Number.parseInt(a.getHeader("Upload-Offset"),10);if(Number.isNaN(s)){t._emitHttpError(d,a,"tus: invalid or missing offset value");return}var c=Number.parseInt(a.getHeader("Upload-Length"),10);if(Number.isNaN(c)&&!t.options.uploadLengthDeferred&&t.options.protocol===ah){t._emitHttpError(d,a,"tus: invalid or missing length value");return}typeof t.options.onUploadUrlAvailable=="function"&&t.options.onUploadUrlAvailable(),t._saveUploadInUrlStorage().then(function(){if(s===c){t._emitProgress(c,c),t._emitSuccess(a);return}t._offset=s,t._performUpload()})}).catch(function(a){t._emitHttpError(d,null,"tus: failed to resume upload",a)})}},{key:"_performUpload",value:function(){var t=this;if(!this._aborted){var d;this.options.overridePatchMethod?(d=this._openRequest("POST",this.url),d.setHeader("X-HTTP-Method-Override","PATCH")):d=this._openRequest("PATCH",this.url),d.setHeader("Upload-Offset","".concat(this._offset));var n=this._addChunkToRequest(d);n.then(function(a){if(!us(a.getStatus(),200)){t._emitHttpError(d,a,"tus: unexpected response while uploading chunk");return}t._handleUploadResponse(d,a)}).catch(function(a){t._aborted||t._emitHttpError(d,null,"tus: failed to upload chunk at offset ".concat(t._offset),a)})}}},{key:"_addChunkToRequest",value:function(t){var d=this,n=this._offset,a=this._offset+this.options.chunkSize;return t.setProgressHandler(function(i){d._emitProgress(n+i,d._size)}),this.options.protocol===ah?t.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===xU&&t.setHeader("Content-Type","application/partial-upload"),(a===Number.POSITIVE_INFINITY||a>this._size)&&!this.options.uploadLengthDeferred&&(a=this._size),this._source.slice(n,a).then(function(i){var s=i.value,c=i.done,F=s!=null&&s.size?s.size:0;d.options.uploadLengthDeferred&&c&&(d._size=d._offset+F,t.setHeader("Upload-Length","".concat(d._size)));var h=d._offset+F;return!d.options.uploadLengthDeferred&&c&&h!==d._size?Promise.reject(new Error("upload was configured with a size of ".concat(d._size," bytes, but the source is done after ").concat(h," bytes"))):s===null?d._sendRequest(t):((d.options.protocol===ih||d.options.protocol===xU)&&t.setHeader("Upload-Complete",c?"?1":"?0"),d._emitProgress(d._offset,d._size),d._sendRequest(t,s))})}},{key:"_handleUploadResponse",value:function(t,d){var n=Number.parseInt(d.getHeader("Upload-Offset"),10);if(Number.isNaN(n)){this._emitHttpError(t,d,"tus: invalid or missing offset value");return}if(this._emitProgress(n,this._size),this._emitChunkComplete(n-this._offset,n,this._size),this._offset=n,n===this._size){this._emitSuccess(d),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(t,d){var n=hp(t,d,this.options);return this._req=n,n}},{key:"_removeFromUrlStorage",value:function(){var t=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(d){t._emitError(d)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var t=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var d={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?d.parallelUploadUrls=this._parallelUploadUrls:d.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,d).then(function(n){t._urlStorageKey=n})}},{key:"_sendRequest",value:function(t){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return op(t,d,this.options)}}],[{key:"terminate",value:function(t){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=hp("DELETE",t,d);return op(n,null,d).then(function(a){if(a.getStatus()!==204)throw new th("tus: unexpected response while terminating upload",null,n,a)}).catch(function(a){if(a instanceof th||(a=new th("tus: failed to terminate upload",a,n,null)),!Vp(a,0,d))throw a;var i=d.retryDelays[0],s=d.retryDelays.slice(1),c=bs(bs({},d),{},{retryDelays:s});return new Promise(function(F){return setTimeout(F,i)}).then(function(){return e.terminate(t,c)})})}}])}();function Fp(e){return Object.entries(e).map(function(l){var t=ap(l,2),d=t[0],n=t[1];return"".concat(d," ").concat(oY.encode(String(n)))}).join(",")}function us(e,l){return e>=l&&e<l+100}function hp(e,l,t){var d=t.httpStack.createRequest(e,l);t.protocol===ih?d.setHeader("Upload-Draft-Interop-Version","5"):t.protocol===xU?d.setHeader("Upload-Draft-Interop-Version","6"):d.setHeader("Tus-Resumable","1.0.0");for(var n=t.headers||{},a=0,i=Object.entries(n);a<i.length;a++){var s=ap(i[a],2),c=s[0],F=s[1];d.setHeader(c,F)}if(t.addRequestId){var h=NY();d.setHeader("X-Request-ID",h)}return d}function op(e,l,t){return sm.apply(this,arguments)}function sm(){return sm=bY(im().mark(function e(l,t,d){var n;return im().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(typeof d.onBeforeRequest!="function"){i.next=3;break}return i.next=3,d.onBeforeRequest(l);case 3:return i.next=5,l.send(t);case 5:if(n=i.sent,typeof d.onAfterResponse!="function"){i.next=9;break}return i.next=9,d.onAfterResponse(l,n);case 9:return i.abrupt("return",n);case 10:case"end":return i.stop()}},e)})),sm.apply(this,arguments)}function yY(){var e=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(e=!1),e}function Vp(e,l,t){return t.retryDelays==null||l>=t.retryDelays.length||e.originalRequest==null?!1:t&&typeof t.onShouldRetry=="function"?t.onShouldRetry(e,l,t):Wp(e)}function Wp(e){var l=e.originalResponse?e.originalResponse.getStatus():0;return(!us(l,400)||l===409||l===423)&&yY()}function Qp(e,l){return new RY(l,e).toString()}function BY(e,l){for(var t=Math.floor(e/l),d=[],n=0;n<l;n++)d.push({start:t*n,end:t*(n+1)});return d[l-1].end=e,d}sh.defaultOptions=XY;var mp=function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"};function YY(e){return new Promise(function(l,t){var d=new XMLHttpRequest;d.responseType="blob",d.onload=function(){var n=d.response;l(n)},d.onerror=function(n){t(n)},d.open("GET",e),d.send()})}var kY=function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")};function zY(e){return new Promise(function(l,t){var d=new FileReader;d.onload=function(){var n=new Uint8Array(d.result);l({value:n})},d.onerror=function(n){t(n)},d.readAsArrayBuffer(e)})}function gU(e){"@babel/helpers - typeof";return gU=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},gU(e)}function LY(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function IY(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,wY(d.key),d)}}function DY(e,l,t){return l&&IY(e.prototype,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function wY(e){var l=EY(e,"string");return gU(l)=="symbol"?l:l+""}function EY(e,l){if(gU(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(gU(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Rp=function(){function e(l){LY(this,e),this._file=l,this.size=l.size}return DY(e,[{key:"slice",value:function(t,d){if(kY())return zY(this._file.slice(t,d));var n=this._file.slice(t,d),a=d>=this.size;return Promise.resolve({value:n,done:a})}},{key:"close",value:function(){}}])}();function jU(e){"@babel/helpers - typeof";return jU=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},jU(e)}function CY(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function xY(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,jY(d.key),d)}}function gY(e,l,t){return l&&xY(e.prototype,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function jY(e){var l=OY(e,"string");return jU(l)=="symbol"?l:l+""}function OY(e,l){if(jU(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(jU(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Np(e){return e===void 0?0:e.size!==void 0?e.size:e.length}function vY(e,l){if(e.concat)return e.concat(l);if(e instanceof Blob)return new Blob([e,l],{type:e.type});if(e.set){var t=new e.constructor(e.length+l.length);return t.set(e),t.set(l,e.length),t}throw new Error("Unknown data type")}var KY=function(){function e(l){CY(this,e),this._buffer=void 0,this._bufferOffset=0,this._reader=l,this._done=!1}return gY(e,[{key:"slice",value:function(t,d){return t<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(t,d)}},{key:"_readUntilEnoughDataOrDone",value:function(t,d){var n=this,a=d<=this._bufferOffset+Np(this._buffer);if(this._done||a){var i=this._getDataFromBuffer(t,d),s=i==null?this._done:!1;return Promise.resolve({value:i,done:s})}return this._reader.read().then(function(c){var F=c.value,h=c.done;return h?n._done=!0:n._buffer===void 0?n._buffer=F:n._buffer=vY(n._buffer,F),n._readUntilEnoughDataOrDone(t,d)})}},{key:"_getDataFromBuffer",value:function(t,d){t>this._bufferOffset&&(this._buffer=this._buffer.slice(t-this._bufferOffset),this._bufferOffset=t);var n=Np(this._buffer)===0;return this._done&&n?null:this._buffer.slice(0,d-t)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}])}();function ja(e){"@babel/helpers - typeof";return ja=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},ja(e)}function cm(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */cm=function(){return l};var e,l={},t=Object.prototype,d=t.hasOwnProperty,n=Object.defineProperty||function(Y,B,z){Y[B]=z.value},a=typeof Symbol=="function"?Symbol:{},i=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function F(Y,B,z){return Object.defineProperty(Y,B,{value:z,enumerable:!0,configurable:!0,writable:!0}),Y[B]}try{F({},"")}catch{F=function(z,g,w){return z[g]=w}}function h(Y,B,z,g){var w=B&&B.prototype instanceof r?B:r,O=Object.create(w.prototype),K=new H(g||[]);return n(O,"_invoke",{value:L(Y,z,K)}),O}function o(Y,B,z){try{return{type:"normal",arg:Y.call(B,z)}}catch(g){return{type:"throw",arg:g}}}l.wrap=h;var V="suspendedStart",W="suspendedYield",Q="executing",m="completed",R={};function r(){}function b(){}function u(){}var J={};F(J,i,function(){return this});var G=Object.getPrototypeOf,T=G&&G(G(f([])));T&&T!==t&&d.call(T,i)&&(J=T);var y=u.prototype=r.prototype=Object.create(J);function k(Y){["next","throw","return"].forEach(function(B){F(Y,B,function(z){return this._invoke(B,z)})})}function X(Y,B){function z(w,O,K,x){var _=o(Y[w],Y,O);if(_.type!=="throw"){var al=_.arg,P=al.value;return P&&ja(P)=="object"&&d.call(P,"__await")?B.resolve(P.__await).then(function(A){z("next",A,K,x)},function(A){z("throw",A,K,x)}):B.resolve(P).then(function(A){al.value=A,K(al)},function(A){return z("throw",A,K,x)})}x(_.arg)}var g;n(this,"_invoke",{value:function(O,K){function x(){return new B(function(_,al){z(O,K,_,al)})}return g=g?g.then(x,x):x()}})}function L(Y,B,z){var g=V;return function(w,O){if(g===Q)throw Error("Generator is already running");if(g===m){if(w==="throw")throw O;return{value:e,done:!0}}for(z.method=w,z.arg=O;;){var K=z.delegate;if(K){var x=D(K,z);if(x){if(x===R)continue;return x}}if(z.method==="next")z.sent=z._sent=z.arg;else if(z.method==="throw"){if(g===V)throw g=m,z.arg;z.dispatchException(z.arg)}else z.method==="return"&&z.abrupt("return",z.arg);g=Q;var _=o(Y,B,z);if(_.type==="normal"){if(g=z.done?m:W,_.arg===R)continue;return{value:_.arg,done:z.done}}_.type==="throw"&&(g=m,z.method="throw",z.arg=_.arg)}}}function D(Y,B){var z=B.method,g=Y.iterator[z];if(g===e)return B.delegate=null,z==="throw"&&Y.iterator.return&&(B.method="return",B.arg=e,D(Y,B),B.method==="throw")||z!=="return"&&(B.method="throw",B.arg=new TypeError("The iterator does not provide a '"+z+"' method")),R;var w=o(g,Y.iterator,B.arg);if(w.type==="throw")return B.method="throw",B.arg=w.arg,B.delegate=null,R;var O=w.arg;return O?O.done?(B[Y.resultName]=O.value,B.next=Y.nextLoc,B.method!=="return"&&(B.method="next",B.arg=e),B.delegate=null,R):O:(B.method="throw",B.arg=new TypeError("iterator result is not an object"),B.delegate=null,R)}function C(Y){var B={tryLoc:Y[0]};1 in Y&&(B.catchLoc=Y[1]),2 in Y&&(B.finallyLoc=Y[2],B.afterLoc=Y[3]),this.tryEntries.push(B)}function I(Y){var B=Y.completion||{};B.type="normal",delete B.arg,Y.completion=B}function H(Y){this.tryEntries=[{tryLoc:"root"}],Y.forEach(C,this),this.reset(!0)}function f(Y){if(Y||Y===""){var B=Y[i];if(B)return B.call(Y);if(typeof Y.next=="function")return Y;if(!isNaN(Y.length)){var z=-1,g=function w(){for(;++z<Y.length;)if(d.call(Y,z))return w.value=Y[z],w.done=!1,w;return w.value=e,w.done=!0,w};return g.next=g}}throw new TypeError(ja(Y)+" is not iterable")}return b.prototype=u,n(y,"constructor",{value:u,configurable:!0}),n(u,"constructor",{value:b,configurable:!0}),b.displayName=F(u,c,"GeneratorFunction"),l.isGeneratorFunction=function(Y){var B=typeof Y=="function"&&Y.constructor;return!!B&&(B===b||(B.displayName||B.name)==="GeneratorFunction")},l.mark=function(Y){return Object.setPrototypeOf?Object.setPrototypeOf(Y,u):(Y.__proto__=u,F(Y,c,"GeneratorFunction")),Y.prototype=Object.create(y),Y},l.awrap=function(Y){return{__await:Y}},k(X.prototype),F(X.prototype,s,function(){return this}),l.AsyncIterator=X,l.async=function(Y,B,z,g,w){w===void 0&&(w=Promise);var O=new X(h(Y,B,z,g),w);return l.isGeneratorFunction(B)?O:O.next().then(function(K){return K.done?K.value:O.next()})},k(y),F(y,c,"Generator"),F(y,i,function(){return this}),F(y,"toString",function(){return"[object Generator]"}),l.keys=function(Y){var B=Object(Y),z=[];for(var g in B)z.push(g);return z.reverse(),function w(){for(;z.length;){var O=z.pop();if(O in B)return w.value=O,w.done=!1,w}return w.done=!0,w}},l.values=f,H.prototype={constructor:H,reset:function(B){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!B)for(var z in this)z.charAt(0)==="t"&&d.call(this,z)&&!isNaN(+z.slice(1))&&(this[z]=e)},stop:function(){this.done=!0;var B=this.tryEntries[0].completion;if(B.type==="throw")throw B.arg;return this.rval},dispatchException:function(B){if(this.done)throw B;var z=this;function g(al,P){return K.type="throw",K.arg=B,z.next=al,P&&(z.method="next",z.arg=e),!!P}for(var w=this.tryEntries.length-1;w>=0;--w){var O=this.tryEntries[w],K=O.completion;if(O.tryLoc==="root")return g("end");if(O.tryLoc<=this.prev){var x=d.call(O,"catchLoc"),_=d.call(O,"finallyLoc");if(x&&_){if(this.prev<O.catchLoc)return g(O.catchLoc,!0);if(this.prev<O.finallyLoc)return g(O.finallyLoc)}else if(x){if(this.prev<O.catchLoc)return g(O.catchLoc,!0)}else{if(!_)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return g(O.finallyLoc)}}}},abrupt:function(B,z){for(var g=this.tryEntries.length-1;g>=0;--g){var w=this.tryEntries[g];if(w.tryLoc<=this.prev&&d.call(w,"finallyLoc")&&this.prev<w.finallyLoc){var O=w;break}}O&&(B==="break"||B==="continue")&&O.tryLoc<=z&&z<=O.finallyLoc&&(O=null);var K=O?O.completion:{};return K.type=B,K.arg=z,O?(this.method="next",this.next=O.finallyLoc,R):this.complete(K)},complete:function(B,z){if(B.type==="throw")throw B.arg;return B.type==="break"||B.type==="continue"?this.next=B.arg:B.type==="return"?(this.rval=this.arg=B.arg,this.method="return",this.next="end"):B.type==="normal"&&z&&(this.next=z),R},finish:function(B){for(var z=this.tryEntries.length-1;z>=0;--z){var g=this.tryEntries[z];if(g.finallyLoc===B)return this.complete(g.completion,g.afterLoc),I(g),R}},catch:function(B){for(var z=this.tryEntries.length-1;z>=0;--z){var g=this.tryEntries[z];if(g.tryLoc===B){var w=g.completion;if(w.type==="throw"){var O=w.arg;I(g)}return O}}throw Error("illegal catch attempt")},delegateYield:function(B,z,g){return this.delegate={iterator:f(B),resultName:z,nextLoc:g},this.method==="next"&&(this.arg=e),R}},l}function bp(e,l,t,d,n,a,i){try{var s=e[a](i),c=s.value}catch(F){t(F);return}s.done?l(c):Promise.resolve(c).then(d,n)}function fY(e){return function(){var l=this,t=arguments;return new Promise(function(d,n){var a=e.apply(l,t);function i(c){bp(a,d,n,i,s,"next",c)}function s(c){bp(a,d,n,i,s,"throw",c)}i(void 0)})}}function HY(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function PY(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,_Y(d.key),d)}}function AY(e,l,t){return l&&PY(e.prototype,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function _Y(e){var l=qY(e,"string");return ja(l)=="symbol"?l:l+""}function qY(e,l){if(ja(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(ja(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var $Y=function(){function e(){HY(this,e)}return AY(e,[{key:"openFile",value:function(){var l=fY(cm().mark(function d(n,a){var i;return cm().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(!(mp()&&n&&typeof n.uri<"u")){c.next=11;break}return c.prev=1,c.next=4,YY(n.uri);case 4:return i=c.sent,c.abrupt("return",new Rp(i));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 n.slice=="function"&&typeof n.size<"u")){c.next=13;break}return c.abrupt("return",Promise.resolve(new Rp(n)));case 13:if(typeof n.read!="function"){c.next=18;break}if(a=Number(a),Number.isFinite(a)){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 KY(n,a)));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()}},d,null,[[1,8]])}));function t(d,n){return l.apply(this,arguments)}return t}()}])}();function l1(e,l){return mp()?Promise.resolve(t1(e,l)):Promise.resolve(["tus-br",e.name,e.type,e.size,e.lastModified,l.endpoint].join("-"))}function t1(e,l){var t=e.exif?e1(JSON.stringify(e.exif)):"noexif";return["tus-rn",e.name||"noname",e.size||"nosize",t,l.endpoint].join("/")}function e1(e){var l=0;if(e.length===0)return l;for(var t=0;t<e.length;t++){var d=e.charCodeAt(t);l=(l<<5)-l+d,l&=l}return l}function OU(e){"@babel/helpers - typeof";return OU=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},OU(e)}function Um(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function d1(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,n1(d.key),d)}}function Zm(e,l,t){return l&&d1(e.prototype,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function n1(e){var l=a1(e,"string");return OU(l)=="symbol"?l:l+""}function a1(e,l){if(OU(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(OU(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var i1=function(){function e(){Um(this,e)}return Zm(e,[{key:"createRequest",value:function(t,d){return new s1(t,d)}},{key:"getName",value:function(){return"XHRHttpStack"}}])}(),s1=function(){function e(l,t){Um(this,e),this._xhr=new XMLHttpRequest,this._xhr.open(l,t,!0),this._method=l,this._url=t,this._headers={}}return Zm(e,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(t,d){this._xhr.setRequestHeader(t,d),this._headers[t]=d}},{key:"getHeader",value:function(t){return this._headers[t]}},{key:"setProgressHandler",value:function(t){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(d){d.lengthComputable&&t(d.loaded)})}},{key:"send",value:function(){var t=this,d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(n,a){t._xhr.onload=function(){n(new c1(t._xhr))},t._xhr.onerror=function(i){a(i)},t._xhr.send(d)})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}(),c1=function(){function e(l){Um(this,e),this._xhr=l}return Zm(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(t){return this._xhr.getResponseHeader(t)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}();function vU(e){"@babel/helpers - typeof";return vU=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},vU(e)}function U1(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function Z1(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,h1(d.key),d)}}function F1(e,l,t){return l&&Z1(e.prototype,l),Object.defineProperty(e,"prototype",{writable:!1}),e}function h1(e){var l=o1(e,"string");return vU(l)=="symbol"?l:l+""}function o1(e,l){if(vU(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(vU(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Fm=!1;try{Fm="localStorage"in window;var hm="tusSupport",up=localStorage.getItem(hm);localStorage.setItem(hm,up),up===null&&localStorage.removeItem(hm)}catch(e){if(e.code===e.SECURITY_ERR||e.code===e.QUOTA_EXCEEDED_ERR)Fm=!1;else throw e}var V1=Fm,W1=function(){function e(){U1(this,e)}return F1(e,[{key:"findAllUploads",value:function(){var t=this._findEntries("tus::");return Promise.resolve(t)}},{key:"findUploadsByFingerprint",value:function(t){var d=this._findEntries("tus::".concat(t,"::"));return Promise.resolve(d)}},{key:"removeUpload",value:function(t){return localStorage.removeItem(t),Promise.resolve()}},{key:"addUpload",value:function(t,d){var n=Math.round(Math.random()*1e12),a="tus::".concat(t,"::").concat(n);return localStorage.setItem(a,JSON.stringify(d)),Promise.resolve(a)}},{key:"_findEntries",value:function(t){for(var d=[],n=0;n<localStorage.length;n++){var a=localStorage.key(n);if(a.indexOf(t)===0)try{var i=JSON.parse(localStorage.getItem(a));i.urlStorageKey=a,d.push(i)}catch{}}return d}}])}();function rs(e){"@babel/helpers - typeof";return rs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},rs(e)}function Q1(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function m1(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,Mp(d.key),d)}}function R1(e,l,t){return t&&m1(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function N1(e,l,t){return l=ch(l),b1(e,rp()?Reflect.construct(l,t||[],ch(e).constructor):l.apply(e,t))}function b1(e,l){if(l&&(rs(l)==="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return u1(e)}function u1(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rp(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rp=function(){return!!e})()}function ch(e){return ch=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ch(e)}function r1(e,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(l&&l.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),l&&om(e,l)}function om(e,l){return om=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(d,n){return d.__proto__=n,d},om(e,l)}function pp(e,l){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);l&&(d=d.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,d)}return t}function ps(e){for(var l=1;l<arguments.length;l++){var t=arguments[l]!=null?arguments[l]:{};l%2?pp(Object(t),!0).forEach(function(d){p1(e,d,t[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):pp(Object(t)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(t,d))})}return e}function p1(e,l,t){return l=Mp(l),l in e?Object.defineProperty(e,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[l]=t,e}function Mp(e){var l=M1(e,"string");return rs(l)=="symbol"?l:l+""}function M1(e,l){if(rs(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(rs(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(e)}var Vm=ps(ps({},sh.defaultOptions),{},{httpStack:new i1,fileReader:new $Y,urlStorage:V1?new W1:new nY,fingerprint:l1}),S1=function(e){function l(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Q1(this,l),d=ps(ps({},Vm),d),N1(this,l,[t,d])}return r1(l,e),R1(l,null,[{key:"terminate",value:function(d){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return n=ps(ps({},Vm),n),sh.terminate(d,n)}}])}(sh);const J1={version:"5.1.0"};function T1(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")}function G1(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"}function X1(e){return(l,t)=>{if(T1()||G1())return Vm.fingerprint(l,t);const d=["tus",e.id,t.endpoint].join("-");return Promise.resolve(d)}}const Sp={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},y1={limit:20,retryDelays:Sp.retryDelays,withCredentials:!1,allowedMetaFields:!0};class Jp extends or{constructor(t,d){var n;super(t,{...y1,...d});dl(this,ka);dl(this,I0);E(this,"requests");E(this,"uploaders");E(this,"uploaderEvents");dl(this,D0,async t=>{if(t.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...");const d=this.uppy.getFilesByIds(t);await cl(this,ka,Uy).call(this,d)});if(this.type="uploader",this.id=this.opts.id||"Tus",(d==null?void 0:d.allowedMetaFields)===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");if("autoRetry"in d)throw new Error("The `autoRetry` option was deprecated and has been removed.");this.requests=this.opts.rateLimitedQueue??new Py(this.opts.limit),Fl(this,I0,(n=this.opts.retryDelays)==null?void 0:n.values()),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null)}resetUploaderReferences(t,d){const n=this.uploaders[t];n&&(n.abort(),d!=null&&d.abort&&n.abort(!0),this.uploaders[t]=null),this.uploaderEvents[t]&&(this.uploaderEvents[t].remove(),this.uploaderEvents[t]=null)}onReceiveUploadUrl(t,d){const n=this.uppy.getFile(t.id);n&&(!n.tus||n.tus.uploadUrl!==d)&&(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(n.id,{tus:{...n.tus,uploadUrl:d}}))}install(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!0}}),this.uppy.addUploader(j(this,D0))}uninstall(){this.uppy.setState({capabilities:{...this.uppy.getState().capabilities,resumableUploads:!1}}),this.uppy.removeUploader(j(this,D0))}}I0=new WeakMap,ka=new WeakSet,sy=async function(t){return this.resetUploaderReferences(t.id),new Promise((d,n)=>{let a,i,s;const c={...this.opts,...t.tus||{}};typeof c.headers=="function"&&(c.headers=c.headers(t));const{onShouldRetry:F,onBeforeRequest:h,...o}=c,V={...Sp,...o};V.fingerprint=X1(t),V.onBeforeRequest=async b=>{const u=b.getUnderlyingObject();u.withCredentials=!!c.withCredentials;let J;if(typeof h=="function"&&(J=h(b,t)),oQ(a,"shouldBeRequeued")){if(!a.shouldBeRequeued)return Promise.reject();let G;const T=new Promise(y=>{G=y});a=this.requests.run(()=>(t.isPaused&&a.abort(),G(),()=>{})),await Promise.all([T,J]);return}return J},V.onError=b=>{this.uppy.log(b);const u=b.originalRequest!=null?b.originalRequest.getUnderlyingObject():null;vy(u)&&(b=new Gy(b,u)),this.resetUploaderReferences(t.id),a==null||a.abort(),typeof c.onError=="function"&&c.onError(b),n(b)},V.onProgress=(b,u)=>{this.onReceiveUploadUrl(t,s.url),typeof c.onProgress=="function"&&c.onProgress(b,u);const J=this.uppy.getFile(t.id);this.uppy.emit("upload-progress",J,{uploadStarted:J.progress.uploadStarted??0,bytesUploaded:b,bytesTotal:u})},V.onSuccess=b=>{const u={uploadURL:s.url??void 0,status:200,body:{xhr:b.lastResponse.getUnderlyingObject()}};if(this.uppy.emit("upload-success",this.uppy.getFile(t.id),u),this.resetUploaderReferences(t.id),a.done(),s.url){const{name:J}=s.file;this.uppy.log(`Download ${J} from ${s.url}`)}typeof c.onSuccess=="function"&&c.onSuccess(b),d(s)};const W=b=>{var J,G;const u=(J=b==null?void 0:b.originalResponse)==null?void 0:J.getStatus();if(u===429){if(!this.requests.isPaused){const T=(G=j(this,I0))==null?void 0:G.next();if(T==null||T.done)return!1;this.requests.rateLimit(T.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 a.abort(),a={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};F!=null?V.onShouldRetry=(b,u)=>F(b,u,c,W):V.onShouldRetry=W;const Q=(b,u,J)=>{oQ(b,u)&&!oQ(b,J)&&(b[J]=b[u])},m={};if(wy(c.allowedMetaFields,t.meta).forEach(b=>{m[b]=String(t.meta[b])}),Q(m,"type","filetype"),Q(m,"name","filename"),V.metadata=m,t.data==null)throw new Error("File data is empty");s=new S1(t.data,V),this.uploaders[t.id]=s;const r=new FB(this.uppy);this.uploaderEvents[t.id]=r,i=()=>(t.isPaused||s.start(),()=>{}),s.findPreviousUploads().then(b=>{const u=b[0];u&&(this.uppy.log(`[Tus] Resuming upload of ${t.id} started at ${u.creationTime}`),s.resumeFromPreviousUpload(u)),a=this.requests.run(i)}),r.onFileRemove(t.id,b=>{a.abort(),this.resetUploaderReferences(t.id,{abort:!!s.url}),d(`upload ${b} was removed`)}),r.onPause(t.id,b=>{a.abort(),b?s.abort():a=this.requests.run(i)}),r.onPauseAll(t.id,()=>{a.abort(),s.abort()}),r.onCancelAll(t.id,()=>{a.abort(),this.resetUploaderReferences(t.id,{abort:!!s.url}),d(`upload ${t.id} was canceled`)}),r.onResumeAll(t.id,()=>{a.abort(),t.error&&s.abort(),a=this.requests.run(i)})}).catch(d=>{throw this.uppy.emit("upload-error",t,d),d})},cy=function(t){const d={...this.opts};return t.tus&&Object.assign(d,t.tus),typeof d.headers=="function"&&(d.headers=d.headers(t)),{..."remote"in t&&t.remote.body,endpoint:d.endpoint,uploadUrl:d.uploadUrl,protocol:"tus",size:t.data.size,headers:d.headers,metadata:t.meta}},Uy=async function(t){const d=By(t),n=Yy(d);this.uppy.emit("upload-start",n),await Promise.allSettled(d.map(a=>{if(a.isRemote){const i=()=>this.requests,s=new AbortController,c=h=>{h.id===a.id&&s.abort()};this.uppy.on("file-removed",c);const F=this.uppy.getRequestClientForFile(a).uploadRemoteFile(a,cl(this,ka,cy).call(this,a),{signal:s.signal,getQueue:i});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",c)},{priority:-1})(),F}return cl(this,ka,sy).call(this,a)}))},D0=new WeakMap,E(Jp,"VERSION",J1.version);var KU={exports:{}},Tp;function B1(){if(Tp)return KU.exports;Tp=1,KU.exports=d,KU.exports.isMobile=d,KU.exports.default=d;const e=/(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,l=/CrOS/,t=/android|ipad|playbook|silk/i;function d(n){n||(n={});let a=n.ua;if(!a&&typeof navigator<"u"&&(a=navigator.userAgent),a&&a.headers&&typeof a.headers["user-agent"]=="string"&&(a=a.headers["user-agent"]),typeof a!="string")return!1;let i=e.test(a)&&!l.test(a)||!!n.tablet&&t.test(a);return!i&&n.tablet&&n.featureDetect&&navigator&&navigator.maxTouchPoints>1&&a.indexOf("Macintosh")!==-1&&a.indexOf("Safari")!==-1&&(i=!0),i}return KU.exports}var Y1=B1();const k1={version:"5.1.0"};function Gp(){return S("svg",{"aria-hidden":"true",focusable:"false",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55",children:S("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"})})}function z1({onDiscard:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--discard",type:"button",title:l("discardRecordedFile"),"aria-label":l("discardRecordedFile"),onClick:e,"data-uppy-super-focusable":!0,children:S("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:S("g",{fill:"#FFF",fillRule:"evenodd",children:[S("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),S("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"})]})})})}function L1({recording:e,onStartRecording:l,onStopRecording:t,i18n:d}){return e?S("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:d("stopRecording"),"aria-label":d("stopRecording"),onClick:t,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:S("rect",{x:"15",y:"15",width:"70",height:"70"})})}):S("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:d("startRecording"),"aria-label":d("startRecording"),onClick:l,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:S("circle",{cx:"50",cy:"50",r:"40"})})})}function I1(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`}function D1({recordingLengthSeconds:e}){const l=I1(e);return S("span",{children:l})}function w1({onSnapshot:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:l("takePicture"),"aria-label":l("takePicture"),onClick:e,"data-uppy-super-focusable":!0,children:Gp()})}function E1({onSubmit:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit",type:"button",title:l("submitRecordedFile"),"aria-label":l("submitRecordedFile"),onClick:e,"data-uppy-super-focusable":!0,children:S("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:S("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})})}function C1({currentDeviceId:e,videoSources:l,onChangeVideoSource:t}){return S("div",{className:"uppy-Webcam-videoSource",children:S("select",{className:"uppy-u-reset uppy-Webcam-videoSource-select",onChange:d=>{t(d.target.value)},children:l.map(d=>S("option",{value:d.deviceId,selected:d.deviceId===e,children:d.label},d.deviceId))})})}function Uh(e,l){return e.includes(l)}class x1 extends se{constructor(){super(...arguments);E(this,"videoElement");E(this,"refs")}componentDidMount(){const{onFocus:t}=this.props;t()}componentWillUnmount(){const{onStop:t}=this.props;t()}render(){const{src:t,recordedVideo:d,capturedSnapshot:n,recording:a,modes:i,supportsRecording:s,videoSources:c,showVideoSourceDropdown:F,showRecordingLength:h,onSubmit:o,i18n:V,mirror:W,onSnapshot:Q,onStartRecording:m,onStopRecording:R,onDiscardRecordedMedia:r,recordingLengthSeconds:b}=this.props,u=!!d,J=!!n,G=u||J,T=!G&&s&&(Uh(i,"video-only")||Uh(i,"audio-only")||Uh(i,"video-audio")),y=!G&&Uh(i,"picture"),k=s&&h&&!u,X=F&&c&&c.length>1,L={playsInline:!0};return d?(L.muted=!1,L.controls=!0,L.src=d,this.videoElement&&(this.videoElement.srcObject=null)):(L.muted=!0,L.autoPlay=!0,L.srcObject=t),S("div",{className:"uppy uppy-Webcam-container",children:[S("div",{className:"uppy-Webcam-videoContainer",children:n&&!a&&!d?S("div",{className:"uppy-Webcam-imageContainer",children:S("img",{src:n,className:"uppy-Webcam-video",alt:"capturedSnapshot"})}):S("video",{ref:D=>{this.videoElement=D},className:`uppy-Webcam-video ${W?"uppy-Webcam-video--mirrored":""}`,...L})}),S("div",{className:"uppy-Webcam-footer",children:[S("div",{className:"uppy-Webcam-videoSourceContainer",children:X?C1(this.props):null}),S("div",{className:"uppy-Webcam-buttonContainer",children:[y&&S(w1,{onSnapshot:Q,i18n:V}),T&&S(L1,{recording:a,onStartRecording:m,onStopRecording:R,i18n:V}),(u||J)&&S(E1,{onSubmit:o,i18n:V}),(u||J)&&S(z1,{onDiscard:r,i18n:V})]}),S("div",{className:"uppy-Webcam-recordingLength",children:k&&S(D1,{recordingLengthSeconds:b})})]})]})}}const g1={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 j1({icon:e,i18n:l,hasCamera:t}){return S("div",{className:"uppy-Webcam-permissons",children:[S("div",{className:"uppy-Webcam-permissonsIcon",children:e()}),S("div",{className:"uppy-Webcam-title",children:l(t?"allowAccessTitle":"noCameraTitle")}),S("p",{children:l(t?"allowAccessDescription":"noCameraDescription")})]})}function O1(){return typeof MediaRecorder=="function"&&!!MediaRecorder.prototype&&typeof MediaRecorder.prototype.start=="function"}function Xp(e){return e[0]==="."?VQ[e.slice(1)]:e}function v1(e){return/^video\/[^*]+$/.test(e)}function K1(e){return/^image\/[^*]+$/.test(e)}function f1(){return navigator.mediaDevices}function Wm(e,l){return e.includes(l)}const H1={onBeforeSnapshot:()=>Promise.resolve(),countdown:!1,modes:["video-audio","video-only","audio-only","picture"],mirror:!0,showVideoSourceDropdown:!1,preferredImageMimeType:null,preferredVideoMimeType:null,showRecordingLength:!1,mobileNativeCamera:Y1.isMobile({tablet:!0})};class yp extends Ln{constructor(t,d){super(t,{...H1,...d});dl(this,za);E(this,"mediaDevices");E(this,"supportsUserMedia");E(this,"protocol");E(this,"capturedMediaFile");E(this,"icon");E(this,"webcamActive");E(this,"stream",null);E(this,"recorder",null);E(this,"recordingChunks",null);E(this,"recordingLengthTimer");E(this,"captureInProgress",!1);this.mediaDevices=f1(),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=()=>S("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:S("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=g1,this.i18nInit(),this.title=this.i18n("pluginNameCamera"),Fl(this,za,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(){const{recordedVideo:t,capturedSnapshot:d,isRecording:n,cameraReady:a,cameraError:i}=this.getPluginState();return n?"recording":t!=null||d!=null?"captured":a?"ready":i?"error":"init"}setOptions(t){super.setOptions({...t,videoConstraints:{...this.opts.videoConstraints,...t==null?void 0:t.videoConstraints}})}hasCameraCheck(){return this.mediaDevices?this.mediaDevices.enumerateDevices().then(t=>t.some(d=>d.kind==="videoinput")):Promise.resolve(!1)}isAudioOnly(){return this.opts.modes.length===1&&this.opts.modes[0]==="audio-only"}getConstraints(t=null){const d=this.opts.modes.indexOf("video-audio")!==-1||this.opts.modes.indexOf("audio-only")!==-1,n=!this.isAudioOnly()&&(this.opts.modes.indexOf("video-audio")!==-1||this.opts.modes.indexOf("video-only")!==-1||this.opts.modes.indexOf("picture")!==-1),a={...this.opts.videoConstraints||{},...t!=null&&{deviceId:t}};return{audio:d,video:n?a:!1}}start(t=null){if(!this.supportsUserMedia)return Promise.reject(new Error("Webcam access not supported"));this.webcamActive=!0,this.opts.mirror&&Fl(this,za,!0);const d=this.getConstraints(t==null?void 0:t.deviceId);this.hasCameraCheck().then(n=>(this.setPluginState({hasCamera:n}),this.mediaDevices.getUserMedia(d).then(a=>{this.stream=a;let i=null;const s=this.isAudioOnly()?a.getAudioTracks():a.getVideoTracks();!t||!t.deviceId?i=s[0].getSettings().deviceId:s.forEach(c=>{c.getSettings().deviceId===t.deviceId&&(i=c.getSettings().deviceId)}),this.updateVideoSources(),this.setPluginState({currentDeviceId:i,cameraReady:!0})}).catch(a=>{this.setPluginState({cameraReady:!1,cameraError:a}),this.uppy.info(a.message,"error")})))}getMediaRecorderOptions(){const t={};if(MediaRecorder.isTypeSupported){const{restrictions:d}=this.uppy.opts;let n=[];this.opts.preferredVideoMimeType?n=[this.opts.preferredVideoMimeType]:d.allowedFileTypes&&(n=d.allowedFileTypes.map(Xp).filter(v1));const a=s=>MediaRecorder.isTypeSupported(s)&&wa(s),i=n.filter(a);i.length>0&&(t.mimeType=i[0])}return t}startRecording(){this.recorder=new MediaRecorder(this.stream,this.getMediaRecorderOptions()),this.recordingChunks=[];let t=!1;this.recorder.addEventListener("dataavailable",d=>{this.recordingChunks.push(d.data);const{restrictions:n}=this.uppy.opts;if(this.recordingChunks.length>1&&n.maxFileSize!=null&&!t){const a=this.recordingChunks.reduce((F,h)=>F+h.size,0),s=(a-this.recordingChunks[0].size)/(this.recordingChunks.length-1)*3,c=Math.max(0,n.maxFileSize-s);a>c&&(t=!0,this.uppy.info(this.i18n("recordingStoppedMaxSize"),"warning",4e3),this.stopRecording())}}),this.recorder.start(500),this.opts.showRecordingLength&&(this.recordingLengthTimer=setInterval(()=>{const d=this.getPluginState().recordingLengthSeconds;this.setPluginState({recordingLengthSeconds:d+1})},1e3)),this.setPluginState({isRecording:!0})}stopRecording(){return new Promise(d=>{this.recorder.addEventListener("stop",()=>{d()}),this.recorder.stop(),this.opts.showRecordingLength&&(clearInterval(this.recordingLengthTimer),this.setPluginState({recordingLengthSeconds:0}))}).then(()=>(this.setPluginState({isRecording:!1}),this.getVideo())).then(d=>{try{this.capturedMediaFile=d,this.setPluginState({recordedVideo:URL.createObjectURL(d.data)}),Fl(this,za,!1)}catch(n){n.isRestriction||this.uppy.log(n)}}).then(()=>{this.recordingChunks=null,this.recorder=null},d=>{throw this.recordingChunks=null,this.recorder=null,d})}discardRecordedMedia(){const{recordedVideo:t,capturedSnapshot:d}=this.getPluginState();t&&URL.revokeObjectURL(t),d&&URL.revokeObjectURL(d),this.setPluginState({recordedVideo:null,capturedSnapshot:null}),this.opts.mirror&&Fl(this,za,!0),this.capturedMediaFile=null}submit(){try{this.capturedMediaFile&&this.uppy.addFile(this.capturedMediaFile)}catch(t){t.isRestriction||this.uppy.log(t,"error")}}async stop(){if(this.stream){const t=this.stream.getAudioTracks(),d=this.stream.getVideoTracks();t.concat(d).forEach(n=>n.stop())}this.recorder&&await new Promise(t=>{this.recorder.addEventListener("stop",t,{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((t,d)=>{let n=this.opts.countdown;const a=setInterval(()=>{if(!this.webcamActive)return clearInterval(a),this.captureInProgress=!1,d(new Error("Webcam is not active"));n?(this.uppy.info(`${n}...`,"warning",800),n--):(clearInterval(a),this.uppy.info(this.i18n("smile"),"success",1500),setTimeout(()=>t(),1500))},1e3)})}async takeSnapshot(){if(!this.captureInProgress){this.captureInProgress=!0;try{await this.opts.onBeforeSnapshot()}catch(t){const d=typeof t=="object"?t.message:t;throw this.uppy.info(d,"error",5e3),new Error(`onBeforeSnapshot: ${d}`)}try{const t=await this.getImage();if(this.capturedMediaFile=t,t.data==null)throw new Error("File data is empty");const d=URL.createObjectURL(t.data);this.setPluginState({capturedSnapshot:d}),this.captureInProgress=!1}catch(t){this.captureInProgress=!1,t.isRestriction||this.uppy.log(t)}}}async getImage(){const t=this.getVideoElement();if(!t)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));const d=t.videoWidth,n=t.videoHeight,a=document.createElement("canvas");a.width=d,a.height=n,a.getContext("2d").drawImage(t,0,0);const{restrictions:s}=this.uppy.opts;let c=[];this.opts.preferredImageMimeType?c=[this.opts.preferredImageMimeType]:s.allowedFileTypes&&(c=s.allowedFileTypes.map(Xp).filter(K1));const F=c[0]||"image/jpeg",h=wa(F)||"jpg",o=`cam-${Date.now()}.${h}`;return Sy(a,F).then(V=>({source:this.id,name:o,data:new Blob([V],{type:F}),type:F}))}getVideo(){const t=this.recordingChunks.find(s=>{var c;return((c=s.type)==null?void 0:c.length)>0}).type,d=wa(t);if(!d)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${t}"`));const n=`webcam-${Date.now()}.${d}`,a=new Blob(this.recordingChunks,{type:t}),i={source:this.id,name:n,data:new Blob([a],{type:t}),type:t};return Promise.resolve(i)}focus(){this.opts.countdown&&setTimeout(()=>{this.uppy.info(this.i18n("smile"),"success",1500)},1e3)}changeVideoSource(t){this.stop(),this.start({deviceId:t})}updateVideoSources(){this.mediaDevices.enumerateDevices().then(t=>{this.setPluginState({videoSources:t.filter(d=>d.kind==="videoinput")})})}render(){this.webcamActive||this.start();const t=this.getPluginState();return!t.cameraReady||!t.hasCamera?S(j1,{icon:Gp,i18n:this.i18n,hasCamera:t.hasCamera}):S(x1,{...t,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:O1(),recording:t.isRecording,mirror:j(this,za),src:this.stream})}install(){var i;const{mobileNativeCamera:t,modes:d,videoConstraints:n}=this.opts,{target:a}=this.opts;if(t&&a){(i=this.getTargetPlugin(a))==null||i.setOptions({showNativeVideoCameraButton:Wm(d,"video-only")||Wm(d,"video-audio"),showNativePhotoCameraButton:Wm(d,"picture"),nativeCameraFacingMode:n==null?void 0:n.facingMode});return}this.setPluginState({cameraReady:!1,recordingLengthSeconds:0}),a&&this.mount(a,this),this.mediaDevices&&(this.updateVideoSources(),this.mediaDevices.ondevicechange=()=>{if(this.updateVideoSources(),this.stream){let s=!0;const{videoSources:c,currentDeviceId:F}=this.getPluginState();c.forEach(h=>{F===h.deviceId&&(s=!1)}),s&&(this.stop(),this.start())}})}uninstall(){this.stop(),this.unmount()}onUnmount(){this.stop()}}za=new WeakMap,E(yp,"VERSION",k1.version);const P1={version:"5.1.0"},A1={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 _1({onDiscard:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--discard",type:"button",title:l("discardMediaFile"),"aria-label":l("discardMediaFile"),onClick:e,"data-uppy-super-focusable":!0,children:S("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:[S("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),S("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}function q1({recording:e,onStartRecording:l,onStopRecording:t,i18n:d}){return e?S("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video uppy-ScreenCapture-button--stop-rec",type:"button",title:d("stopCapturing"),"aria-label":d("stopCapturing"),onClick:t,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:S("rect",{x:"15",y:"15",width:"70",height:"70"})})}):S("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video",type:"button",title:d("startCapturing"),"aria-label":d("startCapturing"),onClick:l,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:S("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"})})})}function $1({onScreenshot:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--screenshot",type:"button",title:l("takeScreenshot"),"aria-label":l("takeScreenshot"),onClick:e,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:[S("path",{d:"M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z"}),S("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"})]})})}function lk(e){return(e-(e%=60))/60+(e>9?":":":0")+e}class tk extends se{constructor(t){super(t);E(this,"wrapperStyle",{width:"100%",height:"100%",display:"flex"});E(this,"overlayStyle",{position:"absolute",width:"100%",height:"100%",background:"black",opacity:.7});E(this,"infoContainerStyle",{marginLeft:"auto",marginRight:"auto",marginTop:"auto",marginBottom:"auto",zIndex:1,color:"white"});E(this,"infotextStyle",{marginLeft:"auto",marginRight:"auto",marginBottom:"1rem",fontSize:"1.5rem"});E(this,"timeStyle",{display:"block",fontWeight:"bold",marginLeft:"auto",marginRight:"auto",fontSize:"3rem",fontFamily:"Courier New"});E(this,"timerRunning",!1);E(this,"timer");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(t=>({elapsedTime:t.elapsedTime+1})),this.timerTick()},1e3)}render(){const{recording:t,i18n:d}={...this.props},{elapsedTime:n}=this.state,a=lk(n);return t&&!this.timerRunning&&this.startTimer(),!t&&this.timerRunning&&this.resetTimer(),t?S("div",{style:this.wrapperStyle,children:[S("div",{style:this.overlayStyle}),S("div",{style:this.infoContainerStyle,children:[S("div",{style:this.infotextStyle,children:d("recording")}),S("div",{style:this.timeStyle,children:a})]})]}):null}}function ek({streamActive:e,i18n:l}){return e?S("div",{title:l("streamActive"),className:"uppy-ScreenCapture-icon--stream uppy-ScreenCapture-icon--streamActive",children:S("svg",{"aria-hidden":"true",focusable:"false",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),S("path",{d:"M0 0h24v24H0z",fill:"none"}),S("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"})]})}):S("div",{title:l("streamPassive"),className:"uppy-ScreenCapture-icon--stream",children:S("svg",{"aria-hidden":"true",focusable:"false",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0z",opacity:".1",fill:"none"}),S("path",{d:"M0 0h24v24H0z",fill:"none"}),S("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"})]})})}function dk({recording:e,recordedVideo:l,onSubmit:t,capturedScreenshotUrl:d,i18n:n}){return(l||d)&&!e?S("button",{className:"uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--submit",type:"button",title:n("submitRecordedFile"),"aria-label":n("submitRecordedFile"),onClick:t,"data-uppy-super-focusable":!0,children:S("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:S("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})}):null}class nk extends se{constructor(){super(...arguments);E(this,"videoElement",null)}componentWillUnmount(){const{onStop:t}=this.props;t()}render(){const{recording:t,stream:d,recordedVideo:n,enableScreenshots:a,capturedScreenshotUrl:i}=this.props,s={playsinline:!0};return(t||!n&&!t)&&(s.muted=!0,s.autoplay=!0,s.srcObject=d),n&&!t&&(s.muted=!1,s.controls=!0,s.src=n,this.videoElement&&(this.videoElement.srcObject=null)),S("div",{className:"uppy uppy-ScreenCapture-container",children:[S("div",{className:"uppy-ScreenCapture-mediaContainer",children:[S(ek,{...this.props}),i&&!t&&!n?S("div",{className:"uppy-ScreenCapture-imageContainer",children:S("img",{src:i,className:"uppy-ScreenCapture-media",alt:"screenshotPreview"})}):S("video",{ref:c=>{this.videoElement=c},className:"uppy-ScreenCapture-media",...s}),S("div",{children:S(tk,{...this.props})})]}),S("div",{className:"uppy-ScreenCapture-buttonContainer",children:n||i?S(Pe,{children:[S(dk,{...this.props}),S(_1,{...this.props})]}):S(Pe,{children:[a&&!t&&S($1,{...this.props}),S(q1,{...this.props})]})})]})}}function ak(){return S("svg",{className:"uppy-DashboardTab-iconScreenRec","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:S("g",{fill:"currentcolor",fillRule:"evenodd",children:[S("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"}),S("circle",{cx:"16",cy:"16",r:"2"})]})})}function ik(){var e;return window.MediaRecorder&&((e=navigator.mediaDevices)==null?void 0:e.getDisplayMedia)}function sk(){return window.MediaRecorder&&navigator.mediaDevices}const ck=["image/png","image/jpeg","image/webp"],Uk={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};class Bp extends Ln{constructor(t,d){super(t,{...Uk,...d});E(this,"mediaDevices");E(this,"protocol");E(this,"icon");E(this,"streamInterrupted");E(this,"captureActive");E(this,"capturedMediaFile");E(this,"videoStream",null);E(this,"audioStream",null);E(this,"userDenied",!1);E(this,"recorder",null);E(this,"outputStream",null);E(this,"recordingChunks",null);this.mediaDevices=sk(),this.protocol=location.protocol==="https:"?"https":"http",this.id=this.opts.id||"ScreenCapture",this.type="acquirer",this.icon=ak,this.defaultLocale=A1,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(!ik())return this.uppy.log("Screen recorder access is not supported","warning"),null;this.setPluginState({streamActive:!1,audioStreamActive:!1,status:"init"});const{target:t}=this.opts;t&&this.mount(t,this)}uninstall(){this.videoStream&&this.stop(),this.unmount()}start(){return this.mediaDevices?(this.captureActive=!0,this.selectAudioStreamSource(),this.selectVideoStreamSource().then(t=>{var d;t===!1&&(d=this.parent)!=null&&d.hideAllPanels&&(this.parent.hideAllPanels(),this.captureActive=!1)})):Promise.reject(new Error("Screen recorder access not supported"))}selectVideoStreamSource(){return this.videoStream?new Promise(t=>t(this.videoStream)):this.mediaDevices.getDisplayMedia(this.opts.displayMediaConstraints).then(t=>(this.videoStream=t,this.videoStream.addEventListener("inactive",()=>{this.streamInactivated()}),this.setPluginState({streamActive:!0,status:"ready",screenRecError:null}),t)).catch(t=>(this.setPluginState({screenRecError:t,status:"error"}),this.userDenied=!0,setTimeout(()=>{this.userDenied=!1},1e3),!1))}selectAudioStreamSource(){return this.audioStream?new Promise(t=>t(this.audioStream)):this.mediaDevices.getUserMedia(this.opts.userMediaConstraints).then(t=>(this.audioStream=t,this.setPluginState({audioStreamActive:!0}),t)).catch(t=>(t.name==="NotAllowedError"&&(this.uppy.info(this.i18n("micDisabled"),"error",5e3),this.uppy.log(this.i18n("micDisabled"),"warning")),!1))}startRecording(){const t={};this.capturedMediaFile=null,this.recordingChunks=[];const{preferredVideoMimeType:d}=this.opts;this.selectVideoStreamSource().then(n=>{if(n===!1)throw new Error("No video stream available");d&&MediaRecorder.isTypeSupported(d)&&wa(d)&&(t.mimeType=d);const a=[n.getVideoTracks()[0]];this.audioStream&&a.push(this.audioStream.getAudioTracks()[0]),this.outputStream=new MediaStream(a),this.recorder=new MediaRecorder(this.outputStream,t),this.recorder.addEventListener("dataavailable",i=>{this.recordingChunks.push(i.data)}),this.recorder.start(),this.setPluginState({recording:!0,status:"recording"})}).catch(n=>{this.uppy.log(n,"error"),this.setPluginState({screenRecError:n,status:"error"})})}streamInactivated(){var n;const{recordedVideo:t,recording:d}={...this.getPluginState()};!t&&!d?((n=this.parent)!=null&&n.hideAllPanels&&this.parent.hideAllPanels(),this.setPluginState({status:"init"})):d&&(this.uppy.log("Capture stream inactive — stop recording"),this.stopRecording()),this.videoStream=null,this.audioStream=null,this.setPluginState({streamActive:!1,audioStreamActive:!1})}stopRecording(){return new Promise(d=>{this.recorder.addEventListener("stop",()=>{d()}),this.recorder.stop()}).then(()=>(this.setPluginState({recording:!1}),this.getVideo())).then(d=>{this.capturedMediaFile=d,this.setPluginState({recordedVideo:URL.createObjectURL(d.data),status:"captured"})}).then(()=>{this.recordingChunks=null,this.recorder=null},d=>{throw this.recordingChunks=null,this.recorder=null,d})}discardRecordedMedia(){const{capturedScreenshotUrl:t,recordedVideo:d}=this.getPluginState();t&&URL.revokeObjectURL(t),d&&URL.revokeObjectURL(d),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(t){t.isRestriction||this.uppy.log(t,"warning")}}stop(){this.videoStream&&(this.videoStream.getVideoTracks().forEach(n=>{n.stop()}),this.videoStream.getAudioTracks().forEach(n=>{n.stop()}),this.videoStream=null),this.audioStream&&(this.audioStream.getAudioTracks().forEach(n=>{n.stop()}),this.audioStream.getVideoTracks().forEach(n=>{n.stop()}),this.audioStream=null),this.outputStream&&(this.outputStream.getAudioTracks().forEach(n=>{n.stop()}),this.outputStream.getVideoTracks().forEach(n=>{n.stop()}),this.outputStream=null);const{capturedScreenshotUrl:t,recordedVideo:d}=this.getPluginState();t&&URL.revokeObjectURL(t),d&&URL.revokeObjectURL(d),this.setPluginState({recording:!1,streamActive:!1,audioStreamActive:!1,recordedVideo:null,capturedScreenshotUrl:null,status:"init"}),this.captureActive=!1}getVideo(){const t=this.recordingChunks[0].type,d=wa(t);if(!d)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${t}"`));const n=`screencap-${Date.now()}.${d}`,a=new Blob(this.recordingChunks,{type:t}),i={source:this.id,name:n,data:new Blob([a],{type:t}),type:t};return Promise.resolve(i)}async captureScreenshot(){var t;if(!((t=this.mediaDevices)!=null&&t.getDisplayMedia))throw new Error("Screen capture is not supported");try{let d=this.videoStream;if(!d){const F=await this.selectVideoStreamSource();if(!F)throw new Error("Failed to get screen capture stream");d=F}const n=document.createElement("video");n.srcObject=d,await new Promise(F=>{n.onloadedmetadata=()=>{n.play(),F(null)}});const a=document.createElement("canvas");a.width=n.videoWidth,a.height=n.videoHeight;const i=a.getContext("2d");if(!i)throw new Error("Failed to get canvas context");i.drawImage(n,0,0,a.width,a.height);let s=this.opts.preferredImageMimeType;(!s||!ck.includes(s))&&(this.uppy.log(`Unsupported image type "${s}", falling back to image/png`,"warning"),s="image/png");const c=1;return new Promise((F,h)=>{a.toBlob(o=>{if(!o){h(new Error("Failed to create screenshot blob"));return}const V=wa(s)||"png",W={source:this.id,name:`Screenshot ${new Date().toISOString()}.${V}`,type:s,data:o};try{this.capturedMediaFile=W;const Q=URL.createObjectURL(o);this.setPluginState({capturedScreenshotUrl:Q,status:"captured"}),F()}catch(Q){this.getPluginState().capturedScreenshotUrl&&this.setPluginState({capturedScreenshotUrl:null}),Q.isRestriction||this.uppy.log(Q,"error"),h(Q)}finally{n.srcObject=null,a.remove(),n.remove()}},s,c)})}catch(d){throw this.uppy.log(d,"error"),d}}render(){const t=this.getPluginState();return!t.streamActive&&!this.captureActive&&!this.userDenied&&this.start(),S(nk,{...t,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})}}E(Bp,"VERSION",P1.version);const Zk={version:"3.1.0"},Fk={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"}},hk=e=>{const{icon:l,hasAudio:t,i18n:d}=e;return S("div",{className:"uppy-Audio-permissons",children:[S("div",{className:"uppy-Audio-permissonsIcon",children:l()}),S("div",{className:"uppy-Audio-title",children:d(t?"allowAudioAccessTitle":"noAudioTitle")}),S("p",{children:d(t?"allowAudioAccessDescription":"noAudioDescription")})]})},ok=({currentDeviceId:e,audioSources:l,onChangeSource:t})=>S("div",{className:"uppy-Audio-videoSource",children:S("select",{className:"uppy-u-reset uppy-Audio-audioSource-select",onChange:d=>{t(d.target.value)},children:l.map(d=>S("option",{value:d.deviceId,selected:d.deviceId===e,children:d.label},d.deviceId))})});function Yp(e){return typeof e=="function"}function fU(e){return Yp(e)?e():e}class Vk{constructor(l,t={}){E(this,"canvas");E(this,"canvasContext");E(this,"width");E(this,"height");E(this,"analyser");E(this,"bufferLength");E(this,"dataArray");E(this,"onDrawFrame");E(this,"streamSource");E(this,"audioContext");E(this,"source");dl(this,$W,()=>this.draw());const d=t.canvas||{},n=t.canvasContext||{};this.analyser=null,this.bufferLength=0,this.canvas=l,this.width=fU(d.width)||this.canvas.width,this.height=fU(d.height)||this.canvas.height,this.canvas.width=this.width,this.canvas.height=this.height,this.canvasContext=this.canvas.getContext("2d"),this.canvasContext.fillStyle=fU(n.fillStyle)||"rgb(255, 255, 255)",this.canvasContext.strokeStyle=fU(n.strokeStyle)||"rgb(0, 0, 0)",this.canvasContext.lineWidth=fU(n.lineWidth)||1,this.onDrawFrame=Yp(t.onDrawFrame)?t.onDrawFrame:()=>{}}addSource(l){this.streamSource=l,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(){const{analyser:l,dataArray:t,bufferLength:d}=this,n=this.canvasContext,a=this.width,i=this.height;l&&l.getByteTimeDomainData(t),n.fillRect(0,0,a,i),n.beginPath();const s=a*1/d;let c=0;d||n.moveTo(0,this.height/2);for(let F=0;F<d;F++){const o=t[F]/128*(i/2);F===0?n.moveTo(c,o):n.lineTo(c,o),c+=s}n.lineTo(a,i/2),n.stroke(),this.onDrawFrame(this),requestAnimationFrame(j(this,$W))}}$W=new WeakMap;function Wk({onDiscard:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button",type:"button",title:l("discardRecordedFile"),"aria-label":l("discardRecordedFile"),onClick:e,"data-uppy-super-focusable":!0,children:S("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:S("g",{fill:"#FFF",fillRule:"evenodd",children:[S("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),S("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"})]})})})}function Qk({recording:e,onStartRecording:l,onStopRecording:t,i18n:d}){return e?S("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button",type:"button",title:d("stopAudioRecording"),"aria-label":d("stopAudioRecording"),onClick:t,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100",children:S("rect",{x:"15",y:"15",width:"70",height:"70"})})}):S("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button",type:"button",title:d("startAudioRecording"),"aria-label":d("startAudioRecording"),onClick:l,"data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14px",height:"20px",viewBox:"0 0 14 20",children:S("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"})})})}function mk(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`}function Rk({recordingLengthSeconds:e}){const l=mk(e);return S("span",{children:l})}function Nk({onSubmit:e,i18n:l}){return S("button",{className:"uppy-u-reset uppy-c-btn uppy-Audio-button uppy-Audio-button--submit",type:"button",title:l("submitRecordedFile"),"aria-label":l("submitRecordedFile"),onClick:e,"data-uppy-super-focusable":!0,children:S("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:S("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})})})}function bk(e){const{stream:l,recordedAudio:t,onStop:d,recording:n,supportsRecording:a,audioSources:i,showAudioSourceDropdown:s,onSubmit:c,i18n:F,onStartRecording:h,onStopRecording:o,onDiscardRecordedAudio:V,recordingLengthSeconds:W}=e,Q=zn(null),m=zn();Qs(()=>()=>{m.current=null,d()},[d]),Qs(()=>{if(!t&&(m.current=new Vk(Q.current,{canvas:{width:600,height:600},canvasContext:{lineWidth:2,fillStyle:"rgb(0,0,0)",strokeStyle:"green"}}),m.current.draw(),l)){const J=new AudioContext().createMediaStreamSource(l);m.current.addSource(J)}},[t,l]);const R=t!=null,r=!R&&a,b=s&&!R&&i&&i.length>1;return S("div",{className:"uppy-Audio-container",children:[S("div",{className:"uppy-Audio-audioContainer",children:R?S("audio",{className:"uppy-Audio-player",controls:!0,src:t}):S("canvas",{ref:Q,className:"uppy-Audio-canvas"})}),S("div",{className:"uppy-Audio-footer",children:[S("div",{className:"uppy-Audio-audioSourceContainer",children:b?ok(e):null}),S("div",{className:"uppy-Audio-buttonContainer",children:[r&&S(Qk,{recording:n,onStartRecording:h,onStopRecording:o,i18n:F}),R&&S(Nk,{onSubmit:c,i18n:F}),R&&S(Wk,{onDiscard:V,i18n:F})]}),S("div",{className:"uppy-Audio-recordingLength",children:!R&&S(Rk,{recordingLengthSeconds:W})})]})]})}function uk(){var e;return typeof MediaRecorder=="function"&&typeof((e=MediaRecorder.prototype)==null?void 0:e.start)=="function"}class kp extends Ln{constructor(t,d){super(t,d);dl(this,rU);dl(this,bU);E(this,"icon");dl(this,Vd,null);dl(this,uU,!1);dl(this,Re,null);dl(this,Ne,null);dl(this,ss,null);dl(this,Wd);dl(this,w0);dl(this,pU,t=>{if(!j(this,w0))return Promise.reject(new Error("Microphone access not supported"));Fl(this,uU,!0),cl(this,rU,Zy).call(this).then(d=>(this.setPluginState({hasAudio:d}),j(this,Wd).getUserMedia({audio:!0}).then(n=>{Fl(this,Vd,n);let a=null;const i=n.getAudioTracks();t!=null&&t.deviceId?a=i.findLast(s=>s.getSettings().deviceId===t.deviceId):a=i[0].getSettings().deviceId,j(this,MU).call(this),this.setPluginState({currentDeviceId:a,audioReady:!0})}).catch(n=>{this.setPluginState({audioReady:!1,cameraError:n}),this.uppy.info(n.message,"error")})))});dl(this,lQ,()=>{Fl(this,Ne,new MediaRecorder(j(this,Vd))),Fl(this,Re,[]);let t=!1;j(this,Ne).addEventListener("dataavailable",d=>{j(this,Re).push(d.data);const{restrictions:n}=this.uppy.opts;if(j(this,Re).length>1&&n.maxFileSize!=null&&!t){const a=j(this,Re).reduce((F,h)=>F+h.size,0),s=(a-j(this,Re)[0].size)/(j(this,Re).length-1)*3,c=Math.max(0,n.maxFileSize-s);a>c&&(t=!0,this.uppy.info(this.i18n("recordingStoppedMaxSize"),"warning",4e3),j(this,E0).call(this))}}),j(this,Ne).start(500),Fl(this,bU,setInterval(()=>{const d=this.getPluginState().recordingLengthSeconds;this.setPluginState({recordingLengthSeconds:d+1})},1e3)),this.setPluginState({isRecording:!0})});dl(this,E0,()=>new Promise(d=>{j(this,Ne).addEventListener("stop",()=>{d()}),j(this,Ne).stop(),clearInterval(j(this,bU)),this.setPluginState({recordingLengthSeconds:0})}).then(()=>(this.setPluginState({isRecording:!1}),cl(this,rU,Fy).call(this))).then(d=>{try{Fl(this,ss,d),this.setPluginState({recordedAudio:URL.createObjectURL(d.data)})}catch(n){n.isRestriction||this.uppy.log(n)}}).then(()=>{Fl(this,Re,null),Fl(this,Ne,null)},d=>{throw Fl(this,Re,null),Fl(this,Ne,null),d}));dl(this,tQ,()=>{this.setPluginState({recordedAudio:null}),Fl(this,ss,null)});dl(this,eQ,()=>{try{j(this,ss)&&this.uppy.addFile(j(this,ss))}catch(t){t.isRestriction||this.uppy.log(t,"warning")}});dl(this,cs,async()=>{j(this,Vd)&&j(this,Vd).getAudioTracks().forEach(d=>d.stop()),j(this,Ne)&&await new Promise(t=>{j(this,Ne).addEventListener("stop",t,{once:!0}),j(this,Ne).stop(),clearInterval(j(this,bU))}),Fl(this,Re,null),Fl(this,Ne,null),Fl(this,uU,!1),Fl(this,Vd,null),this.setPluginState({recordedAudio:null,isRecording:!1,recordingLengthSeconds:0})});dl(this,dQ,t=>{j(this,cs).call(this),j(this,pU).call(this,{deviceId:t})});dl(this,MU,()=>{j(this,Wd).enumerateDevices().then(t=>{this.setPluginState({audioSources:t.filter(d=>d.kind==="audioinput")})})});Fl(this,Wd,navigator.mediaDevices),Fl(this,w0,j(this,Wd)!=null),this.id=this.opts.id||"Audio",this.type="acquirer",this.icon=()=>S("svg",{className:"uppy-DashboardTab-iconAudio","aria-hidden":"true",focusable:"false",width:"32px",height:"32px",viewBox:"0 0 32 32",children:S("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=Fk,this.opts={...d},this.i18nInit(),this.title=this.i18n("pluginNameAudio"),this.setPluginState({hasAudio:!1,audioReady:!1,cameraError:null,recordingLengthSeconds:0,audioSources:[],currentDeviceId:null})}render(){j(this,uU)||j(this,pU).call(this);const t=this.getPluginState();return!t.audioReady||!t.hasAudio?S(hk,{icon:this.icon,i18n:this.i18n,hasAudio:t.hasAudio}):S(bk,{...t,onChangeSource:j(this,dQ),onStartRecording:j(this,lQ),onStopRecording:j(this,E0),onDiscardRecordedAudio:j(this,tQ),onSubmit:j(this,eQ),onStop:j(this,cs),i18n:this.i18n,showAudioSourceDropdown:this.opts.showAudioSourceDropdown,supportsRecording:uk(),recording:t.isRecording,stream:j(this,Vd)})}install(){this.setPluginState({audioReady:!1,recordingLengthSeconds:0});const{target:t}=this.opts;t&&this.mount(t,this),j(this,Wd)&&(j(this,MU).call(this),j(this,Wd).ondevicechange=()=>{if(j(this,MU).call(this),j(this,Vd)){let d=!0;const{audioSources:n,currentDeviceId:a}=this.getPluginState();n.forEach(i=>{a===i.deviceId&&(d=!1)}),d&&(j(this,cs).call(this),j(this,pU).call(this))}})}uninstall(){j(this,Vd)&&j(this,cs).call(this),this.unmount()}}bU=new WeakMap,Vd=new WeakMap,uU=new WeakMap,Re=new WeakMap,Ne=new WeakMap,ss=new WeakMap,Wd=new WeakMap,w0=new WeakMap,rU=new WeakSet,Zy=function(){return j(this,Wd)?j(this,Wd).enumerateDevices().then(t=>t.some(d=>d.kind==="audioinput")):Promise.resolve(!1)},pU=new WeakMap,lQ=new WeakMap,E0=new WeakMap,tQ=new WeakMap,eQ=new WeakMap,cs=new WeakMap,Fy=function(){const t=j(this,Re).find(s=>{var c;return((c=s.type)==null?void 0:c.length)>0}).type,d=wa(t);if(!d)return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type "${t}"`));const n=`audio-${Date.now()}.${d}`,a=new Blob(j(this,Re),{type:t}),i={source:this.id,name:n,data:new Blob([a],{type:t}),type:t};return Promise.resolve(i)},dQ=new WeakMap,MU=new WeakMap,E(kp,"VERSION",Zk.version);const rk={pluralize(){return 0},strings:{addBulkFilesFailed:{0:"因内部错误,添加 %{smart_count} 个文件失败",1:"因内部错误,添加 %{smart_count} 个文件失败"},addedNumFiles:"已添加 %{numFiles} 个文件",addingMoreFiles:"正在添加更多文件",additionalRestrictionsFailed:"%{count} 个附加限制未满足",addMore:"添加更多",addMoreFiles:"添加更多文件",aggregateExceedsSize:"您选择的文件总大小为 %{size},但允许的最大总大小为 %{sizeAllowed}",allFilesFromFolderNamed:"来自文件夹 %{name} 的所有文件",allowAccessDescription:"请允许本站访问您的摄像头,以便拍照或录制视频。",allowAccessTitle:"请允许访问您的摄像头",allowAudioAccessDescription:"请允许本站访问您的麦克风,以便录制音频。",allowAudioAccessTitle:"请允许访问您的麦克风",aspectRatioLandscape:"裁剪为横向 (16:9)",aspectRatioPortrait:"裁剪为纵向 (9:16)",aspectRatioSquare:"裁剪为方形",authAborted:"身份验证已中止",authenticate:"连接",authenticateWith:"连接到 %{pluginName}",authenticateWithTitle:"请通过 %{pluginName} 验证以选择文件",back:"返回",browse:"浏览",browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancel:"取消",cancelUpload:"取消上传",closeModal:"关闭窗口",companionError:"与 Companion 连接失败",companionUnauthorizeHint:"要取消对 %{provider} 帐户的授权,请访问 %{url}",complete:"完成",compressedX:"通过压缩图像节省了 %{size}",compressingImages:"正在压缩图像...",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"请复制下方的 URL",copyLinkToClipboardSuccess:"链接已复制到剪贴板。",creatingAssembly:"正在准备上传...",creatingAssemblyFailed:"Transloadit: 无法创建程序集",dashboardTitle:"Uppy 仪表盘",dashboardWindowTitle:"Uppy 仪表盘窗口 (按 ESC 键关闭)",dataUploadedOfTotal:"%{complete} / %{total}",dataUploadedOfUnknown:"已上传 %{complete}",discardMediaFile:"丢弃媒体文件",discardRecordedFile:"丢弃录制的文件",done:"完成",dropHereOr:"拖放到此处,或%{browse}",dropHint:"将文件拖放到此处",dropPasteBoth:"拖放粘贴文件或文件夹到此处,或者%{browseFiles} / %{browseFolders}",dropPasteFiles:"拖放粘贴文件到此处,或者%{browseFiles}",dropPasteFolders:"拖放粘贴文件到此处,或者%{browseFolders}",dropPasteImportBoth:"拖放粘贴文件到此处,%{browseFiles},%{browseFolders}或从以下位置导入:",dropPasteImportFiles:"拖放粘贴文件到此处,%{browseFiles}或从以下位置导入:",dropPasteImportFolders:"拖放粘贴文件到此处,%{browseFolders}或从以下位置导入:",editFile:"编辑文件",editFileWithFilename:"编辑文件 %{file}",editImage:"编辑图像",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加任何文件",encoding:"正在编码...",enterCorrectUrl:"URL 不正确:请输入文件的直接链接",enterTextToSearch:"输入文本以搜索图像",enterUrlToImport:"输入 URL 以导入文件",error:"错误",exceedsSize:"%{file} 超出了 %{size} 的最大允许大小",failedToFetch:"Companion 无法抓取此 URL,请确保它是正确的",failedToUpload:"上传 %{file} 失败",filesUploadedOfTotal:{0:"%{smart_count} 个文件已上传 %{complete} 个",1:"%{smart_count} 个文件已上传 %{complete} 个"},filter:"筛选",finishEditingFile:"完成文件编辑",flipHorizontal:"水平翻转",folderAdded:{0:"从 %{folder} 添加了 %{smart_count} 个文件",1:"从 %{folder} 添加了 %{smart_count} 个文件"},folderAlreadyAdded:'文件夹 "%{folder}" 已添加',generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",inferiorSize:"此文件小于 %{size} 的最小允许大小",loadedXFiles:"已加载 %{numFiles} 个文件",loading:"加载中...",logIn:"登录",logOut:"登出",micDisabled:"用户已拒绝麦克风访问",missingRequiredMetaField:"缺少必需的元数据字段",missingRequiredMetaFieldOnFile:"%{fileName} 缺少必需的元数据字段",missingRequiredMetaFields:{0:"缺少必需的元数据字段: %{fields}。",1:"缺少必需的元数据字段: %{fields}。"},myDevice:"我的设备",noAudioDescription:"请连接麦克风或其他音频输入设备,以便录制音频",noAudioTitle:"麦克风不可用",noCameraDescription:"请连接摄像头设备,以便拍照或录制视频",noCameraTitle:"摄像头不可用",noDuplicates:"无法添加重复文件“%{fileName}”,该文件已存在",noFilesFound:"此处没有文件或文件夹",noInternetConnection:"无网络连接",noMoreFilesAllowed:"无法添加更多文件",noSearchResults:"抱歉,没有找到相关结果",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",paused:"已暂停",pauseUpload:"暂停上传",pickFiles:"选择文件",pickPhotos:"选择照片",pleaseWait:"请稍候",pluginNameAudio:"音频",pluginNameBox:"Box",pluginNameCamera:"摄像头",pluginNameDropbox:"Dropbox",pluginNameFacebook:"Facebook",pluginNameGoogleDrive:"Google Drive",pluginNameGoogleDrivePicker:"Google Drive",pluginNameGooglePhotosPicker:"Google Photos",pluginNameInstagram:"Instagram",pluginNameOneDrive:"OneDrive",pluginNameScreenCapture:"屏幕录制",pluginNameUnsplash:"Unsplash",pluginNameUrl:"链接",pluginNameWebdav:"WebDAV",pluginNameZoom:"Zoom",pluginWebdavInputLabel:"文件的 WebDAV URL (例如来自 ownCloud 或 Nextcloud)",poweredBy:"由 %{uppy} 驱动",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",recordingLength:"录制时长 %{recording_length}",recordingStoppedMaxSize:"录制已停止,因为文件大小即将超出限制",recordVideoBtn:"录制视频",recoveredAllFiles:"已恢复所有文件。您现在可以继续上传。",recoveredXFiles:{0:"无法完全恢复 1 个文件。请重新选择并继续上传。",1:"无法完全恢复 %{smart_count} 个文件。请重新选择并继续上传。"},removeFile:"移除文件",reSelect:"重新选择",resetFilter:"重置筛选",resetSearch:"重置搜索",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",revert:"重置",rotate:"旋转 90°",save:"保存",saveChanges:"保存更改",search:"搜索",searchImages:"搜索图像",selectX:{0:"选择 %{smart_count} 项",1:"选择 %{smart_count} 项"},sessionRestored:"会话已恢复",showErrorDetails:"显示错误详情",signInWithGoogle:"使用 Google 登录",smile:"笑一笑!",startAudioRecording:"开始音频录制",startCapturing:"开始屏幕录制",startRecording:"开始视频录制",stopAudioRecording:"停止音频录制",stopCapturing:"停止屏幕录制",stopRecording:"停止视频录制",streamActive:"直播流活跃",streamPassive:"直播流空闲",submitRecordedFile:"提交录制的文件",takePicture:"拍照",takePictureBtn:"拍照",takeScreenshot:"截屏",unnamed:"未命名",upload:"上传",uploadComplete:"上传完成",uploadFailed:"上传失败",uploading:"上传中",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},uploadPaused:"上传已暂停",uploadStalled:"上传在 %{seconds} 秒内无任何进展。您可能需要重试。",uploadXFiles:{0:"上传 %{smart_count} 个文件",1:"上传 %{smart_count} 个文件"},uploadXNewFiles:{0:"上传 +%{smart_count} 个文件",1:"上传 +%{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传以下类型:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少要选择 %{smart_count} 个文件",1:"您至少要选择 %{smart_count} 个文件"},zoomIn:"放大",zoomOut:"缩小"}};var Qm={exports:{}};/*!
18
18
  Copyright (c) 2018 Jed Watson.
19
19
  Licensed under the MIT License (MIT), see
20
20
  http://jedwatson.github.io/classnames
@@ -23,7 +23,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${l.byteLength}`),l.tiff&&
23
23
 
24
24
  ${t.details}`),children:"?"})]})},t.message))})})}}function L5({activePickerPanel:e,className:l,hideAllPanels:t,i18n:d,state:n,uppy:a}){const i=zn(null);return S("div",{className:_e("uppy-DashboardContent-panel",l),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${e.id}`,onDragOver:In,onDragLeave:In,onDrop:In,onPaste:In,children:[S("div",{className:"uppy-DashboardContent-bar",children:[S("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:d("importFrom",{name:e.name})}),S("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:d("cancel")})]}),S("div",{ref:i,className:"uppy-DashboardContent-panelBody",children:a.getPlugin(e.id).render(n,i.current)})]})}const md={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function I5(e,l,t,d={}){if(e)return md.STATE_ERROR;if(l)return md.STATE_COMPLETE;if(t)return md.STATE_PAUSED;let n=md.STATE_WAITING;const a=Object.keys(d);for(let i=0;i<a.length;i++){const{progress:s}=d[a[i]];if(s.uploadStarted&&!s.uploadComplete)return md.STATE_UPLOADING;s.preprocess&&n!==md.STATE_UPLOADING&&(n=md.STATE_PREPROCESSING),s.postprocess&&n!==md.STATE_UPLOADING&&n!==md.STATE_PREPROCESSING&&(n=md.STATE_POSTPROCESSING)}return n}function D5({files:e,i18n:l,isAllComplete:t,isAllErrored:d,isAllPaused:n,inProgressNotPausedFiles:a,newFiles:i,processingFiles:s}){switch(I5(d,t,n,e)){case"uploading":return l("uploadingXFiles",{smart_count:a.length});case"preprocessing":case"postprocessing":return l("processingXFiles",{smart_count:s.length});case"paused":return l("uploadPaused");case"waiting":return l("xFilesSelected",{smart_count:i.length});case"complete":return l("uploadComplete");case"error":return l("error")}}function w5(e){const{i18n:l,isAllComplete:t,hideCancelButton:d,maxNumberOfFiles:n,toggleAddFilesPanel:a,uppy:i}=e;let{allowNewUpload:s}=e;return s&&n&&(s=e.totalFileCount<e.maxNumberOfFiles),S("div",{className:"uppy-DashboardContent-bar",children:[!t&&!d?S("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>i.cancelAll(),children:l("cancel")}):S("div",{}),S("div",{className:"uppy-DashboardContent-title",children:S(D5,{...e})}),s?S("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":l("addMoreFiles"),title:l("addMoreFiles"),onClick:()=>a(!0),children:[S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15",children:S("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"})}),S("span",{className:"uppy-DashboardContent-addMoreCaption",children:l("addMore")})]}):S("div",{})]})}const Ss="uppy-transition-slideDownUp",s2=250;function Qh({children:e}){const[l,t]=Ws(null),[d,n]=Ws(""),a=zn(),i=zn(),s=zn(),c=q0(()=>{n(`${Ss}-enter`),cancelAnimationFrame(s.current),clearTimeout(i.current),i.current=void 0,s.current=requestAnimationFrame(()=>{n(`${Ss}-enter ${Ss}-enter-active`),a.current=setTimeout(()=>{n("")},s2)})},[]),F=q0(()=>{n(`${Ss}-leave`),cancelAnimationFrame(s.current),clearTimeout(a.current),a.current=void 0,s.current=requestAnimationFrame(()=>{n(`${Ss}-leave ${Ss}-leave-active`),i.current=setTimeout(()=>{t(null),n("")},s2)})},[]);return Qs(()=>{const h=kn(e)[0];l!==h&&(h&&!l?c():l&&!h&&!i.current&&F(),t(h))},[e,l,c,F]),Qs(()=>()=>{clearTimeout(a.current),clearTimeout(i.current),cancelAnimationFrame(s.current)},[]),l?tr(l,{className:_e(d,l.props.className)}):null}const Rd={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"},E5="·",c2=()=>` ${E5} `;function C5(e){const{newFiles:l,isUploadStarted:t,recoveredState:d,i18n:n,uploadState:a,isSomeGhost:i,startUpload:s}=e,c=_e("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":a===Rd.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":i}),F=l&&t&&!d?n("uploadXNewFiles",{smart_count:l}):n("uploadXFiles",{smart_count:l});return S("button",{type:"button",className:c,"aria-label":n("uploadXFiles",{smart_count:l}),onClick:s,disabled:i,"data-uppy-super-focusable":!0,children:F})}function x5(e){const{i18n:l,uppy:t}=e;return S("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":l("retryUpload"),onClick:()=>t.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:S("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"})}),l("retry")]})}function g5(e){const{i18n:l,uppy:t}=e;return S("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:l("cancel"),"aria-label":l("cancel"),onClick:()=>t.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:S("g",{fill:"none",fillRule:"evenodd",children:[S("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),S("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"})]})})})}function j5(e){const{isAllPaused:l,i18n:t,isAllComplete:d,resumableUploads:n,uppy:a}=e,i=t(l?"resume":"pause");function s(){if(!d){if(!n){a.cancelAll();return}if(l){a.resumeAll();return}a.pauseAll()}}return S("button",{title:i,"aria-label":i,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:s,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:S("g",{fill:"none",fillRule:"evenodd",children:[S("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),S("path",{fill:"#FFF",d:l?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}function O5(e){const{i18n:l,doneButtonHandler:t}=e;return S("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:l("done")})}function U2(){return S("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:S("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"})})}function v5(e){const{progress:l}=e,{value:t,mode:d,message:n}=l;return S("div",{className:"uppy-StatusBar-content",children:[S(U2,{}),d==="determinate"?`${Math.round(t*100)}% · `:"",n]})}function K5(e){const{numUploads:l,complete:t,totalUploadedSize:d,totalSize:n,totalETA:a,i18n:i}=e,s=l>1,c=xa(d);return S("div",{className:"uppy-StatusBar-statusSecondary",children:[s&&i("filesUploadedOfTotal",{complete:t,smart_count:l}),S("span",{className:"uppy-StatusBar-additionalInfo",children:[s&&c2(),n!=null?i("dataUploadedOfTotal",{complete:c,total:xa(n)}):i("dataUploadedOfUnknown",{complete:c}),c2(),a!=null&&i("xTimeLeft",{time:fy(a)})]})]})}function Z2(e){const{i18n:l,complete:t,numUploads:d}=e;return S("div",{className:"uppy-StatusBar-statusSecondary",children:l("filesUploadedOfTotal",{complete:t,smart_count:d})})}function f5(e){const{i18n:l,newFiles:t,startUpload:d}=e,n=_e("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return S("div",{className:"uppy-StatusBar-statusSecondary",children:[S("div",{className:"uppy-StatusBar-statusSecondaryHint",children:l("xMoreFilesAdded",{smart_count:t})}),S("button",{type:"button",className:n,"aria-label":l("uploadXFiles",{smart_count:t}),onClick:d,children:l("upload")})]})}function H5(e){const{i18n:l,supportsUploadProgress:t,totalProgress:d,hideProgressDetails:n,isUploadStarted:a,isAllComplete:i,isAllPaused:s,newFiles:c,numUploads:F,complete:h,totalUploadedSize:o,totalSize:V,totalETA:W,startUpload:Q}=e,m=c&&a;if(!a||i)return null;const R=l(s?"paused":"uploading");function r(){return!s&&!m&&!n?t?S(K5,{numUploads:F,complete:h,totalUploadedSize:o,totalSize:V,totalETA:W,i18n:l}):S(Z2,{i18n:l,complete:h,numUploads:F}):null}return S("div",{className:"uppy-StatusBar-content",title:R,children:[s?null:S(U2,{}),S("div",{className:"uppy-StatusBar-status",children:[S("div",{className:"uppy-StatusBar-statusPrimary",children:t&&d!==0?`${R}: ${d}%`:R}),r(),m?S(f5,{i18n:l,newFiles:c,startUpload:Q}):null]})]})}function P5(e){const{i18n:l}=e;return S("div",{className:"uppy-StatusBar-content",role:"status",title:l("complete"),children:S("div",{className:"uppy-StatusBar-status",children:S("div",{className:"uppy-StatusBar-statusPrimary",children:[S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:S("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),l("complete")]})})})}function A5(e){const{error:l,i18n:t,complete:d,numUploads:n}=e;function a(){const i=`${t("uploadFailed")}
25
25
 
26
- ${l}`;alert(i)}return S("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:S("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"})}),S("div",{className:"uppy-StatusBar-status",children:[S("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),S("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:a,type:"button",children:"?"})]}),S(Z2,{i18n:t,complete:d,numUploads:n})]})]})}function km(e){const l=[];let t="indeterminate",d;for(const{progress:a}of Object.values(e)){const{preprocess:i,postprocess:s}=a;d==null&&(i||s)&&({mode:t,message:d}=i||s),(i==null?void 0:i.mode)==="determinate"&&l.push(i.value),(s==null?void 0:s.mode)==="determinate"&&l.push(s.value)}const n=l.reduce((a,i)=>a+i/l.length,0);return{mode:t,message:d,value:n}}const{STATE_ERROR:F2,STATE_WAITING:_5,STATE_PREPROCESSING:zm,STATE_UPLOADING:mh,STATE_POSTPROCESSING:Lm,STATE_COMPLETE:Rh}=Rd;function q5({newFiles:e,allowNewUpload:l,isUploadInProgress:t,isAllPaused:d,resumableUploads:n,error:a,hideUploadButton:i=void 0,hidePauseResumeButton:s=!1,hideCancelButton:c=!1,hideRetryButton:F=!1,recoveredState:h,uploadState:o,totalProgress:V,files:W,supportsUploadProgress:Q,hideAfterFinish:m=!1,isSomeGhost:R,doneButtonHandler:r=void 0,isUploadStarted:b,i18n:u,startUpload:J,uppy:G,isAllComplete:T,hideProgressDetails:y=void 0,numUploads:k,complete:X,totalSize:L,totalETA:D,totalUploadedSize:C}){function I(){switch(o){case Lm:case zm:{const tl=km(W);return tl.mode==="determinate"?tl.value*100:V}case F2:return null;case mh:return Q?V:null;default:return V}}function P(){switch(o){case Lm:case zm:{const{mode:tl}=km(W);return tl==="indeterminate"}case mh:return!Q;default:return!1}}const H=I(),Y=H??100,B=!a&&e&&(!t&&!d||h)&&l&&!i,z=!c&&o!==_5&&o!==Rh,g=n&&!s&&o===mh,w=a&&!T&&!F,O=r&&o===Rh,f=_e("uppy-StatusBar-progress",{"is-indeterminate":P()}),x=_e("uppy-StatusBar",`is-${o}`,{"has-ghosts":R}),A=(()=>{switch(o){case zm:case Lm:return S(v5,{progress:km(W)});case Rh:return S(P5,{i18n:u});case F2:return S(A5,{error:a,i18n:u,numUploads:k,complete:X});case mh:return S(H5,{i18n:u,supportsUploadProgress:Q,totalProgress:V,hideProgressDetails:y,isUploadStarted:b,isAllComplete:T,isAllPaused:d,newFiles:e,numUploads:k,complete:X,totalUploadedSize:C,totalSize:L,totalETA:D,startUpload:J});default:return null}})();return!(B||w||g||z||O)&&!A||o===Rh&&m?null:S("div",{className:x,children:[S("div",{className:f,style:{width:`${Y}%`},role:"progressbar","aria-label":`${Y}%`,"aria-valuetext":`${Y}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":H}),A,S("div",{className:"uppy-StatusBar-actions",children:[B?S(C5,{newFiles:e,isUploadStarted:b,recoveredState:h,i18n:u,isSomeGhost:R,startUpload:J,uploadState:o}):null,w?S(x5,{i18n:u,uppy:G}):null,g?S(j5,{isAllPaused:d,i18n:u,isAllComplete:T,resumableUploads:n,uppy:G}):null,z?S(g5,{i18n:u,uppy:G}):null,O?S(O5,{i18n:u,doneButtonHandler:r}):null]})]})}const $5=2e3,lz=2e3;function tz(e,l,t,d){if(e)return Rd.STATE_ERROR;if(l)return Rd.STATE_COMPLETE;if(t)return Rd.STATE_WAITING;let n=Rd.STATE_WAITING;const a=Object.keys(d);for(let i=0;i<a.length;i++){const{progress:s}=d[a[i]];if(s.uploadStarted&&!s.uploadComplete)return Rd.STATE_UPLOADING;s.preprocess&&(n=Rd.STATE_PREPROCESSING),s.postprocess&&n!==Rd.STATE_PREPROCESSING&&(n=Rd.STATE_POSTPROCESSING)}return n}class ez extends se{constructor(){super(...arguments);dl(this,nQ);dl(this,La);dl(this,fd);dl(this,Us);dl(this,Yn);dl(this,C0,()=>{const{recoveredState:t}=this.props.uppy.getState();if(Fl(this,Us,null),Fl(this,Yn,null),t){Fl(this,fd,Object.values(t.files).reduce((d,{progress:n})=>d+(n.bytesUploaded||0),0));return}Fl(this,La,performance.now()),Fl(this,fd,0)});E(this,"startUpload",()=>{const{recoveredState:t}=this.props.uppy.getState();t?this.props.uppy.emit("restore-confirmed"):this.props.uppy.upload().catch(()=>{})})}componentDidMount(){Fl(this,La,performance.now()),Fl(this,fd,this.props.uppy.getFiles().reduce((t,d)=>t+(d.progress.bytesUploaded||0),0)),this.props.uppy.on("upload",j(this,C0))}componentWillUnmount(){this.props.uppy.off("upload",j(this,C0))}render(){const{capabilities:t,files:d,allowNewUpload:n,totalProgress:a,error:i,recoveredState:s}=this.props.uppy.getState(),{newFiles:c,startedFiles:F,completeFiles:h,isUploadStarted:o,isAllComplete:V,isAllPaused:W,isUploadInProgress:Q,isSomeGhost:m}=this.props.uppy.getObjectOfFilesPerState(),R=s?Object.values(d):c,r=!!t.resumableUploads,b=t.uploadProgress!==!1;let u=null,J=0;F.every(T=>T.progress.bytesTotal!=null&&T.progress.bytesTotal!==0)?(u=0,F.forEach(T=>{u+=T.progress.bytesTotal||0,J+=T.progress.bytesUploaded||0})):F.forEach(T=>{J+=T.progress.bytesUploaded||0});const G=cl(this,nQ,hy).call(this,{uploaded:J,total:u});return S(q5,{error:i,uploadState:tz(i,V,s,d||{}),allowNewUpload:n,totalProgress:a,totalSize:u,totalUploadedSize:J,isAllComplete:V,isAllPaused:W,isUploadStarted:o,isUploadInProgress:Q,isSomeGhost:m,recoveredState:s,complete:h.length,newFiles:R.length,numUploads:F.length,totalETA:G,files:d,i18n:this.props.i18n,uppy:this.props.uppy,startUpload:this.startUpload,doneButtonHandler:this.props.doneButtonHandler,resumableUploads:r,supportsUploadProgress:b,hideProgressDetails:this.props.hideProgressDetails,hideUploadButton:this.props.hideUploadButton,hideRetryButton:this.props.hideRetryButton,hidePauseResumeButton:this.props.hidePauseResumeButton,hideCancelButton:this.props.hideCancelButton,hideAfterFinish:this.props.hideAfterFinish})}}La=new WeakMap,fd=new WeakMap,Us=new WeakMap,Yn=new WeakMap,C0=new WeakMap,nQ=new WeakSet,hy=function(t){if(t.total==null||t.total===0)return null;const d=t.total-t.uploaded;if(d<=0)return null;j(this,La)??Fl(this,La,performance.now());const n=performance.now()-j(this,La);if(n===0)return Math.round((j(this,Yn)??0)/100)/10;if(j(this,fd)==null)return Fl(this,fd,t.uploaded),null;const a=t.uploaded-j(this,fd);if(Fl(this,fd,t.uploaded),a<=0)return Math.round((j(this,Yn)??0)/100)/10;const i=a/n;if(!Number.isFinite(i)||i<=0)return null;const s=j(this,Us)==null?i:pu(i,j(this,Us),$5,n);if(!Number.isFinite(s)||s<=0)return null;Fl(this,Us,s);const c=d/s;if(!Number.isFinite(c)||c<0)return null;const F=Math.max((j(this,Yn)??0)-n,0),h=j(this,Yn)==null?c:pu(c,F,lz,n);return!Number.isFinite(h)||h<0?null:(Fl(this,Yn,h),Fl(this,La,performance.now()),Math.round(h/100)/10)};const h2=900,o2=700,Im=576,V2=330;function dz(e){const l=e.totalFileCount===0,t=e.totalFileCount===1,d=e.containerWidth>Im,n=e.containerHeight>V2,a=_e({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":e.disabled,"uppy-Dashboard--animateOpenClose":e.animateOpenClose,"uppy-Dashboard--isClosing":e.isClosing,"uppy-Dashboard--isDraggingOver":e.isDraggingOver,"uppy-Dashboard--modal":!e.inline,"uppy-size--md":e.containerWidth>Im,"uppy-size--lg":e.containerWidth>o2,"uppy-size--xl":e.containerWidth>h2,"uppy-size--height-md":e.containerHeight>V2,"uppy-Dashboard--isAddFilesPanelVisible":e.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":e.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":e.singleFileFullScreen&&t&&n});let i=1;e.containerWidth>h2?i=5:e.containerWidth>o2?i=4:e.containerWidth>Im&&(i=3);const s=e.showSelectedFiles&&!l,c=e.recoveredState?Object.keys(e.recoveredState.files).length:null,F=e.files?Object.keys(e.files).filter(V=>e.files[V].isGhost).length:0,h=()=>F>0?e.i18n("recoveredXFiles",{smart_count:F}):e.i18n("recoveredAllFiles");return S("div",{className:a,"data-uppy-theme":e.theme,"data-uppy-num-acquirers":e.acquirers.length,"data-uppy-drag-drop-supported":!e.disableLocalFiles&&Oy(),"aria-hidden":e.inline?"false":e.isHidden,"aria-disabled":e.disabled,"aria-label":e.inline?e.i18n("dashboardTitle"):e.i18n("dashboardWindowTitle"),onPaste:e.handlePaste,onDragOver:e.handleDragOver,onDragLeave:e.handleDragLeave,onDrop:e.handleDrop,children:[S("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:e.handleClickOutside}),S("div",{className:"uppy-Dashboard-inner",role:e.inline?void 0:"dialog",style:{width:e.inline&&e.width?e.width:"",height:e.inline&&e.height?e.height:""},children:[e.inline?null:S("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":e.i18n("closeModal"),title:e.i18n("closeModal"),onClick:e.closeModal,children:S("span",{"aria-hidden":"true",children:"×"})}),S("div",{className:"uppy-Dashboard-innerWrap",children:[S("div",{className:"uppy-Dashboard-dropFilesHereHint",children:e.i18n("dropHint")}),s&&S(w5,{...e}),c!=null&&c>0&&S("div",{className:"uppy-Dashboard-serviceMsg",children:[S("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:S("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[S("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"}),S("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),S("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),S("strong",{className:"uppy-Dashboard-serviceMsg-title",children:e.i18n("sessionRestored")}),S("div",{className:"uppy-Dashboard-serviceMsg-text",children:h()})]}),s?S(G5,{id:e.id,i18n:e.i18n,uppy:e.uppy,files:e.files,resumableUploads:e.resumableUploads,hideRetryButton:e.hideRetryButton,hidePauseResumeButton:e.hidePauseResumeButton,hideCancelButton:e.hideCancelButton,showLinkToFileUploadResult:e.showLinkToFileUploadResult,showRemoveButtonAfterComplete:e.showRemoveButtonAfterComplete,metaFields:e.metaFields,toggleFileCard:e.toggleFileCard,handleRequestThumbnail:e.handleRequestThumbnail,handleCancelThumbnail:e.handleCancelThumbnail,recoveredState:e.recoveredState,individualCancellation:e.individualCancellation,openFileEditor:e.openFileEditor,canEditFile:e.canEditFile,toggleAddFilesPanel:e.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:i,containerWidth:e.containerWidth,containerHeight:e.containerHeight}):S(l2,{i18n:e.i18n,i18nArray:e.i18nArray,acquirers:e.acquirers,handleInputChange:e.handleInputChange,maxNumberOfFiles:e.maxNumberOfFiles,allowedFileTypes:e.allowedFileTypes,showNativePhotoCameraButton:e.showNativePhotoCameraButton,showNativeVideoCameraButton:e.showNativeVideoCameraButton,nativeCameraFacingMode:e.nativeCameraFacingMode,showPanel:e.showPanel,activePickerPanel:e.activePickerPanel,disableLocalFiles:e.disableLocalFiles,fileManagerSelectionType:e.fileManagerSelectionType,note:e.note,proudlyDisplayPoweredByUppy:e.proudlyDisplayPoweredByUppy}),S(Qh,{children:e.showAddFilesPanel?S($k,{...e,isSizeMD:d},"AddFiles"):null}),S(Qh,{children:e.fileCardFor?S(U5,{...e},"FileCard"):null}),S(Qh,{children:e.activePickerPanel?S(L5,{...e},"Picker"):null}),S(Qh,{children:e.showFileEditor?S(l5,{...e},"Editor"):null}),S("div",{className:"uppy-Dashboard-progressindicators",children:[!e.disableInformer&&S(i2,{uppy:e.uppy}),!e.disableStatusBar&&S(ez,{uppy:e.uppy,i18n:e.i18n,hideProgressDetails:e.hideProgressDetails,hideUploadButton:e.hideUploadButton,hideRetryButton:e.hideRetryButton,hidePauseResumeButton:e.hidePauseResumeButton,hideCancelButton:e.hideCancelButton,hideAfterFinish:e.hideProgressAfterFinish,doneButtonHandler:e.doneButtonHandler}),!e.disableInformer&&S(i2,{uppy:e.uppy}),e.progressindicators.map(V=>e.uppy.getPlugin(V.id).render(e.state))]})]})]})]})}const nz={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"}};function W2(e,l){if(l){const t=e.querySelector(`[data-uppy-paneltype="${l}"]`);if(t)return t}return e}function az(){let e=!1;return Jk((t,d)=>{const n=W2(t,d),a=n.contains(document.activeElement);if(a&&e)return;const i=n.querySelector("[data-uppy-super-focusable]");if(!(a&&!i))if(i)i.focus({preventScroll:!0}),e=!0;else{const s=n.querySelector(Mu);s==null||s.focus({preventScroll:!0}),e=!1}},260)}function Q2(e,l){const t=l[0];t&&(t.focus(),e.preventDefault())}function iz(e,l){const t=l[l.length-1];t&&(t.focus(),e.preventDefault())}function sz(e){return e.contains(document.activeElement)}function m2(e,l,t){const d=W2(t,l),n=yU(d.querySelectorAll(Mu)),a=n.indexOf(document.activeElement);sz(d)?e.shiftKey&&a===0?iz(e,n):!e.shiftKey&&a===n.length-1&&Q2(e,n):Q2(e,n)}function cz(e,l,t){l===null||m2(e,l,t)}const R2=9,Uz=27;function N2(){const e={};return e.promise=new Promise((l,t)=>{e.resolve=l,e.reject=t}),e}const Zz={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:Tk,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:()=>{},onDragOver:()=>{},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};class b2 extends Ln{constructor(t,d){var a;const n=(d==null?void 0:d.autoOpen)??null;super(t,{...Zz,...d,autoOpen:n});dl(this,Ia);dl(this,SU);E(this,"modalName",`uppy-Dashboard-${PQ()}`);E(this,"superFocus",az());E(this,"ifFocusedOnUppyRecently",!1);E(this,"dashboardIsDisabled");E(this,"savedScrollPosition");E(this,"savedActiveElement");E(this,"resizeObserver");E(this,"darkModeMediaQuery");E(this,"makeDashboardInsidesVisibleAnywayTimeout");E(this,"removeTarget",t=>{const n=this.getPluginState().targets.filter(a=>a.id!==t.id);this.setPluginState({targets:n})});E(this,"addTarget",t=>{const d=t.id||t.constructor.name,n=t.title||d,a=t.type;if(a!=="acquirer"&&a!=="progressindicator"&&a!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;const i={id:d,name:n,type:a},c=this.getPluginState().targets.slice();return c.push(i),this.setPluginState({targets:c}),this.el});E(this,"hideAllPanels",()=>{var n;const t=this.getPluginState(),d={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};t.activePickerPanel===d.activePickerPanel&&t.showAddFilesPanel===d.showAddFilesPanel&&t.showFileEditor===d.showFileEditor&&t.activeOverlayType===d.activeOverlayType||(this.setPluginState(d),this.uppy.emit("dashboard:close-panel",(n=t.activePickerPanel)==null?void 0:n.id))});E(this,"showPanel",t=>{const{targets:d}=this.getPluginState(),n=d.find(a=>a.type==="acquirer"&&a.id===t);this.setPluginState({activePickerPanel:n,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",t)});E(this,"canEditFile",t=>{const{targets:d}=this.getPluginState();return j(this,Fs).call(this,d).some(a=>this.uppy.getPlugin(a.id).canEditFile(t))});E(this,"openFileEditor",t=>{const{targets:d}=this.getPluginState(),n=j(this,Fs).call(this,d);this.setPluginState({showFileEditor:!0,fileCardFor:t.id||null,activeOverlayType:"FileEditor"}),n.forEach(a=>{this.uppy.getPlugin(a.id).selectFile(t)})});E(this,"closeFileEditor",()=>{const{metaFields:t}=this.getPluginState();t&&t.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})});E(this,"saveFileEditor",()=>{const{targets:t}=this.getPluginState();j(this,Fs).call(this,t).forEach(n=>{this.uppy.getPlugin(n.id).save()}),this.closeFileEditor()});E(this,"openModal",()=>{const{promise:t,resolve:d}=N2();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){const n=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",n,!1),d()};this.el.addEventListener("animationend",n,!1)}else this.setPluginState({isHidden:!1}),d();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),t});E(this,"closeModal",t=>{var c;const d=(t==null?void 0:t.manualClose)??!0,{isHidden:n,isClosing:a}=this.getPluginState();if(n||a)return;const{promise:i,resolve:s}=N2();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});const F=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",F,!1),s()};this.el.addEventListener("animationend",F,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),s();return document.removeEventListener("keydown",this.handleKeyDownInModal),d&&this.opts.browserBackButtonClose&&(c=history.state)!=null&&c[this.modalName]&&history.back(),this.uppy.emit("dashboard:modal-closed"),i});E(this,"isModalOpen",()=>!this.getPluginState().isHidden||!1);E(this,"requestCloseModal",()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal());E(this,"setDarkModeCapability",t=>{const{capabilities:d}=this.uppy.getState();this.uppy.setState({capabilities:{...d,darkMode:t}})});E(this,"handleSystemDarkModeChange",t=>{const d=t.matches;this.uppy.log(`[Dashboard] Dark mode is ${d?"on":"off"}`),this.setDarkModeCapability(d)});E(this,"toggleFileCard",(t,d)=>{const n=this.uppy.getFile(d);t?this.uppy.emit("dashboard:file-edit-start",n):this.uppy.emit("dashboard:file-edit-complete",n),this.setPluginState({fileCardFor:t?d:null,activeOverlayType:t?"FileCard":null})});E(this,"toggleAddFilesPanel",t=>{this.setPluginState({showAddFilesPanel:t,activeOverlayType:t?"AddFiles":null})});E(this,"addFiles",t=>{const d=t.map(n=>({source:this.id,name:n.name,type:n.type,data:n,meta:{relativePath:n.relativePath||n.webkitRelativePath||null}}));try{this.uppy.addFiles(d)}catch(n){this.uppy.log(n)}});E(this,"startListeningToResize",()=>{this.resizeObserver=new ResizeObserver(t=>{const d=t[0],{width:n,height:a}=d.contentRect;this.setPluginState({containerWidth:n,containerHeight:a,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{const t=this.getPluginState(),d=!this.opts.inline&&t.isHidden;!t.areInsidesReadyToBeVisible&&!d&&(this.uppy.log("[Dashboard] resize event didn’t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)});E(this,"stopListeningToResize",()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)});E(this,"recordIfFocusedOnUppyRecently",t=>{this.el.contains(t.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())});E(this,"disableInteractiveElements",t=>{const d=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],n=j(this,SU)??yU(this.el.querySelectorAll(d)).filter(a=>!a.classList.contains("uppy-Dashboard-close"));for(const a of n)a.tagName==="A"?a.setAttribute("aria-disabled",t):a.disabled=t;t?Fl(this,SU,n):Fl(this,SU,null),this.dashboardIsDisabled=t});E(this,"updateBrowserHistory",()=>{var t;(t=history.state)!=null&&t[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)});E(this,"handlePopState",t=>{var d;this.isModalOpen()&&(!t.state||!t.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&((d=t.state)!=null&&d[this.modalName])&&history.back()});E(this,"handleKeyDownInModal",t=>{t.keyCode===Uz&&this.requestCloseModal(),t.keyCode===R2&&m2(t,this.getPluginState().activeOverlayType,this.el)});E(this,"handleClickOutside",()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()});E(this,"handlePaste",t=>{this.uppy.iteratePlugins(n=>{var a;n.type==="acquirer"&&((a=n.handleRootPaste)==null||a.call(n,t))});const d=yU(t.clipboardData.files);d.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(d))});E(this,"handleInputChange",t=>{t.preventDefault();const d=yU(t.currentTarget.files||[]);d.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(d))});E(this,"handleDragOver",t=>{t.preventDefault(),t.stopPropagation();const d=()=>{let s=!0;return this.uppy.iteratePlugins(c=>{var F;(F=c.canHandleRootDrop)!=null&&F.call(c,t)&&(s=!0)}),s},n=()=>{const{types:s}=t.dataTransfer;return s.some(c=>c==="Files")},a=d(),i=n();if(!a&&!i||this.opts.disabled||this.opts.disableLocalFiles&&(i||!a)||!this.uppy.getState().allowNewUpload){t.dataTransfer.dropEffect="none";return}t.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(t)});E(this,"handleDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(t)});E(this,"handleDrop",async t=>{t.preventDefault(),t.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(i=>{var s;i.type==="acquirer"&&((s=i.handleRootDrop)==null||s.call(i,t))});let d=!1;const n=i=>{this.uppy.log(i,"error"),d||(this.uppy.info(i.message,"error"),d=!0)};this.uppy.log("[Dashboard] Processing dropped files");const a=await xy(t.dataTransfer,{logDropError:n});a.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(a)),this.opts.onDrop(t)});E(this,"handleRequestThumbnail",t=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",t)});E(this,"handleCancelThumbnail",t=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",t)});E(this,"handleKeyDownInInline",t=>{t.keyCode===R2&&cz(t,this.getPluginState().activeOverlayType,this.el)});E(this,"handlePasteOnBody",t=>{this.el.contains(document.activeElement)&&this.handlePaste(t)});E(this,"handleComplete",({failed:t})=>{this.opts.closeAfterFinish&&!(t!=null&&t.length)&&this.requestCloseModal()});dl(this,Zs,()=>{if(this.opts.disableThumbnailGenerator)return;const t=600,d=this.uppy.getFiles();if(d.length===1){const n=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);n==null||n.setOptions({thumbnailWidth:t});const a={...d[0],preview:void 0};n==null||n.requestThumbnail(a).then(()=>{n==null||n.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}});dl(this,x0,t=>{const d=t[0],{metaFields:n}=this.getPluginState(),a=n&&n.length>0,i=this.canEditFile(d);a&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,d.id):i&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(d)});E(this,"initEvents",()=>{if(this.opts.trigger&&!this.opts.inline){const t=Ju(this.opts.trigger);t?t.forEach(d=>d.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",j(this,TU)),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",j(this,Zs)),this.uppy.on("file-removed",j(this,Zs)),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",j(this,x0))});E(this,"removeEvents",()=>{const t=Ju(this.opts.trigger);!this.opts.inline&&t&&t.forEach(d=>d.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",j(this,TU)),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",j(this,Zs)),this.uppy.off("file-removed",j(this,Zs)),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",j(this,x0))});E(this,"superFocusOnEachUpdate",()=>{const t=this.el.contains(document.activeElement),d=document.activeElement===document.body||document.activeElement===null,n=this.uppy.getState().info.length===0,a=!this.opts.inline;n&&(a||t||d&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()});E(this,"afterUpdate",()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()});E(this,"saveFileCard",(t,d)=>{this.uppy.setFileMeta(d,t),this.toggleFileCard(!1,d)});dl(this,JU,t=>{const d=this.uppy.getPlugin(t.id);return{...t,icon:d.icon||this.opts.defaultPickerIcon,render:d.render}});dl(this,aQ,t=>{const d=this.uppy.getPlugin(t.id);return typeof d.isSupported!="function"?!0:d.isSupported()});dl(this,iQ,t=>t.filter(d=>d.type==="acquirer"&&j(this,aQ).call(this,d)).map(j(this,JU)));dl(this,sQ,t=>t.filter(d=>d.type==="progressindicator").map(j(this,JU)));dl(this,Fs,t=>t.filter(d=>d.type==="editor").map(j(this,JU)));E(this,"render",t=>{const d=this.getPluginState(),{files:n,capabilities:a,allowNewUpload:i}=t,{newFiles:s,uploadStartedFiles:c,completeFiles:F,erroredFiles:h,inProgressFiles:o,inProgressNotPausedFiles:V,processingFiles:W,isUploadStarted:Q,isAllComplete:m,isAllPaused:R}=this.uppy.getObjectOfFilesPerState(),r=j(this,iQ).call(this,d.targets),b=j(this,sQ).call(this,d.targets),u=j(this,Fs).call(this,d.targets);let J;return this.opts.theme==="auto"?J=a.darkMode?"dark":"light":J=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}".`)),dz({state:t,isHidden:d.isHidden,files:n,newFiles:s,uploadStartedFiles:c,completeFiles:F,erroredFiles:h,inProgressFiles:o,inProgressNotPausedFiles:V,processingFiles:W,isUploadStarted:Q,isAllComplete:m,isAllPaused:R,totalFileCount:Object.keys(n).length,totalProgress:t.totalProgress,allowNewUpload:i,acquirers:r,theme:J,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:d.activePickerPanel,showFileEditor:d.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:d.isClosing,progressindicators:b,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:t.recoveredState,metaFields:d.metaFields,resumableUploads:a.resumableUploads||!1,individualCancellation:a.individualCancellation,isMobileDevice:a.isMobileDevice,fileCardFor:d.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:d.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:d.containerWidth,containerHeight:d.containerHeight,areInsidesReadyToBeVisible:d.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:d.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})});dl(this,cQ,()=>{const{plugins:t}=this.opts;t.forEach(d=>{const n=this.uppy.getPlugin(d);n?n.mount(this,n):this.uppy.log(`[Uppy] Dashboard could not find plugin '${d}', make sure to uppy.use() the plugins you are specifying`,"warning")})});dl(this,UQ,()=>{this.uppy.iteratePlugins(j(this,TU))});dl(this,TU,t=>{var n;const d=["acquirer","editor"];t&&!((n=t.opts)!=null&&n.target)&&d.includes(t.type)&&(this.getPluginState().targets.some(i=>t.id===i.id)||t.mount(this,t))});E(this,"install",()=>{var c;this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});const{inline:t,closeAfterFinish:d}=this.opts;if(t&&d)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.");const{allowMultipleUploads:n,allowMultipleUploadBatches:a}=this.uppy.opts;(n||a)&&d&&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");const{target:i}=this.opts;i&&this.mount(i,this),this.opts.disableThumbnailGenerator||this.uppy.use($p,{id:cl(this,Ia,Ru).call(this),...cl(this,Ia,mu).call(this)}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;const s=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;this.uppy.log(`[Dashboard] Dark mode is ${s?"on":"off"}`),this.setDarkModeCapability(s),this.opts.theme==="auto"&&((c=this.darkModeMediaQuery)==null||c.addListener(this.handleSystemDarkModeChange)),j(this,cQ).call(this),j(this,UQ).call(this),this.initEvents()});E(this,"uninstall",()=>{var d;if(!this.opts.disableThumbnailGenerator){const n=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);n&&this.uppy.removePlugin(n)}const{plugins:t}=this.opts;t.forEach(n=>{const a=this.uppy.getPlugin(n);a&&a.unmount()}),this.opts.theme==="auto"&&((d=this.darkModeMediaQuery)==null||d.removeListener(this.handleSystemDarkModeChange)),this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()});this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=nz,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),(a=this.opts).onRequestCloseModal??(a.onRequestCloseModal=()=>this.closeModal()),this.i18nInit()}setOptions(t){var d;super.setOptions(t),(d=this.uppy.getPlugin(cl(this,Ia,Ru).call(this)))==null||d.setOptions(cl(this,Ia,mu).call(this))}}SU=new WeakMap,Zs=new WeakMap,x0=new WeakMap,JU=new WeakMap,aQ=new WeakMap,iQ=new WeakMap,sQ=new WeakMap,Fs=new WeakMap,cQ=new WeakMap,UQ=new WeakMap,TU=new WeakMap,Ia=new WeakSet,mu=function(){const{thumbnailWidth:t,thumbnailHeight:d,thumbnailType:n,waitForThumbnailsBeforeUpload:a}=this.opts;return{thumbnailWidth:t,thumbnailHeight:d,thumbnailType:n,waitForThumbnailsBeforeUpload:a,lazy:!a}},Ru=function(){return`${this.id}:ThumbnailGenerator`},E(b2,"VERSION",qk.version);const Fz={version:"4.1.0"};/*!
26
+ ${l}`;alert(i)}return S("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[S("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:S("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"})}),S("div",{className:"uppy-StatusBar-status",children:[S("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),S("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:a,type:"button",children:"?"})]}),S(Z2,{i18n:t,complete:d,numUploads:n})]})]})}function km(e){const l=[];let t="indeterminate",d;for(const{progress:a}of Object.values(e)){const{preprocess:i,postprocess:s}=a;d==null&&(i||s)&&({mode:t,message:d}=i||s),(i==null?void 0:i.mode)==="determinate"&&l.push(i.value),(s==null?void 0:s.mode)==="determinate"&&l.push(s.value)}const n=l.reduce((a,i)=>a+i/l.length,0);return{mode:t,message:d,value:n}}const{STATE_ERROR:F2,STATE_WAITING:_5,STATE_PREPROCESSING:zm,STATE_UPLOADING:mh,STATE_POSTPROCESSING:Lm,STATE_COMPLETE:Rh}=Rd;function q5({newFiles:e,allowNewUpload:l,isUploadInProgress:t,isAllPaused:d,resumableUploads:n,error:a,hideUploadButton:i=void 0,hidePauseResumeButton:s=!1,hideCancelButton:c=!1,hideRetryButton:F=!1,recoveredState:h,uploadState:o,totalProgress:V,files:W,supportsUploadProgress:Q,hideAfterFinish:m=!1,isSomeGhost:R,doneButtonHandler:r=void 0,isUploadStarted:b,i18n:u,startUpload:J,uppy:G,isAllComplete:T,hideProgressDetails:y=void 0,numUploads:k,complete:X,totalSize:L,totalETA:D,totalUploadedSize:C}){function I(){switch(o){case Lm:case zm:{const tl=km(W);return tl.mode==="determinate"?tl.value*100:V}case F2:return null;case mh:return Q?V:null;default:return V}}function H(){switch(o){case Lm:case zm:{const{mode:tl}=km(W);return tl==="indeterminate"}case mh:return!Q;default:return!1}}const f=I(),Y=f??100,B=!a&&e&&(!t&&!d||h)&&l&&!i,z=!c&&o!==_5&&o!==Rh,g=n&&!s&&o===mh,w=a&&!T&&!F,O=r&&o===Rh,K=_e("uppy-StatusBar-progress",{"is-indeterminate":H()}),x=_e("uppy-StatusBar",`is-${o}`,{"has-ghosts":R}),_=(()=>{switch(o){case zm:case Lm:return S(v5,{progress:km(W)});case Rh:return S(P5,{i18n:u});case F2:return S(A5,{error:a,i18n:u,numUploads:k,complete:X});case mh:return S(H5,{i18n:u,supportsUploadProgress:Q,totalProgress:V,hideProgressDetails:y,isUploadStarted:b,isAllComplete:T,isAllPaused:d,newFiles:e,numUploads:k,complete:X,totalUploadedSize:C,totalSize:L,totalETA:D,startUpload:J});default:return null}})();return!(B||w||g||z||O)&&!_||o===Rh&&m?null:S("div",{className:x,children:[S("div",{className:K,style:{width:`${Y}%`},role:"progressbar","aria-label":`${Y}%`,"aria-valuetext":`${Y}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":f}),_,S("div",{className:"uppy-StatusBar-actions",children:[B?S(C5,{newFiles:e,isUploadStarted:b,recoveredState:h,i18n:u,isSomeGhost:R,startUpload:J,uploadState:o}):null,w?S(x5,{i18n:u,uppy:G}):null,g?S(j5,{isAllPaused:d,i18n:u,isAllComplete:T,resumableUploads:n,uppy:G}):null,z?S(g5,{i18n:u,uppy:G}):null,O?S(O5,{i18n:u,doneButtonHandler:r}):null]})]})}const $5=2e3,lz=2e3;function tz(e,l,t,d){if(e)return Rd.STATE_ERROR;if(l)return Rd.STATE_COMPLETE;if(t)return Rd.STATE_WAITING;let n=Rd.STATE_WAITING;const a=Object.keys(d);for(let i=0;i<a.length;i++){const{progress:s}=d[a[i]];if(s.uploadStarted&&!s.uploadComplete)return Rd.STATE_UPLOADING;s.preprocess&&(n=Rd.STATE_PREPROCESSING),s.postprocess&&n!==Rd.STATE_PREPROCESSING&&(n=Rd.STATE_POSTPROCESSING)}return n}class ez extends se{constructor(){super(...arguments);dl(this,nQ);dl(this,La);dl(this,fd);dl(this,Us);dl(this,Yn);dl(this,C0,()=>{const{recoveredState:t}=this.props.uppy.getState();if(Fl(this,Us,null),Fl(this,Yn,null),t){Fl(this,fd,Object.values(t.files).reduce((d,{progress:n})=>d+(n.bytesUploaded||0),0));return}Fl(this,La,performance.now()),Fl(this,fd,0)});E(this,"startUpload",()=>{const{recoveredState:t}=this.props.uppy.getState();t?this.props.uppy.emit("restore-confirmed"):this.props.uppy.upload().catch(()=>{})})}componentDidMount(){Fl(this,La,performance.now()),Fl(this,fd,this.props.uppy.getFiles().reduce((t,d)=>t+(d.progress.bytesUploaded||0),0)),this.props.uppy.on("upload",j(this,C0))}componentWillUnmount(){this.props.uppy.off("upload",j(this,C0))}render(){const{capabilities:t,files:d,allowNewUpload:n,totalProgress:a,error:i,recoveredState:s}=this.props.uppy.getState(),{newFiles:c,startedFiles:F,completeFiles:h,isUploadStarted:o,isAllComplete:V,isAllPaused:W,isUploadInProgress:Q,isSomeGhost:m}=this.props.uppy.getObjectOfFilesPerState(),R=s?Object.values(d):c,r=!!t.resumableUploads,b=t.uploadProgress!==!1;let u=null,J=0;F.every(T=>T.progress.bytesTotal!=null&&T.progress.bytesTotal!==0)?(u=0,F.forEach(T=>{u+=T.progress.bytesTotal||0,J+=T.progress.bytesUploaded||0})):F.forEach(T=>{J+=T.progress.bytesUploaded||0});const G=cl(this,nQ,hy).call(this,{uploaded:J,total:u});return S(q5,{error:i,uploadState:tz(i,V,s,d||{}),allowNewUpload:n,totalProgress:a,totalSize:u,totalUploadedSize:J,isAllComplete:V,isAllPaused:W,isUploadStarted:o,isUploadInProgress:Q,isSomeGhost:m,recoveredState:s,complete:h.length,newFiles:R.length,numUploads:F.length,totalETA:G,files:d,i18n:this.props.i18n,uppy:this.props.uppy,startUpload:this.startUpload,doneButtonHandler:this.props.doneButtonHandler,resumableUploads:r,supportsUploadProgress:b,hideProgressDetails:this.props.hideProgressDetails,hideUploadButton:this.props.hideUploadButton,hideRetryButton:this.props.hideRetryButton,hidePauseResumeButton:this.props.hidePauseResumeButton,hideCancelButton:this.props.hideCancelButton,hideAfterFinish:this.props.hideAfterFinish})}}La=new WeakMap,fd=new WeakMap,Us=new WeakMap,Yn=new WeakMap,C0=new WeakMap,nQ=new WeakSet,hy=function(t){if(t.total==null||t.total===0)return null;const d=t.total-t.uploaded;if(d<=0)return null;j(this,La)??Fl(this,La,performance.now());const n=performance.now()-j(this,La);if(n===0)return Math.round((j(this,Yn)??0)/100)/10;if(j(this,fd)==null)return Fl(this,fd,t.uploaded),null;const a=t.uploaded-j(this,fd);if(Fl(this,fd,t.uploaded),a<=0)return Math.round((j(this,Yn)??0)/100)/10;const i=a/n;if(!Number.isFinite(i)||i<=0)return null;const s=j(this,Us)==null?i:pu(i,j(this,Us),$5,n);if(!Number.isFinite(s)||s<=0)return null;Fl(this,Us,s);const c=d/s;if(!Number.isFinite(c)||c<0)return null;const F=Math.max((j(this,Yn)??0)-n,0),h=j(this,Yn)==null?c:pu(c,F,lz,n);return!Number.isFinite(h)||h<0?null:(Fl(this,Yn,h),Fl(this,La,performance.now()),Math.round(h/100)/10)};const h2=900,o2=700,Im=576,V2=330;function dz(e){const l=e.totalFileCount===0,t=e.totalFileCount===1,d=e.containerWidth>Im,n=e.containerHeight>V2,a=_e({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":e.disabled,"uppy-Dashboard--animateOpenClose":e.animateOpenClose,"uppy-Dashboard--isClosing":e.isClosing,"uppy-Dashboard--isDraggingOver":e.isDraggingOver,"uppy-Dashboard--modal":!e.inline,"uppy-size--md":e.containerWidth>Im,"uppy-size--lg":e.containerWidth>o2,"uppy-size--xl":e.containerWidth>h2,"uppy-size--height-md":e.containerHeight>V2,"uppy-Dashboard--isAddFilesPanelVisible":e.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":e.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":e.singleFileFullScreen&&t&&n});let i=1;e.containerWidth>h2?i=5:e.containerWidth>o2?i=4:e.containerWidth>Im&&(i=3);const s=e.showSelectedFiles&&!l,c=e.recoveredState?Object.keys(e.recoveredState.files).length:null,F=e.files?Object.keys(e.files).filter(V=>e.files[V].isGhost).length:0,h=()=>F>0?e.i18n("recoveredXFiles",{smart_count:F}):e.i18n("recoveredAllFiles");return S("div",{className:a,"data-uppy-theme":e.theme,"data-uppy-num-acquirers":e.acquirers.length,"data-uppy-drag-drop-supported":!e.disableLocalFiles&&Oy(),"aria-hidden":e.inline?"false":e.isHidden,"aria-disabled":e.disabled,"aria-label":e.inline?e.i18n("dashboardTitle"):e.i18n("dashboardWindowTitle"),onPaste:e.handlePaste,onDragOver:e.handleDragOver,onDragLeave:e.handleDragLeave,onDrop:e.handleDrop,children:[S("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:e.handleClickOutside}),S("div",{className:"uppy-Dashboard-inner",role:e.inline?void 0:"dialog",style:{width:e.inline&&e.width?e.width:"",height:e.inline&&e.height?e.height:""},children:[e.inline?null:S("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":e.i18n("closeModal"),title:e.i18n("closeModal"),onClick:e.closeModal,children:S("span",{"aria-hidden":"true",children:"×"})}),S("div",{className:"uppy-Dashboard-innerWrap",children:[S("div",{className:"uppy-Dashboard-dropFilesHereHint",children:e.i18n("dropHint")}),s&&S(w5,{...e}),c!=null&&c>0&&S("div",{className:"uppy-Dashboard-serviceMsg",children:[S("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:S("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[S("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"}),S("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),S("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),S("strong",{className:"uppy-Dashboard-serviceMsg-title",children:e.i18n("sessionRestored")}),S("div",{className:"uppy-Dashboard-serviceMsg-text",children:h()})]}),s?S(G5,{id:e.id,i18n:e.i18n,uppy:e.uppy,files:e.files,resumableUploads:e.resumableUploads,hideRetryButton:e.hideRetryButton,hidePauseResumeButton:e.hidePauseResumeButton,hideCancelButton:e.hideCancelButton,showLinkToFileUploadResult:e.showLinkToFileUploadResult,showRemoveButtonAfterComplete:e.showRemoveButtonAfterComplete,metaFields:e.metaFields,toggleFileCard:e.toggleFileCard,handleRequestThumbnail:e.handleRequestThumbnail,handleCancelThumbnail:e.handleCancelThumbnail,recoveredState:e.recoveredState,individualCancellation:e.individualCancellation,openFileEditor:e.openFileEditor,canEditFile:e.canEditFile,toggleAddFilesPanel:e.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:i,containerWidth:e.containerWidth,containerHeight:e.containerHeight}):S(l2,{i18n:e.i18n,i18nArray:e.i18nArray,acquirers:e.acquirers,handleInputChange:e.handleInputChange,maxNumberOfFiles:e.maxNumberOfFiles,allowedFileTypes:e.allowedFileTypes,showNativePhotoCameraButton:e.showNativePhotoCameraButton,showNativeVideoCameraButton:e.showNativeVideoCameraButton,nativeCameraFacingMode:e.nativeCameraFacingMode,showPanel:e.showPanel,activePickerPanel:e.activePickerPanel,disableLocalFiles:e.disableLocalFiles,fileManagerSelectionType:e.fileManagerSelectionType,note:e.note,proudlyDisplayPoweredByUppy:e.proudlyDisplayPoweredByUppy}),S(Qh,{children:e.showAddFilesPanel?S($k,{...e,isSizeMD:d},"AddFiles"):null}),S(Qh,{children:e.fileCardFor?S(U5,{...e},"FileCard"):null}),S(Qh,{children:e.activePickerPanel?S(L5,{...e},"Picker"):null}),S(Qh,{children:e.showFileEditor?S(l5,{...e},"Editor"):null}),S("div",{className:"uppy-Dashboard-progressindicators",children:[!e.disableInformer&&S(i2,{uppy:e.uppy}),!e.disableStatusBar&&S(ez,{uppy:e.uppy,i18n:e.i18n,hideProgressDetails:e.hideProgressDetails,hideUploadButton:e.hideUploadButton,hideRetryButton:e.hideRetryButton,hidePauseResumeButton:e.hidePauseResumeButton,hideCancelButton:e.hideCancelButton,hideAfterFinish:e.hideProgressAfterFinish,doneButtonHandler:e.doneButtonHandler}),!e.disableInformer&&S(i2,{uppy:e.uppy}),e.progressindicators.map(V=>e.uppy.getPlugin(V.id).render(e.state))]})]})]})]})}const nz={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"}};function W2(e,l){if(l){const t=e.querySelector(`[data-uppy-paneltype="${l}"]`);if(t)return t}return e}function az(){let e=!1;return Jk((t,d)=>{const n=W2(t,d),a=n.contains(document.activeElement);if(a&&e)return;const i=n.querySelector("[data-uppy-super-focusable]");if(!(a&&!i))if(i)i.focus({preventScroll:!0}),e=!0;else{const s=n.querySelector(Mu);s==null||s.focus({preventScroll:!0}),e=!1}},260)}function Q2(e,l){const t=l[0];t&&(t.focus(),e.preventDefault())}function iz(e,l){const t=l[l.length-1];t&&(t.focus(),e.preventDefault())}function sz(e){return e.contains(document.activeElement)}function m2(e,l,t){const d=W2(t,l),n=yU(d.querySelectorAll(Mu)),a=n.indexOf(document.activeElement);sz(d)?e.shiftKey&&a===0?iz(e,n):!e.shiftKey&&a===n.length-1&&Q2(e,n):Q2(e,n)}function cz(e,l,t){l===null||m2(e,l,t)}const R2=9,Uz=27;function N2(){const e={};return e.promise=new Promise((l,t)=>{e.resolve=l,e.reject=t}),e}const Zz={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:Tk,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:()=>{},onDragOver:()=>{},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};class b2 extends Ln{constructor(t,d){var a;const n=(d==null?void 0:d.autoOpen)??null;super(t,{...Zz,...d,autoOpen:n});dl(this,Ia);dl(this,SU);E(this,"modalName",`uppy-Dashboard-${PQ()}`);E(this,"superFocus",az());E(this,"ifFocusedOnUppyRecently",!1);E(this,"dashboardIsDisabled");E(this,"savedScrollPosition");E(this,"savedActiveElement");E(this,"resizeObserver");E(this,"darkModeMediaQuery");E(this,"makeDashboardInsidesVisibleAnywayTimeout");E(this,"removeTarget",t=>{const n=this.getPluginState().targets.filter(a=>a.id!==t.id);this.setPluginState({targets:n})});E(this,"addTarget",t=>{const d=t.id||t.constructor.name,n=t.title||d,a=t.type;if(a!=="acquirer"&&a!=="progressindicator"&&a!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;const i={id:d,name:n,type:a},c=this.getPluginState().targets.slice();return c.push(i),this.setPluginState({targets:c}),this.el});E(this,"hideAllPanels",()=>{var n;const t=this.getPluginState(),d={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};t.activePickerPanel===d.activePickerPanel&&t.showAddFilesPanel===d.showAddFilesPanel&&t.showFileEditor===d.showFileEditor&&t.activeOverlayType===d.activeOverlayType||(this.setPluginState(d),this.uppy.emit("dashboard:close-panel",(n=t.activePickerPanel)==null?void 0:n.id))});E(this,"showPanel",t=>{const{targets:d}=this.getPluginState(),n=d.find(a=>a.type==="acquirer"&&a.id===t);this.setPluginState({activePickerPanel:n,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",t)});E(this,"canEditFile",t=>{const{targets:d}=this.getPluginState();return j(this,Fs).call(this,d).some(a=>this.uppy.getPlugin(a.id).canEditFile(t))});E(this,"openFileEditor",t=>{const{targets:d}=this.getPluginState(),n=j(this,Fs).call(this,d);this.setPluginState({showFileEditor:!0,fileCardFor:t.id||null,activeOverlayType:"FileEditor"}),n.forEach(a=>{this.uppy.getPlugin(a.id).selectFile(t)})});E(this,"closeFileEditor",()=>{const{metaFields:t}=this.getPluginState();t&&t.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})});E(this,"saveFileEditor",()=>{const{targets:t}=this.getPluginState();j(this,Fs).call(this,t).forEach(n=>{this.uppy.getPlugin(n.id).save()}),this.closeFileEditor()});E(this,"openModal",()=>{const{promise:t,resolve:d}=N2();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){const n=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",n,!1),d()};this.el.addEventListener("animationend",n,!1)}else this.setPluginState({isHidden:!1}),d();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),t});E(this,"closeModal",t=>{var c;const d=(t==null?void 0:t.manualClose)??!0,{isHidden:n,isClosing:a}=this.getPluginState();if(n||a)return;const{promise:i,resolve:s}=N2();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});const F=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",F,!1),s()};this.el.addEventListener("animationend",F,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),s();return document.removeEventListener("keydown",this.handleKeyDownInModal),d&&this.opts.browserBackButtonClose&&(c=history.state)!=null&&c[this.modalName]&&history.back(),this.uppy.emit("dashboard:modal-closed"),i});E(this,"isModalOpen",()=>!this.getPluginState().isHidden||!1);E(this,"requestCloseModal",()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal());E(this,"setDarkModeCapability",t=>{const{capabilities:d}=this.uppy.getState();this.uppy.setState({capabilities:{...d,darkMode:t}})});E(this,"handleSystemDarkModeChange",t=>{const d=t.matches;this.uppy.log(`[Dashboard] Dark mode is ${d?"on":"off"}`),this.setDarkModeCapability(d)});E(this,"toggleFileCard",(t,d)=>{const n=this.uppy.getFile(d);t?this.uppy.emit("dashboard:file-edit-start",n):this.uppy.emit("dashboard:file-edit-complete",n),this.setPluginState({fileCardFor:t?d:null,activeOverlayType:t?"FileCard":null})});E(this,"toggleAddFilesPanel",t=>{this.setPluginState({showAddFilesPanel:t,activeOverlayType:t?"AddFiles":null})});E(this,"addFiles",t=>{const d=t.map(n=>({source:this.id,name:n.name,type:n.type,data:n,meta:{relativePath:n.relativePath||n.webkitRelativePath||null}}));try{this.uppy.addFiles(d)}catch(n){this.uppy.log(n)}});E(this,"startListeningToResize",()=>{this.resizeObserver=new ResizeObserver(t=>{const d=t[0],{width:n,height:a}=d.contentRect;this.setPluginState({containerWidth:n,containerHeight:a,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{const t=this.getPluginState(),d=!this.opts.inline&&t.isHidden;!t.areInsidesReadyToBeVisible&&!d&&(this.uppy.log("[Dashboard] resize event didn’t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)});E(this,"stopListeningToResize",()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)});E(this,"recordIfFocusedOnUppyRecently",t=>{this.el.contains(t.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())});E(this,"disableInteractiveElements",t=>{const d=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],n=j(this,SU)??yU(this.el.querySelectorAll(d)).filter(a=>!a.classList.contains("uppy-Dashboard-close"));for(const a of n)a.tagName==="A"?a.setAttribute("aria-disabled",t):a.disabled=t;t?Fl(this,SU,n):Fl(this,SU,null),this.dashboardIsDisabled=t});E(this,"updateBrowserHistory",()=>{var t;(t=history.state)!=null&&t[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)});E(this,"handlePopState",t=>{var d;this.isModalOpen()&&(!t.state||!t.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&((d=t.state)!=null&&d[this.modalName])&&history.back()});E(this,"handleKeyDownInModal",t=>{t.keyCode===Uz&&this.requestCloseModal(),t.keyCode===R2&&m2(t,this.getPluginState().activeOverlayType,this.el)});E(this,"handleClickOutside",()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()});E(this,"handlePaste",t=>{this.uppy.iteratePlugins(n=>{var a;n.type==="acquirer"&&((a=n.handleRootPaste)==null||a.call(n,t))});const d=yU(t.clipboardData.files);d.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(d))});E(this,"handleInputChange",t=>{t.preventDefault();const d=yU(t.currentTarget.files||[]);d.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(d))});E(this,"handleDragOver",t=>{t.preventDefault(),t.stopPropagation();const d=()=>{let s=!0;return this.uppy.iteratePlugins(c=>{var F;(F=c.canHandleRootDrop)!=null&&F.call(c,t)&&(s=!0)}),s},n=()=>{const{types:s}=t.dataTransfer;return s.some(c=>c==="Files")},a=d(),i=n();if(!a&&!i||this.opts.disabled||this.opts.disableLocalFiles&&(i||!a)||!this.uppy.getState().allowNewUpload){t.dataTransfer.dropEffect="none";return}t.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(t)});E(this,"handleDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(t)});E(this,"handleDrop",async t=>{t.preventDefault(),t.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(i=>{var s;i.type==="acquirer"&&((s=i.handleRootDrop)==null||s.call(i,t))});let d=!1;const n=i=>{this.uppy.log(i,"error"),d||(this.uppy.info(i.message,"error"),d=!0)};this.uppy.log("[Dashboard] Processing dropped files");const a=await xy(t.dataTransfer,{logDropError:n});a.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(a)),this.opts.onDrop(t)});E(this,"handleRequestThumbnail",t=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",t)});E(this,"handleCancelThumbnail",t=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",t)});E(this,"handleKeyDownInInline",t=>{t.keyCode===R2&&cz(t,this.getPluginState().activeOverlayType,this.el)});E(this,"handlePasteOnBody",t=>{this.el.contains(document.activeElement)&&this.handlePaste(t)});E(this,"handleComplete",({failed:t})=>{this.opts.closeAfterFinish&&!(t!=null&&t.length)&&this.requestCloseModal()});dl(this,Zs,()=>{if(this.opts.disableThumbnailGenerator)return;const t=600,d=this.uppy.getFiles();if(d.length===1){const n=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);n==null||n.setOptions({thumbnailWidth:t});const a={...d[0],preview:void 0};n==null||n.requestThumbnail(a).then(()=>{n==null||n.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}});dl(this,x0,t=>{const d=t[0],{metaFields:n}=this.getPluginState(),a=n&&n.length>0,i=this.canEditFile(d);a&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,d.id):i&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(d)});E(this,"initEvents",()=>{if(this.opts.trigger&&!this.opts.inline){const t=Ju(this.opts.trigger);t?t.forEach(d=>d.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",j(this,TU)),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",j(this,Zs)),this.uppy.on("file-removed",j(this,Zs)),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",j(this,x0))});E(this,"removeEvents",()=>{const t=Ju(this.opts.trigger);!this.opts.inline&&t&&t.forEach(d=>d.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",j(this,TU)),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",j(this,Zs)),this.uppy.off("file-removed",j(this,Zs)),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",j(this,x0))});E(this,"superFocusOnEachUpdate",()=>{const t=this.el.contains(document.activeElement),d=document.activeElement===document.body||document.activeElement===null,n=this.uppy.getState().info.length===0,a=!this.opts.inline;n&&(a||t||d&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()});E(this,"afterUpdate",()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()});E(this,"saveFileCard",(t,d)=>{this.uppy.setFileMeta(d,t),this.toggleFileCard(!1,d)});dl(this,JU,t=>{const d=this.uppy.getPlugin(t.id);return{...t,icon:d.icon||this.opts.defaultPickerIcon,render:d.render}});dl(this,aQ,t=>{const d=this.uppy.getPlugin(t.id);return typeof d.isSupported!="function"?!0:d.isSupported()});dl(this,iQ,t=>t.filter(d=>d.type==="acquirer"&&j(this,aQ).call(this,d)).map(j(this,JU)));dl(this,sQ,t=>t.filter(d=>d.type==="progressindicator").map(j(this,JU)));dl(this,Fs,t=>t.filter(d=>d.type==="editor").map(j(this,JU)));E(this,"render",t=>{const d=this.getPluginState(),{files:n,capabilities:a,allowNewUpload:i}=t,{newFiles:s,uploadStartedFiles:c,completeFiles:F,erroredFiles:h,inProgressFiles:o,inProgressNotPausedFiles:V,processingFiles:W,isUploadStarted:Q,isAllComplete:m,isAllPaused:R}=this.uppy.getObjectOfFilesPerState(),r=j(this,iQ).call(this,d.targets),b=j(this,sQ).call(this,d.targets),u=j(this,Fs).call(this,d.targets);let J;return this.opts.theme==="auto"?J=a.darkMode?"dark":"light":J=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}".`)),dz({state:t,isHidden:d.isHidden,files:n,newFiles:s,uploadStartedFiles:c,completeFiles:F,erroredFiles:h,inProgressFiles:o,inProgressNotPausedFiles:V,processingFiles:W,isUploadStarted:Q,isAllComplete:m,isAllPaused:R,totalFileCount:Object.keys(n).length,totalProgress:t.totalProgress,allowNewUpload:i,acquirers:r,theme:J,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:d.activePickerPanel,showFileEditor:d.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:d.isClosing,progressindicators:b,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:t.recoveredState,metaFields:d.metaFields,resumableUploads:a.resumableUploads||!1,individualCancellation:a.individualCancellation,isMobileDevice:a.isMobileDevice,fileCardFor:d.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:d.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:d.containerWidth,containerHeight:d.containerHeight,areInsidesReadyToBeVisible:d.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:d.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})});dl(this,cQ,()=>{const{plugins:t}=this.opts;t.forEach(d=>{const n=this.uppy.getPlugin(d);n?n.mount(this,n):this.uppy.log(`[Uppy] Dashboard could not find plugin '${d}', make sure to uppy.use() the plugins you are specifying`,"warning")})});dl(this,UQ,()=>{this.uppy.iteratePlugins(j(this,TU))});dl(this,TU,t=>{var n;const d=["acquirer","editor"];t&&!((n=t.opts)!=null&&n.target)&&d.includes(t.type)&&(this.getPluginState().targets.some(i=>t.id===i.id)||t.mount(this,t))});E(this,"install",()=>{var c;this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});const{inline:t,closeAfterFinish:d}=this.opts;if(t&&d)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.");const{allowMultipleUploads:n,allowMultipleUploadBatches:a}=this.uppy.opts;(n||a)&&d&&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");const{target:i}=this.opts;i&&this.mount(i,this),this.opts.disableThumbnailGenerator||this.uppy.use($p,{id:cl(this,Ia,Ru).call(this),...cl(this,Ia,mu).call(this)}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;const s=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;this.uppy.log(`[Dashboard] Dark mode is ${s?"on":"off"}`),this.setDarkModeCapability(s),this.opts.theme==="auto"&&((c=this.darkModeMediaQuery)==null||c.addListener(this.handleSystemDarkModeChange)),j(this,cQ).call(this),j(this,UQ).call(this),this.initEvents()});E(this,"uninstall",()=>{var d;if(!this.opts.disableThumbnailGenerator){const n=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);n&&this.uppy.removePlugin(n)}const{plugins:t}=this.opts;t.forEach(n=>{const a=this.uppy.getPlugin(n);a&&a.unmount()}),this.opts.theme==="auto"&&((d=this.darkModeMediaQuery)==null||d.removeListener(this.handleSystemDarkModeChange)),this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()});this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=nz,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),(a=this.opts).onRequestCloseModal??(a.onRequestCloseModal=()=>this.closeModal()),this.i18nInit()}setOptions(t){var d;super.setOptions(t),(d=this.uppy.getPlugin(cl(this,Ia,Ru).call(this)))==null||d.setOptions(cl(this,Ia,mu).call(this))}}SU=new WeakMap,Zs=new WeakMap,x0=new WeakMap,JU=new WeakMap,aQ=new WeakMap,iQ=new WeakMap,sQ=new WeakMap,Fs=new WeakMap,cQ=new WeakMap,UQ=new WeakMap,TU=new WeakMap,Ia=new WeakSet,mu=function(){const{thumbnailWidth:t,thumbnailHeight:d,thumbnailType:n,waitForThumbnailsBeforeUpload:a}=this.opts;return{thumbnailWidth:t,thumbnailHeight:d,thumbnailType:n,waitForThumbnailsBeforeUpload:a,lazy:!a}},Ru=function(){return`${this.id}:ThumbnailGenerator`},E(b2,"VERSION",qk.version);const Fz={version:"4.1.0"};/*!
27
27
  * Cropper.js v1.6.2
28
28
  * https://fengyuanchen.github.io/cropperjs
29
29
  *
@@ -32,9 +32,9 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${l.byteLength}`),l.tiff&&
32
32
  *
33
33
  * Date: 2024-04-21T07:43:05.335Z
34
34
  */function u2(e,l){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);l&&(d=d.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,d)}return t}function r2(e){for(var l=1;l<arguments.length;l++){var t=arguments[l]!=null?arguments[l]:{};l%2?u2(Object(t),!0).forEach(function(d){Wz(e,d,t[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u2(Object(t)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(t,d))})}return e}function hz(e,l){if(typeof e!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var d=t.call(e,l);if(typeof d!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function p2(e){var l=hz(e,"string");return typeof l=="symbol"?l:l+""}function Dm(e){"@babel/helpers - typeof";return Dm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},Dm(e)}function oz(e,l){if(!(e instanceof l))throw new TypeError("Cannot call a class as a function")}function M2(e,l){for(var t=0;t<l.length;t++){var d=l[t];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,p2(d.key),d)}}function Vz(e,l,t){return l&&M2(e.prototype,l),t&&M2(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Wz(e,l,t){return l=p2(l),l in e?Object.defineProperty(e,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[l]=t,e}function S2(e){return Qz(e)||mz(e)||Rz(e)||Nz()}function Qz(e){if(Array.isArray(e))return wm(e)}function mz(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Rz(e,l){if(e){if(typeof e=="string")return wm(e,l);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return wm(e,l)}}function wm(e,l){(l==null||l>e.length)&&(l=e.length);for(var t=0,d=new Array(l);t<l;t++)d[t]=e[t];return d}function Nz(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
35
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Nh=typeof window<"u"&&typeof window.document<"u",Nd=Nh?window:{},Em=Nh&&Nd.document.documentElement?"ontouchstart"in Nd.document.documentElement:!1,Cm=Nh?"PointerEvent"in Nd:!1,gl="cropper",xm="all",J2="crop",T2="move",G2="zoom",Oa="e",va="w",Js="s",Dn="n",lZ="ne",tZ="nw",eZ="se",dZ="sw",gm="".concat(gl,"-crop"),X2="".concat(gl,"-disabled"),ce="".concat(gl,"-hidden"),y2="".concat(gl,"-hide"),bz="".concat(gl,"-invisible"),bh="".concat(gl,"-modal"),jm="".concat(gl,"-move"),nZ="".concat(gl,"Action"),uh="".concat(gl,"Preview"),Om="crop",B2="move",Y2="none",vm="crop",Km="cropend",fm="cropmove",Hm="cropstart",k2="dblclick",uz=Em?"touchstart":"mousedown",rz=Em?"touchmove":"mousemove",pz=Em?"touchend touchcancel":"mouseup",z2=Cm?"pointerdown":uz,L2=Cm?"pointermove":rz,I2=Cm?"pointerup pointercancel":pz,D2="ready",w2="resize",E2="wheel",Pm="zoom",C2="image/jpeg",Mz=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Sz=/^data:/,Jz=/^data:image\/jpeg;base64,/,Tz=/^img|canvas$/i,x2=200,g2=100,j2={viewMode:0,dragMode:Om,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:x2,minContainerHeight:g2,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},Gz='<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>',Xz=Number.isNaN||Nd.isNaN;function Sl(e){return typeof e=="number"&&!Xz(e)}var O2=function(l){return l>0&&l<1/0};function Am(e){return typeof e>"u"}function Ka(e){return Dm(e)==="object"&&e!==null}var yz=Object.prototype.hasOwnProperty;function Ts(e){if(!Ka(e))return!1;try{var l=e.constructor,t=l.prototype;return l&&t&&yz.call(t,"isPrototypeOf")}catch{return!1}}function Ue(e){return typeof e=="function"}var Bz=Array.prototype.slice;function v2(e){return Array.from?Array.from(e):Bz.call(e)}function it(e,l){return e&&Ue(l)&&(Array.isArray(e)||Sl(e.length)?v2(e).forEach(function(t,d){l.call(e,t,d,e)}):Ka(e)&&Object.keys(e).forEach(function(t){l.call(e,e[t],t,e)})),e}var jl=Object.assign||function(l){for(var t=arguments.length,d=new Array(t>1?t-1:0),n=1;n<t;n++)d[n-1]=arguments[n];return Ka(l)&&d.length>0&&d.forEach(function(a){Ka(a)&&Object.keys(a).forEach(function(i){l[i]=a[i]})}),l},Yz=/\.\d*(?:0|9){12}\d*$/;function Gs(e){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Yz.test(e)?Math.round(e*l)/l:e}var kz=/^width|height|left|top|marginLeft|marginTop$/;function wn(e,l){var t=e.style;it(l,function(d,n){kz.test(n)&&Sl(d)&&(d="".concat(d,"px")),t[n]=d})}function zz(e,l){return e.classList?e.classList.contains(l):e.className.indexOf(l)>-1}function rt(e,l){if(l){if(Sl(e.length)){it(e,function(d){rt(d,l)});return}if(e.classList){e.classList.add(l);return}var t=e.className.trim();t?t.indexOf(l)<0&&(e.className="".concat(t," ").concat(l)):e.className=l}}function bd(e,l){if(l){if(Sl(e.length)){it(e,function(t){bd(t,l)});return}if(e.classList){e.classList.remove(l);return}e.className.indexOf(l)>=0&&(e.className=e.className.replace(l,""))}}function Xs(e,l,t){if(l){if(Sl(e.length)){it(e,function(d){Xs(d,l,t)});return}t?rt(e,l):bd(e,l)}}var Lz=/([a-z\d])([A-Z])/g;function _m(e){return e.replace(Lz,"$1-$2").toLowerCase()}function qm(e,l){return Ka(e[l])?e[l]:e.dataset?e.dataset[l]:e.getAttribute("data-".concat(_m(l)))}function aZ(e,l,t){Ka(t)?e[l]=t:e.dataset?e.dataset[l]=t:e.setAttribute("data-".concat(_m(l)),t)}function Iz(e,l){if(Ka(e[l]))try{delete e[l]}catch{e[l]=void 0}else if(e.dataset)try{delete e.dataset[l]}catch{e.dataset[l]=void 0}else e.removeAttribute("data-".concat(_m(l)))}var K2=/\s\s*/,f2=function(){var e=!1;if(Nh){var l=!1,t=function(){},d=Object.defineProperty({},"once",{get:function(){return e=!0,l},set:function(a){l=a}});Nd.addEventListener("test",t,d),Nd.removeEventListener("test",t,d)}return e}();function $e(e,l,t){var d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},n=t;l.trim().split(K2).forEach(function(a){if(!f2){var i=e.listeners;i&&i[a]&&i[a][t]&&(n=i[a][t],delete i[a][t],Object.keys(i[a]).length===0&&delete i[a],Object.keys(i).length===0&&delete e.listeners)}e.removeEventListener(a,n,d)})}function Ye(e,l,t){var d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},n=t;l.trim().split(K2).forEach(function(a){if(d.once&&!f2){var i=e.listeners,s=i===void 0?{}:i;n=function(){delete s[a][t],e.removeEventListener(a,n,d);for(var F=arguments.length,h=new Array(F),o=0;o<F;o++)h[o]=arguments[o];t.apply(e,h)},s[a]||(s[a]={}),s[a][t]&&e.removeEventListener(a,s[a][t],d),s[a][t]=n,e.listeners=s}e.addEventListener(a,n,d)})}function ys(e,l,t){var d;return Ue(Event)&&Ue(CustomEvent)?d=new CustomEvent(l,{detail:t,bubbles:!0,cancelable:!0}):(d=document.createEvent("CustomEvent"),d.initCustomEvent(l,!0,!0,t)),e.dispatchEvent(d)}function H2(e){var l=e.getBoundingClientRect();return{left:l.left+(window.pageXOffset-document.documentElement.clientLeft),top:l.top+(window.pageYOffset-document.documentElement.clientTop)}}var $m=Nd.location,Dz=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function P2(e){var l=e.match(Dz);return l!==null&&(l[1]!==$m.protocol||l[2]!==$m.hostname||l[3]!==$m.port)}function A2(e){var l="timestamp=".concat(new Date().getTime());return e+(e.indexOf("?")===-1?"?":"&")+l}function iZ(e){var l=e.rotate,t=e.scaleX,d=e.scaleY,n=e.translateX,a=e.translateY,i=[];Sl(n)&&n!==0&&i.push("translateX(".concat(n,"px)")),Sl(a)&&a!==0&&i.push("translateY(".concat(a,"px)")),Sl(l)&&l!==0&&i.push("rotate(".concat(l,"deg)")),Sl(t)&&t!==1&&i.push("scaleX(".concat(t,")")),Sl(d)&&d!==1&&i.push("scaleY(".concat(d,")"));var s=i.length?i.join(" "):"none";return{WebkitTransform:s,msTransform:s,transform:s}}function wz(e){var l=r2({},e),t=0;return it(e,function(d,n){delete l[n],it(l,function(a){var i=Math.abs(d.startX-a.startX),s=Math.abs(d.startY-a.startY),c=Math.abs(d.endX-a.endX),F=Math.abs(d.endY-a.endY),h=Math.sqrt(i*i+s*s),o=Math.sqrt(c*c+F*F),V=(o-h)/h;Math.abs(V)>Math.abs(t)&&(t=V)})}),t}function rh(e,l){var t=e.pageX,d=e.pageY,n={endX:t,endY:d};return l?n:r2({startX:t,startY:d},n)}function Ez(e){var l=0,t=0,d=0;return it(e,function(n){var a=n.startX,i=n.startY;l+=a,t+=i,d+=1}),l/=d,t/=d,{pageX:l,pageY:t}}function En(e){var l=e.aspectRatio,t=e.height,d=e.width,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",a=O2(d),i=O2(t);if(a&&i){var s=t*l;n==="contain"&&s>d||n==="cover"&&s<d?t=d/l:d=t*l}else a?t=d/l:i&&(d=t*l);return{width:d,height:t}}function Cz(e){var l=e.width,t=e.height,d=e.degree;if(d=Math.abs(d)%180,d===90)return{width:t,height:l};var n=d%90*Math.PI/180,a=Math.sin(n),i=Math.cos(n),s=l*i+t*a,c=l*a+t*i;return d>90?{width:c,height:s}:{width:s,height:c}}function xz(e,l,t,d){var n=l.aspectRatio,a=l.naturalWidth,i=l.naturalHeight,s=l.rotate,c=s===void 0?0:s,F=l.scaleX,h=F===void 0?1:F,o=l.scaleY,V=o===void 0?1:o,W=t.aspectRatio,Q=t.naturalWidth,m=t.naturalHeight,R=d.fillColor,r=R===void 0?"transparent":R,b=d.imageSmoothingEnabled,u=b===void 0?!0:b,J=d.imageSmoothingQuality,G=J===void 0?"low":J,T=d.maxWidth,y=T===void 0?1/0:T,k=d.maxHeight,X=k===void 0?1/0:k,L=d.minWidth,D=L===void 0?0:L,C=d.minHeight,I=C===void 0?0:C,P=document.createElement("canvas"),H=P.getContext("2d"),Y=En({aspectRatio:W,width:y,height:X}),B=En({aspectRatio:W,width:D,height:I},"cover"),z=Math.min(Y.width,Math.max(B.width,Q)),g=Math.min(Y.height,Math.max(B.height,m)),w=En({aspectRatio:n,width:y,height:X}),O=En({aspectRatio:n,width:D,height:I},"cover"),f=Math.min(w.width,Math.max(O.width,a)),x=Math.min(w.height,Math.max(O.height,i)),A=[-f/2,-x/2,f,x];return P.width=Gs(z),P.height=Gs(g),H.fillStyle=r,H.fillRect(0,0,z,g),H.save(),H.translate(z/2,g/2),H.rotate(c*Math.PI/180),H.scale(h,V),H.imageSmoothingEnabled=u,H.imageSmoothingQuality=G,H.drawImage.apply(H,[e].concat(S2(A.map(function(al){return Math.floor(Gs(al))})))),H.restore(),P}var _2=String.fromCharCode;function gz(e,l,t){var d="";t+=l;for(var n=l;n<t;n+=1)d+=_2(e.getUint8(n));return d}var jz=/^data:.*,/;function Oz(e){var l=e.replace(jz,""),t=atob(l),d=new ArrayBuffer(t.length),n=new Uint8Array(d);return it(n,function(a,i){n[i]=t.charCodeAt(i)}),d}function vz(e,l){for(var t=[],d=8192,n=new Uint8Array(e);n.length>0;)t.push(_2.apply(null,v2(n.subarray(0,d)))),n=n.subarray(d);return"data:".concat(l,";base64,").concat(btoa(t.join("")))}function Kz(e){var l=new DataView(e),t;try{var d,n,a;if(l.getUint8(0)===255&&l.getUint8(1)===216)for(var i=l.byteLength,s=2;s+1<i;){if(l.getUint8(s)===255&&l.getUint8(s+1)===225){n=s;break}s+=1}if(n){var c=n+4,F=n+10;if(gz(l,c,4)==="Exif"){var h=l.getUint16(F);if(d=h===18761,(d||h===19789)&&l.getUint16(F+2,d)===42){var o=l.getUint32(F+4,d);o>=8&&(a=F+o)}}}if(a){var V=l.getUint16(a,d),W,Q;for(Q=0;Q<V;Q+=1)if(W=a+Q*12+2,l.getUint16(W,d)===274){W+=8,t=l.getUint16(W,d),l.setUint16(W,1,d);break}}}catch{t=1}return t}function fz(e){var l=0,t=1,d=1;switch(e){case 2:t=-1;break;case 3:l=-180;break;case 4:d=-1;break;case 5:l=90,d=-1;break;case 6:l=90;break;case 7:l=90,t=-1;break;case 8:l=-90;break}return{rotate:l,scaleX:t,scaleY:d}}var Hz={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var l=this.element,t=this.options,d=this.container,n=this.cropper,a=Number(t.minContainerWidth),i=Number(t.minContainerHeight);rt(n,ce),bd(l,ce);var s={width:Math.max(d.offsetWidth,a>=0?a:x2),height:Math.max(d.offsetHeight,i>=0?i:g2)};this.containerData=s,wn(n,{width:s.width,height:s.height}),rt(l,ce),bd(n,ce)},initCanvas:function(){var l=this.containerData,t=this.imageData,d=this.options.viewMode,n=Math.abs(t.rotate)%180===90,a=n?t.naturalHeight:t.naturalWidth,i=n?t.naturalWidth:t.naturalHeight,s=a/i,c=l.width,F=l.height;l.height*s>l.width?d===3?c=l.height*s:F=l.width/s:d===3?F=l.width/s:c=l.height*s;var h={aspectRatio:s,naturalWidth:a,naturalHeight:i,width:c,height:F};this.canvasData=h,this.limited=d===1||d===2,this.limitCanvas(!0,!0),h.width=Math.min(Math.max(h.width,h.minWidth),h.maxWidth),h.height=Math.min(Math.max(h.height,h.minHeight),h.maxHeight),h.left=(l.width-h.width)/2,h.top=(l.height-h.height)/2,h.oldLeft=h.left,h.oldTop=h.top,this.initialCanvasData=jl({},h)},limitCanvas:function(l,t){var d=this.options,n=this.containerData,a=this.canvasData,i=this.cropBoxData,s=d.viewMode,c=a.aspectRatio,F=this.cropped&&i;if(l){var h=Number(d.minCanvasWidth)||0,o=Number(d.minCanvasHeight)||0;s>1?(h=Math.max(h,n.width),o=Math.max(o,n.height),s===3&&(o*c>h?h=o*c:o=h/c)):s>0&&(h?h=Math.max(h,F?i.width:0):o?o=Math.max(o,F?i.height:0):F&&(h=i.width,o=i.height,o*c>h?h=o*c:o=h/c));var V=En({aspectRatio:c,width:h,height:o});h=V.width,o=V.height,a.minWidth=h,a.minHeight=o,a.maxWidth=1/0,a.maxHeight=1/0}if(t)if(s>(F?0:1)){var W=n.width-a.width,Q=n.height-a.height;a.minLeft=Math.min(0,W),a.minTop=Math.min(0,Q),a.maxLeft=Math.max(0,W),a.maxTop=Math.max(0,Q),F&&this.limited&&(a.minLeft=Math.min(i.left,i.left+(i.width-a.width)),a.minTop=Math.min(i.top,i.top+(i.height-a.height)),a.maxLeft=i.left,a.maxTop=i.top,s===2&&(a.width>=n.width&&(a.minLeft=Math.min(0,W),a.maxLeft=Math.max(0,W)),a.height>=n.height&&(a.minTop=Math.min(0,Q),a.maxTop=Math.max(0,Q))))}else a.minLeft=-a.width,a.minTop=-a.height,a.maxLeft=n.width,a.maxTop=n.height},renderCanvas:function(l,t){var d=this.canvasData,n=this.imageData;if(t){var a=Cz({width:n.naturalWidth*Math.abs(n.scaleX||1),height:n.naturalHeight*Math.abs(n.scaleY||1),degree:n.rotate||0}),i=a.width,s=a.height,c=d.width*(i/d.naturalWidth),F=d.height*(s/d.naturalHeight);d.left-=(c-d.width)/2,d.top-=(F-d.height)/2,d.width=c,d.height=F,d.aspectRatio=i/s,d.naturalWidth=i,d.naturalHeight=s,this.limitCanvas(!0,!1)}(d.width>d.maxWidth||d.width<d.minWidth)&&(d.left=d.oldLeft),(d.height>d.maxHeight||d.height<d.minHeight)&&(d.top=d.oldTop),d.width=Math.min(Math.max(d.width,d.minWidth),d.maxWidth),d.height=Math.min(Math.max(d.height,d.minHeight),d.maxHeight),this.limitCanvas(!1,!0),d.left=Math.min(Math.max(d.left,d.minLeft),d.maxLeft),d.top=Math.min(Math.max(d.top,d.minTop),d.maxTop),d.oldLeft=d.left,d.oldTop=d.top,wn(this.canvas,jl({width:d.width,height:d.height},iZ({translateX:d.left,translateY:d.top}))),this.renderImage(l),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(l){var t=this.canvasData,d=this.imageData,n=d.naturalWidth*(t.width/t.naturalWidth),a=d.naturalHeight*(t.height/t.naturalHeight);jl(d,{width:n,height:a,left:(t.width-n)/2,top:(t.height-a)/2}),wn(this.image,jl({width:d.width,height:d.height},iZ(jl({translateX:d.left,translateY:d.top},d)))),l&&this.output()},initCropBox:function(){var l=this.options,t=this.canvasData,d=l.aspectRatio||l.initialAspectRatio,n=Number(l.autoCropArea)||.8,a={width:t.width,height:t.height};d&&(t.height*d>t.width?a.height=a.width/d:a.width=a.height*d),this.cropBoxData=a,this.limitCropBox(!0,!0),a.width=Math.min(Math.max(a.width,a.minWidth),a.maxWidth),a.height=Math.min(Math.max(a.height,a.minHeight),a.maxHeight),a.width=Math.max(a.minWidth,a.width*n),a.height=Math.max(a.minHeight,a.height*n),a.left=t.left+(t.width-a.width)/2,a.top=t.top+(t.height-a.height)/2,a.oldLeft=a.left,a.oldTop=a.top,this.initialCropBoxData=jl({},a)},limitCropBox:function(l,t){var d=this.options,n=this.containerData,a=this.canvasData,i=this.cropBoxData,s=this.limited,c=d.aspectRatio;if(l){var F=Number(d.minCropBoxWidth)||0,h=Number(d.minCropBoxHeight)||0,o=s?Math.min(n.width,a.width,a.width+a.left,n.width-a.left):n.width,V=s?Math.min(n.height,a.height,a.height+a.top,n.height-a.top):n.height;F=Math.min(F,n.width),h=Math.min(h,n.height),c&&(F&&h?h*c>F?h=F/c:F=h*c:F?h=F/c:h&&(F=h*c),V*c>o?V=o/c:o=V*c),i.minWidth=Math.min(F,o),i.minHeight=Math.min(h,V),i.maxWidth=o,i.maxHeight=V}t&&(s?(i.minLeft=Math.max(0,a.left),i.minTop=Math.max(0,a.top),i.maxLeft=Math.min(n.width,a.left+a.width)-i.width,i.maxTop=Math.min(n.height,a.top+a.height)-i.height):(i.minLeft=0,i.minTop=0,i.maxLeft=n.width-i.width,i.maxTop=n.height-i.height))},renderCropBox:function(){var l=this.options,t=this.containerData,d=this.cropBoxData;(d.width>d.maxWidth||d.width<d.minWidth)&&(d.left=d.oldLeft),(d.height>d.maxHeight||d.height<d.minHeight)&&(d.top=d.oldTop),d.width=Math.min(Math.max(d.width,d.minWidth),d.maxWidth),d.height=Math.min(Math.max(d.height,d.minHeight),d.maxHeight),this.limitCropBox(!1,!0),d.left=Math.min(Math.max(d.left,d.minLeft),d.maxLeft),d.top=Math.min(Math.max(d.top,d.minTop),d.maxTop),d.oldLeft=d.left,d.oldTop=d.top,l.movable&&l.cropBoxMovable&&aZ(this.face,nZ,d.width>=t.width&&d.height>=t.height?T2:xm),wn(this.cropBox,jl({width:d.width,height:d.height},iZ({translateX:d.left,translateY:d.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),ys(this.element,vm,this.getData())}},Pz={initPreview:function(){var l=this.element,t=this.crossOrigin,d=this.options.preview,n=t?this.crossOriginUrl:this.url,a=l.alt||"The image to preview",i=document.createElement("img");if(t&&(i.crossOrigin=t),i.src=n,i.alt=a,this.viewBox.appendChild(i),this.viewBoxImage=i,!!d){var s=d;typeof d=="string"?s=l.ownerDocument.querySelectorAll(d):d.querySelector&&(s=[d]),this.previews=s,it(s,function(c){var F=document.createElement("img");aZ(c,uh,{width:c.offsetWidth,height:c.offsetHeight,html:c.innerHTML}),t&&(F.crossOrigin=t),F.src=n,F.alt=a,F.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;"',c.innerHTML="",c.appendChild(F)})}},resetPreview:function(){it(this.previews,function(l){var t=qm(l,uh);wn(l,{width:t.width,height:t.height}),l.innerHTML=t.html,Iz(l,uh)})},preview:function(){var l=this.imageData,t=this.canvasData,d=this.cropBoxData,n=d.width,a=d.height,i=l.width,s=l.height,c=d.left-t.left-l.left,F=d.top-t.top-l.top;!this.cropped||this.disabled||(wn(this.viewBoxImage,jl({width:i,height:s},iZ(jl({translateX:-c,translateY:-F},l)))),it(this.previews,function(h){var o=qm(h,uh),V=o.width,W=o.height,Q=V,m=W,R=1;n&&(R=V/n,m=a*R),a&&m>W&&(R=W/a,Q=n*R,m=W),wn(h,{width:Q,height:m}),wn(h.getElementsByTagName("img")[0],jl({width:i*R,height:s*R},iZ(jl({translateX:-c*R,translateY:-F*R},l))))}))}},Az={bind:function(){var l=this.element,t=this.options,d=this.cropper;Ue(t.cropstart)&&Ye(l,Hm,t.cropstart),Ue(t.cropmove)&&Ye(l,fm,t.cropmove),Ue(t.cropend)&&Ye(l,Km,t.cropend),Ue(t.crop)&&Ye(l,vm,t.crop),Ue(t.zoom)&&Ye(l,Pm,t.zoom),Ye(d,z2,this.onCropStart=this.cropStart.bind(this)),t.zoomable&&t.zoomOnWheel&&Ye(d,E2,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&Ye(d,k2,this.onDblclick=this.dblclick.bind(this)),Ye(l.ownerDocument,L2,this.onCropMove=this.cropMove.bind(this)),Ye(l.ownerDocument,I2,this.onCropEnd=this.cropEnd.bind(this)),t.responsive&&Ye(window,w2,this.onResize=this.resize.bind(this))},unbind:function(){var l=this.element,t=this.options,d=this.cropper;Ue(t.cropstart)&&$e(l,Hm,t.cropstart),Ue(t.cropmove)&&$e(l,fm,t.cropmove),Ue(t.cropend)&&$e(l,Km,t.cropend),Ue(t.crop)&&$e(l,vm,t.crop),Ue(t.zoom)&&$e(l,Pm,t.zoom),$e(d,z2,this.onCropStart),t.zoomable&&t.zoomOnWheel&&$e(d,E2,this.onWheel,{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&$e(d,k2,this.onDblclick),$e(l.ownerDocument,L2,this.onCropMove),$e(l.ownerDocument,I2,this.onCropEnd),t.responsive&&$e(window,w2,this.onResize)}},_z={resize:function(){if(!this.disabled){var l=this.options,t=this.container,d=this.containerData,n=t.offsetWidth/d.width,a=t.offsetHeight/d.height,i=Math.abs(n-1)>Math.abs(a-1)?n:a;if(i!==1){var s,c;l.restore&&(s=this.getCanvasData(),c=this.getCropBoxData()),this.render(),l.restore&&(this.setCanvasData(it(s,function(F,h){s[h]=F*i})),this.setCropBoxData(it(c,function(F,h){c[h]=F*i})))}}},dblclick:function(){this.disabled||this.options.dragMode===Y2||this.setDragMode(zz(this.dragBox,gm)?B2:Om)},wheel:function(l){var t=this,d=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(l.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){t.wheeling=!1},50),l.deltaY?n=l.deltaY>0?1:-1:l.wheelDelta?n=-l.wheelDelta/120:l.detail&&(n=l.detail>0?1:-1),this.zoom(-n*d,l)))},cropStart:function(l){var t=l.buttons,d=l.button;if(!(this.disabled||(l.type==="mousedown"||l.type==="pointerdown"&&l.pointerType==="mouse")&&(Sl(t)&&t!==1||Sl(d)&&d!==0||l.ctrlKey))){var n=this.options,a=this.pointers,i;l.changedTouches?it(l.changedTouches,function(s){a[s.identifier]=rh(s)}):a[l.pointerId||0]=rh(l),Object.keys(a).length>1&&n.zoomable&&n.zoomOnTouch?i=G2:i=qm(l.target,nZ),Mz.test(i)&&ys(this.element,Hm,{originalEvent:l,action:i})!==!1&&(l.preventDefault(),this.action=i,this.cropping=!1,i===J2&&(this.cropping=!0,rt(this.dragBox,bh)))}},cropMove:function(l){var t=this.action;if(!(this.disabled||!t)){var d=this.pointers;l.preventDefault(),ys(this.element,fm,{originalEvent:l,action:t})!==!1&&(l.changedTouches?it(l.changedTouches,function(n){jl(d[n.identifier]||{},rh(n,!0))}):jl(d[l.pointerId||0]||{},rh(l,!0)),this.change(l))}},cropEnd:function(l){if(!this.disabled){var t=this.action,d=this.pointers;l.changedTouches?it(l.changedTouches,function(n){delete d[n.identifier]}):delete d[l.pointerId||0],t&&(l.preventDefault(),Object.keys(d).length||(this.action=""),this.cropping&&(this.cropping=!1,Xs(this.dragBox,bh,this.cropped&&this.options.modal)),ys(this.element,Km,{originalEvent:l,action:t}))}}},qz={change:function(l){var t=this.options,d=this.canvasData,n=this.containerData,a=this.cropBoxData,i=this.pointers,s=this.action,c=t.aspectRatio,F=a.left,h=a.top,o=a.width,V=a.height,W=F+o,Q=h+V,m=0,R=0,r=n.width,b=n.height,u=!0,J;!c&&l.shiftKey&&(c=o&&V?o/V:1),this.limited&&(m=a.minLeft,R=a.minTop,r=m+Math.min(n.width,d.width,d.left+d.width),b=R+Math.min(n.height,d.height,d.top+d.height));var G=i[Object.keys(i)[0]],T={x:G.endX-G.startX,y:G.endY-G.startY},y=function(X){switch(X){case Oa:W+T.x>r&&(T.x=r-W);break;case va:F+T.x<m&&(T.x=m-F);break;case Dn:h+T.y<R&&(T.y=R-h);break;case Js:Q+T.y>b&&(T.y=b-Q);break}};switch(s){case xm:F+=T.x,h+=T.y;break;case Oa:if(T.x>=0&&(W>=r||c&&(h<=R||Q>=b))){u=!1;break}y(Oa),o+=T.x,o<0&&(s=va,o=-o,F-=o),c&&(V=o/c,h+=(a.height-V)/2);break;case Dn:if(T.y<=0&&(h<=R||c&&(F<=m||W>=r))){u=!1;break}y(Dn),V-=T.y,h+=T.y,V<0&&(s=Js,V=-V,h-=V),c&&(o=V*c,F+=(a.width-o)/2);break;case va:if(T.x<=0&&(F<=m||c&&(h<=R||Q>=b))){u=!1;break}y(va),o-=T.x,F+=T.x,o<0&&(s=Oa,o=-o,F-=o),c&&(V=o/c,h+=(a.height-V)/2);break;case Js:if(T.y>=0&&(Q>=b||c&&(F<=m||W>=r))){u=!1;break}y(Js),V+=T.y,V<0&&(s=Dn,V=-V,h-=V),c&&(o=V*c,F+=(a.width-o)/2);break;case lZ:if(c){if(T.y<=0&&(h<=R||W>=r)){u=!1;break}y(Dn),V-=T.y,h+=T.y,o=V*c}else y(Dn),y(Oa),T.x>=0?W<r?o+=T.x:T.y<=0&&h<=R&&(u=!1):o+=T.x,T.y<=0?h>R&&(V-=T.y,h+=T.y):(V-=T.y,h+=T.y);o<0&&V<0?(s=dZ,V=-V,o=-o,h-=V,F-=o):o<0?(s=tZ,o=-o,F-=o):V<0&&(s=eZ,V=-V,h-=V);break;case tZ:if(c){if(T.y<=0&&(h<=R||F<=m)){u=!1;break}y(Dn),V-=T.y,h+=T.y,o=V*c,F+=a.width-o}else y(Dn),y(va),T.x<=0?F>m?(o-=T.x,F+=T.x):T.y<=0&&h<=R&&(u=!1):(o-=T.x,F+=T.x),T.y<=0?h>R&&(V-=T.y,h+=T.y):(V-=T.y,h+=T.y);o<0&&V<0?(s=eZ,V=-V,o=-o,h-=V,F-=o):o<0?(s=lZ,o=-o,F-=o):V<0&&(s=dZ,V=-V,h-=V);break;case dZ:if(c){if(T.x<=0&&(F<=m||Q>=b)){u=!1;break}y(va),o-=T.x,F+=T.x,V=o/c}else y(Js),y(va),T.x<=0?F>m?(o-=T.x,F+=T.x):T.y>=0&&Q>=b&&(u=!1):(o-=T.x,F+=T.x),T.y>=0?Q<b&&(V+=T.y):V+=T.y;o<0&&V<0?(s=lZ,V=-V,o=-o,h-=V,F-=o):o<0?(s=eZ,o=-o,F-=o):V<0&&(s=tZ,V=-V,h-=V);break;case eZ:if(c){if(T.x>=0&&(W>=r||Q>=b)){u=!1;break}y(Oa),o+=T.x,V=o/c}else y(Js),y(Oa),T.x>=0?W<r?o+=T.x:T.y>=0&&Q>=b&&(u=!1):o+=T.x,T.y>=0?Q<b&&(V+=T.y):V+=T.y;o<0&&V<0?(s=tZ,V=-V,o=-o,h-=V,F-=o):o<0?(s=dZ,o=-o,F-=o):V<0&&(s=lZ,V=-V,h-=V);break;case T2:this.move(T.x,T.y),u=!1;break;case G2:this.zoom(wz(i),l),u=!1;break;case J2:if(!T.x||!T.y){u=!1;break}J=H2(this.cropper),F=G.startX-J.left,h=G.startY-J.top,o=a.minWidth,V=a.minHeight,T.x>0?s=T.y>0?eZ:lZ:T.x<0&&(F-=o,s=T.y>0?dZ:tZ),T.y<0&&(h-=V),this.cropped||(bd(this.cropBox,ce),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}u&&(a.width=o,a.height=V,a.left=F,a.top=h,this.action=s,this.renderCropBox()),it(i,function(k){k.startX=k.endX,k.startY=k.endY})}},$z={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&rt(this.dragBox,bh),bd(this.cropBox,ce),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=jl({},this.initialImageData),this.canvasData=jl({},this.initialCanvasData),this.cropBoxData=jl({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(jl(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),bd(this.dragBox,bh),rt(this.cropBox,ce)),this},replace:function(l){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&l&&(this.isImg&&(this.element.src=l),t?(this.url=l,this.image.src=l,this.ready&&(this.viewBoxImage.src=l,it(this.previews,function(d){d.getElementsByTagName("img")[0].src=l}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(l))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,bd(this.cropper,X2)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,rt(this.cropper,X2)),this},destroy:function(){var l=this.element;return l[gl]?(l[gl]=void 0,this.isImg&&this.replaced&&(l.src=this.originalUrl),this.uncreate(),this):this},move:function(l){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l,d=this.canvasData,n=d.left,a=d.top;return this.moveTo(Am(l)?l:n+Number(l),Am(t)?t:a+Number(t))},moveTo:function(l){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l,d=this.canvasData,n=!1;return l=Number(l),t=Number(t),this.ready&&!this.disabled&&this.options.movable&&(Sl(l)&&(d.left=l,n=!0),Sl(t)&&(d.top=t,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(l,t){var d=this.canvasData;return l=Number(l),l<0?l=1/(1-l):l=1+l,this.zoomTo(d.width*l/d.naturalWidth,null,t)},zoomTo:function(l,t,d){var n=this.options,a=this.canvasData,i=a.width,s=a.height,c=a.naturalWidth,F=a.naturalHeight;if(l=Number(l),l>=0&&this.ready&&!this.disabled&&n.zoomable){var h=c*l,o=F*l;if(ys(this.element,Pm,{ratio:l,oldRatio:i/c,originalEvent:d})===!1)return this;if(d){var V=this.pointers,W=H2(this.cropper),Q=V&&Object.keys(V).length?Ez(V):{pageX:d.pageX,pageY:d.pageY};a.left-=(h-i)*((Q.pageX-W.left-a.left)/i),a.top-=(o-s)*((Q.pageY-W.top-a.top)/s)}else Ts(t)&&Sl(t.x)&&Sl(t.y)?(a.left-=(h-i)*((t.x-a.left)/i),a.top-=(o-s)*((t.y-a.top)/s)):(a.left-=(h-i)/2,a.top-=(o-s)/2);a.width=h,a.height=o,this.renderCanvas(!0)}return this},rotate:function(l){return this.rotateTo((this.imageData.rotate||0)+Number(l))},rotateTo:function(l){return l=Number(l),Sl(l)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=l%360,this.renderCanvas(!0,!0)),this},scaleX:function(l){var t=this.imageData.scaleY;return this.scale(l,Sl(t)?t:1)},scaleY:function(l){var t=this.imageData.scaleX;return this.scale(Sl(t)?t:1,l)},scale:function(l){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l,d=this.imageData,n=!1;return l=Number(l),t=Number(t),this.ready&&!this.disabled&&this.options.scalable&&(Sl(l)&&(d.scaleX=l,n=!0),Sl(t)&&(d.scaleY=t,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.options,d=this.imageData,n=this.canvasData,a=this.cropBoxData,i;if(this.ready&&this.cropped){i={x:a.left-n.left,y:a.top-n.top,width:a.width,height:a.height};var s=d.width/d.naturalWidth;if(it(i,function(h,o){i[o]=h/s}),l){var c=Math.round(i.y+i.height),F=Math.round(i.x+i.width);i.x=Math.round(i.x),i.y=Math.round(i.y),i.width=F-i.x,i.height=c-i.y}}else i={x:0,y:0,width:0,height:0};return t.rotatable&&(i.rotate=d.rotate||0),t.scalable&&(i.scaleX=d.scaleX||1,i.scaleY=d.scaleY||1),i},setData:function(l){var t=this.options,d=this.imageData,n=this.canvasData,a={};if(this.ready&&!this.disabled&&Ts(l)){var i=!1;t.rotatable&&Sl(l.rotate)&&l.rotate!==d.rotate&&(d.rotate=l.rotate,i=!0),t.scalable&&(Sl(l.scaleX)&&l.scaleX!==d.scaleX&&(d.scaleX=l.scaleX,i=!0),Sl(l.scaleY)&&l.scaleY!==d.scaleY&&(d.scaleY=l.scaleY,i=!0)),i&&this.renderCanvas(!0,!0);var s=d.width/d.naturalWidth;Sl(l.x)&&(a.left=l.x*s+n.left),Sl(l.y)&&(a.top=l.y*s+n.top),Sl(l.width)&&(a.width=l.width*s),Sl(l.height)&&(a.height=l.height*s),this.setCropBoxData(a)}return this},getContainerData:function(){return this.ready?jl({},this.containerData):{}},getImageData:function(){return this.sized?jl({},this.imageData):{}},getCanvasData:function(){var l=this.canvasData,t={};return this.ready&&it(["left","top","width","height","naturalWidth","naturalHeight"],function(d){t[d]=l[d]}),t},setCanvasData:function(l){var t=this.canvasData,d=t.aspectRatio;return this.ready&&!this.disabled&&Ts(l)&&(Sl(l.left)&&(t.left=l.left),Sl(l.top)&&(t.top=l.top),Sl(l.width)?(t.width=l.width,t.height=l.width/d):Sl(l.height)&&(t.height=l.height,t.width=l.height*d),this.renderCanvas(!0)),this},getCropBoxData:function(){var l=this.cropBoxData,t;return this.ready&&this.cropped&&(t={left:l.left,top:l.top,width:l.width,height:l.height}),t||{}},setCropBoxData:function(l){var t=this.cropBoxData,d=this.options.aspectRatio,n,a;return this.ready&&this.cropped&&!this.disabled&&Ts(l)&&(Sl(l.left)&&(t.left=l.left),Sl(l.top)&&(t.top=l.top),Sl(l.width)&&l.width!==t.width&&(n=!0,t.width=l.width),Sl(l.height)&&l.height!==t.height&&(a=!0,t.height=l.height),d&&(n?t.height=t.width/d:a&&(t.width=t.height*d)),this.renderCropBox()),this},getCroppedCanvas:function(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var t=this.canvasData,d=xz(this.image,this.imageData,t,l);if(!this.cropped)return d;var n=this.getData(l.rounded),a=n.x,i=n.y,s=n.width,c=n.height,F=d.width/Math.floor(t.naturalWidth);F!==1&&(a*=F,i*=F,s*=F,c*=F);var h=s/c,o=En({aspectRatio:h,width:l.maxWidth||1/0,height:l.maxHeight||1/0}),V=En({aspectRatio:h,width:l.minWidth||0,height:l.minHeight||0},"cover"),W=En({aspectRatio:h,width:l.width||(F!==1?d.width:s),height:l.height||(F!==1?d.height:c)}),Q=W.width,m=W.height;Q=Math.min(o.width,Math.max(V.width,Q)),m=Math.min(o.height,Math.max(V.height,m));var R=document.createElement("canvas"),r=R.getContext("2d");R.width=Gs(Q),R.height=Gs(m),r.fillStyle=l.fillColor||"transparent",r.fillRect(0,0,Q,m);var b=l.imageSmoothingEnabled,u=b===void 0?!0:b,J=l.imageSmoothingQuality;r.imageSmoothingEnabled=u,J&&(r.imageSmoothingQuality=J);var G=d.width,T=d.height,y=a,k=i,X,L,D,C,I,P;y<=-s||y>G?(y=0,X=0,D=0,I=0):y<=0?(D=-y,y=0,X=Math.min(G,s+y),I=X):y<=G&&(D=0,X=Math.min(s,G-y),I=X),X<=0||k<=-c||k>T?(k=0,L=0,C=0,P=0):k<=0?(C=-k,k=0,L=Math.min(T,c+k),P=L):k<=T&&(C=0,L=Math.min(c,T-k),P=L);var H=[y,k,X,L];if(I>0&&P>0){var Y=Q/s;H.push(D*Y,C*Y,I*Y,P*Y)}return r.drawImage.apply(r,[d].concat(S2(H.map(function(B){return Math.floor(Gs(B))})))),R},setAspectRatio:function(l){var t=this.options;return!this.disabled&&!Am(l)&&(t.aspectRatio=Math.max(0,l)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(l){var t=this.options,d=this.dragBox,n=this.face;if(this.ready&&!this.disabled){var a=l===Om,i=t.movable&&l===B2;l=a||i?l:Y2,t.dragMode=l,aZ(d,nZ,l),Xs(d,gm,a),Xs(d,jm,i),t.cropBoxMovable||(aZ(n,nZ,l),Xs(n,gm,a),Xs(n,jm,i))}return this}},lL=Nd.Cropper,q2=function(){function e(l){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(oz(this,e),!l||!Tz.test(l.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=l,this.options=jl({},j2,Ts(t)&&t),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 Vz(e,[{key:"init",value:function(){var t=this.element,d=t.tagName.toLowerCase(),n;if(!t[gl]){if(t[gl]=this,d==="img"){if(this.isImg=!0,n=t.getAttribute("src")||"",this.originalUrl=n,!n)return;n=t.src}else d==="canvas"&&window.HTMLCanvasElement&&(n=t.toDataURL());this.load(n)}}},{key:"load",value:function(t){var d=this;if(t){this.url=t,this.imageData={};var n=this.element,a=this.options;if(!a.rotatable&&!a.scalable&&(a.checkOrientation=!1),!a.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Sz.test(t)){Jz.test(t)?this.read(Oz(t)):this.clone();return}var i=new XMLHttpRequest,s=this.clone.bind(this);this.reloading=!0,this.xhr=i,i.onabort=s,i.onerror=s,i.ontimeout=s,i.onprogress=function(){i.getResponseHeader("content-type")!==C2&&i.abort()},i.onload=function(){d.read(i.response)},i.onloadend=function(){d.reloading=!1,d.xhr=null},a.checkCrossOrigin&&P2(t)&&n.crossOrigin&&(t=A2(t)),i.open("GET",t,!0),i.responseType="arraybuffer",i.withCredentials=n.crossOrigin==="use-credentials",i.send()}}},{key:"read",value:function(t){var d=this.options,n=this.imageData,a=Kz(t),i=0,s=1,c=1;if(a>1){this.url=vz(t,C2);var F=fz(a);i=F.rotate,s=F.scaleX,c=F.scaleY}d.rotatable&&(n.rotate=i),d.scalable&&(n.scaleX=s,n.scaleY=c),this.clone()}},{key:"clone",value:function(){var t=this.element,d=this.url,n=t.crossOrigin,a=d;this.options.checkCrossOrigin&&P2(d)&&(n||(n="anonymous"),a=A2(d)),this.crossOrigin=n,this.crossOriginUrl=a;var i=document.createElement("img");n&&(i.crossOrigin=n),i.src=a||d,i.alt=t.alt||"The image to crop",this.image=i,i.onload=this.start.bind(this),i.onerror=this.stop.bind(this),rt(i,y2),t.parentNode.insertBefore(i,t.nextSibling)}},{key:"start",value:function(){var t=this,d=this.image;d.onload=null,d.onerror=null,this.sizing=!0;var n=Nd.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(Nd.navigator.userAgent),a=function(F,h){jl(t.imageData,{naturalWidth:F,naturalHeight:h,aspectRatio:F/h}),t.initialImageData=jl({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(d.naturalWidth&&!n){a(d.naturalWidth,d.naturalHeight);return}var i=document.createElement("img"),s=document.body||document.documentElement;this.sizingImage=i,i.onload=function(){a(i.width,i.height),n||s.removeChild(i)},i.src=d.src,n||(i.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;",s.appendChild(i))}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var t=this.element,d=this.options,n=this.image,a=t.parentNode,i=document.createElement("div");i.innerHTML=Gz;var s=i.querySelector(".".concat(gl,"-container")),c=s.querySelector(".".concat(gl,"-canvas")),F=s.querySelector(".".concat(gl,"-drag-box")),h=s.querySelector(".".concat(gl,"-crop-box")),o=h.querySelector(".".concat(gl,"-face"));this.container=a,this.cropper=s,this.canvas=c,this.dragBox=F,this.cropBox=h,this.viewBox=s.querySelector(".".concat(gl,"-view-box")),this.face=o,c.appendChild(n),rt(t,ce),a.insertBefore(s,t.nextSibling),bd(n,y2),this.initPreview(),this.bind(),d.initialAspectRatio=Math.max(0,d.initialAspectRatio)||NaN,d.aspectRatio=Math.max(0,d.aspectRatio)||NaN,d.viewMode=Math.max(0,Math.min(3,Math.round(d.viewMode)))||0,rt(h,ce),d.guides||rt(h.getElementsByClassName("".concat(gl,"-dashed")),ce),d.center||rt(h.getElementsByClassName("".concat(gl,"-center")),ce),d.background&&rt(s,"".concat(gl,"-bg")),d.highlight||rt(o,bz),d.cropBoxMovable&&(rt(o,jm),aZ(o,nZ,xm)),d.cropBoxResizable||(rt(h.getElementsByClassName("".concat(gl,"-line")),ce),rt(h.getElementsByClassName("".concat(gl,"-point")),ce)),this.render(),this.ready=!0,this.setDragMode(d.dragMode),d.autoCrop&&this.crop(),this.setData(d.data),Ue(d.ready)&&Ye(t,D2,d.ready,{once:!0}),ys(t,D2)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var t=this.cropper.parentNode;t&&t.removeChild(this.cropper),bd(this.element,ce)}}},{key:"uncreate",value: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()}}],[{key:"noConflict",value:function(){return window.Cropper=lL,e}},{key:"setDefaults",value:function(t){jl(j2,Ts(t)&&t)}}])}();jl(q2.prototype,Hz,Pz,Az,_z,qz,$z);function tL(e,l){const t=e.width/l.width,d=e.height/l.height,n=Math.min(t,d),a=l.width*n,i=l.height*n,s=(e.width-a)/2,c=(e.height-i)/2;return{width:a,height:i,left:s,top:c}}function eL(e){return e*(Math.PI/180)}function dL(e,l,t){const d=Math.abs(eL(t));return Math.max((Math.sin(d)*e+Math.cos(d)*l)/l,(Math.sin(d)*l+Math.cos(d)*e)/e)}function nL(e,l,t){return l.left<e.left?{left:e.left,width:t.width}:l.top<e.top?{top:e.top,height:t.height}:l.left+l.width>e.left+e.width?{left:e.left+e.width-t.width,width:t.width}:l.top+l.height>e.top+e.height?{top:e.top+e.height-t.height,height:t.height}:null}function aL(e,l,t){return l.left<e.left?{left:e.left,width:t.left+t.width-e.left}:l.top<e.top?{top:e.top,height:t.top+t.height-e.top}:l.left+l.width>e.left+e.width?{left:t.left,width:e.left+e.width-t.left}:l.top+l.height>e.top+e.height?{top:t.top,height:e.top+e.height-t.top}:null}class iL extends se{constructor(t){super(t);E(this,"imgElement");E(this,"cropper");E(this,"onRotate90Deg",()=>{const{angle90Deg:t}=this.state,d=t-90;this.setState({angle90Deg:d,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(d);const n=this.cropper.getCanvasData(),a=this.cropper.getContainerData(),i=tL(a,n);this.cropper.setCanvasData(i),this.cropper.setCropBoxData(i)});E(this,"onRotateGranular",t=>{const d=Number(t.target.value);this.setState({angleGranular:d});const{angle90Deg:n}=this.state,a=n+d;this.cropper.rotateTo(a);const i=this.cropper.getImageData(),s=dL(i.naturalWidth,i.naturalHeight,d),c=this.cropper.getImageData().scaleX<0?-s:s;this.cropper.scale(c,s)});this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){const{opts:t,storeCropperInstance:d}=this.props;this.cropper=new q2(this.imgElement,t.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),d(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(t){const d=this.cropper.getCanvasData(),n=this.cropper.getCropBoxData(),{prevCropboxData:a}=this.state;if(t.detail.action==="all"){const i=nL(d,n,a);i&&this.cropper.setCropBoxData(i)}else{const i=aL(d,n,a);i&&this.cropper.setCropBoxData(i)}}renderGranularRotate(){const{i18n:t}=this.props,{angleGranular:d}=this.state;return S("label",{role:"tooltip","aria-label":`${d}º`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper",children:S("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:d,min:"-45",max:"45","aria-label":t("rotate")})})}renderRevert(){const{i18n:t,opts:d}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("revert"),onClick:()=>{this.cropper.reset(),this.cropper.setAspectRatio(d.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})},children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0z",fill:"none"}),S("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(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("rotate"),onClick:this.onRotate90Deg,children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),S("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(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("flipHorizontal"),onClick:()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1),children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0z",fill:"none"}),S("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(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("zoomIn"),onClick:()=>this.cropper.zoom(.1),children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24",children:[S("path",{d:"M0 0h24v24H0V0z",fill:"none"}),S("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"}),S("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})]})})}renderZoomOut(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("zoomOut"),onClick:()=>this.cropper.zoom(-.1),children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0V0z",fill:"none"}),S("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(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("aspectRatioSquare"),onClick:()=>this.cropper.setAspectRatio(1),children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0z",fill:"none"}),S("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(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("aspectRatioLandscape"),onClick:()=>this.cropper.setAspectRatio(16/9),children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("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"}),S("path",{fill:"none",d:"M0 0h24v24H0z"})]})})}renderCropWidescreenVertical(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button","aria-label":t("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(9/16),children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("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"}),S("path",{d:"M0 0h24v24H0z",fill:"none"})]})})}render(){const{currentImage:t,opts:d}=this.props,{actions:n}=d;if(t.data==null)throw new Error("File data is empty");const a=URL.createObjectURL(t.data);return S("div",{className:"uppy-ImageCropper",children:[S("div",{className:"uppy-ImageCropper-container",children:S("img",{className:"uppy-ImageCropper-image",alt:t.name,src:a,ref:i=>{this.imgElement=i}})}),S("div",{className:"uppy-ImageCropper-controls",children:[n.revert&&this.renderRevert(),n.rotate&&this.renderRotate(),n.granularRotate&&this.renderGranularRotate(),n.flip&&this.renderFlip(),n.zoomIn&&this.renderZoomIn(),n.zoomOut&&this.renderZoomOut(),n.cropSquare&&this.renderCropSquare(),n.cropWidescreen&&this.renderCropWidescreen(),n.cropWidescreenVertical&&this.renderCropWidescreenVertical()]})]})}}const sL={strings:{revert:"Reset",rotate:"Rotate 90°",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}},$2={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},lM={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},cL={quality:.8,actions:lM,cropperOptions:$2};class tM extends Ln{constructor(t,d){super(t,{...cL,...d,actions:{...lM,...d==null?void 0:d.actions},cropperOptions:{...$2,...d==null?void 0:d.cropperOptions}});E(this,"cropper");E(this,"save",()=>{const t=a=>{const{currentImage:i}=this.getPluginState();this.uppy.setFileState(i.id,{data:new File([a],i.name??this.i18n("unnamed"),{type:a.type}),size:a.size,preview:void 0});const s=this.uppy.getFile(i.id);this.uppy.emit("thumbnail:request",s),this.setPluginState({currentImage:s}),this.uppy.emit("file-editor:complete",s)},{currentImage:d}=this.getPluginState(),n=this.cropper.getCroppedCanvas({});n.width%2!==0&&this.cropper.setData({width:n.width-1}),n.height%2!==0&&this.cropper.setData({height:n.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(t,d.type,this.opts.quality)});E(this,"storeCropperInstance",t=>{this.cropper=t});E(this,"selectFile",t=>{this.uppy.emit("file-editor:start",t),this.setPluginState({currentImage:t})});this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=sL,this.i18nInit()}canEditFile(t){if(!t.type||t.isRemote)return!1;const d=t.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(d)}install(){this.setPluginState({currentImage:null});const{target:t}=this.opts;t&&this.mount(t,this)}uninstall(){const{currentImage:t}=this.getPluginState();if(t){const d=this.uppy.getFile(t.id);this.uppy.emit("file-editor:cancel",d)}this.unmount()}render(){const{currentImage:t}=this.getPluginState();return t===null||t.isRemote?null:S(iL,{currentImage:t,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}}E(tM,"VERSION",Fz.version);const UL=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],ZL=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],FL=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],hL=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],eM=(e,l,t)=>{let d=e;return typeof l=="string"||Array.isArray(l)?d=e.toLocaleString(l,t):(l===!0||t!==void 0)&&(d=e.toLocaleString(void 0,t)),d},dM=e=>{if(typeof e=="number")return Math.log10(e);const l=e.toString(10);return l.length+Math.log10(`0.${l.slice(0,15)}`)},oL=e=>typeof e=="number"?Math.log(e):dM(e)*Math.log(10),VL=(e,l)=>{if(typeof e=="number")return e/l;const t=e/BigInt(l),d=e%BigInt(l);return Number(t)+Number(d)/l},nM=(e,l)=>{if(l===void 0)return e;if(typeof l!="number"||!Number.isSafeInteger(l)||l<0)throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof l}: ${l}`);return l===0?e:e.length<l?e.padStart(l," "):e},WL=e=>{const{minimumFractionDigits:l,maximumFractionDigits:t}=e;if(!(l===void 0&&t===void 0))return{...l!==void 0&&{minimumFractionDigits:l},...t!==void 0&&{maximumFractionDigits:t},roundingMode:"trunc"}};function QL(e,l){if(typeof e!="bigint"&&!Number.isFinite(e))throw new TypeError(`Expected a finite number, got ${typeof e}: ${e}`);l={bits:!1,binary:!1,space:!0,nonBreakingSpace:!1,...l};const t=l.bits?l.binary?hL:FL:l.binary?ZL:UL,d=l.space?l.nonBreakingSpace?" ":" ":"",n=typeof e=="number"?e===0:e===0n;if(l.signed&&n){const F=` 0${d}${t[0]}`;return nM(F,l.fixedWidth)}const a=e<0,i=a?"-":l.signed?"+":"";a&&(e=-e);const s=WL(l);let c;if(e<1){const F=eM(e,l.locale,s);c=i+F+d+t[0]}else{const F=Math.min(Math.floor(l.binary?oL(e)/Math.log(1024):dM(e)/3),t.length-1);if(e=VL(e,(l.binary?1024:1e3)**F),!s){const V=Math.max(3,Math.floor(e).toString().length);e=e.toPrecision(V)}const h=eM(Number(e),l.locale,s),o=t[F];c=i+h+d+o}return nM(c,l.fixedWidth)}var mL=Object.defineProperty,aM=e=>{throw TypeError(e)},RL=(e,l,t)=>l in e?mL(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,hl=(e,l,t)=>RL(e,typeof l!="symbol"?l+"":l,t),lR=(e,l,t)=>l.has(e)||aM("Cannot "+t),U=(e,l,t)=>(lR(e,l,"read from private field"),t?t.call(e):l.get(e)),M=(e,l,t)=>l.has(e)?aM("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(e):l.set(e,t),N=(e,l,t,d)=>(lR(e,l,"write to private field"),l.set(e,t),t),p=(e,l,t)=>(lR(e,l,"access private method"),t),le=(e,l,t,d)=>({set _(n){N(e,l,n)},get _(){return U(e,l,d)}}),NL={9306:(e,l,t)=>{var d=t(4901),n=t(6823),a=TypeError;e.exports=function(i){if(d(i))return i;throw new a(n(i)+" is not a function")}},3506:(e,l,t)=>{var d=t(3925),n=String,a=TypeError;e.exports=function(i){if(d(i))return i;throw new a("Can't set "+n(i)+" as a prototype")}},7080:(e,l,t)=>{var d=t(4402).has;e.exports=function(n){return d(n),n}},679:(e,l,t)=>{var d=t(1625),n=TypeError;e.exports=function(a,i){if(d(i,a))return a;throw new n("Incorrect invocation")}},8551:(e,l,t)=>{var d=t(34),n=String,a=TypeError;e.exports=function(i){if(d(i))return i;throw new a(n(i)+" is not an object")}},7811:e=>{e.exports=typeof ArrayBuffer<"u"&&typeof DataView<"u"},7394:(e,l,t)=>{var d=t(4576),n=t(6706),a=t(2195),i=d.ArrayBuffer,s=d.TypeError;e.exports=i&&n(i.prototype,"byteLength","get")||function(c){if(a(c)!=="ArrayBuffer")throw new s("ArrayBuffer expected");return c.byteLength}},3238:(e,l,t)=>{var d=t(4576),n=t(7476),a=t(7394),i=d.ArrayBuffer,s=i&&i.prototype,c=s&&n(s.slice);e.exports=function(F){if(a(F)!==0||!c)return!1;try{return c(F,0,0),!1}catch{return!0}}},5169:(e,l,t)=>{var d=t(3238),n=TypeError;e.exports=function(a){if(d(a))throw new n("ArrayBuffer is detached");return a}},5636:(e,l,t)=>{var d=t(4576),n=t(9504),a=t(6706),i=t(7696),s=t(5169),c=t(7394),F=t(4483),h=t(1548),o=d.structuredClone,V=d.ArrayBuffer,W=d.DataView,Q=Math.min,m=V.prototype,R=W.prototype,r=n(m.slice),b=a(m,"resizable","get"),u=a(m,"maxByteLength","get"),J=n(R.getInt8),G=n(R.setInt8);e.exports=(h||F)&&function(T,y,k){var X=c(T),L=y===void 0?X:i(y),D=!b||!b(T),C;if(s(T),h&&(T=o(T,{transfer:[T]}),X===L&&(k||D)))return T;if(X>=L&&(!k||D))C=r(T,0,L);else{var I=k&&!D&&u?{maxByteLength:u(T)}:void 0;C=new V(L,I);for(var P=new W(T),H=new W(C),Y=Q(L,X),B=0;B<Y;B++)G(H,B,J(P,B))}return h||F(T),C}},4644:(e,l,t)=>{var d=t(7811),n=t(3724),a=t(4576),i=t(4901),s=t(34),c=t(9297),F=t(6955),h=t(6823),o=t(6699),V=t(6840),W=t(2106),Q=t(1625),m=t(2787),R=t(2967),r=t(8227),b=t(3392),u=t(1181),J=u.enforce,G=u.get,T=a.Int8Array,y=T&&T.prototype,k=a.Uint8ClampedArray,X=k&&k.prototype,L=T&&m(T),D=y&&m(y),C=Object.prototype,I=a.TypeError,P=r("toStringTag"),H=b("TYPED_ARRAY_TAG"),Y="TypedArrayConstructor",B=d&&!!R&&F(a.opera)!=="Opera",z=!1,g,w,O,f={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},x={BigInt64Array:8,BigUint64Array:8},A=function(Ql){if(!s(Ql))return!1;var _l=F(Ql);return _l==="DataView"||c(f,_l)||c(x,_l)},al=function(Ql){var _l=m(Ql);if(s(_l)){var Tt=G(_l);return Tt&&c(Tt,Y)?Tt[Y]:al(_l)}},_=function(Ql){if(!s(Ql))return!1;var _l=F(Ql);return c(f,_l)||c(x,_l)},K=function(Ql){if(_(Ql))return Ql;throw new I("Target is not a typed array")},tl=function(Ql){if(i(Ql)&&(!R||Q(L,Ql)))return Ql;throw new I(h(Ql)+" is not a typed array constructor")},el=function(Ql,_l,Tt,Hd){if(n){if(Tt)for(var ie in f){var _t=a[ie];if(_t&&c(_t.prototype,Ql))try{delete _t.prototype[Ql]}catch{try{_t.prototype[Ql]=_l}catch{}}}(!D[Ql]||Tt)&&V(D,Ql,Tt?_l:B&&y[Ql]||_l,Hd)}},Bl=function(Ql,_l,Tt){var Hd,ie;if(n){if(R){if(Tt){for(Hd in f)if(ie=a[Hd],ie&&c(ie,Ql))try{delete ie[Ql]}catch{}}if(!L[Ql]||Tt)try{return V(L,Ql,Tt?_l:B&&L[Ql]||_l)}catch{}else return}for(Hd in f)ie=a[Hd],ie&&(!ie[Ql]||Tt)&&V(ie,Ql,_l)}};for(g in f)w=a[g],O=w&&w.prototype,O?J(O)[Y]=w:B=!1;for(g in x)w=a[g],O=w&&w.prototype,O&&(J(O)[Y]=w);if((!B||!i(L)||L===Function.prototype)&&(L=function(){throw new I("Incorrect invocation")},B))for(g in f)a[g]&&R(a[g],L);if((!B||!D||D===C)&&(D=L.prototype,B))for(g in f)a[g]&&R(a[g].prototype,D);if(B&&m(X)!==D&&R(X,D),n&&!c(D,P)){z=!0,W(D,P,{configurable:!0,get:function(){return s(this)?this[H]:void 0}});for(g in f)a[g]&&o(a[g],H,g)}e.exports={NATIVE_ARRAY_BUFFER_VIEWS:B,TYPED_ARRAY_TAG:z&&H,aTypedArray:K,aTypedArrayConstructor:tl,exportTypedArrayMethod:el,exportTypedArrayStaticMethod:Bl,getTypedArrayConstructor:al,isView:A,isTypedArray:_,TypedArray:L,TypedArrayPrototype:D}},5370:(e,l,t)=>{var d=t(6198);e.exports=function(n,a,i){for(var s=0,c=arguments.length>2?i:d(a),F=new n(c);c>s;)F[s]=a[s++];return F}},9617:(e,l,t)=>{var d=t(5397),n=t(5610),a=t(6198),i=function(s){return function(c,F,h){var o=d(c),V=a(o);if(V===0)return!s&&-1;var W=n(h,V),Q;if(s&&F!==F){for(;V>W;)if(Q=o[W++],Q!==Q)return!0}else for(;V>W;W++)if((s||W in o)&&o[W]===F)return s||W||0;return!s&&-1}};e.exports={includes:i(!0),indexOf:i(!1)}},4527:(e,l,t)=>{var d=t(3724),n=t(4376),a=TypeError,i=Object.getOwnPropertyDescriptor,s=d&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(c){return c instanceof TypeError}}();e.exports=s?function(c,F){if(n(c)&&!i(c,"length").writable)throw new a("Cannot set read only .length");return c.length=F}:function(c,F){return c.length=F}},7680:(e,l,t)=>{var d=t(9504);e.exports=d([].slice)},7628:(e,l,t)=>{var d=t(6198);e.exports=function(n,a){for(var i=d(n),s=new a(i),c=0;c<i;c++)s[c]=n[i-c-1];return s}},9928:(e,l,t)=>{var d=t(6198),n=t(1291),a=RangeError;e.exports=function(i,s,c,F){var h=d(i),o=n(c),V=o<0?h+o:o;if(V>=h||V<0)throw new a("Incorrect index");for(var W=new s(h),Q=0;Q<h;Q++)W[Q]=Q===V?F:i[Q];return W}},6319:(e,l,t)=>{var d=t(8551),n=t(9539);e.exports=function(a,i,s,c){try{return c?i(d(s)[0],s[1]):i(s)}catch(F){n(a,"throw",F)}}},2195:(e,l,t)=>{var d=t(9504),n=d({}.toString),a=d("".slice);e.exports=function(i){return a(n(i),8,-1)}},6955:(e,l,t)=>{var d=t(2140),n=t(4901),a=t(2195),i=t(8227),s=i("toStringTag"),c=Object,F=a(function(){return arguments}())==="Arguments",h=function(o,V){try{return o[V]}catch{}};e.exports=d?a:function(o){var V,W,Q;return o===void 0?"Undefined":o===null?"Null":typeof(W=h(V=c(o),s))=="string"?W:F?a(V):(Q=a(V))==="Object"&&n(V.callee)?"Arguments":Q}},7740:(e,l,t)=>{var d=t(9297),n=t(5031),a=t(7347),i=t(4913);e.exports=function(s,c,F){for(var h=n(c),o=i.f,V=a.f,W=0;W<h.length;W++){var Q=h[W];!d(s,Q)&&!(F&&d(F,Q))&&o(s,Q,V(c,Q))}}},2211:(e,l,t)=>{var d=t(9039);e.exports=!d(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})},2529:e=>{e.exports=function(l,t){return{value:l,done:t}}},6699:(e,l,t)=>{var d=t(3724),n=t(4913),a=t(6980);e.exports=d?function(i,s,c){return n.f(i,s,a(1,c))}:function(i,s,c){return i[s]=c,i}},6980:e=>{e.exports=function(l,t){return{enumerable:!(l&1),configurable:!(l&2),writable:!(l&4),value:t}}},4659:(e,l,t)=>{var d=t(3724),n=t(4913),a=t(6980);e.exports=function(i,s,c){d?n.f(i,s,a(0,c)):i[s]=c}},2106:(e,l,t)=>{var d=t(283),n=t(4913);e.exports=function(a,i,s){return s.get&&d(s.get,i,{getter:!0}),s.set&&d(s.set,i,{setter:!0}),n.f(a,i,s)}},6840:(e,l,t)=>{var d=t(4901),n=t(4913),a=t(283),i=t(9433);e.exports=function(s,c,F,h){h||(h={});var o=h.enumerable,V=h.name!==void 0?h.name:c;if(d(F)&&a(F,V,h),h.global)o?s[c]=F:i(c,F);else{try{h.unsafe?s[c]&&(o=!0):delete s[c]}catch{}o?s[c]=F:n.f(s,c,{value:F,enumerable:!1,configurable:!h.nonConfigurable,writable:!h.nonWritable})}return s}},6279:(e,l,t)=>{var d=t(6840);e.exports=function(n,a,i){for(var s in a)d(n,s,a[s],i);return n}},9433:(e,l,t)=>{var d=t(4576),n=Object.defineProperty;e.exports=function(a,i){try{n(d,a,{value:i,configurable:!0,writable:!0})}catch{d[a]=i}return i}},3724:(e,l,t)=>{var d=t(9039);e.exports=!d(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})},4483:(e,l,t)=>{var d=t(4576),n=t(9429),a=t(1548),i=d.structuredClone,s=d.ArrayBuffer,c=d.MessageChannel,F=!1,h,o,V,W;if(a)F=function(Q){i(Q,{transfer:[Q]})};else if(s)try{c||(h=n("worker_threads"),h&&(c=h.MessageChannel)),c&&(o=new c,V=new s(2),W=function(Q){o.port1.postMessage(null,[Q])},V.byteLength===2&&(W(V),V.byteLength===0&&(F=W)))}catch{}e.exports=F},4055:(e,l,t)=>{var d=t(4576),n=t(34),a=d.document,i=n(a)&&n(a.createElement);e.exports=function(s){return i?a.createElement(s):{}}},6837:e=>{var l=TypeError,t=9007199254740991;e.exports=function(d){if(d>t)throw l("Maximum allowed index exceeded");return d}},5002:e=>{e.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},8727:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6193:(e,l,t)=>{var d=t(4215);e.exports=d==="NODE"},2839:(e,l,t)=>{var d=t(4576),n=d.navigator,a=n&&n.userAgent;e.exports=a?String(a):""},9519:(e,l,t)=>{var d=t(4576),n=t(2839),a=d.process,i=d.Deno,s=a&&a.versions||i&&i.version,c=s&&s.v8,F,h;c&&(F=c.split("."),h=F[0]>0&&F[0]<4?1:+(F[0]+F[1])),!h&&n&&(F=n.match(/Edge\/(\d+)/),(!F||F[1]>=74)&&(F=n.match(/Chrome\/(\d+)/),F&&(h=+F[1]))),e.exports=h},4215:(e,l,t)=>{var d=t(4576),n=t(2839),a=t(2195),i=function(s){return n.slice(0,s.length)===s};e.exports=function(){return i("Bun/")?"BUN":i("Cloudflare-Workers")?"CLOUDFLARE":i("Deno/")?"DENO":i("Node.js/")?"NODE":d.Bun&&typeof Bun.version=="string"?"BUN":d.Deno&&typeof Deno.version=="object"?"DENO":a(d.process)==="process"?"NODE":d.window&&d.document?"BROWSER":"REST"}()},8574:(e,l,t)=>{var d=t(9504),n=Error,a=d("".replace),i=function(F){return String(new n(F).stack)}("zxcasd"),s=/\n\s*at [^:]*:[^\n]*/,c=s.test(i);e.exports=function(F,h){if(c&&typeof F=="string"&&!n.prepareStackTrace)for(;h--;)F=a(F,s,"");return F}},6518:(e,l,t)=>{var d=t(4576),n=t(7347).f,a=t(6699),i=t(6840),s=t(9433),c=t(7740),F=t(2796);e.exports=function(h,o){var V=h.target,W=h.global,Q=h.stat,m,R,r,b,u,J;if(W?R=d:Q?R=d[V]||s(V,{}):R=d[V]&&d[V].prototype,R)for(r in o){if(u=o[r],h.dontCallGetSet?(J=n(R,r),b=J&&J.value):b=R[r],m=F(W?r:V+(Q?".":"#")+r,h.forced),!m&&b!==void 0){if(typeof u==typeof b)continue;c(u,b)}(h.sham||b&&b.sham)&&a(u,"sham",!0),i(R,r,u,h)}}},9039:e=>{e.exports=function(l){try{return!!l()}catch{return!0}}},8745:(e,l,t)=>{var d=t(616),n=Function.prototype,a=n.apply,i=n.call;e.exports=typeof Reflect=="object"&&Reflect.apply||(d?i.bind(a):function(){return i.apply(a,arguments)})},6080:(e,l,t)=>{var d=t(7476),n=t(9306),a=t(616),i=d(d.bind);e.exports=function(s,c){return n(s),c===void 0?s:a?i(s,c):function(){return s.apply(c,arguments)}}},616:(e,l,t)=>{var d=t(9039);e.exports=!d(function(){var n=(function(){}).bind();return typeof n!="function"||n.hasOwnProperty("prototype")})},9565:(e,l,t)=>{var d=t(616),n=Function.prototype.call;e.exports=d?n.bind(n):function(){return n.apply(n,arguments)}},350:(e,l,t)=>{var d=t(3724),n=t(9297),a=Function.prototype,i=d&&Object.getOwnPropertyDescriptor,s=n(a,"name"),c=s&&(function(){}).name==="something",F=s&&(!d||d&&i(a,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:F}},6706:(e,l,t)=>{var d=t(9504),n=t(9306);e.exports=function(a,i,s){try{return d(n(Object.getOwnPropertyDescriptor(a,i)[s]))}catch{}}},7476:(e,l,t)=>{var d=t(2195),n=t(9504);e.exports=function(a){if(d(a)==="Function")return n(a)}},9504:(e,l,t)=>{var d=t(616),n=Function.prototype,a=n.call,i=d&&n.bind.bind(a,a);e.exports=d?i:function(s){return function(){return a.apply(s,arguments)}}},9429:(e,l,t)=>{var d=t(4576),n=t(6193);e.exports=function(a){if(n){try{return d.process.getBuiltinModule(a)}catch{}try{return Function('return require("'+a+'")')()}catch{}}}},7751:(e,l,t)=>{var d=t(4576),n=t(4901),a=function(i){return n(i)?i:void 0};e.exports=function(i,s){return arguments.length<2?a(d[i]):d[i]&&d[i][s]}},1767:e=>{e.exports=function(l){return{iterator:l,next:l.next,done:!1}}},8646:(e,l,t)=>{var d=t(9565),n=t(8551),a=t(1767),i=t(851);e.exports=function(s,c){(!c||typeof s!="string")&&n(s);var F=i(s);return a(n(F!==void 0?d(F,s):s))}},851:(e,l,t)=>{var d=t(6955),n=t(5966),a=t(4117),i=t(6269),s=t(8227),c=s("iterator");e.exports=function(F){if(!a(F))return n(F,c)||n(F,"@@iterator")||i[d(F)]}},81:(e,l,t)=>{var d=t(9565),n=t(9306),a=t(8551),i=t(6823),s=t(851),c=TypeError;e.exports=function(F,h){var o=arguments.length<2?s(F):h;if(n(o))return a(d(o,F));throw new c(i(F)+" is not iterable")}},5966:(e,l,t)=>{var d=t(9306),n=t(4117);e.exports=function(a,i){var s=a[i];return n(s)?void 0:d(s)}},3789:(e,l,t)=>{var d=t(9306),n=t(8551),a=t(9565),i=t(1291),s=t(1767),c="Invalid size",F=RangeError,h=TypeError,o=Math.max,V=function(W,Q){this.set=W,this.size=o(Q,0),this.has=d(W.has),this.keys=d(W.keys)};V.prototype={getIterator:function(){return s(n(a(this.keys,this.set)))},includes:function(W){return a(this.has,this.set,W)}},e.exports=function(W){n(W);var Q=+W.size;if(Q!==Q)throw new h(c);var m=i(Q);if(m<0)throw new F(c);return new V(W,m)}},4576:function(e){var l=function(t){return t&&t.Math===Math&&t};e.exports=l(typeof globalThis=="object"&&globalThis)||l(typeof window=="object"&&window)||l(typeof self=="object"&&self)||l(typeof global=="object"&&global)||l(typeof this=="object"&&this)||function(){return this}()||Function("return this")()},9297:(e,l,t)=>{var d=t(9504),n=t(8981),a=d({}.hasOwnProperty);e.exports=Object.hasOwn||function(i,s){return a(n(i),s)}},421:e=>{e.exports={}},397:(e,l,t)=>{var d=t(7751);e.exports=d("document","documentElement")},5917:(e,l,t)=>{var d=t(3724),n=t(9039),a=t(4055);e.exports=!d&&!n(function(){return Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a!==7})},7055:(e,l,t)=>{var d=t(9504),n=t(9039),a=t(2195),i=Object,s=d("".split);e.exports=n(function(){return!i("z").propertyIsEnumerable(0)})?function(c){return a(c)==="String"?s(c,""):i(c)}:i},3167:(e,l,t)=>{var d=t(4901),n=t(34),a=t(2967);e.exports=function(i,s,c){var F,h;return a&&d(F=s.constructor)&&F!==c&&n(h=F.prototype)&&h!==c.prototype&&a(i,h),i}},3706:(e,l,t)=>{var d=t(9504),n=t(4901),a=t(7629),i=d(Function.toString);n(a.inspectSource)||(a.inspectSource=function(s){return i(s)}),e.exports=a.inspectSource},1181:(e,l,t)=>{var d=t(8622),n=t(4576),a=t(34),i=t(6699),s=t(9297),c=t(7629),F=t(6119),h=t(421),o="Object already initialized",V=n.TypeError,W=n.WeakMap,Q,m,R,r=function(G){return R(G)?m(G):Q(G,{})},b=function(G){return function(T){var y;if(!a(T)||(y=m(T)).type!==G)throw new V("Incompatible receiver, "+G+" required");return y}};if(d||c.state){var u=c.state||(c.state=new W);u.get=u.get,u.has=u.has,u.set=u.set,Q=function(G,T){if(u.has(G))throw new V(o);return T.facade=G,u.set(G,T),T},m=function(G){return u.get(G)||{}},R=function(G){return u.has(G)}}else{var J=F("state");h[J]=!0,Q=function(G,T){if(s(G,J))throw new V(o);return T.facade=G,i(G,J,T),T},m=function(G){return s(G,J)?G[J]:{}},R=function(G){return s(G,J)}}e.exports={set:Q,get:m,has:R,enforce:r,getterFor:b}},4209:(e,l,t)=>{var d=t(8227),n=t(6269),a=d("iterator"),i=Array.prototype;e.exports=function(s){return s!==void 0&&(n.Array===s||i[a]===s)}},4376:(e,l,t)=>{var d=t(2195);e.exports=Array.isArray||function(n){return d(n)==="Array"}},1108:(e,l,t)=>{var d=t(6955);e.exports=function(n){var a=d(n);return a==="BigInt64Array"||a==="BigUint64Array"}},4901:e=>{var l=typeof document=="object"&&document.all;e.exports=typeof l>"u"&&l!==void 0?function(t){return typeof t=="function"||t===l}:function(t){return typeof t=="function"}},2796:(e,l,t)=>{var d=t(9039),n=t(4901),a=/#|\.prototype\./,i=function(o,V){var W=c[s(o)];return W===h?!0:W===F?!1:n(V)?d(V):!!V},s=i.normalize=function(o){return String(o).replace(a,".").toLowerCase()},c=i.data={},F=i.NATIVE="N",h=i.POLYFILL="P";e.exports=i},4117:e=>{e.exports=function(l){return l==null}},34:(e,l,t)=>{var d=t(4901);e.exports=function(n){return typeof n=="object"?n!==null:d(n)}},3925:(e,l,t)=>{var d=t(34);e.exports=function(n){return d(n)||n===null}},6395:e=>{e.exports=!1},757:(e,l,t)=>{var d=t(7751),n=t(4901),a=t(1625),i=t(7040),s=Object;e.exports=i?function(c){return typeof c=="symbol"}:function(c){var F=d("Symbol");return n(F)&&a(F.prototype,s(c))}},507:(e,l,t)=>{var d=t(9565);e.exports=function(n,a,i){for(var s=i?n:n.iterator,c=n.next,F,h;!(F=d(c,s)).done;)if(h=a(F.value),h!==void 0)return h}},2652:(e,l,t)=>{var d=t(6080),n=t(9565),a=t(8551),i=t(6823),s=t(4209),c=t(6198),F=t(1625),h=t(81),o=t(851),V=t(9539),W=TypeError,Q=function(R,r){this.stopped=R,this.result=r},m=Q.prototype;e.exports=function(R,r,b){var u=b&&b.that,J=!!(b&&b.AS_ENTRIES),G=!!(b&&b.IS_RECORD),T=!!(b&&b.IS_ITERATOR),y=!!(b&&b.INTERRUPTED),k=d(r,u),X,L,D,C,I,P,H,Y=function(z){return X&&V(X,"normal",z),new Q(!0,z)},B=function(z){return J?(a(z),y?k(z[0],z[1],Y):k(z[0],z[1])):y?k(z,Y):k(z)};if(G)X=R.iterator;else if(T)X=R;else{if(L=o(R),!L)throw new W(i(R)+" is not iterable");if(s(L)){for(D=0,C=c(R);C>D;D++)if(I=B(R[D]),I&&F(m,I))return I;return new Q(!1)}X=h(R,L)}for(P=G?R.next:X.next;!(H=n(P,X)).done;){try{I=B(H.value)}catch(z){V(X,"throw",z)}if(typeof I=="object"&&I&&F(m,I))return I}return new Q(!1)}},9539:(e,l,t)=>{var d=t(9565),n=t(8551),a=t(5966);e.exports=function(i,s,c){var F,h;n(i);try{if(F=a(i,"return"),!F){if(s==="throw")throw c;return c}F=d(F,i)}catch(o){h=!0,F=o}if(s==="throw")throw c;if(h)throw F;return n(F),c}},9462:(e,l,t)=>{var d=t(9565),n=t(2360),a=t(6699),i=t(6279),s=t(8227),c=t(1181),F=t(5966),h=t(7657).IteratorPrototype,o=t(2529),V=t(9539),W=s("toStringTag"),Q="IteratorHelper",m="WrapForValidIterator",R=c.set,r=function(J){var G=c.getterFor(J?m:Q);return i(n(h),{next:function(){var T=G(this);if(J)return T.nextHandler();try{var y=T.done?void 0:T.nextHandler();return o(y,T.done)}catch(k){throw T.done=!0,k}},return:function(){var T=G(this),y=T.iterator;if(T.done=!0,J){var k=F(y,"return");return k?d(k,y):o(void 0,!0)}if(T.inner)try{V(T.inner.iterator,"normal")}catch(X){return V(y,"throw",X)}return y&&V(y,"normal"),o(void 0,!0)}})},b=r(!0),u=r(!1);a(u,W,"Iterator Helper"),e.exports=function(J,G){var T=function(y,k){k?(k.iterator=y.iterator,k.next=y.next):k=y,k.type=G?m:Q,k.nextHandler=J,k.counter=0,k.done=!1,R(this,k)};return T.prototype=G?b:u,T}},713:(e,l,t)=>{var d=t(9565),n=t(9306),a=t(8551),i=t(1767),s=t(9462),c=t(6319),F=s(function(){var h=this.iterator,o=a(d(this.next,h)),V=this.done=!!o.done;if(!V)return c(h,this.mapper,[o.value,this.counter++],!0)});e.exports=function(h){return a(this),n(h),new F(i(this),{mapper:h})}},7657:(e,l,t)=>{var d=t(9039),n=t(4901),a=t(34),i=t(2360),s=t(2787),c=t(6840),F=t(8227),h=t(6395),o=F("iterator"),V=!1,W,Q,m;[].keys&&(m=[].keys(),"next"in m?(Q=s(s(m)),Q!==Object.prototype&&(W=Q)):V=!0);var R=!a(W)||d(function(){var r={};return W[o].call(r)!==r});R?W={}:h&&(W=i(W)),n(W[o])||c(W,o,function(){return this}),e.exports={IteratorPrototype:W,BUGGY_SAFARI_ITERATORS:V}},6269:e=>{e.exports={}},6198:(e,l,t)=>{var d=t(8014);e.exports=function(n){return d(n.length)}},283:(e,l,t)=>{var d=t(9504),n=t(9039),a=t(4901),i=t(9297),s=t(3724),c=t(350).CONFIGURABLE,F=t(3706),h=t(1181),o=h.enforce,V=h.get,W=String,Q=Object.defineProperty,m=d("".slice),R=d("".replace),r=d([].join),b=s&&!n(function(){return Q(function(){},"length",{value:8}).length!==8}),u=String(String).split("String"),J=e.exports=function(G,T,y){m(W(T),0,7)==="Symbol("&&(T="["+R(W(T),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),y&&y.getter&&(T="get "+T),y&&y.setter&&(T="set "+T),(!i(G,"name")||c&&G.name!==T)&&(s?Q(G,"name",{value:T,configurable:!0}):G.name=T),b&&y&&i(y,"arity")&&G.length!==y.arity&&Q(G,"length",{value:y.arity});try{y&&i(y,"constructor")&&y.constructor?s&&Q(G,"prototype",{writable:!1}):G.prototype&&(G.prototype=void 0)}catch{}var k=o(G);return i(k,"source")||(k.source=r(u,typeof T=="string"?T:"")),G};Function.prototype.toString=J(function(){return a(this)&&V(this).source||F(this)},"toString")},741:e=>{var l=Math.ceil,t=Math.floor;e.exports=Math.trunc||function(d){var n=+d;return(n>0?t:l)(n)}},6043:(e,l,t)=>{var d=t(9306),n=TypeError,a=function(i){var s,c;this.promise=new i(function(F,h){if(s!==void 0||c!==void 0)throw new n("Bad Promise constructor");s=F,c=h}),this.resolve=d(s),this.reject=d(c)};e.exports.f=function(i){return new a(i)}},2603:(e,l,t)=>{var d=t(655);e.exports=function(n,a){return n===void 0?arguments.length<2?"":a:d(n)}},4149:e=>{var l=RangeError;e.exports=function(t){if(t===t)return t;throw new l("NaN is not allowed")}},2360:(e,l,t)=>{var d=t(8551),n=t(6801),a=t(8727),i=t(421),s=t(397),c=t(4055),F=t(6119),h=">",o="<",V="prototype",W="script",Q=F("IE_PROTO"),m=function(){},R=function(G){return o+W+h+G+o+"/"+W+h},r=function(G){G.write(R("")),G.close();var T=G.parentWindow.Object;return G=null,T},b=function(){var G=c("iframe"),T="java"+W+":",y;return G.style.display="none",s.appendChild(G),G.src=String(T),y=G.contentWindow.document,y.open(),y.write(R("document.F=Object")),y.close(),y.F},u,J=function(){try{u=new ActiveXObject("htmlfile")}catch{}J=typeof document<"u"?document.domain&&u?r(u):b():r(u);for(var G=a.length;G--;)delete J[V][a[G]];return J()};i[Q]=!0,e.exports=Object.create||function(G,T){var y;return G!==null?(m[V]=d(G),y=new m,m[V]=null,y[Q]=G):y=J(),T===void 0?y:n.f(y,T)}},6801:(e,l,t)=>{var d=t(3724),n=t(8686),a=t(4913),i=t(8551),s=t(5397),c=t(1072);l.f=d&&!n?Object.defineProperties:function(F,h){i(F);for(var o=s(h),V=c(h),W=V.length,Q=0,m;W>Q;)a.f(F,m=V[Q++],o[m]);return F}},4913:(e,l,t)=>{var d=t(3724),n=t(5917),a=t(8686),i=t(8551),s=t(6969),c=TypeError,F=Object.defineProperty,h=Object.getOwnPropertyDescriptor,o="enumerable",V="configurable",W="writable";l.f=d?a?function(Q,m,R){if(i(Q),m=s(m),i(R),typeof Q=="function"&&m==="prototype"&&"value"in R&&W in R&&!R[W]){var r=h(Q,m);r&&r[W]&&(Q[m]=R.value,R={configurable:V in R?R[V]:r[V],enumerable:o in R?R[o]:r[o],writable:!1})}return F(Q,m,R)}:F:function(Q,m,R){if(i(Q),m=s(m),i(R),n)try{return F(Q,m,R)}catch{}if("get"in R||"set"in R)throw new c("Accessors not supported");return"value"in R&&(Q[m]=R.value),Q}},7347:(e,l,t)=>{var d=t(3724),n=t(9565),a=t(8773),i=t(6980),s=t(5397),c=t(6969),F=t(9297),h=t(5917),o=Object.getOwnPropertyDescriptor;l.f=d?o:function(V,W){if(V=s(V),W=c(W),h)try{return o(V,W)}catch{}if(F(V,W))return i(!n(a.f,V,W),V[W])}},8480:(e,l,t)=>{var d=t(1828),n=t(8727),a=n.concat("length","prototype");l.f=Object.getOwnPropertyNames||function(i){return d(i,a)}},3717:(e,l)=>{l.f=Object.getOwnPropertySymbols},2787:(e,l,t)=>{var d=t(9297),n=t(4901),a=t(8981),i=t(6119),s=t(2211),c=i("IE_PROTO"),F=Object,h=F.prototype;e.exports=s?F.getPrototypeOf:function(o){var V=a(o);if(d(V,c))return V[c];var W=V.constructor;return n(W)&&V instanceof W?W.prototype:V instanceof F?h:null}},1625:(e,l,t)=>{var d=t(9504);e.exports=d({}.isPrototypeOf)},1828:(e,l,t)=>{var d=t(9504),n=t(9297),a=t(5397),i=t(9617).indexOf,s=t(421),c=d([].push);e.exports=function(F,h){var o=a(F),V=0,W=[],Q;for(Q in o)!n(s,Q)&&n(o,Q)&&c(W,Q);for(;h.length>V;)n(o,Q=h[V++])&&(~i(W,Q)||c(W,Q));return W}},1072:(e,l,t)=>{var d=t(1828),n=t(8727);e.exports=Object.keys||function(a){return d(a,n)}},8773:(e,l)=>{var t={}.propertyIsEnumerable,d=Object.getOwnPropertyDescriptor,n=d&&!t.call({1:2},1);l.f=n?function(a){var i=d(this,a);return!!i&&i.enumerable}:t},2967:(e,l,t)=>{var d=t(6706),n=t(34),a=t(7750),i=t(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var s=!1,c={},F;try{F=d(Object.prototype,"__proto__","set"),F(c,[]),s=c instanceof Array}catch{}return function(h,o){return a(h),i(o),n(h)&&(s?F(h,o):h.__proto__=o),h}}():void 0)},4270:(e,l,t)=>{var d=t(9565),n=t(4901),a=t(34),i=TypeError;e.exports=function(s,c){var F,h;if(c==="string"&&n(F=s.toString)&&!a(h=d(F,s))||n(F=s.valueOf)&&!a(h=d(F,s))||c!=="string"&&n(F=s.toString)&&!a(h=d(F,s)))return h;throw new i("Can't convert object to primitive value")}},5031:(e,l,t)=>{var d=t(7751),n=t(9504),a=t(8480),i=t(3717),s=t(8551),c=n([].concat);e.exports=d("Reflect","ownKeys")||function(F){var h=a.f(s(F)),o=i.f;return o?c(h,o(F)):h}},8235:(e,l,t)=>{var d=t(9504),n=t(9297),a=SyntaxError,i=parseInt,s=String.fromCharCode,c=d("".charAt),F=d("".slice),h=d(/./.exec),o={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":`
36
- `,"\\r":"\r","\\t":" "},V=/^[\da-f]{4}$/i,W=/^[\u0000-\u001F]$/;e.exports=function(Q,m){for(var R=!0,r="";m<Q.length;){var b=c(Q,m);if(b==="\\"){var u=F(Q,m,m+2);if(n(o,u))r+=o[u],m+=2;else if(u==="\\u"){m+=2;var J=F(Q,m,m+4);if(!h(V,J))throw new a("Bad Unicode escape at: "+m);r+=s(i(J,16)),m+=4}else throw new a('Unknown escape sequence: "'+u+'"')}else if(b==='"'){R=!1,m++;break}else{if(h(W,b))throw new a("Bad control character in string literal at: "+m);r+=b,m++}}if(R)throw new a("Unterminated string at: "+m);return{value:r,end:m}}},1103:e=>{e.exports=function(l){try{return{error:!1,value:l()}}catch(t){return{error:!0,value:t}}}},7750:(e,l,t)=>{var d=t(4117),n=TypeError;e.exports=function(a){if(d(a))throw new n("Can't call method on "+a);return a}},9286:(e,l,t)=>{var d=t(4402),n=t(8469),a=d.Set,i=d.add;e.exports=function(s){var c=new a;return n(s,function(F){i(c,F)}),c}},3440:(e,l,t)=>{var d=t(7080),n=t(4402),a=t(9286),i=t(5170),s=t(3789),c=t(8469),F=t(507),h=n.has,o=n.remove;e.exports=function(V){var W=d(this),Q=s(V),m=a(W);return i(W)<=Q.size?c(W,function(R){Q.includes(R)&&o(m,R)}):F(Q.getIterator(),function(R){h(W,R)&&o(m,R)}),m}},4402:(e,l,t)=>{var d=t(9504),n=Set.prototype;e.exports={Set,add:d(n.add),has:d(n.has),remove:d(n.delete),proto:n}},8750:(e,l,t)=>{var d=t(7080),n=t(4402),a=t(5170),i=t(3789),s=t(8469),c=t(507),F=n.Set,h=n.add,o=n.has;e.exports=function(V){var W=d(this),Q=i(V),m=new F;return a(W)>Q.size?c(Q.getIterator(),function(R){o(W,R)&&h(m,R)}):s(W,function(R){Q.includes(R)&&h(m,R)}),m}},4449:(e,l,t)=>{var d=t(7080),n=t(4402).has,a=t(5170),i=t(3789),s=t(8469),c=t(507),F=t(9539);e.exports=function(h){var o=d(this),V=i(h);if(a(o)<=V.size)return s(o,function(Q){if(V.includes(Q))return!1},!0)!==!1;var W=V.getIterator();return c(W,function(Q){if(n(o,Q))return F(W,"normal",!1)})!==!1}},3838:(e,l,t)=>{var d=t(7080),n=t(5170),a=t(8469),i=t(3789);e.exports=function(s){var c=d(this),F=i(s);return n(c)>F.size?!1:a(c,function(h){if(!F.includes(h))return!1},!0)!==!1}},8527:(e,l,t)=>{var d=t(7080),n=t(4402).has,a=t(5170),i=t(3789),s=t(507),c=t(9539);e.exports=function(F){var h=d(this),o=i(F);if(a(h)<o.size)return!1;var V=o.getIterator();return s(V,function(W){if(!n(h,W))return c(V,"normal",!1)})!==!1}},8469:(e,l,t)=>{var d=t(9504),n=t(507),a=t(4402),i=a.Set,s=a.proto,c=d(s.forEach),F=d(s.keys),h=F(new i).next;e.exports=function(o,V,W){return W?n({iterator:F(o),next:h},V):c(o,V)}},4916:(e,l,t)=>{var d=t(7751),n=function(a){return{size:a,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};e.exports=function(a){var i=d("Set");try{new i()[a](n(0));try{return new i()[a](n(-1)),!1}catch{return!0}}catch{return!1}}},5170:(e,l,t)=>{var d=t(6706),n=t(4402);e.exports=d(n.proto,"size","get")||function(a){return a.size}},3650:(e,l,t)=>{var d=t(7080),n=t(4402),a=t(9286),i=t(3789),s=t(507),c=n.add,F=n.has,h=n.remove;e.exports=function(o){var V=d(this),W=i(o).getIterator(),Q=a(V);return s(W,function(m){F(V,m)?h(Q,m):c(Q,m)}),Q}},4204:(e,l,t)=>{var d=t(7080),n=t(4402).add,a=t(9286),i=t(3789),s=t(507);e.exports=function(c){var F=d(this),h=i(c).getIterator(),o=a(F);return s(h,function(V){n(o,V)}),o}},6119:(e,l,t)=>{var d=t(5745),n=t(3392),a=d("keys");e.exports=function(i){return a[i]||(a[i]=n(i))}},7629:(e,l,t)=>{var d=t(6395),n=t(4576),a=t(9433),i="__core-js_shared__",s=e.exports=n[i]||a(i,{});(s.versions||(s.versions=[])).push({version:"3.39.0",mode:d?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(e,l,t)=>{var d=t(7629);e.exports=function(n,a){return d[n]||(d[n]=a||{})}},1548:(e,l,t)=>{var d=t(4576),n=t(9039),a=t(9519),i=t(4215),s=d.structuredClone;e.exports=!!s&&!n(function(){if(i==="DENO"&&a>92||i==="NODE"&&a>94||i==="BROWSER"&&a>97)return!1;var c=new ArrayBuffer(8),F=s(c,{transfer:[c]});return c.byteLength!==0||F.byteLength!==8})},4495:(e,l,t)=>{var d=t(9519),n=t(9039),a=t(4576),i=a.String;e.exports=!!Object.getOwnPropertySymbols&&!n(function(){var s=Symbol("symbol detection");return!i(s)||!(Object(s)instanceof Symbol)||!Symbol.sham&&d&&d<41})},5610:(e,l,t)=>{var d=t(1291),n=Math.max,a=Math.min;e.exports=function(i,s){var c=d(i);return c<0?n(c+s,0):a(c,s)}},5854:(e,l,t)=>{var d=t(2777),n=TypeError;e.exports=function(a){var i=d(a,"number");if(typeof i=="number")throw new n("Can't convert number to bigint");return BigInt(i)}},7696:(e,l,t)=>{var d=t(1291),n=t(8014),a=RangeError;e.exports=function(i){if(i===void 0)return 0;var s=d(i),c=n(s);if(s!==c)throw new a("Wrong length or index");return c}},5397:(e,l,t)=>{var d=t(7055),n=t(7750);e.exports=function(a){return d(n(a))}},1291:(e,l,t)=>{var d=t(741);e.exports=function(n){var a=+n;return a!==a||a===0?0:d(a)}},8014:(e,l,t)=>{var d=t(1291),n=Math.min;e.exports=function(a){var i=d(a);return i>0?n(i,9007199254740991):0}},8981:(e,l,t)=>{var d=t(7750),n=Object;e.exports=function(a){return n(d(a))}},9590:(e,l,t)=>{var d=t(1291),n=RangeError;e.exports=function(a){var i=d(a);if(i<0)throw new n("The argument can't be less than 0");return i}},2777:(e,l,t)=>{var d=t(9565),n=t(34),a=t(757),i=t(5966),s=t(4270),c=t(8227),F=TypeError,h=c("toPrimitive");e.exports=function(o,V){if(!n(o)||a(o))return o;var W=i(o,h),Q;if(W){if(V===void 0&&(V="default"),Q=d(W,o,V),!n(Q)||a(Q))return Q;throw new F("Can't convert object to primitive value")}return V===void 0&&(V="number"),s(o,V)}},6969:(e,l,t)=>{var d=t(2777),n=t(757);e.exports=function(a){var i=d(a,"string");return n(i)?i:i+""}},2140:(e,l,t)=>{var d=t(8227),n=d("toStringTag"),a={};a[n]="z",e.exports=String(a)==="[object z]"},655:(e,l,t)=>{var d=t(6955),n=String;e.exports=function(a){if(d(a)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return n(a)}},6823:e=>{var l=String;e.exports=function(t){try{return l(t)}catch{return"Object"}}},3392:(e,l,t)=>{var d=t(9504),n=0,a=Math.random(),i=d(1 .toString);e.exports=function(s){return"Symbol("+(s===void 0?"":s)+")_"+i(++n+a,36)}},7040:(e,l,t)=>{var d=t(4495);e.exports=d&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},8686:(e,l,t)=>{var d=t(3724),n=t(9039);e.exports=d&&n(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})},2812:e=>{var l=TypeError;e.exports=function(t,d){if(t<d)throw new l("Not enough arguments");return t}},8622:(e,l,t)=>{var d=t(4576),n=t(4901),a=d.WeakMap;e.exports=n(a)&&/native code/.test(String(a))},8227:(e,l,t)=>{var d=t(4576),n=t(5745),a=t(9297),i=t(3392),s=t(4495),c=t(7040),F=d.Symbol,h=n("wks"),o=c?F.for||F:F&&F.withoutSetter||i;e.exports=function(V){return a(h,V)||(h[V]=s&&a(F,V)?F[V]:o("Symbol."+V)),h[V]}},6573:(e,l,t)=>{var d=t(3724),n=t(2106),a=t(3238),i=ArrayBuffer.prototype;d&&!("detached"in i)&&n(i,"detached",{configurable:!0,get:function(){return a(this)}})},7936:(e,l,t)=>{var d=t(6518),n=t(5636);n&&d({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return n(this,arguments.length?arguments[0]:void 0,!1)}})},8100:(e,l,t)=>{var d=t(6518),n=t(5636);n&&d({target:"ArrayBuffer",proto:!0},{transfer:function(){return n(this,arguments.length?arguments[0]:void 0,!0)}})},4114:(e,l,t)=>{var d=t(6518),n=t(8981),a=t(6198),i=t(4527),s=t(6837),c=t(9039),F=c(function(){return[].push.call({length:4294967296},1)!==4294967297}),h=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(V){return V instanceof TypeError}},o=F||!h();d({target:"Array",proto:!0,arity:1,forced:o},{push:function(V){var W=n(this),Q=a(W),m=arguments.length;s(Q+m);for(var R=0;R<m;R++)W[Q]=arguments[R],Q++;return i(W,Q),Q}})},8111:(e,l,t)=>{var d=t(6518),n=t(4576),a=t(679),i=t(8551),s=t(4901),c=t(2787),F=t(2106),h=t(4659),o=t(9039),V=t(9297),W=t(8227),Q=t(7657).IteratorPrototype,m=t(3724),R=t(6395),r="constructor",b="Iterator",u=W("toStringTag"),J=TypeError,G=n[b],T=R||!s(G)||G.prototype!==Q||!o(function(){G({})}),y=function(){if(a(this,Q),c(this)===Q)throw new J("Abstract class Iterator not directly constructable")},k=function(X,L){m?F(Q,X,{configurable:!0,get:function(){return L},set:function(D){if(i(this),this===Q)throw new J("You can't redefine this property");V(this,X)?this[X]=D:h(this,X,D)}}):Q[X]=L};V(Q,u)||k(u,b),(T||!V(Q,r)||Q[r]===Object)&&k(r,y),y.prototype=Q,d({global:!0,constructor:!0,forced:T},{Iterator:y})},9314:(e,l,t)=>{var d=t(6518),n=t(9565),a=t(8551),i=t(1767),s=t(4149),c=t(9590),F=t(9462),h=t(6395),o=F(function(){for(var V=this.iterator,W=this.next,Q,m;this.remaining;)if(this.remaining--,Q=a(n(W,V)),m=this.done=!!Q.done,m)return;if(Q=a(n(W,V)),m=this.done=!!Q.done,!m)return Q.value});d({target:"Iterator",proto:!0,real:!0,forced:h},{drop:function(V){a(this);var W=c(s(+V));return new o(i(this),{remaining:W})}})},1148:(e,l,t)=>{var d=t(6518),n=t(2652),a=t(9306),i=t(8551),s=t(1767);d({target:"Iterator",proto:!0,real:!0},{every:function(c){i(this),a(c);var F=s(this),h=0;return!n(F,function(o,V){if(!c(o,h++))return V()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2489:(e,l,t)=>{var d=t(6518),n=t(9565),a=t(9306),i=t(8551),s=t(1767),c=t(9462),F=t(6319),h=t(6395),o=c(function(){for(var V=this.iterator,W=this.predicate,Q=this.next,m,R,r;;){if(m=i(n(Q,V)),R=this.done=!!m.done,R)return;if(r=m.value,F(V,W,[r,this.counter++],!0))return r}});d({target:"Iterator",proto:!0,real:!0,forced:h},{filter:function(V){return i(this),a(V),new o(s(this),{predicate:V})}})},531:(e,l,t)=>{var d=t(6518),n=t(9565),a=t(9306),i=t(8551),s=t(1767),c=t(8646),F=t(9462),h=t(9539),o=t(6395),V=F(function(){for(var W=this.iterator,Q=this.mapper,m,R;;){if(R=this.inner)try{if(m=i(n(R.next,R.iterator)),!m.done)return m.value;this.inner=null}catch(r){h(W,"throw",r)}if(m=i(n(this.next,W)),this.done=!!m.done)return;try{this.inner=c(Q(m.value,this.counter++),!1)}catch(r){h(W,"throw",r)}}});d({target:"Iterator",proto:!0,real:!0,forced:o},{flatMap:function(W){return i(this),a(W),new V(s(this),{mapper:W,inner:null})}})},1701:(e,l,t)=>{var d=t(6518),n=t(713),a=t(6395);d({target:"Iterator",proto:!0,real:!0,forced:a},{map:n})},3579:(e,l,t)=>{var d=t(6518),n=t(2652),a=t(9306),i=t(8551),s=t(1767);d({target:"Iterator",proto:!0,real:!0},{some:function(c){i(this),a(c);var F=s(this),h=0;return n(F,function(o,V){if(c(o,h++))return V()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1689:(e,l,t)=>{var d=t(6518),n=t(4576),a=t(8745),i=t(7680),s=t(6043),c=t(9306),F=t(1103),h=n.Promise,o=!1,V=!h||!h.try||F(function(){h.try(function(W){o=W===8},8)}).error||!o;d({target:"Promise",stat:!0,forced:V},{try:function(W){var Q=arguments.length>1?i(arguments,1):[],m=s.f(this),R=F(function(){return a(c(W),void 0,Q)});return(R.error?m.reject:m.resolve)(R.value),m.promise}})},4628:(e,l,t)=>{var d=t(6518),n=t(6043);d({target:"Promise",stat:!0},{withResolvers:function(){var a=n.f(this);return{promise:a.promise,resolve:a.resolve,reject:a.reject}}})},7642:(e,l,t)=>{var d=t(6518),n=t(3440),a=t(4916);d({target:"Set",proto:!0,real:!0,forced:!a("difference")},{difference:n})},8004:(e,l,t)=>{var d=t(6518),n=t(9039),a=t(8750),i=t(4916),s=!i("intersection")||n(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});d({target:"Set",proto:!0,real:!0,forced:s},{intersection:a})},3853:(e,l,t)=>{var d=t(6518),n=t(4449),a=t(4916);d({target:"Set",proto:!0,real:!0,forced:!a("isDisjointFrom")},{isDisjointFrom:n})},5876:(e,l,t)=>{var d=t(6518),n=t(3838),a=t(4916);d({target:"Set",proto:!0,real:!0,forced:!a("isSubsetOf")},{isSubsetOf:n})},2475:(e,l,t)=>{var d=t(6518),n=t(8527),a=t(4916);d({target:"Set",proto:!0,real:!0,forced:!a("isSupersetOf")},{isSupersetOf:n})},5024:(e,l,t)=>{var d=t(6518),n=t(3650),a=t(4916);d({target:"Set",proto:!0,real:!0,forced:!a("symmetricDifference")},{symmetricDifference:n})},1698:(e,l,t)=>{var d=t(6518),n=t(4204),a=t(4916);d({target:"Set",proto:!0,real:!0,forced:!a("union")},{union:n})},7467:(e,l,t)=>{var d=t(7628),n=t(4644),a=n.aTypedArray,i=n.exportTypedArrayMethod,s=n.getTypedArrayConstructor;i("toReversed",function(){return d(a(this),s(this))})},4732:(e,l,t)=>{var d=t(4644),n=t(9504),a=t(9306),i=t(5370),s=d.aTypedArray,c=d.getTypedArrayConstructor,F=d.exportTypedArrayMethod,h=n(d.TypedArrayPrototype.sort);F("toSorted",function(o){o!==void 0&&a(o);var V=s(this),W=i(c(V),V);return h(W,o)})},9577:(e,l,t)=>{var d=t(9928),n=t(4644),a=t(1108),i=t(1291),s=t(5854),c=n.aTypedArray,F=n.getTypedArrayConstructor,h=n.exportTypedArrayMethod,o=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(V){return V===8}}();h("with",function(V,W){var Q=c(this),m=i(V),R=a(Q)?s(W):+W;return d(Q,F(Q),m,R)},!o)},8992:(e,l,t)=>{t(8111)},4743:(e,l,t)=>{t(9314)},3215:(e,l,t)=>{t(1148)},4520:(e,l,t)=>{t(2489)},670:(e,l,t)=>{t(531)},1454:(e,l,t)=>{t(1701)},7550:(e,l,t)=>{t(3579)},8335:(e,l,t)=>{var d=t(6518),n=t(3724),a=t(4576),i=t(7751),s=t(9504),c=t(9565),F=t(4901),h=t(34),o=t(4376),V=t(9297),W=t(655),Q=t(6198),m=t(4659),R=t(9039),r=t(8235),b=t(4495),u=a.JSON,J=a.Number,G=a.SyntaxError,T=u&&u.parse,y=i("Object","keys"),k=Object.getOwnPropertyDescriptor,X=s("".charAt),L=s("".slice),D=s(/./.exec),C=s([].push),I=/^\d$/,P=/^[1-9]$/,H=/^[\d-]$/,Y=/^[\t\n\r ]$/,B=0,z=1,g=function(_,K){_=W(_);var tl=new x(_,0),el=tl.parse(),Bl=el.value,Ql=tl.skip(Y,el.end);if(Ql<_.length)throw new G('Unexpected extra character: "'+X(_,Ql)+'" after the parsed data at: '+Ql);return F(K)?w({"":Bl},"",K,el):Bl},w=function(_,K,tl,el){var Bl=_[K],Ql=el&&Bl===el.value,_l=Ql&&typeof el.source=="string"?{source:el.source}:{},Tt,Hd,ie,_t,g0;if(h(Bl)){var PX=o(Bl),ZQ=Ql?el.nodes:PX?[]:{};if(PX)for(Tt=ZQ.length,ie=Q(Bl),_t=0;_t<ie;_t++)O(Bl,_t,w(Bl,""+_t,tl,_t<Tt?ZQ[_t]:void 0));else for(Hd=y(Bl),ie=Q(Hd),_t=0;_t<ie;_t++)g0=Hd[_t],O(Bl,g0,w(Bl,g0,tl,V(ZQ,g0)?ZQ[g0]:void 0))}return c(tl,_,K,Bl,_l)},O=function(_,K,tl){if(n){var el=k(_,K);if(el&&!el.configurable)return}tl===void 0?delete _[K]:m(_,K,tl)},f=function(_,K,tl,el){this.value=_,this.end=K,this.source=tl,this.nodes=el},x=function(_,K){this.source=_,this.index=K};x.prototype={fork:function(_){return new x(this.source,_)},parse:function(){var _=this.source,K=this.skip(Y,this.index),tl=this.fork(K),el=X(_,K);if(D(H,el))return tl.number();switch(el){case"{":return tl.object();case"[":return tl.array();case'"':return tl.string();case"t":return tl.keyword(!0);case"f":return tl.keyword(!1);case"n":return tl.keyword(null)}throw new G('Unexpected character: "'+el+'" at: '+K)},node:function(_,K,tl,el,Bl){return new f(K,el,_?null:L(this.source,tl,el),Bl)},object:function(){for(var _=this.source,K=this.index+1,tl=!1,el={},Bl={};K<_.length;){if(K=this.until(['"',"}"],K),X(_,K)==="}"&&!tl){K++;break}var Ql=this.fork(K).string(),_l=Ql.value;K=Ql.end,K=this.until([":"],K)+1,K=this.skip(Y,K),Ql=this.fork(K).parse(),m(Bl,_l,Ql),m(el,_l,Ql.value),K=this.until([",","}"],Ql.end);var Tt=X(_,K);if(Tt===",")tl=!0,K++;else if(Tt==="}"){K++;break}}return this.node(z,el,this.index,K,Bl)},array:function(){for(var _=this.source,K=this.index+1,tl=!1,el=[],Bl=[];K<_.length;){if(K=this.skip(Y,K),X(_,K)==="]"&&!tl){K++;break}var Ql=this.fork(K).parse();if(C(Bl,Ql),C(el,Ql.value),K=this.until([",","]"],Ql.end),X(_,K)===",")tl=!0,K++;else if(X(_,K)==="]"){K++;break}}return this.node(z,el,this.index,K,Bl)},string:function(){var _=this.index,K=r(this.source,this.index+1);return this.node(B,K.value,_,K.end)},number:function(){var _=this.source,K=this.index,tl=K;if(X(_,tl)==="-"&&tl++,X(_,tl)==="0")tl++;else if(D(P,X(_,tl)))tl=this.skip(I,tl+1);else throw new G("Failed to parse number at: "+tl);if(X(_,tl)==="."&&(tl=this.skip(I,tl+1)),X(_,tl)==="e"||X(_,tl)==="E"){tl++,(X(_,tl)==="+"||X(_,tl)==="-")&&tl++;var el=tl;if(tl=this.skip(I,tl),el===tl)throw new G("Failed to parse number's exponent value at: "+tl)}return this.node(B,J(L(_,K,tl)),K,tl)},keyword:function(_){var K=""+_,tl=this.index,el=tl+K.length;if(L(this.source,tl,el)!==K)throw new G("Failed to parse value at: "+tl);return this.node(B,_,tl,el)},skip:function(_,K){for(var tl=this.source;K<tl.length&&D(_,X(tl,K));K++);return K},until:function(_,K){K=this.skip(Y,K);for(var tl=X(this.source,K),el=0;el<_.length;el++)if(_[el]===tl)return K;throw new G('Unexpected character: "'+tl+'" at: '+K)}};var A=R(function(){var _="9007199254740993",K;return T(_,function(tl,el,Bl){K=Bl.source}),K!==_}),al=b&&!R(function(){return 1/T("-0 ")!==-1/0});d({target:"JSON",stat:!0,forced:A},{parse:function(_,K){return al&&!F(K)?T(_):g(_,K)}})},5247:(e,l,t)=>{t(1689)},4979:(e,l,t)=>{var d=t(6518),n=t(4576),a=t(7751),i=t(6980),s=t(4913).f,c=t(9297),F=t(679),h=t(3167),o=t(2603),V=t(5002),W=t(8574),Q=t(3724),m=t(6395),R="DOMException",r=a("Error"),b=a(R),u=function(){F(this,J);var H=arguments.length,Y=o(H<1?void 0:arguments[0]),B=o(H<2?void 0:arguments[1],"Error"),z=new b(Y,B),g=new r(Y);return g.name=R,s(z,"stack",i(1,W(g.stack,1))),h(z,this,u),z},J=u.prototype=b.prototype,G="stack"in new r(R),T="stack"in new b(1,2),y=b&&Q&&Object.getOwnPropertyDescriptor(n,R),k=!!y&&!(y.writable&&y.configurable),X=G&&!k&&!T;d({global:!0,constructor:!0,forced:m||X},{DOMException:X?u:b});var L=a(R),D=L.prototype;if(D.constructor!==L){m||s(D,"constructor",i(1,L));for(var C in V)if(c(V,C)){var I=V[C],P=I.s;c(L,P)||s(L,P,i(6,I.c))}}},4603:(e,l,t)=>{var d=t(6840),n=t(9504),a=t(655),i=t(2812),s=URLSearchParams,c=s.prototype,F=n(c.append),h=n(c.delete),o=n(c.forEach),V=n([].push),W=new s("a=1&a=2&b=3");W.delete("a",1),W.delete("b",void 0),W+""!="a=2"&&d(c,"delete",function(Q){var m=arguments.length,R=m<2?void 0:arguments[1];if(m&&R===void 0)return h(this,Q);var r=[];o(this,function(X,L){V(r,{key:L,value:X})}),i(m,1);for(var b=a(Q),u=a(R),J=0,G=0,T=!1,y=r.length,k;J<y;)k=r[J++],T||k.key===b?(T=!0,h(this,k.key)):G++;for(;G<y;)k=r[G++],k.key===b&&k.value===u||F(this,k.key,k.value)},{enumerable:!0,unsafe:!0})},7566:(e,l,t)=>{var d=t(6840),n=t(9504),a=t(655),i=t(2812),s=URLSearchParams,c=s.prototype,F=n(c.getAll),h=n(c.has),o=new s("a=1");(o.has("a",2)||!o.has("a",void 0))&&d(c,"has",function(V){var W=arguments.length,Q=W<2?void 0:arguments[1];if(W&&Q===void 0)return h(this,V);var m=F(this,V);i(W,1);for(var R=a(Q),r=0;r<m.length;)if(m[r++]===R)return!0;return!1},{enumerable:!0,unsafe:!0})},8721:(e,l,t)=>{var d=t(3724),n=t(9504),a=t(2106),i=URLSearchParams.prototype,s=n(i.forEach);d&&!("size"in i)&&a(i,"size",{get:function(){var c=0;return s(this,function(){c++}),c},configurable:!0,enumerable:!0})}},iM={};function Tl(e){var l=iM[e];if(l!==void 0)return l.exports;var t=iM[e]={exports:{}};return NL[e].call(t.exports,t,t.exports,Tl),t.exports}Tl.d=(e,l)=>{for(var t in l)Tl.o(l,t)&&!Tl.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:l[t]})},Tl.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l);var ml=globalThis.pdfjsLib={};Tl.d(ml,{AbortException:()=>gn,AnnotationEditorLayer:()=>zD,AnnotationEditorParamsType:()=>Jl,AnnotationEditorType:()=>ul,AnnotationEditorUIManager:()=>MZ,AnnotationLayer:()=>rD,AnnotationMode:()=>Cn,ColorPicker:()=>mJ,DOMSVGFactory:()=>nN,DrawLayer:()=>LD,FeatureTest:()=>te,GlobalWorkerOptions:()=>ac,ImageKind:()=>ph,InvalidPDFException:()=>nR,MissingPDFException:()=>cZ,OPS:()=>ld,OutputScale:()=>WR,PDFDataRangeTransport:()=>kS,PDFDateString:()=>hM,PDFWorker:()=>xo,PasswordResponses:()=>pL,PermissionFlag:()=>rL,PixelsPerInch:()=>Bs,RenderingCancelledException:()=>FR,TextLayer:()=>$R,TouchManager:()=>IM,UnexpectedResponseException:()=>Th,Util:()=>sl,VerbosityLevel:()=>Mh,XfaLayer:()=>wS,build:()=>tD,createValidAbsoluteUrl:()=>TL,fetchData:()=>yh,getDocument:()=>OI,getFilenameFromUrl:()=>IL,getPdfFilenameFromUrl:()=>DL,getXfaPageViewport:()=>wL,isDataScheme:()=>Bh,isPdfFile:()=>hR,noContextMenu:()=>td,normalizeUnicode:()=>kL,setLayerDimensions:()=>Pa,shadow:()=>rl,stopEvent:()=>ue,version:()=>lD}),Tl(4114),Tl(6573),Tl(8100),Tl(7936),Tl(7467),Tl(4732),Tl(9577),Tl(5247),Tl(4979),Tl(4603),Tl(7566),Tl(8721);const Et=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),sM=[1,0,0,1,0,0],tR=[.001,0,0,.001,0,0],bL=1e7,eR=1.35,be={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Cn={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},uL="pdfjs_internal_editor_",ul={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},Jl={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35,DRAW_STEP:41},rL={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Ct={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},ph={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},ht={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,WIDGET:20},sZ={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Mh={ERRORS:0,WARNINGS:1,INFOS:5},ld={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},pL={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Sh=Mh.WARNINGS;function ML(e){Number.isInteger(e)&&(Sh=e)}function SL(){return Sh}function Jh(e){Sh>=Mh.INFOS&&console.log(`Info: ${e}`)}function Rl(e){Sh>=Mh.WARNINGS&&console.log(`Warning: ${e}`)}function Cl(e){throw new Error(e)}function st(e,l){e||Cl(l)}function JL(e){switch(e==null?void 0:e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function TL(e,l=null,t=null){if(!e)return null;try{if(t&&typeof e=="string"){if(t.addDefaultProtocol&&e.startsWith("www.")){const n=e.match(/\./g);(n==null?void 0:n.length)>=2&&(e=`http://${e}`)}if(t.tryConvertEncoding)try{e=YL(e)}catch{}}const d=l?new URL(e,l):new URL(e);if(JL(d))return d}catch{}return null}function rl(e,l,t,d=!1){return Object.defineProperty(e,l,{value:t,enumerable:!d,configurable:!0,writable:!1}),t}const xn=function(){function e(l,t){this.message=l,this.name=t}return e.prototype=new Error,e.constructor=e,e}();class cM extends xn{constructor(l,t){super(l,"PasswordException"),this.code=t}}class dR extends xn{constructor(l,t){super(l,"UnknownErrorException"),this.details=t}}let nR=class extends xn{constructor(e){super(e,"InvalidPDFException")}},cZ=class extends xn{constructor(e){super(e,"MissingPDFException")}},Th=class extends xn{constructor(e,l){super(e,"UnexpectedResponseException"),this.status=l}};class GL extends xn{constructor(l){super(l,"FormatError")}}let gn=class extends xn{constructor(e){super(e,"AbortException")}};function UM(e){(typeof e!="object"||(e==null?void 0:e.length)===void 0)&&Cl("Invalid argument for bytesToString");const l=e.length,t=8192;if(l<t)return String.fromCharCode.apply(null,e);const d=[];for(let n=0;n<l;n+=t){const a=Math.min(n+t,l),i=e.subarray(n,a);d.push(String.fromCharCode.apply(null,i))}return d.join("")}function Gh(e){typeof e!="string"&&Cl("Invalid argument for stringToBytes");const l=e.length,t=new Uint8Array(l);for(let d=0;d<l;++d)t[d]=e.charCodeAt(d)&255;return t}function XL(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function aR(e){const l=Object.create(null);for(const[t,d]of e)l[t]=d;return l}function yL(){const e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}function BL(){try{return new Function(""),!0}catch{return!1}}class te{static get isLittleEndian(){return rl(this,"isLittleEndian",yL())}static get isEvalSupported(){return rl(this,"isEvalSupported",BL())}static get isOffscreenCanvasSupported(){return rl(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return rl(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?rl(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof(navigator==null?void 0:navigator.userAgent)=="string"&&navigator.userAgent.includes("Firefox")}):rl(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var l,t;return rl(this,"isCSSRoundSupported",(t=(l=globalThis.CSS)==null?void 0:l.supports)==null?void 0:t.call(l,"width: round(1.5px, 1px)"))}}const iR=Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,"0"));var fa,sR,Xh,cR;let sl=(sR=class{static makeHexColor(e,l,t){return`#${iR[e]}${iR[l]}${iR[t]}`}static scaleMinMax(e,l){let t;e[0]?(e[0]<0&&(t=l[0],l[0]=l[2],l[2]=t),l[0]*=e[0],l[2]*=e[0],e[3]<0&&(t=l[1],l[1]=l[3],l[3]=t),l[1]*=e[3],l[3]*=e[3]):(t=l[0],l[0]=l[1],l[1]=t,t=l[2],l[2]=l[3],l[3]=t,e[1]<0&&(t=l[1],l[1]=l[3],l[3]=t),l[1]*=e[1],l[3]*=e[1],e[2]<0&&(t=l[0],l[0]=l[2],l[2]=t),l[0]*=e[2],l[2]*=e[2]),l[0]+=e[4],l[1]+=e[5],l[2]+=e[4],l[3]+=e[5]}static transform(e,l){return[e[0]*l[0]+e[2]*l[1],e[1]*l[0]+e[3]*l[1],e[0]*l[2]+e[2]*l[3],e[1]*l[2]+e[3]*l[3],e[0]*l[4]+e[2]*l[5]+e[4],e[1]*l[4]+e[3]*l[5]+e[5]]}static applyTransform(e,l){const t=e[0]*l[0]+e[1]*l[2]+l[4],d=e[0]*l[1]+e[1]*l[3]+l[5];return[t,d]}static applyInverseTransform(e,l){const t=l[0]*l[3]-l[1]*l[2],d=(e[0]*l[3]-e[1]*l[2]+l[2]*l[5]-l[4]*l[3])/t,n=(-e[0]*l[1]+e[1]*l[0]+l[4]*l[1]-l[5]*l[0])/t;return[d,n]}static getAxialAlignedBoundingBox(e,l){const t=this.applyTransform(e,l),d=this.applyTransform(e.slice(2,4),l),n=this.applyTransform([e[0],e[3]],l),a=this.applyTransform([e[2],e[1]],l);return[Math.min(t[0],d[0],n[0],a[0]),Math.min(t[1],d[1],n[1],a[1]),Math.max(t[0],d[0],n[0],a[0]),Math.max(t[1],d[1],n[1],a[1])]}static inverseTransform(e){const l=e[0]*e[3]-e[1]*e[2];return[e[3]/l,-e[1]/l,-e[2]/l,e[0]/l,(e[2]*e[5]-e[4]*e[3])/l,(e[4]*e[1]-e[5]*e[0])/l]}static singularValueDecompose2dScale(e){const l=[e[0],e[2],e[1],e[3]],t=e[0]*l[0]+e[1]*l[2],d=e[0]*l[1]+e[1]*l[3],n=e[2]*l[0]+e[3]*l[2],a=e[2]*l[1]+e[3]*l[3],i=(t+a)/2,s=Math.sqrt((t+a)**2-4*(t*a-n*d))/2,c=i+s||1,F=i-s||1;return[Math.sqrt(c),Math.sqrt(F)]}static normalizeRect(e){const l=e.slice(0);return e[0]>e[2]&&(l[0]=e[2],l[2]=e[0]),e[1]>e[3]&&(l[1]=e[3],l[3]=e[1]),l}static intersect(e,l){const t=Math.max(Math.min(e[0],e[2]),Math.min(l[0],l[2])),d=Math.min(Math.max(e[0],e[2]),Math.max(l[0],l[2]));if(t>d)return null;const n=Math.max(Math.min(e[1],e[3]),Math.min(l[1],l[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(l[1],l[3]));return n>a?null:[t,n,d,a]}static bezierBoundingBox(e,l,t,d,n,a,i,s,c){return c?(c[0]=Math.min(c[0],e,i),c[1]=Math.min(c[1],l,s),c[2]=Math.max(c[2],e,i),c[3]=Math.max(c[3],l,s)):c=[Math.min(e,i),Math.min(l,s),Math.max(e,i),Math.max(l,s)],p(this,fa,cR).call(this,e,t,n,i,l,d,a,s,3*(-e+3*(t-n)+i),6*(e-2*t+n),3*(t-e),c),p(this,fa,cR).call(this,e,t,n,i,l,d,a,s,3*(-l+3*(d-a)+s),6*(l-2*d+a),3*(d-l),c),c}},fa=new WeakSet,Xh=function(e,l,t,d,n,a,i,s,c,F){if(c<=0||c>=1)return;const h=1-c,o=c*c,V=o*c,W=h*(h*(h*e+3*c*l)+3*o*t)+V*d,Q=h*(h*(h*n+3*c*a)+3*o*i)+V*s;F[0]=Math.min(F[0],W),F[1]=Math.min(F[1],Q),F[2]=Math.max(F[2],W),F[3]=Math.max(F[3],Q)},cR=function(e,l,t,d,n,a,i,s,c,F,h,o){if(Math.abs(c)<1e-12){Math.abs(F)>=1e-12&&p(this,fa,Xh).call(this,e,l,t,d,n,a,i,s,-h/F,o);return}const V=F**2-4*h*c;if(V<0)return;const W=Math.sqrt(V),Q=2*c;p(this,fa,Xh).call(this,e,l,t,d,n,a,i,s,(-F+W)/Q,o),p(this,fa,Xh).call(this,e,l,t,d,n,a,i,s,(-F-W)/Q,o)},M(sR,fa),sR);function YL(e){return decodeURIComponent(escape(e))}let UR=null,ZM=null;function kL(e){return UR||(UR=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,ZM=new Map([["ſt","ſt"]])),e.replaceAll(UR,(l,t,d)=>t?t.normalize("NFKC"):ZM.get(d))}function zL(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=new Uint8Array(32);return crypto.getRandomValues(e),UM(e)}const ZR="pdfjs_internal_id_";function LL(e){return Uint8Array.prototype.toBase64?e.toBase64():btoa(UM(e))}Tl(4628),Tl(7642),Tl(8004),Tl(3853),Tl(5876),Tl(2475),Tl(5024),Tl(1698),Tl(1454),Tl(8992),Tl(4743),Tl(3215),Tl(7550),Tl(8335);const Ad="http://www.w3.org/2000/svg";var Ha;let Bs=(Ha=class{},hl(Ha,"CSS",96),hl(Ha,"PDF",72),hl(Ha,"PDF_TO_CSS_UNITS",Ha.CSS/Ha.PDF),Ha);async function yh(e,l="text"){if(ZZ(e,document.baseURI)){const t=await fetch(e);if(!t.ok)throw new Error(t.statusText);switch(l){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json()}return t.text()}return new Promise((t,d)=>{const n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType=l,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE){if(n.status===200||n.status===0){switch(l){case"arraybuffer":case"blob":case"json":t(n.response);return}t(n.responseText);return}d(new Error(n.statusText))}},n.send(null)})}class UZ{constructor({viewBox:l,userUnit:t,scale:d,rotation:n,offsetX:a=0,offsetY:i=0,dontFlip:s=!1}){this.viewBox=l,this.userUnit=t,this.scale=d,this.rotation=n,this.offsetX=a,this.offsetY=i,d*=t;const c=(l[2]+l[0])/2,F=(l[3]+l[1])/2;let h,o,V,W;switch(n%=360,n<0&&(n+=360),n){case 180:h=-1,o=0,V=0,W=1;break;case 90:h=0,o=1,V=1,W=0;break;case 270:h=0,o=-1,V=-1,W=0;break;case 0:h=1,o=0,V=0,W=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}s&&(V=-V,W=-W);let Q,m,R,r;h===0?(Q=Math.abs(F-l[1])*d+a,m=Math.abs(c-l[0])*d+i,R=(l[3]-l[1])*d,r=(l[2]-l[0])*d):(Q=Math.abs(c-l[0])*d+a,m=Math.abs(F-l[1])*d+i,R=(l[2]-l[0])*d,r=(l[3]-l[1])*d),this.transform=[h*d,o*d,V*d,W*d,Q-h*d*c-V*d*F,m-o*d*c-W*d*F],this.width=R,this.height=r}get rawDims(){const{userUnit:l,viewBox:t}=this,d=t.map(n=>n*l);return rl(this,"rawDims",{pageWidth:d[2]-d[0],pageHeight:d[3]-d[1],pageX:d[0],pageY:d[1]})}clone({scale:l=this.scale,rotation:t=this.rotation,offsetX:d=this.offsetX,offsetY:n=this.offsetY,dontFlip:a=!1}={}){return new UZ({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:l,rotation:t,offsetX:d,offsetY:n,dontFlip:a})}convertToViewportPoint(l,t){return sl.applyTransform([l,t],this.transform)}convertToViewportRectangle(l){const t=sl.applyTransform([l[0],l[1]],this.transform),d=sl.applyTransform([l[2],l[3]],this.transform);return[t[0],t[1],d[0],d[1]]}convertToPdfPoint(l,t){return sl.applyInverseTransform([l,t],this.transform)}}let FR=class extends xn{constructor(e,l=0){super(e,"RenderingCancelledException"),this.extraDelay=l}};function Bh(e){const l=e.length;let t=0;for(;t<l&&e[t].trim()==="";)t++;return e.substring(t,t+5).toLowerCase()==="data:"}function hR(e){return typeof e=="string"&&/\.pdf$/i.test(e)}function IL(e){return[e]=e.split(/[#?]/,1),e.substring(e.lastIndexOf("/")+1)}function DL(e,l="document.pdf"){if(typeof e!="string")return l;if(Bh(e))return Rl('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),l;const t=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,d=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=t.exec(e);let a=d.exec(n[1])||d.exec(n[2])||d.exec(n[3]);if(a&&(a=a[0],a.includes("%")))try{a=d.exec(decodeURIComponent(a))[0]}catch{}return a||l}class FM{constructor(){hl(this,"started",Object.create(null)),hl(this,"times",[])}time(l){l in this.started&&Rl(`Timer is already running for ${l}`),this.started[l]=Date.now()}timeEnd(l){l in this.started||Rl(`Timer has not been started for ${l}`),this.times.push({name:l,start:this.started[l],end:Date.now()}),delete this.started[l]}toString(){const l=[];let t=0;for(const{name:d}of this.times)t=Math.max(d.length,t);for(const{name:d,start:n,end:a}of this.times)l.push(`${d.padEnd(t)} ${a-n}ms
37
- `);return l.join("")}}function ZZ(e,l){try{const{protocol:t}=l?new URL(e,l):new URL(e);return t==="http:"||t==="https:"}catch{return!1}}function td(e){e.preventDefault()}function ue(e){e.preventDefault(),e.stopPropagation()}var oR,FZ;let hM=(oR=class{static toDateObject(e){if(!e||typeof e!="string")return null;U(this,FZ)||N(this,FZ,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const l=U(this,FZ).exec(e);if(!l)return null;const t=parseInt(l[1],10);let d=parseInt(l[2],10);d=d>=1&&d<=12?d-1:0;let n=parseInt(l[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(l[4],10);a=a>=0&&a<=23?a:0;let i=parseInt(l[5],10);i=i>=0&&i<=59?i:0;let s=parseInt(l[6],10);s=s>=0&&s<=59?s:0;const c=l[7]||"Z";let F=parseInt(l[8],10);F=F>=0&&F<=23?F:0;let h=parseInt(l[9],10)||0;return h=h>=0&&h<=59?h:0,c==="-"?(a+=F,i+=h):c==="+"&&(a-=F,i-=h),new Date(Date.UTC(t,d,n,a,i,s))}},FZ=new WeakMap,M(oR,FZ),oR);function wL(e,{scale:l=1,rotation:t=0}){const{width:d,height:n}=e.attributes.style,a=[0,0,parseInt(d),parseInt(n)];return new UZ({viewBox:a,userUnit:1,scale:l,rotation:t})}function VR(e){if(e.startsWith("#")){const l=parseInt(e.slice(1),16);return[(l&16711680)>>16,(l&65280)>>8,l&255]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map(l=>parseInt(l)):e.startsWith("rgba(")?e.slice(5,-1).split(",").map(l=>parseInt(l)).slice(0,3):(Rl(`Not a valid color format: "${e}"`),[0,0,0])}function EL(e){const l=document.createElement("span");l.style.visibility="hidden",document.body.append(l);for(const t of e.keys()){l.style.color=t;const d=window.getComputedStyle(l).color;e.set(t,VR(d))}l.remove()}function Ol(e){const{a:l,b:t,c:d,d:n,e:a,f:i}=e.getTransform();return[l,t,d,n,a,i]}function ud(e){const{a:l,b:t,c:d,d:n,e:a,f:i}=e.getTransform().invertSelf();return[l,t,d,n,a,i]}function Pa(e,l,t=!1,d=!0){if(l instanceof UZ){const{pageWidth:n,pageHeight:a}=l.rawDims,{style:i}=e,s=te.isCSSRoundSupported,c=`var(--scale-factor) * ${n}px`,F=`var(--scale-factor) * ${a}px`,h=s?`round(down, ${c}, var(--scale-round-x, 1px))`:`calc(${c})`,o=s?`round(down, ${F}, var(--scale-round-y, 1px))`:`calc(${F})`;!t||l.rotation%180===0?(i.width=h,i.height=o):(i.width=o,i.height=h)}d&&e.setAttribute("data-main-rotation",l.rotation)}let WR=class{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}};var Aa,Ys,rd,ks,Yh,hZ,QR,oM,pd,VM,WM,kh,QM,mR;const zh=class FQ{constructor(l){M(this,pd),M(this,Aa,null),M(this,Ys,null),M(this,rd),M(this,ks,null),M(this,Yh,null),N(this,rd,l),U(FQ,hZ)||N(FQ,hZ,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const l=N(this,Aa,document.createElement("div"));l.classList.add("editToolbar","hidden"),l.setAttribute("role","toolbar");const t=U(this,rd)._uiManager._signal;l.addEventListener("contextmenu",td,{signal:t}),l.addEventListener("pointerdown",p(FQ,QR,oM),{signal:t});const d=N(this,ks,document.createElement("div"));d.className="buttons",l.append(d);const n=U(this,rd).toolbarPosition;if(n){const{style:a}=l,i=U(this,rd)._uiManager.direction==="ltr"?1-n[0]:n[0];a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return p(this,pd,QM).call(this),l}get div(){return U(this,Aa)}hide(){var l;U(this,Aa).classList.add("hidden"),(l=U(this,Ys))==null||l.hideDropdown()}show(){var l;U(this,Aa).classList.remove("hidden"),(l=U(this,Yh))==null||l.shown()}async addAltText(l){const t=await l.render();p(this,pd,kh).call(this,t),U(this,ks).prepend(t,U(this,pd,mR)),N(this,Yh,l)}addColorPicker(l){N(this,Ys,l);const t=l.renderButton();p(this,pd,kh).call(this,t),U(this,ks).prepend(t,U(this,pd,mR))}remove(){var l;U(this,Aa).remove(),(l=U(this,Ys))==null||l.destroy(),N(this,Ys,null)}};Aa=new WeakMap,Ys=new WeakMap,rd=new WeakMap,ks=new WeakMap,Yh=new WeakMap,hZ=new WeakMap,QR=new WeakSet,oM=function(e){e.stopPropagation()},pd=new WeakSet,VM=function(e){U(this,rd)._focusEventsAllowed=!1,ue(e)},WM=function(e){U(this,rd)._focusEventsAllowed=!0,ue(e)},kh=function(e){const l=U(this,rd)._uiManager._signal;e.addEventListener("focusin",p(this,pd,VM).bind(this),{capture:!0,signal:l}),e.addEventListener("focusout",p(this,pd,WM).bind(this),{capture:!0,signal:l}),e.addEventListener("contextmenu",td,{signal:l})},QM=function(){const{editorType:e,_uiManager:l}=U(this,rd),t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",U(zh,hZ)[e]),p(this,pd,kh).call(this,t),t.addEventListener("click",d=>{l.delete()},{signal:l._signal}),U(this,ks).append(t)},mR=function(){const e=document.createElement("div");return e.className="divider",e},M(zh,QR),M(zh,hZ,null);let CL=zh;var Lh,_a,zs,oZ,mM,RM,NM;class xL{constructor(l){M(this,oZ),M(this,Lh,null),M(this,_a,null),M(this,zs),N(this,zs,l)}show(l,t,d){const[n,a]=p(this,oZ,RM).call(this,t,d),{style:i}=U(this,_a)||N(this,_a,p(this,oZ,mM).call(this));l.append(U(this,_a)),i.insetInlineEnd=`${100*n}%`,i.top=`calc(${100*a}% + var(--editor-toolbar-vert-offset))`}hide(){U(this,_a).remove()}}Lh=new WeakMap,_a=new WeakMap,zs=new WeakMap,oZ=new WeakSet,mM=function(){const e=N(this,_a,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",td,{signal:U(this,zs)._signal});const l=N(this,Lh,document.createElement("div"));return l.className="buttons",e.append(l),p(this,oZ,NM).call(this),e},RM=function(e,l){let t=0,d=0;for(const n of e){const a=n.y+n.height;if(a<t)continue;const i=n.x+(l?n.width:0);if(a>t){d=i,t=a;continue}l?i>d&&(d=i):i<d&&(d=i)}return[l?1-d:d,t]},NM=function(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const l=document.createElement("span");e.append(l),l.className="visuallyHidden",l.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const t=U(this,zs)._signal;e.addEventListener("contextmenu",td,{signal:t}),e.addEventListener("click",()=>{U(this,zs).highlightSelection("floating_button")},{signal:t}),U(this,Lh).append(e)};function Ih(e,l,t){for(const d of t)l.addEventListener(d,e[d].bind(e))}var RR;class gL{constructor(){M(this,RR,0)}get id(){return`${uL}${le(this,RR)._++}`}}RR=new WeakMap;var VZ,Dh,ot,WZ,wh;const bM=class{constructor(){M(this,WZ),M(this,VZ,zL()),M(this,Dh,0),M(this,ot,null)}static get _isSVGFittingCanvas(){const l='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),d=new Image;d.src=l;const n=d.decode().then(()=>(t.drawImage(d,0,0,1,1,0,0,1,3),new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]===0));return rl(this,"_isSVGFittingCanvas",n)}async getFromFile(l){const{lastModified:t,name:d,size:n,type:a}=l;return p(this,WZ,wh).call(this,`${t}_${d}_${n}_${a}`,l)}async getFromUrl(l){return p(this,WZ,wh).call(this,l,l)}async getFromBlob(l,t){const d=await t;return p(this,WZ,wh).call(this,l,d)}async getFromId(l){U(this,ot)||N(this,ot,new Map);const t=U(this,ot).get(l);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:d}=t;return delete t.blobPromise,this.getFromBlob(t.id,d)}return this.getFromUrl(t.url)}getFromCanvas(l,t){U(this,ot)||N(this,ot,new Map);let d=U(this,ot).get(l);if(d!=null&&d.bitmap)return d.refCounter+=1,d;const n=new OffscreenCanvas(t.width,t.height);return n.getContext("2d").drawImage(t,0,0),d={bitmap:n.transferToImageBitmap(),id:`image_${U(this,VZ)}_${le(this,Dh)._++}`,refCounter:1,isSvg:!1},U(this,ot).set(l,d),U(this,ot).set(d.id,d),d}getSvgUrl(l){const t=U(this,ot).get(l);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(l){var t;U(this,ot)||N(this,ot,new Map);const d=U(this,ot).get(l);if(!d||(d.refCounter-=1,d.refCounter!==0))return;const{bitmap:n}=d;if(!d.url&&!d.file){const a=new OffscreenCanvas(n.width,n.height);a.getContext("bitmaprenderer").transferFromImageBitmap(n),d.blobPromise=a.convertToBlob()}(t=n.close)==null||t.call(n),d.bitmap=null}isValidId(l){return l.startsWith(`image_${U(this,VZ)}_`)}};VZ=new WeakMap,Dh=new WeakMap,ot=new WeakMap,WZ=new WeakSet,wh=async function(e,l){U(this,ot)||N(this,ot,new Map);let t=U(this,ot).get(e);if(t===null)return null;if(t!=null&&t.bitmap)return t.refCounter+=1,t;try{t||(t={bitmap:null,id:`image_${U(this,VZ)}_${le(this,Dh)._++}`,refCounter:0,isSvg:!1});let d;if(typeof l=="string"?(t.url=l,d=await yh(l,"blob")):l instanceof File?d=t.file=l:l instanceof Blob&&(d=l),d.type==="image/svg+xml"){const n=bM._isSVGFittingCanvas,a=new FileReader,i=new Image,s=new Promise((c,F)=>{i.onload=()=>{t.bitmap=i,t.isSvg=!0,c()},a.onload=async()=>{const h=t.svgUrl=a.result;i.src=await n?`${h}#svgView(preserveAspectRatio(none))`:h},i.onerror=a.onerror=F});a.readAsDataURL(d),await s}else t.bitmap=await createImageBitmap(d);t.refCounter=1}catch(d){Rl(d),t=null}return U(this,ot).set(e,t),t&&U(this,ot).set(t.id,t),t};let jL=bM;var ct,qa,Eh,vl;class OL{constructor(l=128){M(this,ct,[]),M(this,qa,!1),M(this,Eh),M(this,vl,-1),N(this,Eh,l)}add({cmd:l,undo:t,post:d,mustExec:n,type:a=NaN,overwriteIfSameType:i=!1,keepUndo:s=!1}){if(n&&l(),U(this,qa))return;const c={cmd:l,undo:t,post:d,type:a};if(U(this,vl)===-1){U(this,ct).length>0&&(U(this,ct).length=0),N(this,vl,0),U(this,ct).push(c);return}if(i&&U(this,ct)[U(this,vl)].type===a){s&&(c.undo=U(this,ct)[U(this,vl)].undo),U(this,ct)[U(this,vl)]=c;return}const F=U(this,vl)+1;F===U(this,Eh)?U(this,ct).splice(0,1):(N(this,vl,F),F<U(this,ct).length&&U(this,ct).splice(F)),U(this,ct).push(c)}undo(){if(U(this,vl)===-1)return;N(this,qa,!0);const{undo:l,post:t}=U(this,ct)[U(this,vl)];l(),t==null||t(),N(this,qa,!1),N(this,vl,U(this,vl)-1)}redo(){if(U(this,vl)<U(this,ct).length-1){N(this,vl,U(this,vl)+1),N(this,qa,!0);const{cmd:l,post:t}=U(this,ct)[U(this,vl)];l(),t==null||t(),N(this,qa,!1)}}hasSomethingToUndo(){return U(this,vl)!==-1}hasSomethingToRedo(){return U(this,vl)<U(this,ct).length-1}cleanType(l){if(U(this,vl)!==-1){for(let t=U(this,vl);t>=0;t--)if(U(this,ct)[t].type!==l){U(this,ct).splice(t+1,U(this,vl)-t),N(this,vl,t);return}U(this,ct).length=0,N(this,vl,-1)}}destroy(){N(this,ct,null)}}ct=new WeakMap,qa=new WeakMap,Eh=new WeakMap,vl=new WeakMap;var NR,uM;class QZ{constructor(l){M(this,NR),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=te.platform;for(const[d,n,a={}]of l)for(const i of d){const s=i.startsWith("mac+");t&&s?(this.callbacks.set(i.slice(4),{callback:n,options:a}),this.allKeys.add(i.split("+").at(-1))):!t&&!s&&(this.callbacks.set(i,{callback:n,options:a}),this.allKeys.add(i.split("+").at(-1)))}}exec(l,t){if(!this.allKeys.has(t.key))return;const d=this.callbacks.get(p(this,NR,uM).call(this,t));if(!d)return;const{callback:n,options:{bubbles:a=!1,args:i=[],checker:s=null}}=d;s&&!s(l,t)||(n.bind(l,...i,t)(),a||ue(t))}}NR=new WeakSet,uM=function(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const l=this.buffer.join("+");return this.buffer.length=0,l};const rM=class oy{get _colors(){const l=new Map([["CanvasText",null],["Canvas",null]]);return EL(l),rl(this,"_colors",l)}convert(l){const t=VR(l);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[d,n]of this._colors)if(n.every((a,i)=>a===t[i]))return oy._colorsMapping.get(d);return t}getHexCode(l){const t=this._colors.get(l);return t?sl.makeHexColor(...t):l}};hl(rM,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let vL=rM;var mZ,ke,pt,xt,RZ,jn,Ls,ed,$a,Is,NZ,Ds,_d,Md,ws,Ch,xh,bZ,gh,qd,li,uZ,ti,Sd,bR,ei,jh,di,Es,Oh,vh,Xt,Dl,On,Cs,rZ,Kh,ni,$d,vn,fh,dd,xs,Ul,Hh,uR,pM,MM,Ph,SM,JM,TM,rR,GM,pR,MR,XM,ee,ln,yM,BM,SR,YM,pZ,JR;let MZ=(xs=class{constructor(e,l,t,d,n,a,i,s,c,F,h,o,V){M(this,Ul),M(this,mZ,new AbortController),M(this,ke,null),M(this,pt,new Map),M(this,xt,new Map),M(this,RZ,null),M(this,jn,null),M(this,Ls,null),M(this,ed,new OL),M(this,$a,null),M(this,Is,null),M(this,NZ,0),M(this,Ds,new Set),M(this,_d,null),M(this,Md,null),M(this,ws,new Set),hl(this,"_editorUndoBar",null),M(this,Ch,!1),M(this,xh,!1),M(this,bZ,!1),M(this,gh,null),M(this,qd,null),M(this,li,null),M(this,uZ,null),M(this,ti,!1),M(this,Sd,null),M(this,bR,new gL),M(this,ei,!1),M(this,jh,!1),M(this,di,null),M(this,Es,null),M(this,Oh,null),M(this,vh,null),M(this,Xt,ul.NONE),M(this,Dl,new Set),M(this,On,null),M(this,Cs,null),M(this,rZ,null),M(this,Kh,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),M(this,ni,[0,0]),M(this,$d,null),M(this,vn,null),M(this,fh,null),M(this,dd,null);const W=this._signal=U(this,mZ).signal;N(this,vn,e),N(this,fh,l),N(this,RZ,t),this._eventBus=d,d._on("editingaction",this.onEditingAction.bind(this),{signal:W}),d._on("pagechanging",this.onPageChanging.bind(this),{signal:W}),d._on("scalechanging",this.onScaleChanging.bind(this),{signal:W}),d._on("rotationchanging",this.onRotationChanging.bind(this),{signal:W}),d._on("setpreference",this.onSetPreference.bind(this),{signal:W}),d._on("switchannotationeditorparams",Q=>this.updateParams(Q.type,Q.value),{signal:W}),p(this,Ul,SM).call(this),p(this,Ul,XM).call(this),p(this,Ul,rR).call(this),N(this,jn,n.annotationStorage),N(this,gh,n.filterFactory),N(this,Cs,a),N(this,uZ,i||null),N(this,Ch,s),N(this,xh,c),N(this,bZ,F),N(this,vh,h||null),this.viewParameters={realScale:Bs.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=o||null,this._supportsPinchToZoom=V!==!1}static get _keyboardManager(){const e=xs.prototype,l=a=>U(a,vn).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),t=(a,{target:i})=>{if(i instanceof HTMLInputElement){const{type:s}=i;return s!=="text"&&s!=="number"}return!0},d=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return rl(this,"_keyboardManager",new QZ([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:t}],[["ctrl+z","mac+meta+z"],e.undo,{checker:t}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:t}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:t}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(a,{target:i})=>!(i instanceof HTMLButtonElement)&&U(a,vn).contains(i)&&!a.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(a,{target:i})=>!(i instanceof HTMLButtonElement)&&U(a,vn).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-d,0],checker:l}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:l}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[d,0],checker:l}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:l}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-d],checker:l}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:l}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,d],checker:l}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:l}]]))}destroy(){var e,l,t,d,n;(e=U(this,dd))==null||e.resolve(),N(this,dd,null),(l=U(this,mZ))==null||l.abort(),N(this,mZ,null),this._signal=null;for(const a of U(this,xt).values())a.destroy();U(this,xt).clear(),U(this,pt).clear(),U(this,ws).clear(),N(this,ke,null),U(this,Dl).clear(),U(this,ed).destroy(),(t=U(this,RZ))==null||t.destroy(),(d=U(this,Sd))==null||d.hide(),N(this,Sd,null),U(this,qd)&&(clearTimeout(U(this,qd)),N(this,qd,null)),U(this,$d)&&(clearTimeout(U(this,$d)),N(this,$d,null)),(n=this._editorUndoBar)==null||n.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return U(this,vh)}get useNewAltTextFlow(){return U(this,xh)}get useNewAltTextWhenAddingImage(){return U(this,bZ)}get hcmFilter(){return rl(this,"hcmFilter",U(this,Cs)?U(this,gh).addHCMFilter(U(this,Cs).foreground,U(this,Cs).background):"none")}get direction(){return rl(this,"direction",getComputedStyle(U(this,vn)).direction)}get highlightColors(){return rl(this,"highlightColors",U(this,uZ)?new Map(U(this,uZ).split(",").map(e=>e.split("=").map(l=>l.trim()))):null)}get highlightColorNames(){return rl(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),N(this,Is,e)}setMainHighlightColorPicker(e){N(this,Oh,e)}editAltText(e,l=!1){var t;(t=U(this,RZ))==null||t.editAltText(this,e,l)}switchToMode(e,l){this._eventBus.on("annotationeditormodechanged",l,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,l){this._eventBus.dispatch("setpreference",{source:this,name:e,value:l})}onSetPreference({name:e,value:l}){switch(e){case"enableNewAltTextWhenAddingImage":N(this,bZ,l);break}}onPageChanging({pageNumber:e}){N(this,NZ,e-1)}focusMainContainer(){U(this,vn).focus()}findParent(e,l){for(const t of U(this,xt).values()){const{x:d,y:n,width:a,height:i}=t.div.getBoundingClientRect();if(e>=d&&e<=d+a&&l>=n&&l<=n+i)return t}return null}disableUserSelect(e=!1){U(this,fh).classList.toggle("noUserSelect",e)}addShouldRescale(e){U(this,ws).add(e)}removeShouldRescale(e){U(this,ws).delete(e)}onScaleChanging({scale:e}){var l;this.commitOrRemove(),this.viewParameters.realScale=e*Bs.PDF_TO_CSS_UNITS;for(const t of U(this,ws))t.onScaleChanging();(l=U(this,Is))==null||l.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const l=document.getSelection();if(!l||l.isCollapsed)return;const{anchorNode:t,anchorOffset:d,focusNode:n,focusOffset:a}=l,i=l.toString(),s=p(this,Ul,Hh).call(this,l).closest(".textLayer"),c=this.getSelectionBoxes(s);if(!c)return;l.empty();const F=p(this,Ul,uR).call(this,s),h=U(this,Xt)===ul.NONE,o=()=>{F==null||F.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:c,anchorNode:t,anchorOffset:d,focusNode:n,focusOffset:a,text:i}),h&&this.showAllEditors("highlight",!0,!0)};if(h){this.switchToMode(ul.HIGHLIGHT,o);return}o()}addToAnnotationStorage(e){!e.isEmpty()&&U(this,jn)&&!U(this,jn).has(e.id)&&U(this,jn).setValue(e.id,e)}blur(){if(this.isShiftKeyDown=!1,U(this,ti)&&(N(this,ti,!1),p(this,Ul,Ph).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const l of U(this,Dl))if(l.div.contains(e)){N(this,Es,[l,e]),l._focusEventsAllowed=!1;break}}focus(){if(!U(this,Es))return;const[e,l]=U(this,Es);N(this,Es,null),l.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),l.focus()}addEditListeners(){p(this,Ul,rR).call(this),p(this,Ul,pR).call(this)}removeEditListeners(){p(this,Ul,GM).call(this),p(this,Ul,MR).call(this)}dragOver(e){for(const{type:l}of e.dataTransfer.items)for(const t of U(this,Md))if(t.isHandlingMimeForPasting(l)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const l of e.dataTransfer.items)for(const t of U(this,Md))if(t.isHandlingMimeForPasting(l.type)){t.paste(l,this.currentLayer),e.preventDefault();return}}copy(e){var l;if(e.preventDefault(),(l=U(this,ke))==null||l.commitOrRemove(),!this.hasSelection)return;const t=[];for(const d of U(this,Dl)){const n=d.serialize(!0);n&&t.push(n)}t.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:l}=e;for(const n of l.items)for(const a of U(this,Md))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let t=l.getData("application/pdfjs");if(!t)return;try{t=JSON.parse(t)}catch(n){Rl(`paste: "${n.message}".`);return}if(!Array.isArray(t))return;this.unselectAll();const d=this.currentLayer;try{const n=[];for(const s of t){const c=await d.deserialize(s);if(!c)return;n.push(c)}const a=()=>{for(const s of n)p(this,Ul,SR).call(this,s);p(this,Ul,JR).call(this,n)},i=()=>{for(const s of n)s.remove()};this.addCommands({cmd:a,undo:i,mustExec:!0})}catch(n){Rl(`paste: "${n.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),U(this,Xt)!==ul.NONE&&!this.isEditorHandlingKeyboard&&xs._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,U(this,ti)&&(N(this,ti,!1),p(this,Ul,Ph).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(e){e?(p(this,Ul,JM).call(this),p(this,Ul,pR).call(this),p(this,Ul,ee).call(this,{isEditing:U(this,Xt)!==ul.NONE,isEmpty:p(this,Ul,pZ).call(this),hasSomethingToUndo:U(this,ed).hasSomethingToUndo(),hasSomethingToRedo:U(this,ed).hasSomethingToRedo(),hasSelectedEditor:!1})):(p(this,Ul,TM).call(this),p(this,Ul,MR).call(this),p(this,Ul,ee).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!U(this,Md)){N(this,Md,e);for(const l of U(this,Md))p(this,Ul,ln).call(this,l.defaultPropertiesToUpdate)}}getId(){return U(this,bR).id}get currentLayer(){return U(this,xt).get(U(this,NZ))}getLayer(e){return U(this,xt).get(e)}get currentPageIndex(){return U(this,NZ)}addLayer(e){U(this,xt).set(e.pageIndex,e),U(this,ei)?e.enable():e.disable()}removeLayer(e){U(this,xt).delete(e.pageIndex)}async updateMode(e,l=null,t=!1){var d;if(U(this,Xt)!==e&&!(U(this,dd)&&(await U(this,dd).promise,!U(this,dd)))){if(N(this,dd,Promise.withResolvers()),N(this,Xt,e),e===ul.NONE){this.setEditingState(!1),p(this,Ul,BM).call(this),(d=this._editorUndoBar)==null||d.hide(),U(this,dd).resolve();return}this.setEditingState(!0),await p(this,Ul,yM).call(this),this.unselectAll();for(const n of U(this,xt).values())n.updateMode(e);if(!l){t&&this.addNewEditorFromKeyboard(),U(this,dd).resolve();return}for(const n of U(this,pt).values())n.annotationElementId===l?(this.setSelected(n),n.enterInEditMode()):n.unselect();U(this,dd).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==U(this,Xt)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,l){var t;if(U(this,Md)){switch(e){case Jl.CREATE:this.currentLayer.addNewEditor();return;case Jl.HIGHLIGHT_DEFAULT_COLOR:(t=U(this,Oh))==null||t.updateColor(l);break;case Jl.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(U(this,rZ)||N(this,rZ,new Map)).set(e,l),this.showAllEditors("highlight",l);break}for(const d of U(this,Dl))d.updateParams(e,l);for(const d of U(this,Md))d.updateDefaultParams(e,l)}}showAllEditors(e,l,t=!1){var d;for(const n of U(this,pt).values())n.editorType===e&&n.show(l);(((d=U(this,rZ))==null?void 0:d.get(Jl.HIGHLIGHT_SHOW_ALL))??!0)!==l&&p(this,Ul,ln).call(this,[[Jl.HIGHLIGHT_SHOW_ALL,l]])}enableWaiting(e=!1){if(U(this,jh)!==e){N(this,jh,e);for(const l of U(this,xt).values())e?l.disableClick():l.enableClick(),l.div.classList.toggle("waiting",e)}}getEditors(e){const l=[];for(const t of U(this,pt).values())t.pageIndex===e&&l.push(t);return l}getEditor(e){return U(this,pt).get(e)}addEditor(e){U(this,pt).set(e.id,e)}removeEditor(e){var l;e.div.contains(document.activeElement)&&(U(this,qd)&&clearTimeout(U(this,qd)),N(this,qd,setTimeout(()=>{this.focusMainContainer(),N(this,qd,null)},0))),U(this,pt).delete(e.id),this.unselect(e),(!e.annotationElementId||!U(this,Ds).has(e.annotationElementId))&&((l=U(this,jn))==null||l.remove(e.id))}addDeletedAnnotationElement(e){U(this,Ds).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return U(this,Ds).has(e)}removeDeletedAnnotationElement(e){U(this,Ds).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){U(this,ke)!==e&&(N(this,ke,e),e&&p(this,Ul,ln).call(this,e.propertiesToUpdate))}updateUI(e){U(this,Ul,YM)===e&&p(this,Ul,ln).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){p(this,Ul,ln).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(U(this,Dl).has(e)){U(this,Dl).delete(e),e.unselect(),p(this,Ul,ee).call(this,{hasSelectedEditor:this.hasSelection});return}U(this,Dl).add(e),e.select(),p(this,Ul,ln).call(this,e.propertiesToUpdate),p(this,Ul,ee).call(this,{hasSelectedEditor:!0})}setSelected(e){var l;(l=U(this,Is))==null||l.commitOrRemove();for(const t of U(this,Dl))t!==e&&t.unselect();U(this,Dl).clear(),U(this,Dl).add(e),e.select(),p(this,Ul,ln).call(this,e.propertiesToUpdate),p(this,Ul,ee).call(this,{hasSelectedEditor:!0})}isSelected(e){return U(this,Dl).has(e)}get firstSelectedEditor(){return U(this,Dl).values().next().value}unselect(e){e.unselect(),U(this,Dl).delete(e),p(this,Ul,ee).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return U(this,Dl).size!==0}get isEnterHandled(){return U(this,Dl).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;U(this,ed).undo(),p(this,Ul,ee).call(this,{hasSomethingToUndo:U(this,ed).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:p(this,Ul,pZ).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){U(this,ed).redo(),p(this,Ul,ee).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:U(this,ed).hasSomethingToRedo(),isEmpty:p(this,Ul,pZ).call(this)})}addCommands(e){U(this,ed).add(e),p(this,Ul,ee).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:p(this,Ul,pZ).call(this)})}cleanUndoStack(e){U(this,ed).cleanType(e)}delete(){var e;this.commitOrRemove();const l=(e=this.currentLayer)==null?void 0:e.endDrawingSession(!0);if(!this.hasSelection&&!l)return;const t=l?[l]:[...U(this,Dl)],d=()=>{var a;(a=this._editorUndoBar)==null||a.show(n,t.length===1?t[0].editorType:t.length);for(const i of t)i.remove()},n=()=>{for(const a of t)p(this,Ul,SR).call(this,a)};this.addCommands({cmd:d,undo:n,mustExec:!0})}commitOrRemove(){var e;(e=U(this,ke))==null||e.commitOrRemove()}hasSomethingToControl(){return U(this,ke)||this.hasSelection}selectAll(){for(const e of U(this,Dl))e.commit();p(this,Ul,JR).call(this,U(this,pt).values())}unselectAll(){var e;if(!(U(this,ke)&&(U(this,ke).commitOrRemove(),U(this,Xt)!==ul.NONE))&&!((e=U(this,Is))!=null&&e.commitOrRemove())&&this.hasSelection){for(const l of U(this,Dl))l.unselect();U(this,Dl).clear(),p(this,Ul,ee).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,l,t=!1){if(t||this.commitOrRemove(),!this.hasSelection)return;U(this,ni)[0]+=e,U(this,ni)[1]+=l;const[d,n]=U(this,ni),a=[...U(this,Dl)];U(this,$d)&&clearTimeout(U(this,$d)),N(this,$d,setTimeout(()=>{N(this,$d,null),U(this,ni)[0]=U(this,ni)[1]=0,this.addCommands({cmd:()=>{for(const s of a)U(this,pt).has(s.id)&&s.translateInPage(d,n)},undo:()=>{for(const s of a)U(this,pt).has(s.id)&&s.translateInPage(-d,-n)},mustExec:!1})},1e3));for(const s of a)s.translateInPage(e,l)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),N(this,_d,new Map);for(const e of U(this,Dl))U(this,_d).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!U(this,_d))return!1;this.disableUserSelect(!1);const e=U(this,_d);N(this,_d,null);let l=!1;for(const[{x:d,y:n,pageIndex:a},i]of e)i.newX=d,i.newY=n,i.newPageIndex=a,l||(l=d!==i.savedX||n!==i.savedY||a!==i.savedPageIndex);if(!l)return!1;const t=(d,n,a,i)=>{if(U(this,pt).has(d.id)){const s=U(this,xt).get(i);s?d._setParentAndPosition(s,n,a):(d.pageIndex=i,d.x=n,d.y=a)}};return this.addCommands({cmd:()=>{for(const[d,{newX:n,newY:a,newPageIndex:i}]of e)t(d,n,a,i)},undo:()=>{for(const[d,{savedX:n,savedY:a,savedPageIndex:i}]of e)t(d,n,a,i)},mustExec:!0}),!0}dragSelectedEditors(e,l){if(U(this,_d))for(const t of U(this,_d).keys())t.drag(e,l)}rebuild(e){if(e.parent===null){const l=this.getLayer(e.pageIndex);l?(l.changeParent(e),l.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||U(this,Dl).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return U(this,ke)===e}getActive(){return U(this,ke)}getMode(){return U(this,Xt)}get imageManager(){return rl(this,"imageManager",new jL)}getSelectionBoxes(e){if(!e)return null;const l=document.getSelection();for(let c=0,F=l.rangeCount;c<F;c++)if(!e.contains(l.getRangeAt(c).commonAncestorContainer))return null;const{x:t,y:d,width:n,height:a}=e.getBoundingClientRect();let i;switch(e.getAttribute("data-main-rotation")){case"90":i=(c,F,h,o)=>({x:(F-d)/a,y:1-(c+h-t)/n,width:o/a,height:h/n});break;case"180":i=(c,F,h,o)=>({x:1-(c+h-t)/n,y:1-(F+o-d)/a,width:h/n,height:o/a});break;case"270":i=(c,F,h,o)=>({x:1-(F+o-d)/a,y:(c-t)/n,width:o/a,height:h/n});break;default:i=(c,F,h,o)=>({x:(c-t)/n,y:(F-d)/a,width:h/n,height:o/a});break}const s=[];for(let c=0,F=l.rangeCount;c<F;c++){const h=l.getRangeAt(c);if(!h.collapsed)for(const{x:o,y:V,width:W,height:Q}of h.getClientRects())W===0||Q===0||s.push(i(o,V,W,Q))}return s.length===0?null:s}addChangedExistingAnnotation({annotationElementId:e,id:l}){(U(this,Ls)||N(this,Ls,new Map)).set(e,l)}removeChangedExistingAnnotation({annotationElementId:e}){var l;(l=U(this,Ls))==null||l.delete(e)}renderAnnotationElement(e){var l;const t=(l=U(this,Ls))==null?void 0:l.get(e.data.id);if(!t)return;const d=U(this,jn).getRawValue(t);d&&(U(this,Xt)===ul.NONE&&!d.hasBeenModified||d.renderAnnotationElement(e))}},mZ=new WeakMap,ke=new WeakMap,pt=new WeakMap,xt=new WeakMap,RZ=new WeakMap,jn=new WeakMap,Ls=new WeakMap,ed=new WeakMap,$a=new WeakMap,Is=new WeakMap,NZ=new WeakMap,Ds=new WeakMap,_d=new WeakMap,Md=new WeakMap,ws=new WeakMap,Ch=new WeakMap,xh=new WeakMap,bZ=new WeakMap,gh=new WeakMap,qd=new WeakMap,li=new WeakMap,uZ=new WeakMap,ti=new WeakMap,Sd=new WeakMap,bR=new WeakMap,ei=new WeakMap,jh=new WeakMap,di=new WeakMap,Es=new WeakMap,Oh=new WeakMap,vh=new WeakMap,Xt=new WeakMap,Dl=new WeakMap,On=new WeakMap,Cs=new WeakMap,rZ=new WeakMap,Kh=new WeakMap,ni=new WeakMap,$d=new WeakMap,vn=new WeakMap,fh=new WeakMap,dd=new WeakMap,Ul=new WeakSet,Hh=function({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},uR=function(e){const{currentLayer:l}=this;if(l.hasTextLayer(e))return l;for(const t of U(this,xt).values())if(t.hasTextLayer(e))return t;return null},pM=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const l=p(this,Ul,Hh).call(this,e).closest(".textLayer"),t=this.getSelectionBoxes(l);t&&(U(this,Sd)||N(this,Sd,new xL(this)),U(this,Sd).show(l,t,this.direction==="ltr"))},MM=function(){var e,l,t;const d=document.getSelection();if(!d||d.isCollapsed){U(this,On)&&((e=U(this,Sd))==null||e.hide(),N(this,On,null),p(this,Ul,ee).call(this,{hasSelectedText:!1}));return}const{anchorNode:n}=d;if(n===U(this,On))return;const a=p(this,Ul,Hh).call(this,d).closest(".textLayer");if(!a){U(this,On)&&((l=U(this,Sd))==null||l.hide(),N(this,On,null),p(this,Ul,ee).call(this,{hasSelectedText:!1}));return}if((t=U(this,Sd))==null||t.hide(),N(this,On,n),p(this,Ul,ee).call(this,{hasSelectedText:!0}),!(U(this,Xt)!==ul.HIGHLIGHT&&U(this,Xt)!==ul.NONE)&&(U(this,Xt)===ul.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),N(this,ti,this.isShiftKeyDown),!this.isShiftKeyDown)){const i=U(this,Xt)===ul.HIGHLIGHT?p(this,Ul,uR).call(this,a):null;i==null||i.toggleDrawing();const s=new AbortController,c=this.combinedSignal(s),F=h=>{h.type==="pointerup"&&h.button!==0||(s.abort(),i==null||i.toggleDrawing(!0),h.type==="pointerup"&&p(this,Ul,Ph).call(this,"main_toolbar"))};window.addEventListener("pointerup",F,{signal:c}),window.addEventListener("blur",F,{signal:c})}},Ph=function(e=""){U(this,Xt)===ul.HIGHLIGHT?this.highlightSelection(e):U(this,Ch)&&p(this,Ul,pM).call(this)},SM=function(){document.addEventListener("selectionchange",p(this,Ul,MM).bind(this),{signal:this._signal})},JM=function(){if(U(this,li))return;N(this,li,new AbortController);const e=this.combinedSignal(U(this,li));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},TM=function(){var e;(e=U(this,li))==null||e.abort(),N(this,li,null)},rR=function(){if(U(this,di))return;N(this,di,new AbortController);const e=this.combinedSignal(U(this,di));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},GM=function(){var e;(e=U(this,di))==null||e.abort(),N(this,di,null)},pR=function(){if(U(this,$a))return;N(this,$a,new AbortController);const e=this.combinedSignal(U(this,$a));document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})},MR=function(){var e;(e=U(this,$a))==null||e.abort(),N(this,$a,null)},XM=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},ee=function(e){Object.entries(e).some(([l,t])=>U(this,Kh)[l]!==t)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(U(this,Kh),e)}),U(this,Xt)===ul.HIGHLIGHT&&e.hasSelectedEditor===!1&&p(this,Ul,ln).call(this,[[Jl.HIGHLIGHT_FREE,!0]]))},ln=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},yM=async function(){if(!U(this,ei)){N(this,ei,!0);const e=[];for(const l of U(this,xt).values())e.push(l.enable());await Promise.all(e);for(const l of U(this,pt).values())l.enable()}},BM=function(){if(this.unselectAll(),U(this,ei)){N(this,ei,!1);for(const e of U(this,xt).values())e.disable();for(const e of U(this,pt).values())e.disable()}},SR=function(e){const l=U(this,xt).get(e.pageIndex);l?l.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},YM=function(){let e=null;for(e of U(this,Dl));return e},pZ=function(){if(U(this,pt).size===0)return!0;if(U(this,pt).size===1)for(const e of U(this,pt).values())return e.isEmpty();return!1},JR=function(e){for(const l of U(this,Dl))l.unselect();U(this,Dl).clear();for(const l of e)l.isEmpty()||(U(this,Dl).add(l),l.select());p(this,Ul,ee).call(this,{hasSelectedEditor:this.hasSelection})},hl(xs,"TRANSLATE_SMALL",1),hl(xs,"TRANSLATE_BIG",10),xs);var yt,tn,Jd,SZ,en,ze,JZ,dn,re,Kn,gs,nn,fn,an,TZ,Ah;const GZ=class Da{constructor(l){M(this,an),M(this,yt,null),M(this,tn,!1),M(this,Jd,null),M(this,SZ,null),M(this,en,null),M(this,ze,null),M(this,JZ,!1),M(this,dn,null),M(this,re,null),M(this,Kn,null),M(this,gs,null),M(this,nn,!1),N(this,re,l),N(this,nn,l._uiManager.useNewAltTextFlow),U(Da,fn)||N(Da,fn,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(l){Da._l10n??(Da._l10n=l)}async render(){const l=N(this,Jd,document.createElement("button"));l.className="altText",l.tabIndex="0";const t=N(this,SZ,document.createElement("span"));l.append(t),U(this,nn)?(l.classList.add("new"),l.setAttribute("data-l10n-id",U(Da,fn).missing),t.setAttribute("data-l10n-id",U(Da,fn)["missing-label"])):(l.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const d=U(this,re)._uiManager._signal;l.addEventListener("contextmenu",td,{signal:d}),l.addEventListener("pointerdown",a=>a.stopPropagation(),{signal:d});const n=a=>{a.preventDefault(),U(this,re)._uiManager.editAltText(U(this,re)),U(this,nn)&&U(this,re)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:U(this,an,TZ)}})};return l.addEventListener("click",n,{capture:!0,signal:d}),l.addEventListener("keydown",a=>{a.target===l&&a.key==="Enter"&&(N(this,JZ,!0),n(a))},{signal:d}),await p(this,an,Ah).call(this),l}finish(){U(this,Jd)&&(U(this,Jd).focus({focusVisible:U(this,JZ)}),N(this,JZ,!1))}isEmpty(){return U(this,nn)?U(this,yt)===null:!U(this,yt)&&!U(this,tn)}hasData(){return U(this,nn)?U(this,yt)!==null||!!U(this,Kn):this.isEmpty()}get guessedText(){return U(this,Kn)}async setGuessedText(l){U(this,yt)===null&&(N(this,Kn,l),N(this,gs,await Da._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:l})),p(this,an,Ah).call(this))}toggleAltTextBadge(l=!1){var t;if(!U(this,nn)||U(this,yt)){(t=U(this,dn))==null||t.remove(),N(this,dn,null);return}if(!U(this,dn)){const d=N(this,dn,document.createElement("div"));d.className="noAltTextBadge",U(this,re).div.append(d)}U(this,dn).classList.toggle("hidden",!l)}serialize(l){let t=U(this,yt);return!l&&U(this,Kn)===t&&(t=U(this,gs)),{altText:t,decorative:U(this,tn),guessedText:U(this,Kn),textWithDisclaimer:U(this,gs)}}get data(){return{altText:U(this,yt),decorative:U(this,tn)}}set data({altText:l,decorative:t,guessedText:d,textWithDisclaimer:n,cancel:a=!1}){d&&(N(this,Kn,d),N(this,gs,n)),!(U(this,yt)===l&&U(this,tn)===t)&&(a||(N(this,yt,l),N(this,tn,t)),p(this,an,Ah).call(this))}toggle(l=!1){U(this,Jd)&&(!l&&U(this,ze)&&(clearTimeout(U(this,ze)),N(this,ze,null)),U(this,Jd).disabled=!l)}shown(){U(this,re)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:U(this,an,TZ)}})}destroy(){var l,t;(l=U(this,Jd))==null||l.remove(),N(this,Jd,null),N(this,SZ,null),N(this,en,null),(t=U(this,dn))==null||t.remove(),N(this,dn,null)}};yt=new WeakMap,tn=new WeakMap,Jd=new WeakMap,SZ=new WeakMap,en=new WeakMap,ze=new WeakMap,JZ=new WeakMap,dn=new WeakMap,re=new WeakMap,Kn=new WeakMap,gs=new WeakMap,nn=new WeakMap,fn=new WeakMap,an=new WeakSet,TZ=function(){return U(this,yt)&&"added"||U(this,yt)===null&&this.guessedText&&"review"||"missing"},Ah=async function(){var e,l,t;const d=U(this,Jd);if(!d)return;if(U(this,nn)){if(d.classList.toggle("done",!!U(this,yt)),d.setAttribute("data-l10n-id",U(GZ,fn)[U(this,an,TZ)]),(e=U(this,SZ))==null||e.setAttribute("data-l10n-id",U(GZ,fn)[`${U(this,an,TZ)}-label`]),!U(this,yt)){(l=U(this,en))==null||l.remove();return}}else{if(!U(this,yt)&&!U(this,tn)){d.classList.remove("done"),(t=U(this,en))==null||t.remove();return}d.classList.add("done"),d.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let n=U(this,en);if(!n){N(this,en,n=document.createElement("span")),n.className="tooltip",n.setAttribute("role","tooltip"),n.id=`alt-text-tooltip-${U(this,re).id}`;const i=100,s=U(this,re)._uiManager._signal;s.addEventListener("abort",()=>{clearTimeout(U(this,ze)),N(this,ze,null)},{once:!0}),d.addEventListener("mouseenter",()=>{N(this,ze,setTimeout(()=>{N(this,ze,null),U(this,en).classList.add("show"),U(this,re)._reportTelemetry({action:"alt_text_tooltip"})},i))},{signal:s}),d.addEventListener("mouseleave",()=>{var c;U(this,ze)&&(clearTimeout(U(this,ze)),N(this,ze,null)),(c=U(this,en))==null||c.classList.remove("show")},{signal:s})}U(this,tn)?n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(n.removeAttribute("data-l10n-id"),n.textContent=U(this,yt)),n.parentNode||d.append(n);const a=U(this,re).getImageForAltText();a==null||a.setAttribute("aria-describedby",n.id)},M(GZ,fn,null),hl(GZ,"_l10n",null);let kM=GZ;var _h,js,qh,$h,lo,to,eo,XZ,Hn,Os,ai,vs,zM,LM,TR,GR;let IM=(GR=class{constructor({container:e,isPinchingDisabled:l=null,isPinchingStopped:t=null,onPinchStart:d=null,onPinching:n=null,onPinchEnd:a=null,signal:i}){M(this,vs),M(this,_h),M(this,js,!1),M(this,qh,null),M(this,$h),M(this,lo),M(this,to),M(this,eo),M(this,XZ),M(this,Hn,null),M(this,Os),M(this,ai,null),N(this,_h,e),N(this,qh,t),N(this,$h,l),N(this,lo,d),N(this,to,n),N(this,eo,a),N(this,Os,new AbortController),N(this,XZ,AbortSignal.any([i,U(this,Os).signal])),e.addEventListener("touchstart",p(this,vs,zM).bind(this),{passive:!1,signal:U(this,XZ)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return rl(this,"MIN_TOUCH_DISTANCE_TO_PINCH",35/(window.devicePixelRatio||1))}destroy(){var e;(e=U(this,Os))==null||e.abort(),N(this,Os,null)}},_h=new WeakMap,js=new WeakMap,qh=new WeakMap,$h=new WeakMap,lo=new WeakMap,to=new WeakMap,eo=new WeakMap,XZ=new WeakMap,Hn=new WeakMap,Os=new WeakMap,ai=new WeakMap,vs=new WeakSet,zM=function(e){var l,t,d;if((l=U(this,$h))!=null&&l.call(this)||e.touches.length<2)return;if(!U(this,ai)){N(this,ai,new AbortController);const i=AbortSignal.any([U(this,XZ),U(this,ai).signal]),s=U(this,_h),c={signal:i,passive:!1};s.addEventListener("touchmove",p(this,vs,LM).bind(this),c),s.addEventListener("touchend",p(this,vs,TR).bind(this),c),s.addEventListener("touchcancel",p(this,vs,TR).bind(this),c),(t=U(this,lo))==null||t.call(this)}if(ue(e),e.touches.length!==2||(d=U(this,qh))!=null&&d.call(this)){N(this,Hn,null);return}let[n,a]=e.touches;n.identifier>a.identifier&&([n,a]=[a,n]),N(this,Hn,{touch0X:n.screenX,touch0Y:n.screenY,touch1X:a.screenX,touch1Y:a.screenY})},LM=function(e){var l;if(!U(this,Hn)||e.touches.length!==2)return;let[t,d]=e.touches;t.identifier>d.identifier&&([t,d]=[d,t]);const{screenX:n,screenY:a}=t,{screenX:i,screenY:s}=d,c=U(this,Hn),{touch0X:F,touch0Y:h,touch1X:o,touch1Y:V}=c,W=o-F,Q=V-h,m=i-n,R=s-a,r=Math.hypot(m,R)||1,b=Math.hypot(W,Q)||1;if(!U(this,js)&&Math.abs(b-r)<=GR.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=n,c.touch0Y=a,c.touch1X=i,c.touch1Y=s,e.preventDefault(),!U(this,js)){N(this,js,!0);return}const u=[(n+i)/2,(a+s)/2];(l=U(this,to))==null||l.call(this,u,b,r)},TR=function(e){var l;U(this,ai).abort(),N(this,ai,null),(l=U(this,eo))==null||l.call(this),U(this,Hn)&&(e.preventDefault(),N(this,Hn,null),N(this,js,!1))},GR);var Ks,Td,Kl,yZ,ii,no,fs,gt,Hs,Pn,si,ao,Ps,jt,io,As,An,sn,BZ,YZ,Le,ci,so,XR,yl,yR,co,BR,Uo,DM,wM,YR,Zo,kR,EM,CM,xM,zR,gM,LR,jM,OM,vM,IR,kZ;const et=class Dt{constructor(l){M(this,yl),M(this,Ks,null),M(this,Td,null),M(this,Kl,null),M(this,yZ,!1),M(this,ii,null),M(this,no,""),M(this,fs,!1),M(this,gt,null),M(this,Hs,null),M(this,Pn,null),M(this,si,null),M(this,ao,""),M(this,Ps,!1),M(this,jt,null),M(this,io,!1),M(this,As,!1),M(this,An,!1),M(this,sn,null),M(this,BZ,0),M(this,YZ,0),M(this,Le,null),M(this,ci,null),hl(this,"_editToolbar",null),hl(this,"_initialOptions",Object.create(null)),hl(this,"_initialData",null),hl(this,"_isVisible",!0),hl(this,"_uiManager",null),hl(this,"_focusEventsAllowed",!0),M(this,so,!1),M(this,XR,Dt._zIndex++),this.parent=l.parent,this.id=l.id,this.width=this.height=null,this.pageIndex=l.parent.pageIndex,this.name=l.name,this.div=null,this._uiManager=l.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=l.isCentered,this._structTreeParentId=null;const{rotation:t,rawDims:{pageWidth:d,pageHeight:n,pageX:a,pageY:i}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[d,n],this.pageTranslation=[a,i];const[s,c]=this.parentDimensions;this.x=l.x/s,this.y=l.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const l=Dt.prototype._resizeWithKeyboard,t=MZ.TRANSLATE_SMALL,d=MZ.TRANSLATE_BIG;return rl(this,"_resizerKeyboardManager",new QZ([[["ArrowLeft","mac+ArrowLeft"],l,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],l,{args:[-d,0]}],[["ArrowRight","mac+ArrowRight"],l,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],l,{args:[d,0]}],[["ArrowUp","mac+ArrowUp"],l,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],l,{args:[0,-d]}],[["ArrowDown","mac+ArrowDown"],l,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],l,{args:[0,d]}],[["Escape","mac+Escape"],Dt.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get isDrawer(){return!1}static get _defaultLineColor(){return rl(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(l){const t=new KL({id:l.parent.getNextId(),parent:l.parent,uiManager:l._uiManager});t.annotationElementId=l.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(l,t){if(Dt._l10n??(Dt._l10n=l),Dt._l10nResizer||(Dt._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),Dt._borderLineWidth!==-1)return;const d=getComputedStyle(document.documentElement);Dt._borderLineWidth=parseFloat(d.getPropertyValue("--outline-width"))||0}static updateDefaultParams(l,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(l){return!1}static paste(l,t){Cl("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return U(this,so)}set _isDraggable(l){var t;N(this,so,l),(t=this.div)==null||t.classList.toggle("draggable",l)}get isEnterHandled(){return!0}center(){const[l,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(l*2),this.y+=this.width*l/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(l*2),this.y-=this.width*l/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(l){this._uiManager.addCommands(l)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=U(this,XR)}setParent(l){l!==null?(this.pageIndex=l.pageIndex,this.pageDimensions=l.pageDimensions):p(this,yl,kZ).call(this),this.parent=l}focusin(l){this._focusEventsAllowed&&(U(this,Ps)?N(this,Ps,!1):this.parent.setSelected(this))}focusout(l){var t;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const d=l.relatedTarget;d!=null&&d.closest(`#${this.id}`)||(l.preventDefault(),(t=this.parent)!=null&&t.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(l,t,d,n){const[a,i]=this.parentDimensions;[d,n]=this.screenToPageTranslation(d,n),this.x=(l+d)/a,this.y=(t+n)/i,this.fixAndSetPosition()}translate(l,t){p(this,yl,yR).call(this,this.parentDimensions,l,t)}translateInPage(l,t){U(this,jt)||N(this,jt,[this.x,this.y,this.width,this.height]),p(this,yl,yR).call(this,this.pageDimensions,l,t),this.div.scrollIntoView({block:"nearest"})}drag(l,t){U(this,jt)||N(this,jt,[this.x,this.y,this.width,this.height]);const{div:d,parentDimensions:[n,a]}=this;if(this.x+=l/n,this.y+=t/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:o,y:V}=this.div.getBoundingClientRect();this.parent.findNewParent(this,o,V)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:i,y:s}=this;const[c,F]=this.getBaseTranslation();i+=c,s+=F;const{style:h}=d;h.left=`${(100*i).toFixed(2)}%`,h.top=`${(100*s).toFixed(2)}%`,this._onTranslating(i,s),d.scrollIntoView({block:"nearest"})}_onTranslating(l,t){}_onTranslated(l,t){}get _hasBeenMoved(){return!!U(this,jt)&&(U(this,jt)[0]!==this.x||U(this,jt)[1]!==this.y)}get _hasBeenResized(){return!!U(this,jt)&&(U(this,jt)[2]!==this.width||U(this,jt)[3]!==this.height)}getBaseTranslation(){const[l,t]=this.parentDimensions,{_borderLineWidth:d}=Dt,n=d/l,a=d/t;switch(this.rotation){case 90:return[-n,a];case 180:return[n,a];case 270:return[n,-a];default:return[-n,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(l=this.rotation){const{div:{style:t},pageDimensions:[d,n]}=this;let{x:a,y:i,width:s,height:c}=this;if(s*=d,c*=n,a*=d,i*=n,this._mustFixPosition)switch(l){case 0:a=Math.max(0,Math.min(d-s,a)),i=Math.max(0,Math.min(n-c,i));break;case 90:a=Math.max(0,Math.min(d-c,a)),i=Math.min(n,Math.max(s,i));break;case 180:a=Math.min(d,Math.max(s,a)),i=Math.min(n,Math.max(c,i));break;case 270:a=Math.min(d,Math.max(c,a)),i=Math.max(0,Math.min(n-s,i));break}this.x=a/=d,this.y=i/=n;const[F,h]=this.getBaseTranslation();a+=F,i+=h,t.left=`${(100*a).toFixed(2)}%`,t.top=`${(100*i).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(l,t){var d;return p(d=Dt,co,BR).call(d,l,t,this.parentRotation)}pageTranslationToScreen(l,t){var d;return p(d=Dt,co,BR).call(d,l,t,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:l,pageDimensions:[t,d]}=this;return[t*l,d*l]}setDims(l,t){const[d,n]=this.parentDimensions,{style:a}=this.div;a.width=`${(100*l/d).toFixed(2)}%`,U(this,fs)||(a.height=`${(100*t/n).toFixed(2)}%`)}fixDims(){const{style:l}=this.div,{height:t,width:d}=l,n=d.endsWith("%"),a=!U(this,fs)&&t.endsWith("%");if(n&&a)return;const[i,s]=this.parentDimensions;n||(l.width=`${(100*parseFloat(d)/i).toFixed(2)}%`),!U(this,fs)&&!a&&(l.height=`${(100*parseFloat(t)/s).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}_onResized(){}static _round(l){return Math.round(l*1e4)/1e4}_onResizing(){}altTextFinish(){var l;(l=U(this,Kl))==null||l.finish()}async addEditToolbar(){return this._editToolbar||U(this,As)?this._editToolbar:(this._editToolbar=new CL(this),this.div.append(this._editToolbar.render()),U(this,Kl)&&await this._editToolbar.addAltText(U(this,Kl)),this._editToolbar)}removeEditToolbar(){var l;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(l=U(this,Kl))==null||l.destroy())}addContainer(l){var t;const d=(t=this._editToolbar)==null?void 0:t.div;d?d.before(l):this.div.append(l)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){U(this,Kl)||(kM.initialize(Dt._l10n),N(this,Kl,new kM(this)),U(this,Ks)&&(U(this,Kl).data=U(this,Ks),N(this,Ks,null)),await this.addEditToolbar())}get altTextData(){var l;return(l=U(this,Kl))==null?void 0:l.data}set altTextData(l){U(this,Kl)&&(U(this,Kl).data=l)}get guessedAltText(){var l;return(l=U(this,Kl))==null?void 0:l.guessedText}async setGuessedAltText(l){var t;await((t=U(this,Kl))==null?void 0:t.setGuessedText(l))}serializeAltText(l){var t;return(t=U(this,Kl))==null?void 0:t.serialize(l)}hasAltText(){return!!U(this,Kl)&&!U(this,Kl).isEmpty()}hasAltTextData(){var l;return((l=U(this,Kl))==null?void 0:l.hasData())??!1}render(){var l;this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=U(this,yZ)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),p(this,yl,LR).call(this);const[t,d]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*d/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/d).toFixed(2)}%`);const[n,a]=this.getInitialTranslation();return this.translate(n,a),Ih(this,this.div,["pointerdown"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(U(this,ci)||N(this,ci,new IM({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:p(this,yl,EM).bind(this),onPinching:p(this,yl,CM).bind(this),onPinchEnd:p(this,yl,xM).bind(this),signal:this._uiManager._signal}))),(l=this._uiManager._editorUndoBar)==null||l.hide(),this.div}pointerdown(l){const{isMac:t}=te.platform;if(l.button!==0||l.ctrlKey&&t){l.preventDefault();return}if(N(this,Ps,!0),this._isDraggable){p(this,yl,gM).call(this,l);return}p(this,yl,zR).call(this,l)}get isSelected(){return this._uiManager.isSelected(this)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){U(this,sn)&&clearTimeout(U(this,sn)),N(this,sn,setTimeout(()=>{var l;N(this,sn,null),(l=this.parent)==null||l.moveEditorInDOM(this)},0))}_setParentAndPosition(l,t,d){l.changeParent(this),this.x=t,this.y=d,this.fixAndSetPosition(),this._onTranslated()}getRect(l,t,d=this.rotation){const n=this.parentScale,[a,i]=this.pageDimensions,[s,c]=this.pageTranslation,F=l/n,h=t/n,o=this.x*a,V=this.y*i,W=this.width*a,Q=this.height*i;switch(d){case 0:return[o+F+s,i-V-h-Q+c,o+F+W+s,i-V-h+c];case 90:return[o+h+s,i-V+F+c,o+h+Q+s,i-V+F+W+c];case 180:return[o-F-W+s,i-V+h+c,o-F+s,i-V+h+Q+c];case 270:return[o-h-Q+s,i-V-F-W+c,o-h+s,i-V-F+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(l,t){const[d,n,a,i]=l,s=a-d,c=i-n;switch(this.rotation){case 0:return[d,t-i,s,c];case 90:return[d,t-n,c,s];case 180:return[a,t-n,s,c];case 270:return[a,t-i,c,s];default:throw new Error("Invalid rotation")}}onceAdded(l){}isEmpty(){return!1}enableEditMode(){N(this,As,!0)}disableEditMode(){N(this,As,!1)}isInEditMode(){return U(this,As)}shouldGetKeyboardEvents(){return U(this,An)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:l,left:t,bottom:d,right:n}=this.getClientDimensions(),{innerHeight:a,innerWidth:i}=window;return t<i&&n>0&&l<a&&d>0}rebuild(){p(this,yl,LR).call(this)}rotate(l){}resize(){}serializeDeleted(){var l;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((l=this._initialData)==null?void 0:l.popupRef)||""}}serialize(l=!1,t=null){Cl("An editor must be serializable")}static async deserialize(l,t,d){const n=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:d});n.rotation=l.rotation,N(n,Ks,l.accessibilityData);const[a,i]=n.pageDimensions,[s,c,F,h]=n.getRectInCurrentCoords(l.rect,i);return n.x=s/a,n.y=c/i,n.width=F/a,n.height=h/i,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var l,t;if((l=U(this,si))==null||l.abort(),N(this,si,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),U(this,sn)&&(clearTimeout(U(this,sn)),N(this,sn,null)),p(this,yl,kZ).call(this),this.removeEditToolbar(),U(this,Le)){for(const d of U(this,Le).values())clearTimeout(d);N(this,Le,null)}this.parent=null,(t=U(this,ci))==null||t.destroy(),N(this,ci,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(p(this,yl,DM).call(this),U(this,gt).classList.remove("hidden"),Ih(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(l){if(!this.isResizable||l.target!==this.div||l.key!=="Enter")return;this._uiManager.setSelected(this),N(this,Pn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=U(this,gt).children;if(!U(this,Td)){N(this,Td,Array.from(t));const i=p(this,yl,jM).bind(this),s=p(this,yl,OM).bind(this),c=this._uiManager._signal;for(const F of U(this,Td)){const h=F.getAttribute("data-resizer-name");F.setAttribute("role","spinbutton"),F.addEventListener("keydown",i,{signal:c}),F.addEventListener("blur",s,{signal:c}),F.addEventListener("focus",p(this,yl,vM).bind(this,h),{signal:c}),F.setAttribute("data-l10n-id",Dt._l10nResizer[h])}}const d=U(this,Td)[0];let n=0;for(const i of t){if(i===d)break;n++}const a=(360-this.rotation+this.parentRotation)%360/90*(U(this,Td).length/4);if(a!==n){if(a<n)for(let s=0;s<n-a;s++)U(this,gt).append(U(this,gt).firstChild);else if(a>n)for(let s=0;s<a-n;s++)U(this,gt).firstChild.before(U(this,gt).lastChild);let i=0;for(const s of t){const c=U(this,Td)[i++].getAttribute("data-resizer-name");s.setAttribute("data-l10n-id",Dt._l10nResizer[c])}}p(this,yl,IR).call(this,0),N(this,An,!0),U(this,gt).firstChild.focus({focusVisible:!0}),l.preventDefault(),l.stopImmediatePropagation()}_resizeWithKeyboard(l,t){U(this,An)&&p(this,yl,kR).call(this,U(this,ao),{deltaX:l,deltaY:t,fromKeyboard:!0})}_stopResizingWithKeyboard(){p(this,yl,kZ).call(this),this.div.focus()}select(){var l,t,d;if(this.makeResizable(),(l=this.div)==null||l.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var n,a;(n=this.div)!=null&&n.classList.contains("selectedEditor")&&((a=this._editToolbar)==null||a.show())});return}(t=this._editToolbar)==null||t.show(),(d=U(this,Kl))==null||d.toggleAltTextBadge(!1)}unselect(){var l,t,d,n,a;(l=U(this,gt))==null||l.classList.add("hidden"),(t=this.div)==null||t.classList.remove("selectedEditor"),(d=this.div)!=null&&d.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(n=this._editToolbar)==null||n.hide(),(a=U(this,Kl))==null||a.toggleAltTextBadge(!0)}updateParams(l,t){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return U(this,io)}set isEditing(l){N(this,io,l),this.parent&&(l?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(l,t){N(this,fs,!0);const d=l/t,{style:n}=this.div;n.aspectRatio=d,n.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(l,t=!1){if(t){U(this,Le)||N(this,Le,new Map);const{action:d}=l;let n=U(this,Le).get(d);n&&clearTimeout(n),n=setTimeout(()=>{this._reportTelemetry(l),U(this,Le).delete(d),U(this,Le).size===0&&N(this,Le,null)},Dt._telemetryTimeout),U(this,Le).set(d,n);return}l.type||(l.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:l}})}show(l=this._isVisible){this.div.classList.toggle("hidden",!l),this._isVisible=l}enable(){this.div&&(this.div.tabIndex=0),N(this,yZ,!1)}disable(){this.div&&(this.div.tabIndex=-1),N(this,yZ,!0)}renderAnnotationElement(l){let t=l.container.querySelector(".annotationContent");if(!t)t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),l.container.prepend(t);else if(t.nodeName==="CANVAS"){const d=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),d.before(t)}return t}resetAnnotationElement(l){const{firstChild:t}=l.container;(t==null?void 0:t.nodeName)==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}};Ks=new WeakMap,Td=new WeakMap,Kl=new WeakMap,yZ=new WeakMap,ii=new WeakMap,no=new WeakMap,fs=new WeakMap,gt=new WeakMap,Hs=new WeakMap,Pn=new WeakMap,si=new WeakMap,ao=new WeakMap,Ps=new WeakMap,jt=new WeakMap,io=new WeakMap,As=new WeakMap,An=new WeakMap,sn=new WeakMap,BZ=new WeakMap,YZ=new WeakMap,Le=new WeakMap,ci=new WeakMap,so=new WeakMap,XR=new WeakMap,yl=new WeakSet,yR=function([e,l],t,d){[t,d]=this.screenToPageTranslation(t,d),this.x+=t/e,this.y+=d/l,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},co=new WeakSet,BR=function(e,l,t){switch(t){case 90:return[l,-e];case 180:return[-e,-l];case 270:return[-l,e];default:return[e,l]}},Uo=function(e){switch(e){case 90:{const[l,t]=this.pageDimensions;return[0,-l/t,t/l,0]}case 180:return[-1,0,0,-1];case 270:{const[l,t]=this.pageDimensions;return[0,l/t,-t/l,0]}default:return[1,0,0,1]}},DM=function(){if(U(this,gt))return;N(this,gt,document.createElement("div")),U(this,gt).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],l=this._uiManager._signal;for(const t of e){const d=document.createElement("div");U(this,gt).append(d),d.classList.add("resizer",t),d.setAttribute("data-resizer-name",t),d.addEventListener("pointerdown",p(this,yl,wM).bind(this,t),{signal:l}),d.addEventListener("contextmenu",td,{signal:l}),d.tabIndex=-1}this.div.prepend(U(this,gt))},wM=function(e,l){var t;l.preventDefault();const{isMac:d}=te.platform;if(l.button!==0||l.ctrlKey&&d)return;(t=U(this,Kl))==null||t.toggle(!1);const n=this._isDraggable;this._isDraggable=!1,N(this,Hs,[l.screenX,l.screenY]);const a=new AbortController,i=this._uiManager.combinedSignal(a);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",p(this,yl,kR).bind(this,e),{passive:!0,capture:!0,signal:i}),window.addEventListener("touchmove",ue,{passive:!1,signal:i}),window.addEventListener("contextmenu",td,{signal:i}),N(this,Pn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const s=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(l.target).cursor;const F=()=>{var h;a.abort(),this.parent.togglePointerEvents(!0),(h=U(this,Kl))==null||h.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=s,this.div.style.cursor=c,p(this,yl,Zo).call(this)};window.addEventListener("pointerup",F,{signal:i}),window.addEventListener("blur",F,{signal:i})},YR=function(e,l,t,d){this.width=t,this.height=d,this.x=e,this.y=l;const[n,a]=this.parentDimensions;this.setDims(n*t,a*d),this.fixAndSetPosition(),this._onResized()},Zo=function(){if(!U(this,Pn))return;const{savedX:e,savedY:l,savedWidth:t,savedHeight:d}=U(this,Pn);N(this,Pn,null);const n=this.x,a=this.y,i=this.width,s=this.height;n===e&&a===l&&i===t&&s===d||this.addCommands({cmd:p(this,yl,YR).bind(this,n,a,i,s),undo:p(this,yl,YR).bind(this,e,l,t,d),mustExec:!0})},kR=function(e,l){const[t,d]=this.parentDimensions,n=this.x,a=this.y,i=this.width,s=this.height,c=et.MIN_SIZE/t,F=et.MIN_SIZE/d,h=p(this,yl,Uo).call(this,this.rotation),o=(H,Y)=>[h[0]*H+h[2]*Y,h[1]*H+h[3]*Y],V=p(this,yl,Uo).call(this,360-this.rotation),W=(H,Y)=>[V[0]*H+V[2]*Y,V[1]*H+V[3]*Y];let Q,m,R=!1,r=!1;switch(e){case"topLeft":R=!0,Q=(H,Y)=>[0,0],m=(H,Y)=>[H,Y];break;case"topMiddle":Q=(H,Y)=>[H/2,0],m=(H,Y)=>[H/2,Y];break;case"topRight":R=!0,Q=(H,Y)=>[H,0],m=(H,Y)=>[0,Y];break;case"middleRight":r=!0,Q=(H,Y)=>[H,Y/2],m=(H,Y)=>[0,Y/2];break;case"bottomRight":R=!0,Q=(H,Y)=>[H,Y],m=(H,Y)=>[0,0];break;case"bottomMiddle":Q=(H,Y)=>[H/2,Y],m=(H,Y)=>[H/2,0];break;case"bottomLeft":R=!0,Q=(H,Y)=>[0,Y],m=(H,Y)=>[H,0];break;case"middleLeft":r=!0,Q=(H,Y)=>[0,Y/2],m=(H,Y)=>[H,Y/2];break}const b=Q(i,s),u=m(i,s);let J=o(...u);const G=et._round(n+J[0]),T=et._round(a+J[1]);let y=1,k=1,X,L;if(l.fromKeyboard)({deltaX:X,deltaY:L}=l);else{const{screenX:H,screenY:Y}=l,[B,z]=U(this,Hs);[X,L]=this.screenToPageTranslation(H-B,Y-z),U(this,Hs)[0]=H,U(this,Hs)[1]=Y}if([X,L]=W(X/t,L/d),R){const H=Math.hypot(i,s);y=k=Math.max(Math.min(Math.hypot(u[0]-b[0]-X,u[1]-b[1]-L)/H,1/i,1/s),c/i,F/s)}else r?y=Math.max(c,Math.min(1,Math.abs(u[0]-b[0]-X)))/i:k=Math.max(F,Math.min(1,Math.abs(u[1]-b[1]-L)))/s;const D=et._round(i*y),C=et._round(s*k);J=o(...m(D,C));const I=G-J[0],P=T-J[1];U(this,jt)||N(this,jt,[this.x,this.y,this.width,this.height]),this.width=D,this.height=C,this.x=I,this.y=P,this.setDims(t*D,d*C),this.fixAndSetPosition(),this._onResizing()},EM=function(){var e;N(this,Pn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=U(this,Kl))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)},CM=function(e,l,t){let d=.7*(t/l)+1-.7;if(d===1)return;const n=p(this,yl,Uo).call(this,this.rotation),a=(J,G)=>[n[0]*J+n[2]*G,n[1]*J+n[3]*G],[i,s]=this.parentDimensions,c=this.x,F=this.y,h=this.width,o=this.height,V=et.MIN_SIZE/i,W=et.MIN_SIZE/s;d=Math.max(Math.min(d,1/h,1/o),V/h,W/o);const Q=et._round(h*d),m=et._round(o*d);if(Q===h&&m===o)return;U(this,jt)||N(this,jt,[c,F,h,o]);const R=a(h/2,o/2),r=et._round(c+R[0]),b=et._round(F+R[1]),u=a(Q/2,m/2);this.x=r-u[0],this.y=b-u[1],this.width=Q,this.height=m,this.setDims(i*Q,s*m),this.fixAndSetPosition(),this._onResizing()},xM=function(){var e;(e=U(this,Kl))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),p(this,yl,Zo).call(this)},zR=function(e){const{isMac:l}=te.platform;e.ctrlKey&&!l||e.shiftKey||e.metaKey&&l?this.parent.toggleSelected(this):this.parent.setSelected(this)},gM=function(e){const{isSelected:l}=this;this._uiManager.setUpDragSession();let t=!1;const d=new AbortController,n=this._uiManager.combinedSignal(d),a={capture:!0,passive:!1,signal:n},i=c=>{d.abort(),N(this,ii,null),N(this,Ps,!1),this._uiManager.endDragSession()||p(this,yl,zR).call(this,c),t&&this._onStopDragging()};l&&(N(this,BZ,e.clientX),N(this,YZ,e.clientY),N(this,ii,e.pointerId),N(this,no,e.pointerType),window.addEventListener("pointermove",c=>{t||(t=!0,this._onStartDragging());const{clientX:F,clientY:h,pointerId:o}=c;if(o!==U(this,ii)){ue(c);return}const[V,W]=this.screenToPageTranslation(F-U(this,BZ),h-U(this,YZ));N(this,BZ,F),N(this,YZ,h),this._uiManager.dragSelectedEditors(V,W)},a),window.addEventListener("touchmove",ue,a),window.addEventListener("pointerdown",c=>{c.pointerType===U(this,no)&&(U(this,ci)||c.isPrimary)&&i(c),ue(c)},a));const s=c=>{if(!U(this,ii)||U(this,ii)===c.pointerId){i(c);return}ue(c)};window.addEventListener("pointerup",s,{signal:n}),window.addEventListener("blur",s,{signal:n})},LR=function(){if(U(this,si)||!this.div)return;N(this,si,new AbortController);const e=this._uiManager.combinedSignal(U(this,si));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},jM=function(e){et._resizerKeyboardManager.exec(this,e)},OM=function(e){var l;U(this,An)&&((l=e.relatedTarget)==null?void 0:l.parentNode)!==U(this,gt)&&p(this,yl,kZ).call(this)},vM=function(e){N(this,ao,U(this,An)?e:"")},IR=function(e){if(U(this,Td))for(const l of U(this,Td))l.tabIndex=e},kZ=function(){N(this,An,!1),p(this,yl,IR).call(this,-1),p(this,yl,Zo).call(this)},M(et,co),hl(et,"_l10n",null),hl(et,"_l10nResizer",null),hl(et,"_borderLineWidth",-1),hl(et,"_colorManager",new vL),hl(et,"_zIndex",1),hl(et,"_telemetryTimeout",1e3);let dt=et;class KL extends dt{constructor(l){super(l),this.annotationElementId=l.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const KM=3285377520,Ie=4294901760,Gd=65535;class fM{constructor(l){this.h1=l?l&4294967295:KM,this.h2=l?l&4294967295:KM}update(l){let t,d;if(typeof l=="string"){t=new Uint8Array(l.length*2),d=0;for(let m=0,R=l.length;m<R;m++){const r=l.charCodeAt(m);r<=255?t[d++]=r:(t[d++]=r>>>8,t[d++]=r&255)}}else if(ArrayBuffer.isView(l))t=l.slice(),d=t.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const n=d>>2,a=d-n*4,i=new Uint32Array(t.buffer,0,n);let s=0,c=0,F=this.h1,h=this.h2;const o=3432918353,V=461845907,W=o&Gd,Q=V&Gd;for(let m=0;m<n;m++)m&1?(s=i[m],s=s*o&Ie|s*W&Gd,s=s<<15|s>>>17,s=s*V&Ie|s*Q&Gd,F^=s,F=F<<13|F>>>19,F=F*5+3864292196):(c=i[m],c=c*o&Ie|c*W&Gd,c=c<<15|c>>>17,c=c*V&Ie|c*Q&Gd,h^=c,h=h<<13|h>>>19,h=h*5+3864292196);switch(s=0,a){case 3:s^=t[n*4+2]<<16;case 2:s^=t[n*4+1]<<8;case 1:s^=t[n*4],s=s*o&Ie|s*W&Gd,s=s<<15|s>>>17,s=s*V&Ie|s*Q&Gd,n&1?F^=s:h^=s}this.h1=F,this.h2=h}hexdigest(){let l=this.h1,t=this.h2;return l^=t>>>1,l=l*3981806797&Ie|l*36045&Gd,t=t*4283543511&Ie|((t<<16|l>>>16)*2950163797&Ie)>>>16,l^=t>>>1,l=l*444984403&Ie|l*60499&Gd,t=t*3301882366&Ie|((t<<16|l>>>16)*3120437893&Ie)>>>16,l^=t>>>1,(l>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const DR=Object.freeze({map:null,hash:"",transfer:void 0});var _s,qs,Bt,wR,HM;class ER{constructor(){M(this,wR),M(this,_s,!1),M(this,qs,null),M(this,Bt,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(l,t){const d=U(this,Bt).get(l);return d===void 0?t:Object.assign(t,d)}getRawValue(l){return U(this,Bt).get(l)}remove(l){if(U(this,Bt).delete(l),U(this,Bt).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const t of U(this,Bt).values())if(t instanceof dt)return;this.onAnnotationEditor(null)}}setValue(l,t){const d=U(this,Bt).get(l);let n=!1;if(d!==void 0)for(const[a,i]of Object.entries(t))d[a]!==i&&(n=!0,d[a]=i);else n=!0,U(this,Bt).set(l,t);n&&p(this,wR,HM).call(this),t instanceof dt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(t.constructor._type)}has(l){return U(this,Bt).has(l)}getAll(){return U(this,Bt).size>0?aR(U(this,Bt)):null}setAll(l){for(const[t,d]of Object.entries(l))this.setValue(t,d)}get size(){return U(this,Bt).size}resetModified(){U(this,_s)&&(N(this,_s,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new PM(this)}get serializable(){if(U(this,Bt).size===0)return DR;const l=new Map,t=new fM,d=[],n=Object.create(null);let a=!1;for(const[i,s]of U(this,Bt)){const c=s instanceof dt?s.serialize(!1,n):s;c&&(l.set(i,c),t.update(`${i}:${JSON.stringify(c)}`),a||(a=!!c.bitmap))}if(a)for(const i of l.values())i.bitmap&&d.push(i.bitmap);return l.size>0?{map:l,hash:t.hexdigest(),transfer:d}:DR}get editorStats(){let l=null;const t=new Map;for(const d of U(this,Bt).values()){if(!(d instanceof dt))continue;const n=d.telemetryFinalData;if(!n)continue;const{type:a}=n;t.has(a)||t.set(a,Object.getPrototypeOf(d).constructor),l||(l=Object.create(null));const i=l[a]||(l[a]=new Map);for(const[s,c]of Object.entries(n)){if(s==="type")continue;let F=i.get(s);F||(F=new Map,i.set(s,F));const h=F.get(c)??0;F.set(c,h+1)}}for(const[d,n]of t)l[d]=n.computeTelemetryFinalData(l[d]);return l}resetModifiedIds(){N(this,qs,null)}get modifiedIds(){if(U(this,qs))return U(this,qs);const l=[];for(const t of U(this,Bt).values())!(t instanceof dt)||!t.annotationElementId||!t.serialize()||l.push(t.annotationElementId);return N(this,qs,{ids:new Set(l),hash:l.join(",")})}}_s=new WeakMap,qs=new WeakMap,Bt=new WeakMap,wR=new WeakSet,HM=function(){U(this,_s)||(N(this,_s,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var Fo;class PM extends ER{constructor(l){super(),M(this,Fo);const{map:t,hash:d,transfer:n}=l.serializable,a=structuredClone(t,n?{transfer:n}:null);N(this,Fo,{map:a,hash:d,transfer:n})}get print(){Cl("Should not call PrintAnnotationStorage.print")}get serializable(){return U(this,Fo)}get modifiedIds(){return rl(this,"modifiedIds",{ids:new Set,hash:""})}}Fo=new WeakMap;var zZ;class fL{constructor({ownerDocument:l=globalThis.document,styleElement:t=null}){M(this,zZ,new Set),this._document=l,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(l){this.nativeFontFaces.add(l),this._document.fonts.add(l)}removeNativeFontFace(l){this.nativeFontFaces.delete(l),this._document.fonts.delete(l)}insertRule(l){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(l,t.cssRules.length)}clear(){for(const l of this.nativeFontFaces)this._document.fonts.delete(l);this.nativeFontFaces.clear(),U(this,zZ).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:l,_inspectFont:t}){if(!(!l||U(this,zZ).has(l.loadedName))){if(st(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:d,src:n,style:a}=l,i=new FontFace(d,n,a);this.addNativeFontFace(i);try{await i.load(),U(this,zZ).add(d),t==null||t(l)}catch{Rl(`Cannot load system font: ${l.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(i)}return}Cl("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(l){if(l.attached||l.missingFile&&!l.systemFontInfo)return;if(l.attached=!0,l.systemFontInfo){await this.loadSystemFont(l);return}if(this.isFontLoadingAPISupported){const d=l.createNativeFontFace();if(d){this.addNativeFontFace(d);try{await d.loaded}catch(n){throw Rl(`Failed to load font '${d.family}': '${n}'.`),l.disableFontFace=!0,n}}return}const t=l.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(d=>{const n=this._queueLoadingCallback(d);this._prepareFontLoadEvent(l,n)})}}get isFontLoadingAPISupported(){var l;const t=!!((l=this._document)!=null&&l.fonts);return rl(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let l=!1;return(Et||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(l=!0),rl(this,"isSyncFontLoadingSupported",l)}_queueLoadingCallback(l){function t(){for(st(!n.done,"completeRequest() cannot be called twice."),n.done=!0;d.length>0&&d[0].done;){const a=d.shift();setTimeout(a.callback,0)}}const{loadingRequests:d}=this,n={done:!1,complete:t,callback:l};return d.push(n),n}get _loadTestFont(){const l=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return rl(this,"_loadTestFont",l)}_prepareFontLoadEvent(l,t){function d(u,J){return u.charCodeAt(J)<<24|u.charCodeAt(J+1)<<16|u.charCodeAt(J+2)<<8|u.charCodeAt(J+3)&255}function n(u,J,G,T){const y=u.substring(0,J),k=u.substring(J+G);return y+T+k}let a,i;const s=this._document.createElement("canvas");s.width=1,s.height=1;const c=s.getContext("2d");let F=0;function h(u,J){if(++F>30){Rl("Load test font never loaded."),J();return}if(c.font="30px "+u,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){J();return}setTimeout(h.bind(null,u,J))}const o=`lt${Date.now()}${this.loadTestFontId++}`;let V=this._loadTestFont;V=n(V,976,o.length,o);const W=16,Q=1482184792;let m=d(V,W);for(a=0,i=o.length-3;a<i;a+=4)m=m-Q+d(o,a)|0;a<o.length&&(m=m-Q+d(o+"XXX",a)|0),V=n(V,W,4,XL(m));const R=`url(data:font/opentype;base64,${btoa(V)});`,r=`@font-face {font-family:"${o}";src:${R}}`;this.insertRule(r);const b=this._document.createElement("div");b.style.visibility="hidden",b.style.width=b.style.height="10px",b.style.position="absolute",b.style.top=b.style.left="0px";for(const u of[l.loadedName,o]){const J=this._document.createElement("span");J.textContent="Hi",J.style.fontFamily=u,b.append(J)}this._document.body.append(b),h(o,()=>{b.remove(),t.complete()})}}zZ=new WeakMap;class HL{constructor(l,{disableFontFace:t=!1,fontExtraProperties:d=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const a in l)this[a]=l[a];this.disableFontFace=t===!0,this.fontExtraProperties=d===!0,this._inspectFont=n}createNativeFontFace(){var l;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const d={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(d.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,d)}return(l=this._inspectFont)==null||l.call(this,this),t}createFontFaceRule(){var l;if(!this.data||this.disableFontFace)return null;const t=`url(data:${this.mimetype};base64,${LL(this.data)});`;let d;if(!this.cssFontInfo)d=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),d=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${t}}`}return(l=this._inspectFont)==null||l.call(this,this,t),d}getPathGenerator(l,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];const d=this.loadedName+"_path_"+t;let n;try{n=l.get(d)}catch(i){Rl(`getPathGenerator - ignoring character: "${i}".`)}const a=new Path2D(n||"");return this.fontExtraProperties||l.delete(d),this.compiledGlyphs[t]=a}}const ho={DATA:1,ERROR:2},Ut={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function AM(){}function Ze(e){if(e instanceof gn||e instanceof nR||e instanceof cZ||e instanceof cM||e instanceof Th||e instanceof dR)return e;switch(e instanceof Error||typeof e=="object"&&e!==null||Cl('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new gn(e.message);case"InvalidPDFException":return new nR(e.message);case"MissingPDFException":return new cZ(e.message);case"PasswordException":return new cM(e.message,e.code);case"UnexpectedResponseException":return new Th(e.message,e.status);case"UnknownErrorException":return new dR(e.message,e.details)}return new dR(e.message,e.toString())}var LZ,_n,_M,qM,$M,oo;class IZ{constructor(l,t,d){M(this,_n),M(this,LZ,new AbortController),this.sourceName=l,this.targetName=t,this.comObj=d,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),d.addEventListener("message",p(this,_n,_M).bind(this),{signal:U(this,LZ).signal})}on(l,t){const d=this.actionHandler;if(d[l])throw new Error(`There is already an actionName called "${l}"`);d[l]=t}send(l,t,d){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:l,data:t},d)}sendWithPromise(l,t,d){const n=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[n]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:l,callbackId:n,data:t},d)}catch(i){a.reject(i)}return a.promise}sendWithStream(l,t,d,n){const a=this.streamId++,i=this.sourceName,s=this.targetName,c=this.comObj;return new ReadableStream({start:F=>{const h=Promise.withResolvers();return this.streamControllers[a]={controller:F,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:i,targetName:s,action:l,streamId:a,data:t,desiredSize:F.desiredSize},n),h.promise},pull:F=>{const h=Promise.withResolvers();return this.streamControllers[a].pullCall=h,c.postMessage({sourceName:i,targetName:s,stream:Ut.PULL,streamId:a,desiredSize:F.desiredSize}),h.promise},cancel:F=>{st(F instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[a].cancelCall=h,this.streamControllers[a].isClosed=!0,c.postMessage({sourceName:i,targetName:s,stream:Ut.CANCEL,streamId:a,reason:Ze(F)}),h.promise}},d)}destroy(){var l;(l=U(this,LZ))==null||l.abort(),N(this,LZ,null)}}LZ=new WeakMap,_n=new WeakSet,_M=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){p(this,_n,$M).call(this,e);return}if(e.callback){const t=e.callbackId,d=this.callbackCapabilities[t];if(!d)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===ho.DATA)d.resolve(e.data);else if(e.callback===ho.ERROR)d.reject(Ze(e.reason));else throw new Error("Unexpected callback case");return}const l=this.actionHandler[e.action];if(!l)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const t=this.sourceName,d=e.sourceName,n=this.comObj;Promise.try(l,e.data).then(function(a){n.postMessage({sourceName:t,targetName:d,callback:ho.DATA,callbackId:e.callbackId,data:a})},function(a){n.postMessage({sourceName:t,targetName:d,callback:ho.ERROR,callbackId:e.callbackId,reason:Ze(a)})});return}if(e.streamId){p(this,_n,qM).call(this,e);return}l(e.data)},qM=function(e){const l=e.streamId,t=this.sourceName,d=e.sourceName,n=this.comObj,a=this,i=this.actionHandler[e.action],s={enqueue(c,F=1,h){if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=F,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:t,targetName:d,stream:Ut.ENQUEUE,streamId:l,chunk:c},h)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:t,targetName:d,stream:Ut.CLOSE,streamId:l}),delete a.streamSinks[l])},error(c){st(c instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:t,targetName:d,stream:Ut.ERROR,streamId:l,reason:Ze(c)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,this.streamSinks[l]=s,Promise.try(i,e.data,s).then(function(){n.postMessage({sourceName:t,targetName:d,stream:Ut.START_COMPLETE,streamId:l,success:!0})},function(c){n.postMessage({sourceName:t,targetName:d,stream:Ut.START_COMPLETE,streamId:l,reason:Ze(c)})})},$M=function(e){const l=e.streamId,t=this.sourceName,d=e.sourceName,n=this.comObj,a=this.streamControllers[l],i=this.streamSinks[l];switch(e.stream){case Ut.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(Ze(e.reason));break;case Ut.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(Ze(e.reason));break;case Ut.PULL:if(!i){n.postMessage({sourceName:t,targetName:d,stream:Ut.PULL_COMPLETE,streamId:l,success:!0});break}i.desiredSize<=0&&e.desiredSize>0&&i.sinkCapability.resolve(),i.desiredSize=e.desiredSize,Promise.try(i.onPull||AM).then(function(){n.postMessage({sourceName:t,targetName:d,stream:Ut.PULL_COMPLETE,streamId:l,success:!0})},function(c){n.postMessage({sourceName:t,targetName:d,stream:Ut.PULL_COMPLETE,streamId:l,reason:Ze(c)})});break;case Ut.ENQUEUE:if(st(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(e.chunk);break;case Ut.CLOSE:if(st(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),p(this,_n,oo).call(this,a,l);break;case Ut.ERROR:st(a,"error should have stream controller"),a.controller.error(Ze(e.reason)),p(this,_n,oo).call(this,a,l);break;case Ut.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(Ze(e.reason)),p(this,_n,oo).call(this,a,l);break;case Ut.CANCEL:if(!i)break;const s=Ze(e.reason);Promise.try(i.onCancel||AM,s).then(function(){n.postMessage({sourceName:t,targetName:d,stream:Ut.CANCEL_COMPLETE,streamId:l,success:!0})},function(c){n.postMessage({sourceName:t,targetName:d,stream:Ut.CANCEL_COMPLETE,streamId:l,reason:Ze(c)})}),i.sinkCapability.reject(s),i.isCancelled=!0,delete this.streamSinks[l];break;default:throw new Error("Unexpected stream case")}},oo=async function(e,l){var t,d,n;await Promise.allSettled([(t=e.startCall)==null?void 0:t.promise,(d=e.pullCall)==null?void 0:d.promise,(n=e.cancelCall)==null?void 0:n.promise]),delete this.streamControllers[l]};var Vo;class lS{constructor({enableHWA:l=!1}){M(this,Vo,!1),N(this,Vo,l)}create(l,t){if(l<=0||t<=0)throw new Error("Invalid canvas size");const d=this._createCanvas(l,t);return{canvas:d,context:d.getContext("2d",{willReadFrequently:!U(this,Vo)})}}reset(l,t,d){if(!l.canvas)throw new Error("Canvas is not specified");if(t<=0||d<=0)throw new Error("Invalid canvas size");l.canvas.width=t,l.canvas.height=d}destroy(l){if(!l.canvas)throw new Error("Canvas is not specified");l.canvas.width=0,l.canvas.height=0,l.canvas=null,l.context=null}_createCanvas(l,t){Cl("Abstract method `_createCanvas` called.")}}Vo=new WeakMap;class PL extends lS{constructor({ownerDocument:l=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=l}_createCanvas(l,t){const d=this._document.createElement("canvas");return d.width=l,d.height=t,d}}class tS{constructor({baseUrl:l=null,isCompressed:t=!0}){this.baseUrl=l,this.isCompressed=t}async fetch({name:l}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!l)throw new Error("CMap name must be specified.");const t=this.baseUrl+l+(this.isCompressed?".bcmap":"");return this._fetch(t).then(d=>({cMapData:d,isCompressed:this.isCompressed})).catch(d=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)})}async _fetch(l){Cl("Abstract method `_fetch` called.")}}class eS extends tS{async _fetch(l){const t=await yh(l,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):Gh(t)}}Tl(4520);class dS{addFilter(l){return"none"}addHCMFilter(l,t){return"none"}addAlphaFilter(l){return"none"}addLuminosityFilter(l){return"none"}addHighlightHCMFilter(l,t,d,n,a){return"none"}destroy(l=!1){}}var $s,lc,qn,$n,de,Ui,tc,Zl,Ot,DZ,ec,Wo,dc,nS,CR,nc,wZ,EZ,xR,CZ;class AL extends dS{constructor({docId:l,ownerDocument:t=globalThis.document}){super(),M(this,Zl),M(this,$s),M(this,lc),M(this,qn),M(this,$n),M(this,de),M(this,Ui),M(this,tc,0),N(this,$n,l),N(this,de,t)}addFilter(l){if(!l)return"none";let t=U(this,Zl,Ot).get(l);if(t)return t;const[d,n,a]=p(this,Zl,Wo).call(this,l),i=l.length===1?d:`${d}${n}${a}`;if(t=U(this,Zl,Ot).get(i),t)return U(this,Zl,Ot).set(l,t),t;const s=`g_${U(this,$n)}_transfer_map_${le(this,tc)._++}`,c=p(this,Zl,dc).call(this,s);U(this,Zl,Ot).set(l,c),U(this,Zl,Ot).set(i,c);const F=p(this,Zl,nc).call(this,s);return p(this,Zl,EZ).call(this,d,n,a,F),c}addHCMFilter(l,t){var d;const n=`${l}-${t}`,a="base";let i=U(this,Zl,DZ).get(a);if((i==null?void 0:i.key)===n||(i?((d=i.filter)==null||d.remove(),i.key=n,i.url="none",i.filter=null):(i={key:n,url:"none",filter:null},U(this,Zl,DZ).set(a,i)),!l||!t))return i.url;const s=p(this,Zl,CZ).call(this,l);l=sl.makeHexColor(...s);const c=p(this,Zl,CZ).call(this,t);if(t=sl.makeHexColor(...c),U(this,Zl,ec).style.color="",l==="#000000"&&t==="#ffffff"||l===t)return i.url;const F=new Array(256);for(let Q=0;Q<=255;Q++){const m=Q/255;F[Q]=m<=.03928?m/12.92:((m+.055)/1.055)**2.4}const h=F.join(","),o=`g_${U(this,$n)}_hcm_filter`,V=i.filter=p(this,Zl,nc).call(this,o);p(this,Zl,EZ).call(this,h,h,h,V),p(this,Zl,CR).call(this,V);const W=(Q,m)=>{const R=s[Q]/255,r=c[Q]/255,b=new Array(m+1);for(let u=0;u<=m;u++)b[u]=R+u/m*(r-R);return b.join(",")};return p(this,Zl,EZ).call(this,W(0,5),W(1,5),W(2,5),V),i.url=p(this,Zl,dc).call(this,o),i.url}addAlphaFilter(l){let t=U(this,Zl,Ot).get(l);if(t)return t;const[d]=p(this,Zl,Wo).call(this,[l]),n=`alpha_${d}`;if(t=U(this,Zl,Ot).get(n),t)return U(this,Zl,Ot).set(l,t),t;const a=`g_${U(this,$n)}_alpha_map_${le(this,tc)._++}`,i=p(this,Zl,dc).call(this,a);U(this,Zl,Ot).set(l,i),U(this,Zl,Ot).set(n,i);const s=p(this,Zl,nc).call(this,a);return p(this,Zl,xR).call(this,d,s),i}addLuminosityFilter(l){let t=U(this,Zl,Ot).get(l||"luminosity");if(t)return t;let d,n;if(l?([d]=p(this,Zl,Wo).call(this,[l]),n=`luminosity_${d}`):n="luminosity",t=U(this,Zl,Ot).get(n),t)return U(this,Zl,Ot).set(l,t),t;const a=`g_${U(this,$n)}_luminosity_map_${le(this,tc)._++}`,i=p(this,Zl,dc).call(this,a);U(this,Zl,Ot).set(l,i),U(this,Zl,Ot).set(n,i);const s=p(this,Zl,nc).call(this,a);return p(this,Zl,nS).call(this,s),l&&p(this,Zl,xR).call(this,d,s),i}addHighlightHCMFilter(l,t,d,n,a){var i;const s=`${t}-${d}-${n}-${a}`;let c=U(this,Zl,DZ).get(l);if((c==null?void 0:c.key)===s||(c?((i=c.filter)==null||i.remove(),c.key=s,c.url="none",c.filter=null):(c={key:s,url:"none",filter:null},U(this,Zl,DZ).set(l,c)),!t||!d))return c.url;const[F,h]=[t,d].map(p(this,Zl,CZ).bind(this));let o=Math.round(.2126*F[0]+.7152*F[1]+.0722*F[2]),V=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[W,Q]=[n,a].map(p(this,Zl,CZ).bind(this));V<o&&([o,V,W,Q]=[V,o,Q,W]),U(this,Zl,ec).style.color="";const m=(b,u,J)=>{const G=new Array(256),T=(V-o)/J,y=b/255,k=(u-b)/(255*J);let X=0;for(let L=0;L<=J;L++){const D=Math.round(o+L*T),C=y+L*k;for(let I=X;I<=D;I++)G[I]=C;X=D+1}for(let L=X;L<256;L++)G[L]=G[X-1];return G.join(",")},R=`g_${U(this,$n)}_hcm_${l}_filter`,r=c.filter=p(this,Zl,nc).call(this,R);return p(this,Zl,CR).call(this,r),p(this,Zl,EZ).call(this,m(W[0],Q[0],5),m(W[1],Q[1],5),m(W[2],Q[2],5),r),c.url=p(this,Zl,dc).call(this,R),c.url}destroy(l=!1){var t,d,n,a;l&&(t=U(this,Ui))!=null&&t.size||((d=U(this,qn))==null||d.parentNode.parentNode.remove(),N(this,qn,null),(n=U(this,lc))==null||n.clear(),N(this,lc,null),(a=U(this,Ui))==null||a.clear(),N(this,Ui,null),N(this,tc,0))}}$s=new WeakMap,lc=new WeakMap,qn=new WeakMap,$n=new WeakMap,de=new WeakMap,Ui=new WeakMap,tc=new WeakMap,Zl=new WeakSet,Ot=function(){return U(this,lc)||N(this,lc,new Map)},DZ=function(){return U(this,Ui)||N(this,Ui,new Map)},ec=function(){if(!U(this,qn)){const e=U(this,de).createElement("div"),{style:l}=e;l.visibility="hidden",l.contain="strict",l.width=l.height=0,l.position="absolute",l.top=l.left=0,l.zIndex=-1;const t=U(this,de).createElementNS(Ad,"svg");t.setAttribute("width",0),t.setAttribute("height",0),N(this,qn,U(this,de).createElementNS(Ad,"defs")),e.append(t),t.append(U(this,qn)),U(this,de).body.append(e)}return U(this,qn)},Wo=function(e){if(e.length===1){const s=e[0],c=new Array(256);for(let h=0;h<256;h++)c[h]=s[h]/255;const F=c.join(",");return[F,F,F]}const[l,t,d]=e,n=new Array(256),a=new Array(256),i=new Array(256);for(let s=0;s<256;s++)n[s]=l[s]/255,a[s]=t[s]/255,i[s]=d[s]/255;return[n.join(","),a.join(","),i.join(",")]},dc=function(e){if(U(this,$s)===void 0){N(this,$s,"");const l=U(this,de).URL;l!==U(this,de).baseURI&&(Bh(l)?Rl('#createUrl: ignore "data:"-URL for performance reasons.'):N(this,$s,l.split("#",1)[0]))}return`url(${U(this,$s)}#${e})`},nS=function(e){const l=U(this,de).createElementNS(Ad,"feColorMatrix");l.setAttribute("type","matrix"),l.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(l)},CR=function(e){const l=U(this,de).createElementNS(Ad,"feColorMatrix");l.setAttribute("type","matrix"),l.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(l)},nc=function(e){const l=U(this,de).createElementNS(Ad,"filter");return l.setAttribute("color-interpolation-filters","sRGB"),l.setAttribute("id",e),U(this,Zl,ec).append(l),l},wZ=function(e,l,t){const d=U(this,de).createElementNS(Ad,l);d.setAttribute("type","discrete"),d.setAttribute("tableValues",t),e.append(d)},EZ=function(e,l,t,d){const n=U(this,de).createElementNS(Ad,"feComponentTransfer");d.append(n),p(this,Zl,wZ).call(this,n,"feFuncR",e),p(this,Zl,wZ).call(this,n,"feFuncG",l),p(this,Zl,wZ).call(this,n,"feFuncB",t)},xR=function(e,l){const t=U(this,de).createElementNS(Ad,"feComponentTransfer");l.append(t),p(this,Zl,wZ).call(this,t,"feFuncA",e)},CZ=function(e){return U(this,Zl,ec).style.color=e,VR(getComputedStyle(U(this,Zl,ec)).getPropertyValue("color"))};class aS{constructor({baseUrl:l=null}){this.baseUrl=l}async fetch({filename:l}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!l)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${l}`;return this._fetch(t).catch(d=>{throw new Error(`Unable to load font data at: ${t}`)})}async _fetch(l){Cl("Abstract method `_fetch` called.")}}class iS extends aS{async _fetch(l){const t=await yh(l,"arraybuffer");return new Uint8Array(t)}}if(Et){let e;try{const l=process.getBuiltinModule("module").createRequire(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:os&&os.tagName.toUpperCase()==="SCRIPT"&&os.src||new URL("index.umd.cjs",document.baseURI).href);try{e=l("@napi-rs/canvas")}catch(t){Rl(`Cannot load "@napi-rs/canvas" package: "${t}".`)}}catch(l){Rl(`Cannot access the \`require\` function: "${l}".`)}globalThis.DOMMatrix||(e!=null&&e.DOMMatrix?globalThis.DOMMatrix=e.DOMMatrix:Rl("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.ImageData||(e!=null&&e.ImageData?globalThis.ImageData=e.ImageData:Rl("Cannot polyfill `ImageData`, rendering may be broken.")),globalThis.Path2D||(e!=null&&e.Path2D?globalThis.Path2D=e.Path2D:Rl("Cannot polyfill `Path2D`, rendering may be broken."))}async function sS(e){const l=await process.getBuiltinModule("fs").promises.readFile(e);return new Uint8Array(l)}class _L extends dS{}class qL extends lS{_createCanvas(l,t){return process.getBuiltinModule("module").createRequire(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:os&&os.tagName.toUpperCase()==="SCRIPT"&&os.src||new URL("index.umd.cjs",document.baseURI).href)("@napi-rs/canvas").createCanvas(l,t)}}class $L extends tS{async _fetch(l){return sS(l)}}class lI extends aS{async _fetch(l){return sS(l)}}const vt={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function gR(e,l){if(!l)return;const t=l[2]-l[0],d=l[3]-l[1],n=new Path2D;n.rect(l[0],l[1],t,d),e.clip(n)}class jR{getPattern(){Cl("Abstract method `getPattern` called.")}}class tI extends jR{constructor(l){super(),this._type=l[1],this._bbox=l[2],this._colorStops=l[3],this._p0=l[4],this._p1=l[5],this._r0=l[6],this._r1=l[7],this.matrix=null}_createGradient(l){let t;this._type==="axial"?t=l.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(t=l.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const d of this._colorStops)t.addColorStop(d[0],d[1]);return t}getPattern(l,t,d,n){let a;if(n===vt.STROKE||n===vt.FILL){const i=t.current.getClippedPathBoundingBox(n,Ol(l))||[0,0,0,0],s=Math.ceil(i[2]-i[0])||1,c=Math.ceil(i[3]-i[1])||1,F=t.cachedCanvases.getCanvas("pattern",s,c),h=F.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-i[0],-i[1]),d=sl.transform(d,[1,0,0,1,i[0],i[1]]),h.transform(...t.baseTransform),this.matrix&&h.transform(...this.matrix),gR(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),a=l.createPattern(F.canvas,"no-repeat");const o=new DOMMatrix(d);a.setTransform(o)}else gR(l,this._bbox),a=this._createGradient(l);return a}}function OR(e,l,t,d,n,a,i,s){const c=l.coords,F=l.colors,h=e.data,o=e.width*4;let V;c[t+1]>c[d+1]&&(V=t,t=d,d=V,V=a,a=i,i=V),c[d+1]>c[n+1]&&(V=d,d=n,n=V,V=i,i=s,s=V),c[t+1]>c[d+1]&&(V=t,t=d,d=V,V=a,a=i,i=V);const W=(c[t]+l.offsetX)*l.scaleX,Q=(c[t+1]+l.offsetY)*l.scaleY,m=(c[d]+l.offsetX)*l.scaleX,R=(c[d+1]+l.offsetY)*l.scaleY,r=(c[n]+l.offsetX)*l.scaleX,b=(c[n+1]+l.offsetY)*l.scaleY;if(Q>=b)return;const u=F[a],J=F[a+1],G=F[a+2],T=F[i],y=F[i+1],k=F[i+2],X=F[s],L=F[s+1],D=F[s+2],C=Math.round(Q),I=Math.round(b);let P,H,Y,B,z,g,w,O;for(let f=C;f<=I;f++){if(f<R){const K=f<Q?0:(Q-f)/(Q-R);P=W-(W-m)*K,H=u-(u-T)*K,Y=J-(J-y)*K,B=G-(G-k)*K}else{let K;f>b?K=1:R===b?K=0:K=(R-f)/(R-b),P=m-(m-r)*K,H=T-(T-X)*K,Y=y-(y-L)*K,B=k-(k-D)*K}let x;f<Q?x=0:f>b?x=1:x=(Q-f)/(Q-b),z=W-(W-r)*x,g=u-(u-X)*x,w=J-(J-L)*x,O=G-(G-D)*x;const A=Math.round(Math.min(P,z)),al=Math.round(Math.max(P,z));let _=o*f+A*4;for(let K=A;K<=al;K++)x=(P-K)/(P-z),x<0?x=0:x>1&&(x=1),h[_++]=H-(H-g)*x|0,h[_++]=Y-(Y-w)*x|0,h[_++]=B-(B-O)*x|0,h[_++]=255}}function eI(e,l,t){const d=l.coords,n=l.colors;let a,i;switch(l.type){case"lattice":const s=l.verticesPerRow,c=Math.floor(d.length/s)-1,F=s-1;for(a=0;a<c;a++){let h=a*s;for(let o=0;o<F;o++,h++)OR(e,t,d[h],d[h+1],d[h+s],n[h],n[h+1],n[h+s]),OR(e,t,d[h+s+1],d[h+1],d[h+s],n[h+s+1],n[h+1],n[h+s])}break;case"triangles":for(a=0,i=d.length;a<i;a+=3)OR(e,t,d[a],d[a+1],d[a+2],n[a],n[a+1],n[a+2]);break;default:throw new Error("illegal figure")}}class dI extends jR{constructor(l){super(),this._coords=l[2],this._colors=l[3],this._figures=l[4],this._bounds=l[5],this._bbox=l[7],this._background=l[8],this.matrix=null}_createMeshCanvas(l,t,d){const n=Math.floor(this._bounds[0]),a=Math.floor(this._bounds[1]),i=Math.ceil(this._bounds[2])-n,s=Math.ceil(this._bounds[3])-a,c=Math.min(Math.ceil(Math.abs(i*l[0]*1.1)),3e3),F=Math.min(Math.ceil(Math.abs(s*l[1]*1.1)),3e3),h=i/c,o=s/F,V={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-a,scaleX:1/h,scaleY:1/o},W=c+4,Q=F+4,m=d.getCanvas("mesh",W,Q),R=m.context,r=R.createImageData(c,F);if(t){const b=r.data;for(let u=0,J=b.length;u<J;u+=4)b[u]=t[0],b[u+1]=t[1],b[u+2]=t[2],b[u+3]=255}for(const b of this._figures)eI(r,b,V);return R.putImageData(r,2,2),{canvas:m.canvas,offsetX:n-2*h,offsetY:a-2*o,scaleX:h,scaleY:o}}getPattern(l,t,d,n){gR(l,this._bbox);let a;if(n===vt.SHADING)a=sl.singularValueDecompose2dScale(Ol(l));else if(a=sl.singularValueDecompose2dScale(t.baseTransform),this.matrix){const s=sl.singularValueDecompose2dScale(this.matrix);a=[a[0]*s[0],a[1]*s[1]]}const i=this._createMeshCanvas(a,n===vt.SHADING?null:this._background,t.cachedCanvases);return n!==vt.SHADING&&(l.setTransform(...t.baseTransform),this.matrix&&l.transform(...this.matrix)),l.translate(i.offsetX,i.offsetY),l.scale(i.scaleX,i.scaleY),l.createPattern(i.canvas,"no-repeat")}}class nI extends jR{getPattern(){return"hotpink"}}function aI(e){switch(e[0]){case"RadialAxial":return new tI(e);case"Mesh":return new dI(e);case"Dummy":return new nI}throw new Error(`Unknown IR type: ${e[0]}`)}const cS={COLORED:1,UNCOLORED:2},US=class Vy{constructor(l,t,d,n,a){this.operatorList=l[2],this.matrix=l[3],this.bbox=l[4],this.xstep=l[5],this.ystep=l[6],this.paintType=l[7],this.tilingType=l[8],this.color=t,this.ctx=d,this.canvasGraphicsFactory=n,this.baseTransform=a}createPatternCanvas(l){const{bbox:t,operatorList:d,paintType:n,tilingType:a,color:i,canvasGraphicsFactory:s}=this;let{xstep:c,ystep:F}=this;c=Math.abs(c),F=Math.abs(F),Jh("TilingType: "+a);const h=t[0],o=t[1],V=t[2],W=t[3],Q=V-h,m=W-o,R=sl.singularValueDecompose2dScale(this.matrix),r=sl.singularValueDecompose2dScale(this.baseTransform),b=R[0]*r[0],u=R[1]*r[1];let J=Q,G=m,T=!1,y=!1;const k=Math.ceil(c*b),X=Math.ceil(F*u),L=Math.ceil(Q*b),D=Math.ceil(m*u);k>=L?J=c:T=!0,X>=D?G=F:y=!0;const C=this.getSizeAndScale(J,this.ctx.canvas.width,b),I=this.getSizeAndScale(G,this.ctx.canvas.height,u),P=l.cachedCanvases.getCanvas("pattern",C.size,I.size),H=P.context,Y=s.createCanvasGraphics(H);if(Y.groupLevel=l.groupLevel,this.setFillAndStrokeStyleToContext(Y,n,i),H.translate(-C.scale*h,-I.scale*o),Y.transform(C.scale,0,0,I.scale,0,0),H.save(),this.clipBbox(Y,h,o,V,W),Y.baseTransform=Ol(Y.ctx),Y.executeOperatorList(d),Y.endDrawing(),H.restore(),T||y){const B=P.canvas;T&&(J=c),y&&(G=F);const z=this.getSizeAndScale(J,this.ctx.canvas.width,b),g=this.getSizeAndScale(G,this.ctx.canvas.height,u),w=z.size,O=g.size,f=l.cachedCanvases.getCanvas("pattern-workaround",w,O),x=f.context,A=T?Math.floor(Q/c):0,al=y?Math.floor(m/F):0;for(let _=0;_<=A;_++)for(let K=0;K<=al;K++)x.drawImage(B,w*_,O*K,w,O,0,0,w,O);return{canvas:f.canvas,scaleX:z.scale,scaleY:g.scale,offsetX:h,offsetY:o}}return{canvas:P.canvas,scaleX:C.scale,scaleY:I.scale,offsetX:h,offsetY:o}}getSizeAndScale(l,t,d){const n=Math.max(Vy.MAX_PATTERN_SIZE,t);let a=Math.ceil(l*d);return a>=n?a=n:d=a/l,{scale:d,size:a}}clipBbox(l,t,d,n,a){const i=n-t,s=a-d;l.ctx.rect(t,d,i,s),l.current.updateRectMinMax(Ol(l.ctx),[t,d,n,a]),l.clip(),l.endPath()}setFillAndStrokeStyleToContext(l,t,d){const n=l.ctx,a=l.current;switch(t){case cS.COLORED:const i=this.ctx;n.fillStyle=i.fillStyle,n.strokeStyle=i.strokeStyle,a.fillColor=i.fillStyle,a.strokeColor=i.strokeStyle;break;case cS.UNCOLORED:const s=sl.makeHexColor(d[0],d[1],d[2]);n.fillStyle=s,n.strokeStyle=s,a.fillColor=s,a.strokeColor=s;break;default:throw new GL(`Unsupported paint type: ${t}`)}}getPattern(l,t,d,n){let a=d;n!==vt.SHADING&&(a=sl.transform(a,t.baseTransform),this.matrix&&(a=sl.transform(a,this.matrix)));const i=this.createPatternCanvas(t);let s=new DOMMatrix(a);s=s.translate(i.offsetX,i.offsetY),s=s.scale(1/i.scaleX,1/i.scaleY);const c=l.createPattern(i.canvas,"repeat");return c.setTransform(s),c}};hl(US,"MAX_PATTERN_SIZE",3e3);let iI=US;function sI({src:e,srcPos:l=0,dest:t,width:d,height:n,nonBlackColor:a=4294967295,inverseDecode:i=!1}){const s=te.isLittleEndian?4278190080:255,[c,F]=i?[a,s]:[s,a],h=d>>3,o=d&7,V=e.length;t=new Uint32Array(t.buffer);let W=0;for(let Q=0;Q<n;Q++){for(const R=l+h;l<R;l++){const r=l<V?e[l]:255;t[W++]=r&128?F:c,t[W++]=r&64?F:c,t[W++]=r&32?F:c,t[W++]=r&16?F:c,t[W++]=r&8?F:c,t[W++]=r&4?F:c,t[W++]=r&2?F:c,t[W++]=r&1?F:c}if(o===0)continue;const m=l<V?e[l++]:255;for(let R=0;R<o;R++)t[W++]=m&1<<7-R?F:c}return{srcPos:l,destPos:W}}const ZS=16,FS=100,cI=15,hS=10,oS=1e3,Fe=16;function UI(e,l){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){l.save(),this.__originalSave()},e.restore=function(){l.restore(),this.__originalRestore()},e.translate=function(t,d){l.translate(t,d),this.__originalTranslate(t,d)},e.scale=function(t,d){l.scale(t,d),this.__originalScale(t,d)},e.transform=function(t,d,n,a,i,s){l.transform(t,d,n,a,i,s),this.__originalTransform(t,d,n,a,i,s)},e.setTransform=function(t,d,n,a,i,s){l.setTransform(t,d,n,a,i,s),this.__originalSetTransform(t,d,n,a,i,s)},e.resetTransform=function(){l.resetTransform(),this.__originalResetTransform()},e.rotate=function(t){l.rotate(t),this.__originalRotate(t)},e.clip=function(t){l.clip(t),this.__originalClip(t)},e.moveTo=function(t,d){l.moveTo(t,d),this.__originalMoveTo(t,d)},e.lineTo=function(t,d){l.lineTo(t,d),this.__originalLineTo(t,d)},e.bezierCurveTo=function(t,d,n,a,i,s){l.bezierCurveTo(t,d,n,a,i,s),this.__originalBezierCurveTo(t,d,n,a,i,s)},e.rect=function(t,d,n,a){l.rect(t,d,n,a),this.__originalRect(t,d,n,a)},e.closePath=function(){l.closePath(),this.__originalClosePath()},e.beginPath=function(){l.beginPath(),this.__originalBeginPath()}}class ZI{constructor(l){this.canvasFactory=l,this.cache=Object.create(null)}getCanvas(l,t,d){let n;return this.cache[l]!==void 0?(n=this.cache[l],this.canvasFactory.reset(n,t,d)):(n=this.canvasFactory.create(t,d),this.cache[l]=n),n}delete(l){delete this.cache[l]}clear(){for(const l in this.cache){const t=this.cache[l];this.canvasFactory.destroy(t),delete this.cache[l]}}}function Qo(e,l,t,d,n,a,i,s,c,F){const[h,o,V,W,Q,m]=Ol(e);if(o===0&&V===0){const b=i*h+Q,u=Math.round(b),J=s*W+m,G=Math.round(J),T=(i+c)*h+Q,y=Math.abs(Math.round(T)-u)||1,k=(s+F)*W+m,X=Math.abs(Math.round(k)-G)||1;return e.setTransform(Math.sign(h),0,0,Math.sign(W),u,G),e.drawImage(l,t,d,n,a,0,0,y,X),e.setTransform(h,o,V,W,Q,m),[y,X]}if(h===0&&W===0){const b=s*V+Q,u=Math.round(b),J=i*o+m,G=Math.round(J),T=(s+F)*V+Q,y=Math.abs(Math.round(T)-u)||1,k=(i+c)*o+m,X=Math.abs(Math.round(k)-G)||1;return e.setTransform(0,Math.sign(o),Math.sign(V),0,u,G),e.drawImage(l,t,d,n,a,0,0,X,y),e.setTransform(h,o,V,W,Q,m),[X,y]}e.drawImage(l,t,d,n,a,i,s,c,F);const R=Math.hypot(h,o),r=Math.hypot(V,W);return[R*c,r*F]}function FI(e){const{width:l,height:t}=e;if(l>oS||t>oS)return null;const d=1e3,n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),a=l+1;let i=new Uint8Array(a*(t+1)),s,c,F;const h=l+7&-8;let o=new Uint8Array(h*t),V=0;for(const R of e.data){let r=128;for(;r>0;)o[V++]=R&r?0:255,r>>=1}let W=0;for(V=0,o[V]!==0&&(i[0]=1,++W),c=1;c<l;c++)o[V]!==o[V+1]&&(i[c]=o[V]?2:1,++W),V++;for(o[V]!==0&&(i[c]=2,++W),s=1;s<t;s++){V=s*h,F=s*a,o[V-h]!==o[V]&&(i[F]=o[V]?1:8,++W);let R=(o[V]?4:0)+(o[V-h]?8:0);for(c=1;c<l;c++)R=(R>>2)+(o[V+1]?4:0)+(o[V-h+1]?8:0),n[R]&&(i[F+c]=n[R],++W),V++;if(o[V-h]!==o[V]&&(i[F+c]=o[V]?2:4,++W),W>d)return null}for(V=h*(t-1),F=s*a,o[V]!==0&&(i[F]=8,++W),c=1;c<l;c++)o[V]!==o[V+1]&&(i[F+c]=o[V]?4:8,++W),V++;if(o[V]!==0&&(i[F+c]=4,++W),W>d)return null;const Q=new Int32Array([0,a,-1,0,-a,0,0,0,1]),m=new Path2D;for(s=0;W&&s<=t;s++){let R=s*a;const r=R+l;for(;R<r&&!i[R];)R++;if(R===r)continue;m.moveTo(R%a,s);const b=R;let u=i[R];do{const J=Q[u];do R+=J;while(!i[R]);const G=i[R];G!==5&&G!==10?(u=G,i[R]=0):(u=G&51*u>>4,i[R]&=u>>2|u<<2),m.lineTo(R%a,R/a|0),i[R]||--W}while(b!==R);--s}return o=null,i=null,function(R){R.save(),R.scale(1/l,-1/t),R.translate(0,-t),R.fill(m),R.beginPath(),R.restore()}}class VS{constructor(l,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=sM,this.textMatrixScale=1,this.fontMatrix=tR,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=Ct.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.patternStroke=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,l,t])}clone(){const l=Object.create(this);return l.clipBox=this.clipBox.slice(),l}setCurrentPoint(l,t){this.x=l,this.y=t}updatePathMinMax(l,t,d){[t,d]=sl.applyTransform([t,d],l),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,d),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,d)}updateRectMinMax(l,t){const d=sl.applyTransform(t,l),n=sl.applyTransform(t.slice(2),l),a=sl.applyTransform([t[0],t[3]],l),i=sl.applyTransform([t[2],t[1]],l);this.minX=Math.min(this.minX,d[0],n[0],a[0],i[0]),this.minY=Math.min(this.minY,d[1],n[1],a[1],i[1]),this.maxX=Math.max(this.maxX,d[0],n[0],a[0],i[0]),this.maxY=Math.max(this.maxY,d[1],n[1],a[1],i[1])}updateScalingPathMinMax(l,t){sl.scaleMinMax(l,t),this.minX=Math.min(this.minX,t[0]),this.minY=Math.min(this.minY,t[1]),this.maxX=Math.max(this.maxX,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(l,t,d,n,a,i,s,c,F,h){const o=sl.bezierBoundingBox(t,d,n,a,i,s,c,F,h);h||this.updateRectMinMax(l,o)}getPathBoundingBox(l=vt.FILL,t=null){const d=[this.minX,this.minY,this.maxX,this.maxY];if(l===vt.STROKE){t||Cl("Stroke bounding box must include transform.");const n=sl.singularValueDecompose2dScale(t),a=n[0]*this.lineWidth/2,i=n[1]*this.lineWidth/2;d[0]-=a,d[1]-=i,d[2]+=a,d[3]+=i}return d}updateClipFromPath(){const l=sl.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(l||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(l){this.clipBox=l,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(l=vt.FILL,t=null){return sl.intersect(this.clipBox,this.getPathBoundingBox(l,t))}}function WS(e,l){if(l instanceof ImageData){e.putImageData(l,0,0);return}const t=l.height,d=l.width,n=t%Fe,a=(t-n)/Fe,i=n===0?a:a+1,s=e.createImageData(d,Fe);let c=0,F;const h=l.data,o=s.data;let V,W,Q,m;if(l.kind===ph.GRAYSCALE_1BPP){const R=h.byteLength,r=new Uint32Array(o.buffer,0,o.byteLength>>2),b=r.length,u=d+7>>3,J=4294967295,G=te.isLittleEndian?4278190080:255;for(V=0;V<i;V++){for(Q=V<a?Fe:n,F=0,W=0;W<Q;W++){const T=R-c;let y=0;const k=T>u?d:T*8-7,X=k&-8;let L=0,D=0;for(;y<X;y+=8)D=h[c++],r[F++]=D&128?J:G,r[F++]=D&64?J:G,r[F++]=D&32?J:G,r[F++]=D&16?J:G,r[F++]=D&8?J:G,r[F++]=D&4?J:G,r[F++]=D&2?J:G,r[F++]=D&1?J:G;for(;y<k;y++)L===0&&(D=h[c++],L=128),r[F++]=D&L?J:G,L>>=1}for(;F<b;)r[F++]=0;e.putImageData(s,0,V*Fe)}}else if(l.kind===ph.RGBA_32BPP){for(W=0,m=d*Fe*4,V=0;V<a;V++)o.set(h.subarray(c,c+m)),c+=m,e.putImageData(s,0,W),W+=Fe;V<i&&(m=d*n*4,o.set(h.subarray(c,c+m)),e.putImageData(s,0,W))}else if(l.kind===ph.RGB_24BPP)for(Q=Fe,m=d*Q,V=0;V<i;V++){for(V>=a&&(Q=n,m=d*Q),F=0,W=m;W--;)o[F++]=h[c++],o[F++]=h[c++],o[F++]=h[c++],o[F++]=255;e.putImageData(s,0,V*Fe)}else throw new Error(`bad image kind: ${l.kind}`)}function QS(e,l){if(l.bitmap){e.drawImage(l.bitmap,0,0);return}const t=l.height,d=l.width,n=t%Fe,a=(t-n)/Fe,i=n===0?a:a+1,s=e.createImageData(d,Fe);let c=0;const F=l.data,h=s.data;for(let o=0;o<i;o++){const V=o<a?Fe:n;({srcPos:c}=sI({src:F,srcPos:c,dest:h,width:d,height:V,nonBlackColor:0})),e.putImageData(s,0,o*Fe)}}function xZ(e,l){const t=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const d of t)e[d]!==void 0&&(l[d]=e[d]);e.setLineDash!==void 0&&(l.setLineDash(e.getLineDash()),l.lineDashOffset=e.lineDashOffset)}function mo(e){if(e.strokeStyle=e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",e.setLineDash!==void 0&&(e.setLineDash([]),e.lineDashOffset=0),!Et){const{filter:l}=e;l!=="none"&&l!==""&&(e.filter="none")}}function mS(e,l){if(l)return!0;const t=sl.singularValueDecompose2dScale(e);t[0]=Math.fround(t[0]),t[1]=Math.fround(t[1]);const d=Math.fround((globalThis.devicePixelRatio||1)*Bs.PDF_TO_CSS_UNITS);return t[0]<=d&&t[1]<=d}const hI=["butt","round","square"],oI=["miter","round","bevel"],VI={},RS={};var la,vR,KR,fR;const WI=class Wy{constructor(l,t,d,n,a,{optionalContentConfig:i,markedContentStack:s=null},c,F){M(this,la),this.ctx=l,this.current=new VS(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=d,this.canvasFactory=n,this.filterFactory=a,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=s||[],this.optionalContentConfig=i,this.cachedCanvases=new ZI(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=F,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(l,t=null){return typeof l=="string"?l.startsWith("g_")?this.commonObjs.get(l):this.objs.get(l):t}beginDrawing({transform:l,viewport:t,transparency:d=!1,background:n=null}){const a=this.ctx.canvas.width,i=this.ctx.canvas.height,s=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,a,i),this.ctx.fillStyle=s,d){const c=this.cachedCanvases.getCanvas("transparent",a,i);this.compositeCtx=this.ctx,this.transparentCanvas=c.canvas,this.ctx=c.context,this.ctx.save(),this.ctx.transform(...Ol(this.compositeCtx))}this.ctx.save(),mo(this.ctx),l&&(this.ctx.transform(...l),this.outputScaleX=l[0],this.outputScaleY=l[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=Ol(this.ctx)}executeOperatorList(l,t,d,n){const a=l.argsArray,i=l.fnArray;let s=t||0;const c=a.length;if(c===s)return s;const F=c-s>hS&&typeof d=="function",h=F?Date.now()+cI:0;let o=0;const V=this.commonObjs,W=this.objs;let Q;for(;;){if(n!==void 0&&s===n.nextBreakPoint)return n.breakIt(s,d),s;if(Q=i[s],Q!==ld.dependency)this[Q].apply(this,a[s]);else for(const m of a[s]){const R=m.startsWith("g_")?V:W;if(!R.has(m))return R.get(m,d),s}if(s++,s===c)return s;if(F&&++o>hS){if(Date.now()>h)return d(),s;o=0}}}endDrawing(){p(this,la,vR).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const l of this._cachedBitmapsMap.values()){for(const t of l.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);l.clear()}this._cachedBitmapsMap.clear(),p(this,la,KR).call(this)}_scaleImage(l,t){const d=l.width??l.displayWidth,n=l.height??l.displayHeight;let a=Math.max(Math.hypot(t[0],t[1]),1),i=Math.max(Math.hypot(t[2],t[3]),1),s=d,c=n,F="prescale1",h,o;for(;a>2&&s>1||i>2&&c>1;){let V=s,W=c;a>2&&s>1&&(V=s>=16384?Math.floor(s/2)-1||1:Math.ceil(s/2),a/=s/V),i>2&&c>1&&(W=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,i/=c/W),h=this.cachedCanvases.getCanvas(F,V,W),o=h.context,o.clearRect(0,0,V,W),o.drawImage(l,0,0,s,c,0,0,V,W),l=h.canvas,s=V,c=W,F=F==="prescale1"?"prescale2":"prescale1"}return{img:l,paintWidth:s,paintHeight:c}}_createMaskCanvas(l){const t=this.ctx,{width:d,height:n}=l,a=this.current.fillColor,i=this.current.patternFill,s=Ol(t);let c,F,h,o;if((l.bitmap||l.data)&&l.count>1){const k=l.bitmap||l.data.buffer;F=JSON.stringify(i?s:[s.slice(0,4),a]),c=this._cachedBitmapsMap.get(k),c||(c=new Map,this._cachedBitmapsMap.set(k,c));const X=c.get(F);if(X&&!i){const L=Math.round(Math.min(s[0],s[2])+s[4]),D=Math.round(Math.min(s[1],s[3])+s[5]);return{canvas:X,offsetX:L,offsetY:D}}h=X}h||(o=this.cachedCanvases.getCanvas("maskCanvas",d,n),QS(o.context,l));let V=sl.transform(s,[1/d,0,0,-1/n,0,0]);V=sl.transform(V,[1,0,0,1,0,-n]);const[W,Q,m,R]=sl.getAxialAlignedBoundingBox([0,0,d,n],V),r=Math.round(m-W)||1,b=Math.round(R-Q)||1,u=this.cachedCanvases.getCanvas("fillCanvas",r,b),J=u.context,G=W,T=Q;J.translate(-G,-T),J.transform(...V),h||(h=this._scaleImage(o.canvas,ud(J)),h=h.img,c&&i&&c.set(F,h)),J.imageSmoothingEnabled=mS(Ol(J),l.interpolate),Qo(J,h,0,0,h.width,h.height,0,0,d,n),J.globalCompositeOperation="source-in";const y=sl.transform(ud(J),[1,0,0,1,-G,-T]);return J.fillStyle=i?a.getPattern(t,this,y,vt.FILL):a,J.fillRect(0,0,d,n),c&&!i&&(this.cachedCanvases.delete("fillCanvas"),c.set(F,u.canvas)),{canvas:u.canvas,offsetX:Math.round(G),offsetY:Math.round(T)}}setLineWidth(l){l!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=l,this.ctx.lineWidth=l}setLineCap(l){this.ctx.lineCap=hI[l]}setLineJoin(l){this.ctx.lineJoin=oI[l]}setMiterLimit(l){this.ctx.miterLimit=l}setDash(l,t){const d=this.ctx;d.setLineDash!==void 0&&(d.setLineDash(l),d.lineDashOffset=t)}setRenderingIntent(l){}setFlatness(l){}setGState(l){for(const[t,d]of l)switch(t){case"LW":this.setLineWidth(d);break;case"LC":this.setLineCap(d);break;case"LJ":this.setLineJoin(d);break;case"ML":this.setMiterLimit(d);break;case"D":this.setDash(d[0],d[1]);break;case"RI":this.setRenderingIntent(d);break;case"FL":this.setFlatness(d);break;case"Font":this.setFont(d[0],d[1]);break;case"CA":this.current.strokeAlpha=d;break;case"ca":this.current.fillAlpha=d,this.ctx.globalAlpha=d;break;case"BM":this.ctx.globalCompositeOperation=d;break;case"SMask":this.current.activeSMask=d?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(d);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const l=this.inSMaskMode;this.current.activeSMask&&!l?this.beginSMaskMode():!this.current.activeSMask&&l&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const l=this.ctx.canvas.width,t=this.ctx.canvas.height,d="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(d,l,t);this.suspendedCtx=this.ctx,this.ctx=n.context;const a=this.ctx;a.setTransform(...Ol(this.suspendedCtx)),xZ(this.suspendedCtx,a),UI(a,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),xZ(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(l){if(!this.current.activeSMask)return;l?(l[0]=Math.floor(l[0]),l[1]=Math.floor(l[1]),l[2]=Math.ceil(l[2]),l[3]=Math.ceil(l[3])):l=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,d=this.suspendedCtx;this.composeSMask(d,t,this.ctx,l),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(l,t,d,n){const a=n[0],i=n[1],s=n[2]-a,c=n[3]-i;s===0||c===0||(this.genericComposeSMask(t.context,d,s,c,t.subtype,t.backdrop,t.transferMap,a,i,t.offsetX,t.offsetY),l.save(),l.globalAlpha=1,l.globalCompositeOperation="source-over",l.setTransform(1,0,0,1,0,0),l.drawImage(d.canvas,0,0),l.restore())}genericComposeSMask(l,t,d,n,a,i,s,c,F,h,o){let V=l.canvas,W=c-h,Q=F-o;if(i){const R=sl.makeHexColor(...i);if(W<0||Q<0||W+d>V.width||Q+n>V.height){const r=this.cachedCanvases.getCanvas("maskExtension",d,n),b=r.context;b.drawImage(V,-W,-Q),b.globalCompositeOperation="destination-atop",b.fillStyle=R,b.fillRect(0,0,d,n),b.globalCompositeOperation="source-over",V=r.canvas,W=Q=0}else{l.save(),l.globalAlpha=1,l.setTransform(1,0,0,1,0,0);const r=new Path2D;r.rect(W,Q,d,n),l.clip(r),l.globalCompositeOperation="destination-atop",l.fillStyle=R,l.fillRect(W,Q,d,n),l.restore()}}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),a==="Alpha"&&s?t.filter=this.filterFactory.addAlphaFilter(s):a==="Luminosity"&&(t.filter=this.filterFactory.addLuminosityFilter(s));const m=new Path2D;m.rect(c,F,d,n),t.clip(m),t.globalCompositeOperation="destination-in",t.drawImage(V,W,Q,d,n,c,F,d,n),t.restore()}save(){this.inSMaskMode?(xZ(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const l=this.current;this.stateStack.push(l),this.current=l.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),xZ(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(l,t,d,n,a,i){this.ctx.transform(l,t,d,n,a,i),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(l,t,d){const n=this.ctx,a=this.current;let i=a.x,s=a.y,c,F;const h=Ol(n),o=h[0]===0&&h[3]===0||h[1]===0&&h[2]===0,V=o?d.slice(0):null;for(let W=0,Q=0,m=l.length;W<m;W++)switch(l[W]|0){case ld.rectangle:i=t[Q++],s=t[Q++];const R=t[Q++],r=t[Q++],b=i+R,u=s+r;n.moveTo(i,s),R===0||r===0?n.lineTo(b,u):(n.lineTo(b,s),n.lineTo(b,u),n.lineTo(i,u)),o||a.updateRectMinMax(h,[i,s,b,u]),n.closePath();break;case ld.moveTo:i=t[Q++],s=t[Q++],n.moveTo(i,s),o||a.updatePathMinMax(h,i,s);break;case ld.lineTo:i=t[Q++],s=t[Q++],n.lineTo(i,s),o||a.updatePathMinMax(h,i,s);break;case ld.curveTo:c=i,F=s,i=t[Q+4],s=t[Q+5],n.bezierCurveTo(t[Q],t[Q+1],t[Q+2],t[Q+3],i,s),a.updateCurvePathMinMax(h,c,F,t[Q],t[Q+1],t[Q+2],t[Q+3],i,s,V),Q+=6;break;case ld.curveTo2:c=i,F=s,n.bezierCurveTo(i,s,t[Q],t[Q+1],t[Q+2],t[Q+3]),a.updateCurvePathMinMax(h,c,F,i,s,t[Q],t[Q+1],t[Q+2],t[Q+3],V),i=t[Q+2],s=t[Q+3],Q+=4;break;case ld.curveTo3:c=i,F=s,i=t[Q+2],s=t[Q+3],n.bezierCurveTo(t[Q],t[Q+1],i,s,i,s),a.updateCurvePathMinMax(h,c,F,t[Q],t[Q+1],i,s,i,s,V),Q+=4;break;case ld.closePath:n.closePath();break}o&&a.updateScalingPathMinMax(h,V),a.setCurrentPoint(i,s)}closePath(){this.ctx.closePath()}stroke(l=!0){const t=this.ctx,d=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof d=="object"&&d!=null&&d.getPattern?(t.save(),t.strokeStyle=d.getPattern(t,this,ud(t),vt.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),l&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(l=!0){const t=this.ctx,d=this.current.fillColor,n=this.current.patternFill;let a=!1;n&&(t.save(),t.fillStyle=d.getPattern(t,this,ud(t),vt.FILL),a=!0);const i=this.current.getClippedPathBoundingBox();this.contentVisible&&i!==null&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),a&&t.restore(),l&&this.consumePath(i)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=VI}eoClip(){this.pendingClip=RS}beginText(){this.current.textMatrix=sM,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const l=this.pendingTextPaths,t=this.ctx;if(l===void 0){t.beginPath();return}const d=new Path2D,n=t.getTransform().invertSelf();for(const{transform:a,x:i,y:s,fontSize:c,path:F}of l)d.addPath(F,new DOMMatrix(a).preMultiplySelf(n).translate(i,s).scale(c,-c));t.clip(d),t.beginPath(),delete this.pendingTextPaths}setCharSpacing(l){this.current.charSpacing=l}setWordSpacing(l){this.current.wordSpacing=l}setHScale(l){this.current.textHScale=l/100}setLeading(l){this.current.leading=-l}setFont(l,t){var d;const n=this.commonObjs.get(l),a=this.current;if(!n)throw new Error(`Can't find font for ${l}`);if(a.fontMatrix=n.fontMatrix||tR,(a.fontMatrix[0]===0||a.fontMatrix[3]===0)&&Rl("Invalid font matrix for font "+l),t<0?(t=-t,a.fontDirection=-1):a.fontDirection=1,this.current.font=n,this.current.fontSize=t,n.isType3Font)return;const i=n.loadedName||"sans-serif",s=((d=n.systemFontInfo)==null?void 0:d.css)||`"${i}", ${n.fallbackName}`;let c="normal";n.black?c="900":n.bold&&(c="bold");const F=n.italic?"italic":"normal";let h=t;t<ZS?h=ZS:t>FS&&(h=FS),this.current.fontSizeScale=t/h,this.ctx.font=`${F} ${c} ${h}px ${s}`}setTextRenderingMode(l){this.current.textRenderingMode=l}setTextRise(l){this.current.textRise=l}moveText(l,t){this.current.x=this.current.lineX+=l,this.current.y=this.current.lineY+=t}setLeadingMoveText(l,t){this.setLeading(-t),this.moveText(l,t)}setTextMatrix(l,t,d,n,a,i){this.current.textMatrix=[l,t,d,n,a,i],this.current.textMatrixScale=Math.hypot(l,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(l,t,d,n,a){const i=this.ctx,s=this.current,c=s.font,F=s.textRenderingMode,h=s.fontSize/s.fontSizeScale,o=F&Ct.FILL_STROKE_MASK,V=!!(F&Ct.ADD_TO_PATH_FLAG),W=s.patternFill&&!c.missingFile,Q=s.patternStroke&&!c.missingFile;let m;if((c.disableFontFace||V||W||Q)&&(m=c.getPathGenerator(this.commonObjs,l)),c.disableFontFace||W||Q){if(i.save(),i.translate(t,d),i.scale(h,-h),o===Ct.FILL||o===Ct.FILL_STROKE)if(n){const R=i.getTransform();i.setTransform(...n),i.fill(p(this,la,fR).call(this,m,R,n))}else i.fill(m);if(o===Ct.STROKE||o===Ct.FILL_STROKE)if(a){const R=i.getTransform();i.setTransform(...a),i.stroke(p(this,la,fR).call(this,m,R,a))}else i.lineWidth/=h,i.stroke(m);i.restore()}else(o===Ct.FILL||o===Ct.FILL_STROKE)&&i.fillText(l,t,d),(o===Ct.STROKE||o===Ct.FILL_STROKE)&&i.strokeText(l,t,d);V&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Ol(i),x:t,y:d,fontSize:h,path:m})}get isFontSubpixelAAEnabled(){const{context:l}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);l.scale(1.5,1),l.fillText("I",0,10);const t=l.getImageData(0,0,10,10).data;let d=!1;for(let n=3;n<t.length;n+=4)if(t[n]>0&&t[n]<255){d=!0;break}return rl(this,"isFontSubpixelAAEnabled",d)}showText(l){const t=this.current,d=t.font;if(d.isType3Font)return this.showType3Text(l);const n=t.fontSize;if(n===0)return;const a=this.ctx,i=t.fontSizeScale,s=t.charSpacing,c=t.wordSpacing,F=t.fontDirection,h=t.textHScale*F,o=l.length,V=d.vertical,W=V?1:-1,Q=d.defaultVMetrics,m=n*t.fontMatrix[0],R=t.textRenderingMode===Ct.FILL&&!d.disableFontFace&&!t.patternFill;a.save(),a.transform(...t.textMatrix),a.translate(t.x,t.y+t.textRise),F>0?a.scale(h,-1):a.scale(h,1);let r,b;if(t.patternFill){a.save();const y=t.fillColor.getPattern(a,this,ud(a),vt.FILL);r=Ol(a),a.restore(),a.fillStyle=y}if(t.patternStroke){a.save();const y=t.strokeColor.getPattern(a,this,ud(a),vt.STROKE);b=Ol(a),a.restore(),a.strokeStyle=y}let u=t.lineWidth;const J=t.textMatrixScale;if(J===0||u===0){const y=t.textRenderingMode&Ct.FILL_STROKE_MASK;(y===Ct.STROKE||y===Ct.FILL_STROKE)&&(u=this.getSinglePixelWidth())}else u/=J;if(i!==1&&(a.scale(i,i),u/=i),a.lineWidth=u,d.isInvalidPDFjsFont){const y=[];let k=0;for(const X of l)y.push(X.unicode),k+=X.width;a.fillText(y.join(""),0,0),t.x+=k*m*h,a.restore(),this.compose();return}let G=0,T;for(T=0;T<o;++T){const y=l[T];if(typeof y=="number"){G+=W*y*n/1e3;continue}let k=!1;const X=(y.isSpace?c:0)+s,L=y.fontChar,D=y.accent;let C,I,P=y.width;if(V){const Y=y.vmetric||Q,B=-(y.vmetric?Y[1]:P*.5)*m,z=Y[2]*m;P=Y?-Y[0]:P,C=B/i,I=(G+z)/i}else C=G/i,I=0;if(d.remeasure&&P>0){const Y=a.measureText(L).width*1e3/n*i;if(P<Y&&this.isFontSubpixelAAEnabled){const B=P/Y;k=!0,a.save(),a.scale(B,1),C/=B}else P!==Y&&(C+=(P-Y)/2e3*n/i)}if(this.contentVisible&&(y.isInFont||d.missingFile)){if(R&&!D)a.fillText(L,C,I);else if(this.paintChar(L,C,I,r,b),D){const Y=C+n*D.offset.x/i,B=I-n*D.offset.y/i;this.paintChar(D.fontChar,Y,B,r,b)}}const H=V?P*m-X*F:P*m+X*F;G+=H,k&&a.restore()}V?t.y-=G:t.x+=G*h,a.restore(),this.compose()}showType3Text(l){const t=this.ctx,d=this.current,n=d.font,a=d.fontSize,i=d.fontDirection,s=n.vertical?1:-1,c=d.charSpacing,F=d.wordSpacing,h=d.textHScale*i,o=d.fontMatrix||tR,V=l.length,W=d.textRenderingMode===Ct.INVISIBLE;let Q,m,R,r;if(!(W||a===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...d.textMatrix),t.translate(d.x,d.y),t.scale(h,i),Q=0;Q<V;++Q){if(m=l[Q],typeof m=="number"){r=s*m*a/1e3,this.ctx.translate(r,0),d.x+=r*h;continue}const b=(m.isSpace?F:0)+c,u=n.charProcOperatorList[m.operatorListId];if(!u){Rl(`Type3 character "${m.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=m,this.save(),t.scale(a,a),t.transform(...o),this.executeOperatorList(u),this.restore()),R=sl.applyTransform([m.width,0],o)[0]*a+b,t.translate(R,0),d.x+=R*h}t.restore(),this.processingType3=null}}setCharWidth(l,t){}setCharWidthAndBounds(l,t,d,n,a,i){this.ctx.rect(d,n,a-d,i-n),this.ctx.clip(),this.endPath()}getColorN_Pattern(l){let t;if(l[0]==="TilingPattern"){const d=l[1],n=this.baseTransform||Ol(this.ctx),a={createCanvasGraphics:i=>new Wy(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new iI(l,d,this.ctx,a,n)}else t=this._getPattern(l[1],l[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(l,t,d){this.ctx.strokeStyle=this.current.strokeColor=sl.makeHexColor(l,t,d),this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(l,t,d){this.ctx.fillStyle=this.current.fillColor=sl.makeHexColor(l,t,d),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(l,t=null){let d;return this.cachedPatterns.has(l)?d=this.cachedPatterns.get(l):(d=aI(this.getObject(l)),this.cachedPatterns.set(l,d)),t&&(d.matrix=t),d}shadingFill(l){if(!this.contentVisible)return;const t=this.ctx;this.save();const d=this._getPattern(l);t.fillStyle=d.getPattern(t,this,ud(t),vt.SHADING);const n=ud(t);if(n){const{width:a,height:i}=t.canvas,[s,c,F,h]=sl.getAxialAlignedBoundingBox([0,0,a,i],n);this.ctx.fillRect(s,c,F-s,h-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Cl("Should not call beginInlineImage")}beginImageData(){Cl("Should not call beginImageData")}paintFormXObjectBegin(l,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),l&&this.transform(...l),this.baseTransform=Ol(this.ctx),t)){const d=t[2]-t[0],n=t[3]-t[1];this.ctx.rect(t[0],t[1],d,n),this.current.updateRectMinMax(Ol(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(l){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;l.isolated||Jh("TODO: Support non-isolated groups."),l.knockout&&Rl("Knockout groups not supported.");const d=Ol(t);if(l.matrix&&t.transform(...l.matrix),!l.bbox)throw new Error("Bounding box is required.");let n=sl.getAxialAlignedBoundingBox(l.bbox,Ol(t));const a=[0,0,t.canvas.width,t.canvas.height];n=sl.intersect(n,a)||[0,0,0,0];const i=Math.floor(n[0]),s=Math.floor(n[1]),c=Math.max(Math.ceil(n[2])-i,1),F=Math.max(Math.ceil(n[3])-s,1);this.current.startNewPathAndClipBox([0,0,c,F]);let h="groupAt"+this.groupLevel;l.smask&&(h+="_smask_"+this.smaskCounter++%2);const o=this.cachedCanvases.getCanvas(h,c,F),V=o.context;V.translate(-i,-s),V.transform(...d),l.smask?this.smaskStack.push({canvas:o.canvas,context:V,offsetX:i,offsetY:s,subtype:l.smask.subtype,backdrop:l.smask.backdrop,transferMap:l.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(i,s),t.save()),xZ(t,V),this.ctx=V,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(l){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,d=this.groupStack.pop();if(this.ctx=d,this.ctx.imageSmoothingEnabled=!1,l.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const n=Ol(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...n);const a=sl.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],n);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(a)}}beginAnnotation(l,t,d,n,a){if(p(this,la,vR).call(this),mo(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const i=t[2]-t[0],s=t[3]-t[1];if(a&&this.annotationCanvasMap){d=d.slice(),d[4]-=t[0],d[5]-=t[1],t=t.slice(),t[0]=t[1]=0,t[2]=i,t[3]=s;const[c,F]=sl.singularValueDecompose2dScale(Ol(this.ctx)),{viewportScale:h}=this,o=Math.ceil(i*this.outputScaleX*h),V=Math.ceil(s*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(o,V);const{canvas:W,context:Q}=this.annotationCanvas;this.annotationCanvasMap.set(l,W),this.annotationCanvas.savedCtx=this.ctx,this.ctx=Q,this.ctx.save(),this.ctx.setTransform(c,0,0,-F,0,s*F),mo(this.ctx)}else mo(this.ctx),this.endPath(),this.ctx.rect(t[0],t[1],i,s),this.ctx.clip(),this.ctx.beginPath()}this.current=new VS(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...d),this.transform(...n)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),p(this,la,KR).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(l){if(!this.contentVisible)return;const t=l.count;l=this.getObject(l.data,l),l.count=t;const d=this.ctx,n=this.processingType3;if(n&&(n.compiled===void 0&&(n.compiled=FI(l)),n.compiled)){n.compiled(d);return}const a=this._createMaskCanvas(l),i=a.canvas;d.save(),d.setTransform(1,0,0,1,0,0),d.drawImage(i,a.offsetX,a.offsetY),d.restore(),this.compose()}paintImageMaskXObjectRepeat(l,t,d=0,n=0,a,i){if(!this.contentVisible)return;l=this.getObject(l.data,l);const s=this.ctx;s.save();const c=Ol(s);s.transform(t,d,n,a,0,0);const F=this._createMaskCanvas(l);s.setTransform(1,0,0,1,F.offsetX-c[4],F.offsetY-c[5]);for(let h=0,o=i.length;h<o;h+=2){const V=sl.transform(c,[t,d,n,a,i[h],i[h+1]]),[W,Q]=sl.applyTransform([0,0],V);s.drawImage(F.canvas,W,Q)}s.restore(),this.compose()}paintImageMaskXObjectGroup(l){if(!this.contentVisible)return;const t=this.ctx,d=this.current.fillColor,n=this.current.patternFill;for(const a of l){const{data:i,width:s,height:c,transform:F}=a,h=this.cachedCanvases.getCanvas("maskCanvas",s,c),o=h.context;o.save();const V=this.getObject(i,a);QS(o,V),o.globalCompositeOperation="source-in",o.fillStyle=n?d.getPattern(o,this,ud(t),vt.FILL):d,o.fillRect(0,0,s,c),o.restore(),t.save(),t.transform(...F),t.scale(1,-1),Qo(t,h.canvas,0,0,s,c,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(l){if(!this.contentVisible)return;const t=this.getObject(l);if(!t){Rl("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t)}paintImageXObjectRepeat(l,t,d,n){if(!this.contentVisible)return;const a=this.getObject(l);if(!a){Rl("Dependent image isn't ready yet");return}const i=a.width,s=a.height,c=[];for(let F=0,h=n.length;F<h;F+=2)c.push({transform:[t,0,0,d,n[F],n[F+1]],x:0,y:0,w:i,h:s});this.paintInlineImageXObjectGroup(a,c)}applyTransferMapsToCanvas(l){return this.current.transferMaps!=="none"&&(l.filter=this.current.transferMaps,l.drawImage(l.canvas,0,0),l.filter="none"),l.canvas}applyTransferMapsToBitmap(l){if(this.current.transferMaps==="none")return l.bitmap;const{bitmap:t,width:d,height:n}=l,a=this.cachedCanvases.getCanvas("inlineImage",d,n),i=a.context;return i.filter=this.current.transferMaps,i.drawImage(t,0,0),i.filter="none",a.canvas}paintInlineImageXObject(l){if(!this.contentVisible)return;const t=l.width,d=l.height,n=this.ctx;if(this.save(),!Et){const{filter:s}=n;s!=="none"&&s!==""&&(n.filter="none")}n.scale(1/t,-1/d);let a;if(l.bitmap)a=this.applyTransferMapsToBitmap(l);else if(typeof HTMLElement=="function"&&l instanceof HTMLElement||!l.data)a=l;else{const s=this.cachedCanvases.getCanvas("inlineImage",t,d).context;WS(s,l),a=this.applyTransferMapsToCanvas(s)}const i=this._scaleImage(a,ud(n));n.imageSmoothingEnabled=mS(Ol(n),l.interpolate),Qo(n,i.img,0,0,i.paintWidth,i.paintHeight,0,-d,t,d),this.compose(),this.restore()}paintInlineImageXObjectGroup(l,t){if(!this.contentVisible)return;const d=this.ctx;let n;if(l.bitmap)n=l.bitmap;else{const a=l.width,i=l.height,s=this.cachedCanvases.getCanvas("inlineImage",a,i).context;WS(s,l),n=this.applyTransferMapsToCanvas(s)}for(const a of t)d.save(),d.transform(...a.transform),d.scale(1,-1),Qo(d,n,a.x,a.y,a.w,a.h,0,-1,1,1),d.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(l){}markPointProps(l,t){}beginMarkedContent(l){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(l,t){l==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(l){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(l);const d=this.ctx;this.pendingClip&&(t||(this.pendingClip===RS?d.clip("evenodd"):d.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),d.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const l=Ol(this.ctx);if(l[1]===0&&l[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(l[0]),Math.abs(l[3]));else{const t=Math.abs(l[0]*l[3]-l[2]*l[1]),d=Math.hypot(l[0],l[2]),n=Math.hypot(l[1],l[3]);this._cachedGetSinglePixelWidth=Math.max(d,n)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:l}=this.current,{a:t,b:d,c:n,d:a}=this.ctx.getTransform();let i,s;if(d===0&&n===0){const c=Math.abs(t),F=Math.abs(a);if(c===F)if(l===0)i=s=1/c;else{const h=c*l;i=s=h<1?1/h:1}else if(l===0)i=1/c,s=1/F;else{const h=c*l,o=F*l;i=h<1?1/h:1,s=o<1?1/o:1}}else{const c=Math.abs(t*a-d*n),F=Math.hypot(t,d),h=Math.hypot(n,a);if(l===0)i=h/c,s=F/c;else{const o=l*c;i=h>o?h/o:1,s=F>o?F/o:1}}this._cachedScaleForStroking[0]=i,this._cachedScaleForStroking[1]=s}return this._cachedScaleForStroking}rescaleAndStroke(l){const{ctx:t}=this,{lineWidth:d}=this.current,[n,a]=this.getScaleForStroking();if(t.lineWidth=d||1,n===1&&a===1){t.stroke();return}const i=t.getLineDash();if(l&&t.save(),t.scale(n,a),i.length>0){const s=Math.max(n,a);t.setLineDash(i.map(c=>c/s)),t.lineDashOffset/=s}t.stroke(),l&&t.restore()}isContentVisible(){for(let l=this.markedContentStack.length-1;l>=0;l--)if(!this.markedContentStack[l].visible)return!1;return!0}};la=new WeakSet,vR=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)},KR=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const l=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=l}}},fR=function(e,l,t){const d=new Path2D;return d.addPath(e,new DOMMatrix(t).invertSelf().multiplySelf(l)),d};let Ro=WI;for(const e in ld)Ro.prototype[e]!==void 0&&(Ro.prototype[ld[e]]=Ro.prototype[e]);var No,bo,uo;let ac=(No=class{static get workerPort(){return U(this,bo)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");N(this,bo,e)}static get workerSrc(){return U(this,uo)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");N(this,uo,e)}},bo=new WeakMap,uo=new WeakMap,M(No,bo,null),M(No,uo,""),No);var ic,ro;class QI{constructor({parsedData:l,rawData:t}){M(this,ic),M(this,ro),N(this,ic,l),N(this,ro,t)}getRaw(){return U(this,ro)}get(l){return U(this,ic).get(l)??null}getAll(){return aR(U(this,ic))}has(l){return U(this,ic).has(l)}}ic=new WeakMap,ro=new WeakMap;const sc=Symbol("INTERNAL");var po,Mo,So,gZ;class mI{constructor(l,{name:t,intent:d,usage:n,rbGroups:a}){M(this,po,!1),M(this,Mo,!1),M(this,So,!1),M(this,gZ,!0),N(this,po,!!(l&be.DISPLAY)),N(this,Mo,!!(l&be.PRINT)),this.name=t,this.intent=d,this.usage=n,this.rbGroups=a}get visible(){if(U(this,So))return U(this,gZ);if(!U(this,gZ))return!1;const{print:l,view:t}=this.usage;return U(this,po)?(t==null?void 0:t.viewState)!=="OFF":U(this,Mo)?(l==null?void 0:l.printState)!=="OFF":!0}_setVisible(l,t,d=!1){l!==sc&&Cl("Internal method `_setVisible` called."),N(this,So,d),N(this,gZ,t)}}po=new WeakMap,Mo=new WeakMap,So=new WeakMap,gZ=new WeakMap;var Zi,wl,jZ,OZ,Jo,HR;class RI{constructor(l,t=be.DISPLAY){if(M(this,Jo),M(this,Zi,null),M(this,wl,new Map),M(this,jZ,null),M(this,OZ,null),this.renderingIntent=t,this.name=null,this.creator=null,l!==null){this.name=l.name,this.creator=l.creator,N(this,OZ,l.order);for(const d of l.groups)U(this,wl).set(d.id,new mI(t,d));if(l.baseState==="OFF")for(const d of U(this,wl).values())d._setVisible(sc,!1);for(const d of l.on)U(this,wl).get(d)._setVisible(sc,!0);for(const d of l.off)U(this,wl).get(d)._setVisible(sc,!1);N(this,jZ,this.getHash())}}isVisible(l){if(U(this,wl).size===0)return!0;if(!l)return Jh("Optional content group not defined."),!0;if(l.type==="OCG")return U(this,wl).has(l.id)?U(this,wl).get(l.id).visible:(Rl(`Optional content group not found: ${l.id}`),!0);if(l.type==="OCMD"){if(l.expression)return p(this,Jo,HR).call(this,l.expression);if(!l.policy||l.policy==="AnyOn"){for(const t of l.ids){if(!U(this,wl).has(t))return Rl(`Optional content group not found: ${t}`),!0;if(U(this,wl).get(t).visible)return!0}return!1}else if(l.policy==="AllOn"){for(const t of l.ids){if(!U(this,wl).has(t))return Rl(`Optional content group not found: ${t}`),!0;if(!U(this,wl).get(t).visible)return!1}return!0}else if(l.policy==="AnyOff"){for(const t of l.ids){if(!U(this,wl).has(t))return Rl(`Optional content group not found: ${t}`),!0;if(!U(this,wl).get(t).visible)return!0}return!1}else if(l.policy==="AllOff"){for(const t of l.ids){if(!U(this,wl).has(t))return Rl(`Optional content group not found: ${t}`),!0;if(U(this,wl).get(t).visible)return!1}return!0}return Rl(`Unknown optional content policy ${l.policy}.`),!0}return Rl(`Unknown group type ${l.type}.`),!0}setVisibility(l,t=!0,d=!0){var n;const a=U(this,wl).get(l);if(!a){Rl(`Optional content group not found: ${l}`);return}if(d&&t&&a.rbGroups.length)for(const i of a.rbGroups)for(const s of i)s!==l&&((n=U(this,wl).get(s))==null||n._setVisible(sc,!1,!0));a._setVisible(sc,!!t,!0),N(this,Zi,null)}setOCGState({state:l,preserveRB:t}){let d;for(const n of l){switch(n){case"ON":case"OFF":case"Toggle":d=n;continue}const a=U(this,wl).get(n);if(a)switch(d){case"ON":this.setVisibility(n,!0,t);break;case"OFF":this.setVisibility(n,!1,t);break;case"Toggle":this.setVisibility(n,!a.visible,t);break}}N(this,Zi,null)}get hasInitialVisibility(){return U(this,jZ)===null||this.getHash()===U(this,jZ)}getOrder(){return U(this,wl).size?U(this,OZ)?U(this,OZ).slice():[...U(this,wl).keys()]:null}getGroups(){return U(this,wl).size>0?aR(U(this,wl)):null}getGroup(l){return U(this,wl).get(l)||null}getHash(){if(U(this,Zi)!==null)return U(this,Zi);const l=new fM;for(const[t,d]of U(this,wl))l.update(`${t}:${d.visible}`);return N(this,Zi,l.hexdigest())}}Zi=new WeakMap,wl=new WeakMap,jZ=new WeakMap,OZ=new WeakMap,Jo=new WeakSet,HR=function(e){const l=e.length;if(l<2)return!0;const t=e[0];for(let d=1;d<l;d++){const n=e[d];let a;if(Array.isArray(n))a=p(this,Jo,HR).call(this,n);else if(U(this,wl).has(n))a=U(this,wl).get(n).visible;else return Rl(`Optional content group not found: ${n}`),!0;switch(t){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return t==="And"};class NI{constructor(l,{disableRange:t=!1,disableStream:d=!1}){st(l,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:a,progressiveDone:i,contentDispositionFilename:s}=l;if(this._queuedChunks=[],this._progressiveDone=i,this._contentDispositionFilename=s,(a==null?void 0:a.length)>0){const c=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=l,this._isStreamingSupported=!d,this._isRangeSupported=!t,this._contentLength=n,this._fullRequestReader=null,this._rangeReaders=[],l.addRangeListener((c,F)=>{this._onReceiveData({begin:c,chunk:F})}),l.addProgressListener((c,F)=>{this._onProgress({loaded:c,total:F})}),l.addProgressiveReadListener(c=>{this._onReceiveData({chunk:c})}),l.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),l.transportReady()}_onReceiveData({begin:l,chunk:t}){const d=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(l===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(d):this._queuedChunks.push(d);else{const n=this._rangeReaders.some(function(a){return a._begin!==l?!1:(a._enqueue(d),!0)});st(n,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var l;return((l=this._fullRequestReader)==null?void 0:l._loaded)??0}_onProgress(l){var t,d,n,a;l.total===void 0?(d=(t=this._rangeReaders[0])==null?void 0:t.onProgress)==null||d.call(t,{loaded:l.loaded}):(a=(n=this._fullRequestReader)==null?void 0:n.onProgress)==null||a.call(n,{loaded:l.loaded,total:l.total})}_onProgressiveDone(){var l;(l=this._fullRequestReader)==null||l.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(l){const t=this._rangeReaders.indexOf(l);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){st(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const l=this._queuedChunks;return this._queuedChunks=null,new bI(this,l,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(l,t){if(t<=this._progressiveDataLength)return null;const d=new uI(this,l,t);return this._pdfDataRangeTransport.requestDataRange(l,t),this._rangeReaders.push(d),d}cancelAllRequests(l){var t;(t=this._fullRequestReader)==null||t.cancel(l);for(const d of this._rangeReaders.slice(0))d.cancel(l);this._pdfDataRangeTransport.abort()}}class bI{constructor(l,t,d=!1,n=null){this._stream=l,this._done=d||!1,this._filename=hR(n)?n:null,this._queuedChunks=t||[],this._loaded=0;for(const a of this._queuedChunks)this._loaded+=a.byteLength;this._requests=[],this._headersReady=Promise.resolve(),l._fullRequestReader=this,this.onProgress=null}_enqueue(l){this._done||(this._requests.length>0?this._requests.shift().resolve({value:l,done:!1}):this._queuedChunks.push(l),this._loaded+=l.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const l=Promise.withResolvers();return this._requests.push(l),l.promise}cancel(l){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class uI{constructor(l,t,d){this._stream=l,this._begin=t,this._end=d,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(l){if(!this._done){if(this._requests.length===0)this._queuedChunk=l;else{this._requests.shift().resolve({value:l,done:!1});for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const l=Promise.withResolvers();return this._requests.push(l),l.promise}cancel(l){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function rI(e){let l=!0,t=d("filename\\*","i").exec(e);if(t){t=t[1];let h=s(t);return h=unescape(h),h=c(h),h=F(h),a(h)}if(t=i(e),t){const h=F(t);return a(h)}if(t=d("filename","i").exec(e),t){t=t[1];let h=s(t);return h=F(h),a(h)}function d(h,o){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',o)}function n(h,o){if(h){if(!/^[\x00-\xFF]+$/.test(o))return o;try{const V=new TextDecoder(h,{fatal:!0}),W=Gh(o);o=V.decode(W),l=!1}catch{}}return o}function a(h){return l&&/[\x80-\xff]/.test(h)&&(h=n("utf-8",h),l&&(h=n("iso-8859-1",h))),h}function i(h){const o=[];let V;const W=d("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(V=W.exec(h))!==null;){let[,m,R,r]=V;if(m=parseInt(m,10),m in o){if(m===0)break;continue}o[m]=[R,r]}const Q=[];for(let m=0;m<o.length&&m in o;++m){let[R,r]=o[m];r=s(r),R&&(r=unescape(r),m===0&&(r=c(r))),Q.push(r)}return Q.join("")}function s(h){if(h.startsWith('"')){const o=h.slice(1).split('\\"');for(let V=0;V<o.length;++V){const W=o[V].indexOf('"');W!==-1&&(o[V]=o[V].slice(0,W),o.length=V+1),o[V]=o[V].replaceAll(/\\(.)/g,"$1")}h=o.join('"')}return h}function c(h){const o=h.indexOf("'");if(o===-1)return h;const V=h.slice(0,o),W=h.slice(o+1).replace(/^[^']*'/,"");return n(V,W)}function F(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(o,V,W,Q){if(W==="q"||W==="Q")return Q=Q.replaceAll("_"," "),Q=Q.replaceAll(/=([0-9a-fA-F]{2})/g,function(m,R){return String.fromCharCode(parseInt(R,16))}),n(V,Q);try{Q=atob(Q)}catch{}return n(V,Q)})}return""}function NS(e,l){const t=new Headers;if(!e||!l||typeof l!="object")return t;for(const d in l){const n=l[d];n!==void 0&&t.append(d,n)}return t}function To(e){try{return new URL(e).origin}catch{}return null}function bS({responseHeaders:e,isHttp:l,rangeChunkSize:t,disableRange:d}){const n={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(e.get("Content-Length"),10);return!Number.isInteger(a)||(n.suggestedLength=a,a<=2*t)||d||!l||e.get("Accept-Ranges")!=="bytes"||(e.get("Content-Encoding")||"identity")!=="identity"||(n.allowRangeRequests=!0),n}function uS(e){const l=e.get("Content-Disposition");if(l){let t=rI(l);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(hR(t))return t}return null}function Go(e,l){return e===404||e===0&&l.startsWith("file:")?new cZ('Missing PDF "'+l+'".'):new Th(`Unexpected server response (${e}) while retrieving PDF "${l}".`,e)}function rS(e){return e===200||e===206}function pS(e,l,t){return{method:"GET",headers:e,signal:t.signal,mode:"cors",credentials:l?"include":"same-origin",redirect:"follow"}}function MS(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:(Rl(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class SS{constructor(l){hl(this,"_responseOrigin",null),this.source=l,this.isHttp=/^https?:/i.test(l.url),this.headers=NS(this.isHttp,l.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var l;return((l=this._fullRequestReader)==null?void 0:l._loaded)??0}getFullReader(){return st(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new pI(this),this._fullRequestReader}getRangeReader(l,t){if(t<=this._progressiveDataLength)return null;const d=new MI(this,l,t);return this._rangeRequestReaders.push(d),d}cancelAllRequests(l){var t;(t=this._fullRequestReader)==null||t.cancel(l);for(const d of this._rangeRequestReaders.slice(0))d.cancel(l)}}class pI{constructor(l){this._stream=l,this._reader=null,this._loaded=0,this._filename=null;const t=l.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange;const d=new Headers(l.headers),n=t.url;fetch(n,pS(d,this._withCredentials,this._abortController)).then(a=>{if(l._responseOrigin=To(a.url),!rS(a.status))throw Go(a.status,n);this._reader=a.body.getReader(),this._headersCapability.resolve();const i=a.headers,{allowRangeRequests:s,suggestedLength:c}=bS({responseHeaders:i,isHttp:l.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=c||this._contentLength,this._filename=uS(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new gn("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var l;await this._headersCapability.promise;const{value:t,done:d}=await this._reader.read();return d?{value:t,done:d}:(this._loaded+=t.byteLength,(l=this.onProgress)==null||l.call(this,{loaded:this._loaded,total:this._contentLength}),{value:MS(t),done:!1})}cancel(l){var t;(t=this._reader)==null||t.cancel(l),this._abortController.abort()}}class MI{constructor(l,t,d){this._stream=l,this._reader=null,this._loaded=0;const n=l.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const a=new Headers(l.headers);a.append("Range",`bytes=${t}-${d-1}`);const i=n.url;fetch(i,pS(a,this._withCredentials,this._abortController)).then(s=>{const c=To(s.url);if(c!==l._responseOrigin)throw new Error(`Expected range response-origin "${c}" to match "${l._responseOrigin}".`);if(!rS(s.status))throw Go(s.status,i);this._readCapability.resolve(),this._reader=s.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var l;await this._readCapability.promise;const{value:t,done:d}=await this._reader.read();return d?{value:t,done:d}:(this._loaded+=t.byteLength,(l=this.onProgress)==null||l.call(this,{loaded:this._loaded}),{value:MS(t),done:!1})}cancel(l){var t;(t=this._reader)==null||t.cancel(l),this._abortController.abort()}}const PR=200,AR=206;function SI(e){const l=e.response;return typeof l!="string"?l:Gh(l).buffer}class JI{constructor({url:l,httpHeaders:t,withCredentials:d}){hl(this,"_responseOrigin",null),this.url=l,this.isHttp=/^https?:/i.test(l),this.headers=NS(this.isHttp,t),this.withCredentials=d||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(l){const t=new XMLHttpRequest,d=this.currXhrId++,n=this.pendingRequests[d]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const[a,i]of this.headers)t.setRequestHeader(a,i);return this.isHttp&&"begin"in l&&"end"in l?(t.setRequestHeader("Range",`bytes=${l.begin}-${l.end-1}`),n.expectedStatus=AR):n.expectedStatus=PR,t.responseType="arraybuffer",st(l.onError,"Expected `onError` callback to be provided."),t.onerror=()=>{l.onError(t.status)},t.onreadystatechange=this.onStateChange.bind(this,d),t.onprogress=this.onProgress.bind(this,d),n.onHeadersReceived=l.onHeadersReceived,n.onDone=l.onDone,n.onError=l.onError,n.onProgress=l.onProgress,t.send(null),d}onProgress(l,t){var d;const n=this.pendingRequests[l];n&&((d=n.onProgress)==null||d.call(n,t))}onStateChange(l,t){const d=this.pendingRequests[l];if(!d)return;const n=d.xhr;if(n.readyState>=2&&d.onHeadersReceived&&(d.onHeadersReceived(),delete d.onHeadersReceived),n.readyState!==4||!(l in this.pendingRequests))return;if(delete this.pendingRequests[l],n.status===0&&this.isHttp){d.onError(n.status);return}const a=n.status||PR;if(!(a===PR&&d.expectedStatus===AR)&&a!==d.expectedStatus){d.onError(n.status);return}const i=SI(n);if(a===AR){const s=n.getResponseHeader("Content-Range"),c=/bytes (\d+)-(\d+)\/(\d+)/.exec(s);c?d.onDone({begin:parseInt(c[1],10),chunk:i}):(Rl('Missing or invalid "Content-Range" header.'),d.onError(0))}else i?d.onDone({begin:0,chunk:i}):d.onError(n.status)}getRequestXhr(l){return this.pendingRequests[l].xhr}isPendingRequest(l){return l in this.pendingRequests}abortRequest(l){const t=this.pendingRequests[l].xhr;delete this.pendingRequests[l],t.abort()}}class TI{constructor(l){this._source=l,this._manager=new JI(l),this._rangeChunkSize=l.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(l){const t=this._rangeRequestReaders.indexOf(l);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return st(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new GI(this._manager,this._source),this._fullRequestReader}getRangeReader(l,t){const d=new XI(this._manager,l,t);return d.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(d),d}cancelAllRequests(l){var t;(t=this._fullRequestReader)==null||t.cancel(l);for(const d of this._rangeRequestReaders.slice(0))d.cancel(l)}}class GI{constructor(l,t){this._manager=l,this._url=t.url,this._fullRequestId=l.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const l=this._fullRequestId,t=this._manager.getRequestXhr(l);this._manager._responseOrigin=To(t.responseURL);const d=t.getAllResponseHeaders(),n=new Headers(d?d.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(s=>{const[c,...F]=s.split(": ");return[c,F.join(": ")]}):[]),{allowRangeRequests:a,suggestedLength:i}=bS({responseHeaders:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=i||this._contentLength,this._filename=uS(n),this._isRangeSupported&&this._manager.abortRequest(l),this._headersCapability.resolve()}_onDone(l){if(l&&(this._requests.length>0?this._requests.shift().resolve({value:l.chunk,done:!1}):this._cachedChunks.push(l.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(l){this._storedError=Go(l,this._url),this._headersCapability.reject(this._storedError);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(l){var t;(t=this.onProgress)==null||t.call(this,{loaded:l.loaded,total:l.lengthComputable?l.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const l=Promise.withResolvers();return this._requests.push(l),l.promise}cancel(l){this._done=!0,this._headersCapability.reject(l);for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class XI{constructor(l,t,d){this._manager=l,this._url=l.url,this._requestId=l.request({begin:t,end:d,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var l;const t=To((l=this._manager.getRequestXhr(this._requestId))==null?void 0:l.responseURL);t!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${t}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var l;(l=this.onClosed)==null||l.call(this,this)}_onDone(l){const t=l.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const d of this._requests)d.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(l){this._storedError??(this._storedError=Go(l,this._url));for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(l){var t;this.isStreamingSupported||(t=this.onProgress)==null||t.call(this,{loaded:l.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const l=Promise.withResolvers();return this._requests.push(l),l.promise}cancel(l){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const yI=/^[a-z][a-z0-9\-+.]+:/i;function BI(e){if(yI.test(e))return new URL(e);const l=process.getBuiltinModule("url");return new URL(l.pathToFileURL(e))}class YI{constructor(l){this.source=l,this.url=BI(l.url),st(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var l;return((l=this._fullRequestReader)==null?void 0:l._loaded)??0}getFullReader(){return st(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new kI(this),this._fullRequestReader}getRangeReader(l,t){if(t<=this._progressiveDataLength)return null;const d=new zI(this,l,t);return this._rangeRequestReaders.push(d),d}cancelAllRequests(l){var t;(t=this._fullRequestReader)==null||t.cancel(l);for(const d of this._rangeRequestReaders.slice(0))d.cancel(l)}}class kI{constructor(l){this._url=l.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=l.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const d=process.getBuiltinModule("fs");d.promises.lstat(this._url).then(n=>{this._contentLength=n.size,this._setReadableStream(d.createReadStream(this._url)),this._headersCapability.resolve()},n=>{n.code==="ENOENT"&&(n=new cZ(`Missing PDF "${this._url}".`)),this._storedError=n,this._headersCapability.reject(n)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var l;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(l=this.onProgress)==null||l.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(l){if(!this._readableStream){this._error(l);return}this._readableStream.destroy(l)}_error(l){this._storedError=l,this._readCapability.resolve()}_setReadableStream(l){this._readableStream=l,l.on("readable",()=>{this._readCapability.resolve()}),l.on("end",()=>{l.destroy(),this._done=!0,this._readCapability.resolve()}),l.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new gn("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class zI{constructor(l,t,d){this._url=l.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const n=l.source;this._isStreamingSupported=!n.disableStream;const a=process.getBuiltinModule("fs");this._setReadableStream(a.createReadStream(this._url,{start:t,end:d-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var l;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(l=this.onProgress)==null||l.call(this,{loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(l){if(!this._readableStream){this._error(l);return}this._readableStream.destroy(l)}_error(l){this._storedError=l,this._readCapability.resolve()}_setReadableStream(l){this._readableStream=l,l.on("readable",()=>{this._readCapability.resolve()}),l.on("end",()=>{l.destroy(),this._done=!0,this._readCapability.resolve()}),l.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const LI=1e5,he=30,II=.8;var JS,Fi,pe,Xo,yo,hi,ta,Bo,Yo,cc,vZ,KZ,oi,fZ,ko,HZ,Uc,zo,Lo,Vt,Zc,Fc,Io,Vi,PZ,hc,TS,GS,_R,cn,Do,qR,XS,yS;let $R=(Vt=class{constructor({textContentSource:e,container:l,viewport:t}){M(this,hc),M(this,Fi,Promise.withResolvers()),M(this,pe,null),M(this,Xo,!1),M(this,yo,!!((JS=globalThis.FontInspector)!=null&&JS.enabled)),M(this,hi,null),M(this,ta,null),M(this,Bo,0),M(this,Yo,0),M(this,cc,null),M(this,vZ,null),M(this,KZ,0),M(this,oi,0),M(this,fZ,Object.create(null)),M(this,ko,[]),M(this,HZ,null),M(this,Uc,[]),M(this,zo,new WeakMap),M(this,Lo,null);var d;if(e instanceof ReadableStream)N(this,HZ,e);else if(typeof e=="object")N(this,HZ,new ReadableStream({start(c){c.enqueue(e),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');N(this,pe,N(this,vZ,l)),N(this,oi,t.scale*(globalThis.devicePixelRatio||1)),N(this,KZ,t.rotation),N(this,ta,{div:null,properties:null,ctx:null});const{pageWidth:n,pageHeight:a,pageX:i,pageY:s}=t.rawDims;N(this,Lo,[1,0,0,-1,-i,s+a]),N(this,Yo,n),N(this,Bo,a),p(d=Vt,cn,XS).call(d),Pa(l,t),U(this,Fi).promise.finally(()=>{U(Vt,PZ).delete(this),N(this,ta,null),N(this,fZ,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:l}=te.platform;return rl(this,"fontFamilyMap",new Map([["sans-serif",`${e&&l?"Calibri, ":""}sans-serif`],["monospace",`${e&&l?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{U(this,cc).read().then(({value:l,done:t})=>{if(t){U(this,Fi).resolve();return}U(this,hi)??N(this,hi,l.lang),Object.assign(U(this,fZ),l.styles),p(this,hc,TS).call(this,l.items),e()},U(this,Fi).reject)};return N(this,cc,U(this,HZ).getReader()),U(Vt,PZ).add(this),e(),U(this,Fi).promise}update({viewport:e,onBefore:l=null}){var t;const d=e.scale*(globalThis.devicePixelRatio||1),n=e.rotation;if(n!==U(this,KZ)&&(l==null||l(),N(this,KZ,n),Pa(U(this,vZ),{rotation:n})),d!==U(this,oi)){l==null||l(),N(this,oi,d);const a={div:null,properties:null,ctx:p(t=Vt,cn,Do).call(t,U(this,hi))};for(const i of U(this,Uc))a.properties=U(this,zo).get(i),a.div=i,p(this,hc,_R).call(this,a)}}cancel(){var e;const l=new gn("TextLayer task cancelled.");(e=U(this,cc))==null||e.cancel(l).catch(()=>{}),N(this,cc,null),U(this,Fi).reject(l)}get textDivs(){return U(this,Uc)}get textContentItemsStr(){return U(this,ko)}static cleanup(){if(!(U(this,PZ).size>0)){U(this,Zc).clear();for(const{canvas:e}of U(this,Fc).values())e.remove();U(this,Fc).clear()}}},Fi=new WeakMap,pe=new WeakMap,Xo=new WeakMap,yo=new WeakMap,hi=new WeakMap,ta=new WeakMap,Bo=new WeakMap,Yo=new WeakMap,cc=new WeakMap,vZ=new WeakMap,KZ=new WeakMap,oi=new WeakMap,fZ=new WeakMap,ko=new WeakMap,HZ=new WeakMap,Uc=new WeakMap,zo=new WeakMap,Lo=new WeakMap,Zc=new WeakMap,Fc=new WeakMap,Io=new WeakMap,Vi=new WeakMap,PZ=new WeakMap,hc=new WeakSet,TS=function(e){var l,t;if(U(this,Xo))return;(t=U(this,ta)).ctx??(t.ctx=p(l=Vt,cn,Do).call(l,U(this,hi)));const d=U(this,Uc),n=U(this,ko);for(const a of e){if(d.length>LI){Rl("Ignoring additional textDivs for performance reasons."),N(this,Xo,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const i=U(this,pe);N(this,pe,document.createElement("span")),U(this,pe).classList.add("markedContent"),a.id!==null&&U(this,pe).setAttribute("id",`${a.id}`),i.append(U(this,pe))}else a.type==="endMarkedContent"&&N(this,pe,U(this,pe).parentNode);continue}n.push(a.str),p(this,hc,GS).call(this,a)}},GS=function(e){var l;const t=document.createElement("span"),d={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};U(this,Uc).push(t);const n=sl.transform(U(this,Lo),e.transform);let a=Math.atan2(n[1],n[0]);const i=U(this,fZ)[e.fontName];i.vertical&&(a+=Math.PI/2);let s=U(this,yo)&&i.fontSubstitution||i.fontFamily;s=Vt.fontFamilyMap.get(s)||s;const c=Math.hypot(n[2],n[3]),F=c*p(l=Vt,cn,yS).call(l,s,U(this,hi));let h,o;a===0?(h=n[4],o=n[5]-F):(h=n[4]+F*Math.sin(a),o=n[5]-F*Math.cos(a));const V="calc(var(--scale-factor)*",W=t.style;U(this,pe)===U(this,vZ)?(W.left=`${(100*h/U(this,Yo)).toFixed(2)}%`,W.top=`${(100*o/U(this,Bo)).toFixed(2)}%`):(W.left=`${V}${h.toFixed(2)}px)`,W.top=`${V}${o.toFixed(2)}px)`),W.fontSize=`${V}${(U(Vt,Vi)*c).toFixed(2)}px)`,W.fontFamily=s,d.fontSize=c,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,U(this,yo)&&(t.dataset.fontName=i.fontSubstitutionLoadedName||e.fontName),a!==0&&(d.angle=a*(180/Math.PI));let Q=!1;if(e.str.length>1)Q=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const m=Math.abs(e.transform[0]),R=Math.abs(e.transform[3]);m!==R&&Math.max(m,R)/Math.min(m,R)>1.5&&(Q=!0)}if(Q&&(d.canvasWidth=i.vertical?e.height:e.width),U(this,zo).set(t,d),U(this,ta).div=t,U(this,ta).properties=d,p(this,hc,_R).call(this,U(this,ta)),d.hasText&&U(this,pe).append(t),d.hasEOL){const m=document.createElement("br");m.setAttribute("role","presentation"),U(this,pe).append(m)}},_R=function(e){var l;const{div:t,properties:d,ctx:n}=e,{style:a}=t;let i="";if(U(Vt,Vi)>1&&(i=`scale(${1/U(Vt,Vi)})`),d.canvasWidth!==0&&d.hasText){const{fontFamily:s}=a,{canvasWidth:c,fontSize:F}=d;p(l=Vt,cn,qR).call(l,n,F*U(this,oi),s);const{width:h}=n.measureText(t.textContent);h>0&&(i=`scaleX(${c*U(this,oi)/h}) ${i}`)}d.angle!==0&&(i=`rotate(${d.angle}deg) ${i}`),i.length>0&&(a.transform=i)},cn=new WeakSet,Do=function(e=null){let l=U(this,Fc).get(e||(e=""));if(!l){const t=document.createElement("canvas");t.className="hiddenCanvasElement",t.lang=e,document.body.append(t),l=t.getContext("2d",{alpha:!1,willReadFrequently:!0}),U(this,Fc).set(e,l),U(this,Io).set(l,{size:0,family:""})}return l},qR=function(e,l,t){const d=U(this,Io).get(e);l===d.size&&t===d.family||(e.font=`${l}px ${t}`,d.size=l,d.family=t)},XS=function(){if(U(this,Vi)!==null)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),N(this,Vi,e.getBoundingClientRect().height),e.remove()},yS=function(e,l){const t=U(this,Zc).get(e);if(t)return t;const d=p(this,cn,Do).call(this,l);d.canvas.width=d.canvas.height=he,p(this,cn,qR).call(this,d,he,e);const n=d.measureText("");let a=n.fontBoundingBoxAscent,i=Math.abs(n.fontBoundingBoxDescent);if(a){const F=a/(a+i);return U(this,Zc).set(e,F),d.canvas.width=d.canvas.height=0,F}d.strokeStyle="red",d.clearRect(0,0,he,he),d.strokeText("g",0,0);let s=d.getImageData(0,0,he,he).data;i=0;for(let F=s.length-1-3;F>=0;F-=4)if(s[F]>0){i=Math.ceil(F/4/he);break}d.clearRect(0,0,he,he),d.strokeText("A",0,he),s=d.getImageData(0,0,he,he).data,a=0;for(let F=0,h=s.length;F<h;F+=4)if(s[F]>0){a=he-Math.floor(F/4/he);break}d.canvas.width=d.canvas.height=0;const c=a?a/(a+i):II;return U(this,Zc).set(e,c),c},M(Vt,cn),M(Vt,Zc,new Map),M(Vt,Fc,new Map),M(Vt,Io,new WeakMap),M(Vt,Vi,null),M(Vt,PZ,new Set),Vt);class AZ{static textContent(l){const t=[],d={items:t,styles:Object.create(null)};function n(a){var i;if(!a)return;let s=null;const c=a.name;if(c==="#text")s=a.value;else if(AZ.shouldBuildText(c))(i=a==null?void 0:a.attributes)!=null&&i.textContent?s=a.attributes.textContent:a.value&&(s=a.value);else return;if(s!==null&&t.push({str:s}),!!a.children)for(const F of a.children)n(F)}return n(l),d}static shouldBuildText(l){return!(l==="textarea"||l==="input"||l==="option"||l==="select")}}const DI=65536,wI=100,EI=5e3,CI=Et?qL:PL,xI=Et?$L:eS,gI=Et?_L:AL,jI=Et?lI:iS;function OI(e={}){typeof e=="string"||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const l=new fI,{docId:t}=l,d=e.url?vI(e.url):null,n=e.data?KI(e.data):null,a=e.httpHeaders||null,i=e.withCredentials===!0,s=e.password??null,c=e.range instanceof kS?e.range:null,F=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:DI;let h=e.worker instanceof xo?e.worker:null;const o=e.verbosity,V=typeof e.docBaseUrl=="string"&&!Bh(e.docBaseUrl)?e.docBaseUrl:null,W=typeof e.cMapUrl=="string"?e.cMapUrl:null,Q=e.cMapPacked!==!1,m=e.CMapReaderFactory||xI,R=typeof e.standardFontDataUrl=="string"?e.standardFontDataUrl:null,r=e.StandardFontDataFactory||jI,b=e.stopAtErrors!==!0,u=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,J=e.isEvalSupported!==!1,G=typeof e.isOffscreenCanvasSupported=="boolean"?e.isOffscreenCanvasSupported:!Et,T=typeof e.isImageDecoderSupported=="boolean"?e.isImageDecoderSupported:!Et&&(te.platform.isFirefox||!globalThis.chrome),y=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,k=typeof e.disableFontFace=="boolean"?e.disableFontFace:Et,X=e.fontExtraProperties===!0,L=e.enableXfa===!0,D=e.ownerDocument||globalThis.document,C=e.disableRange===!0,I=e.disableStream===!0,P=e.disableAutoFetch===!0,H=e.pdfBug===!0,Y=e.CanvasFactory||CI,B=e.FilterFactory||gI,z=e.enableHWA===!0,g=c?c.length:e.length??NaN,w=typeof e.useSystemFonts=="boolean"?e.useSystemFonts:!Et&&!k,O=typeof e.useWorkerFetch=="boolean"?e.useWorkerFetch:m===eS&&r===iS&&W&&R&&ZZ(W,document.baseURI)&&ZZ(R,document.baseURI),f=null;ML(o);const x={canvasFactory:new Y({ownerDocument:D,enableHWA:z}),filterFactory:new B({docId:t,ownerDocument:D}),cMapReaderFactory:O?null:new m({baseUrl:W,isCompressed:Q}),standardFontDataFactory:O?null:new r({baseUrl:R})};if(!h){const _={verbosity:o,port:ac.workerPort};h=_.port?xo.fromPort(_):new xo(_),l._worker=h}const A={docId:t,apiVersion:"4.10.38",data:n,password:s,disableAutoFetch:P,rangeChunkSize:F,length:g,docBaseUrl:V,enableXfa:L,evaluatorOptions:{maxImageSize:u,disableFontFace:k,ignoreErrors:b,isEvalSupported:J,isOffscreenCanvasSupported:G,isImageDecoderSupported:T,canvasMaxAreaInBytes:y,fontExtraProperties:X,useSystemFonts:w,cMapUrl:O?W:null,standardFontDataUrl:O?R:null}},al={disableFontFace:k,fontExtraProperties:X,ownerDocument:D,pdfBug:H,styleElement:f,loadingParams:{disableAutoFetch:P,enableXfa:L}};return h.promise.then(function(){if(l.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const _=h.messageHandler.sendWithPromise("GetDocRequest",A,n?[n.buffer]:null);let K;if(c)K=new NI(c,{disableRange:C,disableStream:I});else if(!n){if(!d)throw new Error("getDocument - no `url` parameter provided.");let tl;if(Et)if(ZZ(d)){if(typeof fetch>"u"||typeof Response>"u"||!("body"in Response.prototype))throw new Error("getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`.");tl=SS}else tl=YI;else tl=ZZ(d)?SS:TI;K=new tl({url:d,length:g,httpHeaders:a,withCredentials:i,rangeChunkSize:F,disableRange:C,disableStream:I})}return _.then(tl=>{if(l.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const el=new IZ(t,tl,h.port),Bl=new _I(el,l,K,al,x);l._transport=Bl,el.send("Ready",null)})}).catch(l._capability.reject),l}function vI(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(Et&&typeof e=="string")return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function KI(e){if(Et&&typeof Buffer<"u"&&e instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e=="string")return Gh(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof e=="object"&&!isNaN(e==null?void 0:e.length))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function BS(e){return typeof e=="object"&&Number.isInteger(e==null?void 0:e.num)&&e.num>=0&&Number.isInteger(e==null?void 0:e.gen)&&e.gen>=0}var lN;const YS=class Qy{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${le(Qy,lN)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var l,t,d,n;this.destroyed=!0;try{(l=this._worker)!=null&&l.port&&(this._worker._pendingDestroy=!0),await((t=this._transport)==null?void 0:t.destroy())}catch(a){throw(d=this._worker)!=null&&d.port&&delete this._worker._pendingDestroy,a}this._transport=null,(n=this._worker)==null||n.destroy(),this._worker=null}};lN=new WeakMap,M(YS,lN,0);let fI=YS,kS=class{constructor(e,l,t=!1,d=null){this.length=e,this.initialData=l,this.progressiveDone=t,this.contentDispositionFilename=d,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,l){for(const t of this._rangeListeners)t(e,l)}onDataProgress(e,l){this._readyCapability.promise.then(()=>{for(const t of this._progressListeners)t(e,l)})}onDataProgressiveRead(e){this._readyCapability.promise.then(()=>{for(const l of this._progressiveReadListeners)l(e)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const e of this._progressiveDoneListeners)e()})}transportReady(){this._readyCapability.resolve()}requestDataRange(e,l){Cl("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class HI{constructor(l,t){this._pdfInfo=l,this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return rl(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(l){return this._transport.getPage(l)}getPageIndex(l){return this._transport.getPageIndex(l)}getDestinations(){return this._transport.getDestinations()}getDestination(l){return this._transport.getDestination(l)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:l="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(l);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(l=!1){return this._transport.startCleanup(l||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(l){return this._transport.cachedPageNumber(l)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Wi,ea,Xd,oc,wo;class PI{constructor(l,t,d,n=!1){M(this,Xd),M(this,Wi,null),M(this,ea,!1),this._pageIndex=l,this._pageInfo=t,this._transport=d,this._stats=n?new FM:null,this._pdfBug=n,this.commonObjs=d.commonObjs,this.objs=new zS,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:l,rotation:t=this.rotate,offsetX:d=0,offsetY:n=0,dontFlip:a=!1}={}){return new UZ({viewBox:this.view,userUnit:this.userUnit,scale:l,rotation:t,offsetX:d,offsetY:n,dontFlip:a})}getAnnotations({intent:l="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(l);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return rl(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var l;return((l=this._transport._htmlForXfa)==null?void 0:l.children[this._pageIndex])||null}render({canvasContext:l,viewport:t,intent:d="display",annotationMode:n=Cn.ENABLE,transform:a=null,background:i=null,optionalContentConfigPromise:s=null,annotationCanvasMap:c=null,pageColors:F=null,printAnnotationStorage:h=null,isEditing:o=!1}){var V,W;(V=this._stats)==null||V.time("Overall");const Q=this._transport.getRenderingIntent(d,n,h,o),{renderingIntent:m,cacheKey:R}=Q;N(this,ea,!1),p(this,Xd,wo).call(this),s||(s=this._transport.getOptionalContentConfig(m));let r=this._intentStates.get(R);r||(r=Object.create(null),this._intentStates.set(R,r)),r.streamReaderCancelTimeout&&(clearTimeout(r.streamReaderCancelTimeout),r.streamReaderCancelTimeout=null);const b=!!(m&be.PRINT);r.displayReadyCapability||(r.displayReadyCapability=Promise.withResolvers(),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(W=this._stats)==null||W.time("Page Request"),this._pumpOperatorList(Q));const u=T=>{var y;r.renderTasks.delete(J),(this._maybeCleanupAfterRender||b)&&N(this,ea,!0),p(this,Xd,oc).call(this,!b),T?(J.capability.reject(T),this._abortOperatorList({intentState:r,reason:T instanceof Error?T:new Error(T)})):J.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(y=globalThis.Stats)!=null&&y.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},J=new $I({callback:u,params:{canvasContext:l,viewport:t,transform:a,background:i},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:r.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!b,pdfBug:this._pdfBug,pageColors:F});(r.renderTasks||(r.renderTasks=new Set)).add(J);const G=J.task;return Promise.all([r.displayReadyCapability.promise,s]).then(([T,y])=>{var k;if(this.destroyed){u();return}if((k=this._stats)==null||k.time("Rendering"),!(y.renderingIntent&m))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");J.initializeGraphics({transparency:T,optionalContentConfig:y}),J.operatorListChanged()}).catch(u),G}getOperatorList({intent:l="display",annotationMode:t=Cn.ENABLE,printAnnotationStorage:d=null,isEditing:n=!1}={}){var a;function i(){c.operatorList.lastChunk&&(c.opListReadCapability.resolve(c.operatorList),c.renderTasks.delete(F))}const s=this._transport.getRenderingIntent(l,t,d,n,!0);let c=this._intentStates.get(s.cacheKey);c||(c=Object.create(null),this._intentStates.set(s.cacheKey,c));let F;return c.opListReadCapability||(F=Object.create(null),F.operatorListChanged=i,c.opListReadCapability=Promise.withResolvers(),(c.renderTasks||(c.renderTasks=new Set)).add(F),c.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(a=this._stats)==null||a.time("Page Request"),this._pumpOperatorList(s)),c.opListReadCapability.promise}streamTextContent({includeMarkedContent:l=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:l===!0,disableNormalization:t===!0},{highWaterMark:100,size(d){return d.items.length}})}getTextContent(l={}){if(this._transport._htmlForXfa)return this.getXfa().then(d=>AZ.textContent(d));const t=this.streamTextContent(l);return new Promise(function(d,n){function a(){i.read().then(function({value:c,done:F}){if(F){d(s);return}s.lang??(s.lang=c.lang),Object.assign(s.styles,c.styles),s.items.push(...c.items),a()},n)}const i=t.getReader(),s={items:[],styles:Object.create(null),lang:null};a()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const l=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const d of t.renderTasks)l.push(d.completed),d.cancel();return this.objs.clear(),N(this,ea,!1),p(this,Xd,wo).call(this),Promise.all(l)}cleanup(l=!1){N(this,ea,!0);const t=p(this,Xd,oc).call(this,!1);return l&&t&&this._stats&&(this._stats=new FM),t}_startRenderPage(l,t){var d,n;const a=this._intentStates.get(t);a&&((d=this._stats)==null||d.timeEnd("Page Request"),(n=a.displayReadyCapability)==null||n.resolve(l))}_renderPageChunk(l,t){for(let d=0,n=l.length;d<n;d++)t.operatorList.fnArray.push(l.fnArray[d]),t.operatorList.argsArray.push(l.argsArray[d]);t.operatorList.lastChunk=l.lastChunk,t.operatorList.separateAnnots=l.separateAnnots;for(const d of t.renderTasks)d.operatorListChanged();l.lastChunk&&p(this,Xd,oc).call(this,!0)}_pumpOperatorList({renderingIntent:l,cacheKey:t,annotationStorageSerializable:d,modifiedIds:n}){const{map:a,transfer:i}=d,s=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:l,cacheKey:t,annotationStorage:a,modifiedIds:n},i).getReader(),c=this._intentStates.get(t);c.streamReader=s;const F=()=>{s.read().then(({value:h,done:o})=>{if(o){c.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,c),F())},h=>{if(c.streamReader=null,!this._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;for(const o of c.renderTasks)o.operatorListChanged();p(this,Xd,oc).call(this,!0)}if(c.displayReadyCapability)c.displayReadyCapability.reject(h);else if(c.opListReadCapability)c.opListReadCapability.reject(h);else throw h}})};F()}_abortOperatorList({intentState:l,reason:t,force:d=!1}){if(l.streamReader){if(l.streamReaderCancelTimeout&&(clearTimeout(l.streamReaderCancelTimeout),l.streamReaderCancelTimeout=null),!d){if(l.renderTasks.size>0)return;if(t instanceof FR){let n=wI;t.extraDelay>0&&t.extraDelay<1e3&&(n+=t.extraDelay),l.streamReaderCancelTimeout=setTimeout(()=>{l.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:l,reason:t,force:!0})},n);return}}if(l.streamReader.cancel(new gn(t.message)).catch(()=>{}),l.streamReader=null,!this._transport.destroyed){for(const[n,a]of this._intentStates)if(a===l){this._intentStates.delete(n);break}this.cleanup()}}}get stats(){return this._stats}}Wi=new WeakMap,ea=new WeakMap,Xd=new WeakSet,oc=function(e=!1){if(p(this,Xd,wo).call(this),!U(this,ea)||this.destroyed)return!1;if(e)return N(this,Wi,setTimeout(()=>{N(this,Wi,null),p(this,Xd,oc).call(this,!1)},EI)),!1;for(const{renderTasks:l,operatorList:t}of this._intentStates.values())if(l.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),N(this,ea,!1),!0},wo=function(){U(this,Wi)&&(clearTimeout(U(this,Wi)),N(this,Wi,null))};var da,tN;class AI{constructor(){M(this,da,new Map),M(this,tN,Promise.resolve())}postMessage(l,t){const d={data:structuredClone(l,t?{transfer:t}:null)};U(this,tN).then(()=>{for(const[n]of U(this,da))n.call(this,d)})}addEventListener(l,t,d=null){let n=null;if((d==null?void 0:d.signal)instanceof AbortSignal){const{signal:a}=d;if(a.aborted){Rl("LoopbackPort - cannot use an `aborted` signal.");return}const i=()=>this.removeEventListener(l,t);n=()=>a.removeEventListener("abort",i),a.addEventListener("abort",i)}U(this,da).set(t,n)}removeEventListener(l,t){const d=U(this,da).get(t);d==null||d(),U(this,da).delete(t)}terminate(){for(const[,l]of U(this,da))l==null||l();U(this,da).clear()}}da=new WeakMap,tN=new WeakMap;var Pl,eN,Vc,Qi,_Z,Eo,qZ,Co;let xo=(Pl=class{constructor({name:e=null,port:l=null,verbosity:t=SL()}={}){M(this,_Z);var d;if(this.name=e,this.destroyed=!1,this.verbosity=t,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,l){if((d=U(Pl,Qi))!=null&&d.has(l))throw new Error("Cannot use more than one PDFWorker per port.");(U(Pl,Qi)||N(Pl,Qi,new WeakMap)).set(l,this),this._initializeFromPort(l);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new IZ("main","worker",e),this._messageHandler.on("ready",function(){}),p(this,_Z,Eo).call(this)}_initialize(){if(U(Pl,Vc)||U(Pl,qZ,Co)){this._setupFakeWorker();return}let{workerSrc:e}=Pl;try{Pl._isSameOrigin(window.location.href,e)||(e=Pl._createCDNWrapper(new URL(e,window.location).href));const l=new Worker(e,{type:"module"}),t=new IZ("main","worker",l),d=()=>{n.abort(),t.destroy(),l.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;l.addEventListener("error",()=>{this._webWorker||d()},{signal:n.signal}),t.on("test",i=>{if(n.abort(),this.destroyed||!i){d();return}this._messageHandler=t,this._port=l,this._webWorker=l,p(this,_Z,Eo).call(this)}),t.on("ready",i=>{if(n.abort(),this.destroyed){d();return}try{a()}catch{this._setupFakeWorker()}});const a=()=>{const i=new Uint8Array;t.send("test",i,[i.buffer])};a();return}catch{Jh("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){U(Pl,Vc)||(Rl("Setting up fake worker."),N(Pl,Vc,!0)),Pl._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const l=new AI;this._port=l;const t=`fake${le(Pl,eN)._++}`,d=new IZ(t+"_worker",t,l);e.setup(d,l),this._messageHandler=new IZ(t,t+"_worker",l),p(this,_Z,Eo).call(this)}).catch(e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){var e,l,t;this.destroyed=!0,(e=this._webWorker)==null||e.terminate(),this._webWorker=null,(l=U(Pl,Qi))==null||l.delete(this._port),this._port=null,(t=this._messageHandler)==null||t.destroy(),this._messageHandler=null}static fromPort(e){var l;if(!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const t=(l=U(this,Qi))==null?void 0:l.get(e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new Pl(e)}static get workerSrc(){if(ac.workerSrc)return ac.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return rl(this,"_setupFakeWorkerGlobal",(async()=>U(this,qZ,Co)?U(this,qZ,Co):(await import(this.workerSrc)).WorkerMessageHandler)())}},eN=new WeakMap,Vc=new WeakMap,Qi=new WeakMap,_Z=new WeakSet,Eo=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},qZ=new WeakSet,Co=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},M(Pl,qZ),M(Pl,eN,0),M(Pl,Vc,!1),M(Pl,Qi),Et&&(N(Pl,Vc,!0),ac.workerSrc||(ac.workerSrc="./pdf.worker.mjs")),Pl._isSameOrigin=(e,l)=>{let t;try{if(t=new URL(e),!t.origin||t.origin==="null")return!1}catch{return!1}const d=new URL(l,t);return t.origin===d.origin},Pl._createCDNWrapper=e=>{const l=`await import("${e}");`;return URL.createObjectURL(new Blob([l],{type:"text/javascript"}))},Pl);var na,Un,$Z,lF,aa,Wc,tF;class _I{constructor(l,t,d,n,a){M(this,Wc),M(this,na,new Map),M(this,Un,new Map),M(this,$Z,new Map),M(this,lF,new Map),M(this,aa,null),this.messageHandler=l,this.loadingTask=t,this.commonObjs=new zS,this.fontLoader=new fL({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=a.canvasFactory,this.filterFactory=a.filterFactory,this.cMapReaderFactory=a.cMapReaderFactory,this.standardFontDataFactory=a.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=d,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return rl(this,"annotationStorage",new ER)}getRenderingIntent(l,t=Cn.ENABLE,d=null,n=!1,a=!1){let i=be.DISPLAY,s=DR;switch(l){case"any":i=be.ANY;break;case"display":break;case"print":i=be.PRINT;break;default:Rl(`getRenderingIntent - invalid intent: ${l}`)}const c=i&be.PRINT&&d instanceof PM?d:this.annotationStorage;switch(t){case Cn.DISABLE:i+=be.ANNOTATIONS_DISABLE;break;case Cn.ENABLE:break;case Cn.ENABLE_FORMS:i+=be.ANNOTATIONS_FORMS;break;case Cn.ENABLE_STORAGE:i+=be.ANNOTATIONS_STORAGE,s=c.serializable;break;default:Rl(`getRenderingIntent - invalid annotationMode: ${t}`)}n&&(i+=be.IS_EDITING),a&&(i+=be.OPLIST);const{ids:F,hash:h}=c.modifiedIds,o=[i,s.hash,h];return{renderingIntent:i,cacheKey:o.join("_"),annotationStorageSerializable:s,modifiedIds:F}}destroy(){var l;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(l=U(this,aa))==null||l.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const n of U(this,Un).values())t.push(n._destroy());U(this,Un).clear(),U(this,$Z).clear(),U(this,lF).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const d=this.messageHandler.sendWithPromise("Terminate",null);return t.push(d),Promise.all(t).then(()=>{var n,a;this.commonObjs.clear(),this.fontLoader.clear(),U(this,na).clear(),this.filterFactory.destroy(),$R.cleanup(),(n=this._networkStream)==null||n.cancelAllRequests(new gn("Worker was terminated.")),(a=this.messageHandler)==null||a.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:l,loadingTask:t}=this;l.on("GetReader",(d,n)=>{st(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=a=>{this._lastProgress={loaded:a.loaded,total:a.total}},n.onPull=()=>{this._fullReader.read().then(function({value:a,done:i}){if(i){n.close();return}st(a instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{n.error(a)})},n.onCancel=a=>{this._fullReader.cancel(a),n.ready.catch(i=>{if(!this.destroyed)throw i})}}),l.on("ReaderHeadersReady",async d=>{var n;await this._fullReader.headersReady;const{isStreamingSupported:a,isRangeSupported:i,contentLength:s}=this._fullReader;return(!a||!i)&&(this._lastProgress&&((n=t.onProgress)==null||n.call(t,this._lastProgress)),this._fullReader.onProgress=c=>{var F;(F=t.onProgress)==null||F.call(t,{loaded:c.loaded,total:c.total})}),{isStreamingSupported:a,isRangeSupported:i,contentLength:s}}),l.on("GetRangeReader",(d,n)=>{st(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const a=this._networkStream.getRangeReader(d.begin,d.end);if(!a){n.close();return}n.onPull=()=>{a.read().then(function({value:i,done:s}){if(s){n.close();return}st(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(i),1,[i])}).catch(i=>{n.error(i)})},n.onCancel=i=>{a.cancel(i),n.ready.catch(s=>{if(!this.destroyed)throw s})}}),l.on("GetDoc",({pdfInfo:d})=>{this._numPages=d.numPages,this._htmlForXfa=d.htmlForXfa,delete d.htmlForXfa,t._capability.resolve(new HI(d,this))}),l.on("DocException",d=>{t._capability.reject(Ze(d))}),l.on("PasswordRequest",d=>{N(this,aa,Promise.withResolvers());try{if(!t.onPassword)throw Ze(d);const n=a=>{a instanceof Error?U(this,aa).reject(a):U(this,aa).resolve({password:a})};t.onPassword(n,d.code)}catch(n){U(this,aa).reject(n)}return U(this,aa).promise}),l.on("DataLoaded",d=>{var n;(n=t.onProgress)==null||n.call(t,{loaded:d.length,total:d.length}),this.downloadInfoCapability.resolve(d)}),l.on("StartRenderPage",d=>{this.destroyed||U(this,Un).get(d.pageIndex)._startRenderPage(d.transparency,d.cacheKey)}),l.on("commonobj",([d,n,a])=>{var i;if(this.destroyed||this.commonObjs.has(d))return null;switch(n){case"Font":const{disableFontFace:s,fontExtraProperties:c,pdfBug:F}=this._params;if("error"in a){const W=a.error;Rl(`Error during font loading: ${W}`),this.commonObjs.resolve(d,W);break}const h=F&&(i=globalThis.FontInspector)!=null&&i.enabled?(W,Q)=>globalThis.FontInspector.fontAdded(W,Q):null,o=new HL(a,{disableFontFace:s,fontExtraProperties:c,inspectFont:h});this.fontLoader.bind(o).catch(()=>l.sendWithPromise("FontFallback",{id:d})).finally(()=>{!c&&o.data&&(o.data=null),this.commonObjs.resolve(d,o)});break;case"CopyLocalImage":const{imageRef:V}=a;st(V,"The imageRef must be defined.");for(const W of U(this,Un).values())for(const[,Q]of W.objs)if((Q==null?void 0:Q.ref)===V)return Q.dataLen?(this.commonObjs.resolve(d,structuredClone(Q)),Q.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(d,a);break;default:throw new Error(`Got unknown common object type ${n}`)}return null}),l.on("obj",([d,n,a,i])=>{var s;if(this.destroyed)return;const c=U(this,Un).get(n);if(!c.objs.has(d)){if(c._intentStates.size===0){(s=i==null?void 0:i.bitmap)==null||s.close();return}switch(a){case"Image":c.objs.resolve(d,i),(i==null?void 0:i.dataLen)>bL&&(c._maybeCleanupAfterRender=!0);break;case"Pattern":c.objs.resolve(d,i);break;default:throw new Error(`Got unknown object type ${a}`)}}}),l.on("DocProgress",d=>{var n;this.destroyed||(n=t.onProgress)==null||n.call(t,{loaded:d.loaded,total:d.total})}),l.on("FetchBuiltInCMap",async d=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(d)}),l.on("FetchStandardFontData",async d=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(d)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var l;this.annotationStorage.size<=0&&Rl("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:d}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:((l=this._fullReader)==null?void 0:l.filename)??null},d).finally(()=>{this.annotationStorage.resetModified()})}getPage(l){if(!Number.isInteger(l)||l<=0||l>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=l-1,d=U(this,$Z).get(t);if(d)return d;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then(a=>{if(this.destroyed)throw new Error("Transport destroyed");a.refStr&&U(this,lF).set(a.refStr,l);const i=new PI(t,a,this,this._params.pdfBug);return U(this,Un).set(t,i),i});return U(this,$Z).set(t,n),n}getPageIndex(l){return BS(l)?this.messageHandler.sendWithPromise("GetPageIndex",{num:l.num,gen:l.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(l,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:l,intent:t})}getFieldObjects(){return p(this,Wc,tF).call(this,"GetFieldObjects")}hasJSActions(){return p(this,Wc,tF).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(l){return typeof l!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:l})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return p(this,Wc,tF).call(this,"GetDocJSActions")}getPageJSActions(l){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:l})}getStructTree(l){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:l})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(l){return p(this,Wc,tF).call(this,"GetOptionalContentConfig").then(t=>new RI(t,l))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const l="GetMetadata",t=U(this,na).get(l);if(t)return t;const d=this.messageHandler.sendWithPromise(l,null).then(n=>{var a,i;return{info:n[0],metadata:n[1]?new QI(n[1]):null,contentDispositionFilename:((a=this._fullReader)==null?void 0:a.filename)??null,contentLength:((i=this._fullReader)==null?void 0:i.contentLength)??null}});return U(this,na).set(l,d),d}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(l=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of U(this,Un).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),l||this.fontLoader.clear(),U(this,na).clear(),this.filterFactory.destroy(!0),$R.cleanup()}}cachedPageNumber(l){if(!BS(l))return null;const t=l.gen===0?`${l.num}R`:`${l.num}R${l.gen}`;return U(this,lF).get(t)??null}}na=new WeakMap,Un=new WeakMap,$Z=new WeakMap,lF=new WeakMap,aa=new WeakMap,Wc=new WeakSet,tF=function(e,l=null){const t=U(this,na).get(e);if(t)return t;const d=this.messageHandler.sendWithPromise(e,l);return U(this,na).set(e,d),d};const eF=Symbol("INITIAL_DATA");var De,go,dN;class zS{constructor(){M(this,go),M(this,De,Object.create(null))}get(l,t=null){if(t){const n=p(this,go,dN).call(this,l);return n.promise.then(()=>t(n.data)),null}const d=U(this,De)[l];if(!d||d.data===eF)throw new Error(`Requesting object that isn't resolved yet ${l}.`);return d.data}has(l){const t=U(this,De)[l];return!!t&&t.data!==eF}delete(l){const t=U(this,De)[l];return!t||t.data===eF?!1:(delete U(this,De)[l],!0)}resolve(l,t=null){const d=p(this,go,dN).call(this,l);d.data=t,d.resolve()}clear(){var l;for(const t in U(this,De)){const{data:d}=U(this,De)[t];(l=d==null?void 0:d.bitmap)==null||l.close()}N(this,De,Object.create(null))}*[Symbol.iterator](){for(const l in U(this,De)){const{data:t}=U(this,De)[l];t!==eF&&(yield[l,t])}}}De=new WeakMap,go=new WeakSet,dN=function(e){var l;return(l=U(this,De))[e]||(l[e]={...Promise.withResolvers(),data:eF})};var mi;class qI{constructor(l){M(this,mi,null),N(this,mi,l),this.onContinue=null}get promise(){return U(this,mi).capability.promise}cancel(l=0){U(this,mi).cancel(null,l)}get separateAnnots(){const{separateAnnots:l}=U(this,mi).operatorList;if(!l)return!1;const{annotationCanvasMap:t}=U(this,mi);return l.form||l.canvas&&(t==null?void 0:t.size)>0}}mi=new WeakMap;var Ri,Qc;const LS=class K0{constructor({callback:l,params:t,objs:d,commonObjs:n,annotationCanvasMap:a,operatorList:i,pageIndex:s,canvasFactory:c,filterFactory:F,useRequestAnimationFrame:h=!1,pdfBug:o=!1,pageColors:V=null}){M(this,Ri,null),this.callback=l,this.params=t,this.objs=d,this.commonObjs=n,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=i,this._pageIndex=s,this.canvasFactory=c,this.filterFactory=F,this._pdfBug=o,this.pageColors=V,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new qI(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:l=!1,optionalContentConfig:t}){var d,n;if(this.cancelled)return;if(this._canvas){if(U(K0,Qc).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");U(K0,Qc).add(this._canvas)}this._pdfBug&&(d=globalThis.StepperManager)!=null&&d.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:a,viewport:i,transform:s,background:c}=this.params;this.gfx=new Ro(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:i,transparency:l,background:c}),this.operatorListIdx=0,this.graphicsReady=!0,(n=this.graphicsReadyCallback)==null||n.call(this)}cancel(l=null,t=0){var d;this.running=!1,this.cancelled=!0,(d=this.gfx)==null||d.endDrawing(),U(this,Ri)&&(window.cancelAnimationFrame(U(this,Ri)),N(this,Ri,null)),U(K0,Qc).delete(this._canvas),this.callback(l||new FR(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){var l;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(l=this.stepper)==null||l.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?N(this,Ri,window.requestAnimationFrame(()=>{N(this,Ri,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),U(K0,Qc).delete(this._canvas),this.callback())))}};Ri=new WeakMap,Qc=new WeakMap,M(LS,Qc,new WeakSet);let $I=LS;const lD="4.10.38",tD="f9bea397f";Tl(670);function IS(e){return Math.floor(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,"0")}function dF(e){return Math.max(0,Math.min(255,255*e))}class DS{static CMYK_G([l,t,d,n]){return["G",1-Math.min(1,.3*l+.59*d+.11*t+n)]}static G_CMYK([l]){return["CMYK",0,0,0,1-l]}static G_RGB([l]){return["RGB",l,l,l]}static G_rgb([l]){return l=dF(l),[l,l,l]}static G_HTML([l]){const t=IS(l);return`#${t}${t}${t}`}static RGB_G([l,t,d]){return["G",.3*l+.59*t+.11*d]}static RGB_rgb(l){return l.map(dF)}static RGB_HTML(l){return`#${l.map(IS).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([l,t,d,n]){return["RGB",1-Math.min(1,l+n),1-Math.min(1,d+n),1-Math.min(1,t+n)]}static CMYK_rgb([l,t,d,n]){return[dF(1-Math.min(1,l+n)),dF(1-Math.min(1,d+n)),dF(1-Math.min(1,t+n))]}static CMYK_HTML(l){const t=this.CMYK_RGB(l).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([l,t,d]){const n=1-l,a=1-t,i=1-d,s=Math.min(n,a,i);return["CMYK",n,a,i,s]}}class eD{create(l,t,d=!1){if(l<=0||t<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),d||(n.setAttribute("width",`${l}px`),n.setAttribute("height",`${t}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${l} ${t}`),n}createElement(l){if(typeof l!="string")throw new Error("Invalid SVG element type");return this._createSVG(l)}_createSVG(l){Cl("Abstract method `_createSVG` called.")}}let nN=class extends eD{_createSVG(e){return document.createElementNS(Ad,e)}},wS=class{static setupStorage(e,l,t,d,n){const a=d.getValue(l,{value:null});switch(t.name){case"textarea":if(a.value!==null&&(e.textContent=a.value),n==="print")break;e.addEventListener("input",i=>{d.setValue(l,{value:i.target.value})});break;case"input":if(t.attributes.type==="radio"||t.attributes.type==="checkbox"){if(a.value===t.attributes.xfaOn?e.setAttribute("checked",!0):a.value===t.attributes.xfaOff&&e.removeAttribute("checked"),n==="print")break;e.addEventListener("change",i=>{d.setValue(l,{value:i.target.checked?i.target.getAttribute("xfaOn"):i.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&e.setAttribute("value",a.value),n==="print")break;e.addEventListener("input",i=>{d.setValue(l,{value:i.target.value})})}break;case"select":if(a.value!==null){e.setAttribute("value",a.value);for(const i of t.children)i.attributes.value===a.value?i.attributes.selected=!0:i.attributes.hasOwnProperty("selected")&&delete i.attributes.selected}e.addEventListener("input",i=>{const s=i.target.options,c=s.selectedIndex===-1?"":s[s.selectedIndex].value;d.setValue(l,{value:c})});break}}static setAttributes({html:e,element:l,storage:t=null,intent:d,linkService:n}){const{attributes:a}=l,i=e instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${d}`);for(const[s,c]of Object.entries(a))if(c!=null)switch(s){case"class":c.length&&e.setAttribute(s,c.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",c);break;case"style":Object.assign(e.style,c);break;case"textContent":e.textContent=c;break;default:(!i||s!=="href"&&s!=="newWindow")&&e.setAttribute(s,c)}i&&n.addLinkAttributes(e,a.href,a.newWindow),t&&a.dataId&&this.setupStorage(e,a.dataId,l,t)}static render(e){var l,t;const d=e.annotationStorage,n=e.linkService,a=e.xfaHtml,i=e.intent||"display",s=document.createElement(a.name);a.attributes&&this.setAttributes({html:s,element:a,intent:i,linkService:n});const c=i!=="richText",F=e.div;if(F.append(s),e.viewport){const V=`matrix(${e.viewport.transform.join(",")})`;F.style.transform=V}c&&F.setAttribute("class","xfaLayer xfaFont");const h=[];if(a.children.length===0){if(a.value){const V=document.createTextNode(a.value);s.append(V),c&&AZ.shouldBuildText(a.name)&&h.push(V)}return{textDivs:h}}const o=[[a,-1,s]];for(;o.length>0;){const[V,W,Q]=o.at(-1);if(W+1===V.children.length){o.pop();continue}const m=V.children[++o.at(-1)[1]];if(m===null)continue;const{name:R}=m;if(R==="#text"){const b=document.createTextNode(m.value);h.push(b),Q.append(b);continue}const r=(l=m==null?void 0:m.attributes)!=null&&l.xmlns?document.createElementNS(m.attributes.xmlns,R):document.createElement(R);if(Q.append(r),m.attributes&&this.setAttributes({html:r,element:m,storage:d,intent:i,linkService:n}),((t=m.children)==null?void 0:t.length)>0)o.push([m,-1,r]);else if(m.value){const b=document.createTextNode(m.value);c&&AZ.shouldBuildText(R)&&h.push(b),r.append(b)}}for(const V of F.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))V.setAttribute("readOnly",!0);return{textDivs:h}}static update(e){const l=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=l,e.div.hidden=!1}};const nF=1e3,dD=9,Ni=new WeakSet;function ia(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class nD{static create(l){switch(l.data.annotationType){case ht.LINK:return new xS(l);case ht.TEXT:return new iD(l);case ht.WIDGET:switch(l.data.fieldType){case"Tx":return new sD(l);case"Btn":return l.data.radioButton?new gS(l):l.data.checkBox?new UD(l):new ZD(l);case"Ch":return new FD(l);case"Sig":return new cD(l)}return new ri(l);case ht.POPUP:return new iN(l);case ht.FREETEXT:return new fS(l);case ht.LINE:return new oD(l);case ht.SQUARE:return new VD(l);case ht.CIRCLE:return new WD(l);case ht.POLYLINE:return new HS(l);case ht.CARET:return new mD(l);case ht.INK:return new hN(l);case ht.POLYGON:return new QD(l);case ht.HIGHLIGHT:return new PS(l);case ht.UNDERLINE:return new RD(l);case ht.SQUIGGLY:return new ND(l);case ht.STRIKEOUT:return new bD(l);case ht.STAMP:return new AS(l);case ht.FILEATTACHMENT:return new uD(l);default:return new Wt(l)}}}var bi,aF,iF,jo,aN;const aD=class my{constructor(l,{isRenderable:t=!1,ignoreBorder:d=!1,createQuadrilaterals:n=!1}={}){M(this,jo),M(this,bi,null),M(this,aF,!1),M(this,iF,null),this.isRenderable=t,this.data=l.data,this.layer=l.layer,this.linkService=l.linkService,this.downloadManager=l.downloadManager,this.imageResourcesPath=l.imageResourcesPath,this.renderForms=l.renderForms,this.svgFactory=l.svgFactory,this.annotationStorage=l.annotationStorage,this.enableScripting=l.enableScripting,this.hasJSActions=l.hasJSActions,this._fieldObjects=l.fieldObjects,this.parent=l.parent,t&&(this.container=this._createContainer(d)),n&&this._createQuadrilaterals()}static _hasPopupData({titleObj:l,contentsObj:t,richText:d}){return!!(l!=null&&l.str||t!=null&&t.str||d!=null&&d.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return my._hasPopupData(this.data)}updateEdited(l){var t;if(!this.container)return;U(this,bi)||N(this,bi,{rect:this.data.rect.slice(0)});const{rect:d}=l;d&&p(this,jo,aN).call(this,d),(t=U(this,iF))==null||t.popup.updateEdited(l)}resetEdited(){var l;U(this,bi)&&(p(this,jo,aN).call(this,U(this,bi).rect),(l=U(this,iF))==null||l.popup.resetEdited(),N(this,bi,null))}_createContainer(l){const{data:t,parent:{page:d,viewport:n}}=this,a=document.createElement("section");a.setAttribute("data-annotation-id",t.id),this instanceof ri||(a.tabIndex=nF);const{style:i}=a;if(i.zIndex=this.parent.zIndex++,t.alternativeText&&(a.title=t.alternativeText),t.noRotate&&a.classList.add("norotate"),!t.rect||this instanceof iN){const{rotation:m}=t;return!t.hasOwnCanvas&&m!==0&&this.setRotation(m,a),a}const{width:s,height:c}=ia(t.rect);if(!l&&t.borderStyle.width>0){i.borderWidth=`${t.borderStyle.width}px`;const m=t.borderStyle.horizontalCornerRadius,R=t.borderStyle.verticalCornerRadius;if(m>0||R>0){const b=`calc(${m}px * var(--scale-factor)) / calc(${R}px * var(--scale-factor))`;i.borderRadius=b}else if(this instanceof gS){const b=`calc(${s}px * var(--scale-factor)) / calc(${c}px * var(--scale-factor))`;i.borderRadius=b}switch(t.borderStyle.style){case sZ.SOLID:i.borderStyle="solid";break;case sZ.DASHED:i.borderStyle="dashed";break;case sZ.BEVELED:Rl("Unimplemented border style: beveled");break;case sZ.INSET:Rl("Unimplemented border style: inset");break;case sZ.UNDERLINE:i.borderBottomStyle="solid";break}const r=t.borderColor||null;r?(N(this,aF,!0),i.borderColor=sl.makeHexColor(r[0]|0,r[1]|0,r[2]|0)):i.borderWidth=0}const F=sl.normalizeRect([t.rect[0],d.view[3]-t.rect[1]+d.view[1],t.rect[2],d.view[3]-t.rect[3]+d.view[1]]),{pageWidth:h,pageHeight:o,pageX:V,pageY:W}=n.rawDims;i.left=`${100*(F[0]-V)/h}%`,i.top=`${100*(F[1]-W)/o}%`;const{rotation:Q}=t;return t.hasOwnCanvas||Q===0?(i.width=`${100*s/h}%`,i.height=`${100*c/o}%`):this.setRotation(Q,a),a}setRotation(l,t=this.container){if(!this.data.rect)return;const{pageWidth:d,pageHeight:n}=this.parent.viewport.rawDims,{width:a,height:i}=ia(this.data.rect);let s,c;l%180===0?(s=100*a/d,c=100*i/n):(s=100*i/d,c=100*a/n),t.style.width=`${s}%`,t.style.height=`${c}%`,t.setAttribute("data-main-rotation",(360-l)%360)}get _commonActions(){const l=(t,d,n)=>{const a=n.detail[t],i=a[0],s=a.slice(1);n.target.style[d]=DS[`${i}_HTML`](s),this.annotationStorage.setValue(this.data.id,{[d]:DS[`${i}_rgb`](s)})};return rl(this,"_commonActions",{display:t=>{const{display:d}=t.detail,n=d%2===1;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:d===1||d===2})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:d}=t.detail;this.container.style.visibility=d?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:d,noView:d})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:t=>{l("bgColor","backgroundColor",t)},fillColor:t=>{l("fillColor","backgroundColor",t)},fgColor:t=>{l("fgColor","color",t)},textColor:t=>{l("textColor","color",t)},borderColor:t=>{l("borderColor","borderColor",t)},strokeColor:t=>{l("strokeColor","borderColor",t)},rotation:t=>{const d=t.detail.rotation;this.setRotation(d),this.annotationStorage.setValue(this.data.id,{rotation:d})}})}_dispatchEventFromSandbox(l,t){const d=this._commonActions;for(const n of Object.keys(t.detail)){const a=l[n]||d[n];a==null||a(t)}}_setDefaultPropertiesFromJS(l){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const d=this._commonActions;for(const[n,a]of Object.entries(t)){const i=d[n];if(i){const s={detail:{[n]:a},target:l};i(s),delete t[n]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:l}=this.data;if(!l)return;const[t,d,n,a]=this.data.rect.map(m=>Math.fround(m));if(l.length===8){const[m,R,r,b]=l.subarray(2,6);if(n===m&&a===R&&t===r&&d===b)return}const{style:i}=this.container;let s;if(U(this,aF)){const{borderColor:m,borderWidth:R}=i;i.borderWidth=0,s=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${m}" stroke-width="${R}">`],this.container.classList.add("hasBorder")}const c=n-t,F=a-d,{svgFactory:h}=this,o=h.createElement("svg");o.classList.add("quadrilateralsContainer"),o.setAttribute("width",0),o.setAttribute("height",0);const V=h.createElement("defs");o.append(V);const W=h.createElement("clipPath"),Q=`clippath_${this.data.id}`;W.setAttribute("id",Q),W.setAttribute("clipPathUnits","objectBoundingBox"),V.append(W);for(let m=2,R=l.length;m<R;m+=8){const r=l[m],b=l[m+1],u=l[m+2],J=l[m+3],G=h.createElement("rect"),T=(u-t)/c,y=(a-b)/F,k=(r-u)/c,X=(b-J)/F;G.setAttribute("x",T),G.setAttribute("y",y),G.setAttribute("width",k),G.setAttribute("height",X),W.append(G),s==null||s.push(`<rect vector-effect="non-scaling-stroke" x="${T}" y="${y}" width="${k}" height="${X}"/>`)}U(this,aF)&&(s.push("</g></svg>')"),i.backgroundImage=s.join("")),this.container.append(o),this.container.style.clipPath=`url(#${Q})`}_createPopup(){const{data:l}=this,t=N(this,iF,new iN({data:{color:l.color,titleObj:l.titleObj,modificationDate:l.modificationDate,contentsObj:l.contentsObj,richText:l.richText,parentRect:l.rect,borderStyle:0,id:`popup_${l.id}`,rotation:l.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(t.render())}render(){Cl("Abstract method `AnnotationElement.render` called")}_getElementsByName(l,t=null){const d=[];if(this._fieldObjects){const n=this._fieldObjects[l];if(n)for(const{page:a,id:i,exportValues:s}of n){if(a===-1||i===t)continue;const c=typeof s=="string"?s:null,F=document.querySelector(`[data-element-id="${i}"]`);if(F&&!Ni.has(F)){Rl(`_getElementsByName - element not allowed: ${i}`);continue}d.push({id:i,exportValue:c,domElement:F})}return d}for(const n of document.getElementsByName(l)){const{exportValue:a}=n,i=n.getAttribute("data-element-id");i!==t&&Ni.has(n)&&d.push({id:i,exportValue:a,domElement:n})}return d}show(){var l;this.container&&(this.container.hidden=!1),(l=this.popup)==null||l.maybeShow()}hide(){var l;this.container&&(this.container.hidden=!0),(l=this.popup)==null||l.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const l=this.getElementsToTriggerPopup();if(Array.isArray(l))for(const t of l)t.classList.add("highlightArea");else l.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:l,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{var d;(d=this.linkService.eventBus)==null||d.dispatch("switchannotationeditormode",{source:this,mode:l,editId:t})})}};bi=new WeakMap,aF=new WeakMap,iF=new WeakMap,jo=new WeakSet,aN=function(e){const{container:{style:l},data:{rect:t,rotation:d},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:i,pageY:s}}}}=this;t==null||t.splice(0,4,...e);const{width:c,height:F}=ia(e);l.left=`${100*(e[0]-i)/n}%`,l.top=`${100*(a-e[3]+s)/a}%`,d===0?(l.width=`${100*c/n}%`,l.height=`${100*F/a}%`):this.setRotation(d)};let Wt=aD;var yd,ui,ES,CS;class xS extends Wt{constructor(l,t=null){super(l,{isRenderable:!0,ignoreBorder:!!(t!=null&&t.ignoreBorder),createQuadrilaterals:!0}),M(this,yd),this.isTooltipOnly=l.data.isTooltipOnly}render(){const{data:l,linkService:t}=this,d=document.createElement("a");d.setAttribute("data-element-id",l.id);let n=!1;return l.url?(t.addLinkAttributes(d,l.url,l.newWindow),n=!0):l.action?(this._bindNamedAction(d,l.action),n=!0):l.attachment?(p(this,yd,ES).call(this,d,l.attachment,l.attachmentDest),n=!0):l.setOCGState?(p(this,yd,CS).call(this,d,l.setOCGState),n=!0):l.dest?(this._bindLink(d,l.dest),n=!0):(l.actions&&(l.actions.Action||l.actions["Mouse Up"]||l.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(d,l),n=!0),l.resetForm?(this._bindResetFormAction(d,l.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(d,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(d),this.container}_bindLink(l,t){l.href=this.linkService.getDestinationHash(t),l.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||t==="")&&p(this,yd,ui).call(this)}_bindNamedAction(l,t){l.href=this.linkService.getAnchorUrl(""),l.onclick=()=>(this.linkService.executeNamedAction(t),!1),p(this,yd,ui).call(this)}_bindJSAction(l,t){l.href=this.linkService.getAnchorUrl("");const d=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(t.actions)){const a=d.get(n);a&&(l[a]=()=>{var i;return(i=this.linkService.eventBus)==null||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:n}}),!1})}l.onclick||(l.onclick=()=>!1),p(this,yd,ui).call(this)}_bindResetFormAction(l,t){const d=l.onclick;if(d||(l.href=this.linkService.getAnchorUrl("")),p(this,yd,ui).call(this),!this._fieldObjects){Rl('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),d||(l.onclick=()=>!1);return}l.onclick=()=>{var n;d==null||d();const{fields:a,refs:i,include:s}=t,c=[];if(a.length!==0||i.length!==0){const o=new Set(i);for(const V of a){const W=this._fieldObjects[V]||[];for(const{id:Q}of W)o.add(Q)}for(const V of Object.values(this._fieldObjects))for(const W of V)o.has(W.id)===s&&c.push(W)}else for(const o of Object.values(this._fieldObjects))c.push(...o);const F=this.annotationStorage,h=[];for(const o of c){const{id:V}=o;switch(h.push(V),o.type){case"text":{const Q=o.defaultValue||"";F.setValue(V,{value:Q});break}case"checkbox":case"radiobutton":{const Q=o.defaultValue===o.exportValues;F.setValue(V,{value:Q});break}case"combobox":case"listbox":{const Q=o.defaultValue||"";F.setValue(V,{value:Q});break}default:continue}const W=document.querySelector(`[data-element-id="${V}"]`);if(W){if(!Ni.has(W)){Rl(`_bindResetFormAction - element not allowed: ${V}`);continue}}else continue;W.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((n=this.linkService.eventBus)==null||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}})),!1}}}yd=new WeakSet,ui=function(){this.container.setAttribute("data-internal-link","")},ES=function(e,l,t=null){e.href=this.linkService.getAnchorUrl(""),l.description&&(e.title=l.description),e.onclick=()=>{var d;return(d=this.downloadManager)==null||d.openOrDownloadData(l.content,l.filename,t),!1},p(this,yd,ui).call(this)},CS=function(e,l){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(l),!1),p(this,yd,ui).call(this)};class iD extends Wt{constructor(l){super(l,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const l=document.createElement("img");return l.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",l.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),l.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(l),this.container}}class ri extends Wt{render(){return this.container}showElementAndHideCanvas(l){var t;this.data.hasOwnCanvas&&(((t=l.previousSibling)==null?void 0:t.nodeName)==="CANVAS"&&(l.previousSibling.hidden=!0),l.hidden=!1)}_getKeyModifier(l){return te.platform.isMac?l.metaKey:l.ctrlKey}_setEventListener(l,t,d,n,a){d.includes("mouse")?l.addEventListener(d,i=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:a(i),shift:i.shiftKey,modifier:this._getKeyModifier(i)}})}):l.addEventListener(d,i=>{var s;if(d==="blur"){if(!t.focused||!i.relatedTarget)return;t.focused=!1}else if(d==="focus"){if(t.focused)return;t.focused=!0}a&&((s=this.linkService.eventBus)==null||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:a(i)}}))})}_setEventListeners(l,t,d,n){var a,i,s;for(const[c,F]of d)(F==="Action"||(a=this.data.actions)!=null&&a[F])&&((F==="Focus"||F==="Blur")&&(t||(t={focused:!1})),this._setEventListener(l,t,c,F,n),F==="Focus"&&!((i=this.data.actions)!=null&&i.Blur)?this._setEventListener(l,t,"blur","Blur",null):F==="Blur"&&!((s=this.data.actions)!=null&&s.Focus)&&this._setEventListener(l,t,"focus","Focus",null))}_setBackgroundColor(l){const t=this.data.backgroundColor||null;l.style.backgroundColor=t===null?"transparent":sl.makeHexColor(t[0],t[1],t[2])}_setTextStyle(l){const t=["left","center","right"],{fontColor:d}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||dD,a=l.style;let i;const s=2,c=F=>Math.round(10*F)/10;if(this.data.multiLine){const F=Math.abs(this.data.rect[3]-this.data.rect[1]-s),h=Math.round(F/(eR*n))||1,o=F/h;i=Math.min(n,c(o/eR))}else{const F=Math.abs(this.data.rect[3]-this.data.rect[1]-s);i=Math.min(n,c(F/eR))}a.fontSize=`calc(${i}px * var(--scale-factor))`,a.color=sl.makeHexColor(d[0],d[1],d[2]),this.data.textAlignment!==null&&(a.textAlign=t[this.data.textAlignment])}_setRequired(l,t){t?l.setAttribute("required",!0):l.removeAttribute("required"),l.setAttribute("aria-required",t)}}class sD extends ri{constructor(l){const t=l.renderForms||l.data.hasOwnCanvas||!l.data.hasAppearance&&!!l.data.fieldValue;super(l,{isRenderable:t})}setPropertyOnSiblings(l,t,d,n){const a=this.annotationStorage;for(const i of this._getElementsByName(l.name,l.id))i.domElement&&(i.domElement[t]=d),a.setValue(i.id,{[n]:d})}render(){var l,t;const d=this.annotationStorage,n=this.data.id;this.container.classList.add("textWidgetAnnotation");let a=null;if(this.renderForms){const i=d.getValue(n,{value:this.data.fieldValue});let s=i.value||"";const c=d.getValue(n,{charLimit:this.data.maxLen}).charLimit;c&&s.length>c&&(s=s.slice(0,c));let F=i.formattedValue||((l=this.data.textContent)==null?void 0:l.join(`
35
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Nh=typeof window<"u"&&typeof window.document<"u",Nd=Nh?window:{},Em=Nh&&Nd.document.documentElement?"ontouchstart"in Nd.document.documentElement:!1,Cm=Nh?"PointerEvent"in Nd:!1,gl="cropper",xm="all",J2="crop",T2="move",G2="zoom",Oa="e",va="w",Js="s",Dn="n",lZ="ne",tZ="nw",eZ="se",dZ="sw",gm="".concat(gl,"-crop"),X2="".concat(gl,"-disabled"),ce="".concat(gl,"-hidden"),y2="".concat(gl,"-hide"),bz="".concat(gl,"-invisible"),bh="".concat(gl,"-modal"),jm="".concat(gl,"-move"),nZ="".concat(gl,"Action"),uh="".concat(gl,"Preview"),Om="crop",B2="move",Y2="none",vm="crop",Km="cropend",fm="cropmove",Hm="cropstart",k2="dblclick",uz=Em?"touchstart":"mousedown",rz=Em?"touchmove":"mousemove",pz=Em?"touchend touchcancel":"mouseup",z2=Cm?"pointerdown":uz,L2=Cm?"pointermove":rz,I2=Cm?"pointerup pointercancel":pz,D2="ready",w2="resize",E2="wheel",Pm="zoom",C2="image/jpeg",Mz=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Sz=/^data:/,Jz=/^data:image\/jpeg;base64,/,Tz=/^img|canvas$/i,x2=200,g2=100,j2={viewMode:0,dragMode:Om,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:x2,minContainerHeight:g2,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},Gz='<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>',Xz=Number.isNaN||Nd.isNaN;function Sl(e){return typeof e=="number"&&!Xz(e)}var O2=function(l){return l>0&&l<1/0};function Am(e){return typeof e>"u"}function Ka(e){return Dm(e)==="object"&&e!==null}var yz=Object.prototype.hasOwnProperty;function Ts(e){if(!Ka(e))return!1;try{var l=e.constructor,t=l.prototype;return l&&t&&yz.call(t,"isPrototypeOf")}catch{return!1}}function Ue(e){return typeof e=="function"}var Bz=Array.prototype.slice;function v2(e){return Array.from?Array.from(e):Bz.call(e)}function it(e,l){return e&&Ue(l)&&(Array.isArray(e)||Sl(e.length)?v2(e).forEach(function(t,d){l.call(e,t,d,e)}):Ka(e)&&Object.keys(e).forEach(function(t){l.call(e,e[t],t,e)})),e}var jl=Object.assign||function(l){for(var t=arguments.length,d=new Array(t>1?t-1:0),n=1;n<t;n++)d[n-1]=arguments[n];return Ka(l)&&d.length>0&&d.forEach(function(a){Ka(a)&&Object.keys(a).forEach(function(i){l[i]=a[i]})}),l},Yz=/\.\d*(?:0|9){12}\d*$/;function Gs(e){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Yz.test(e)?Math.round(e*l)/l:e}var kz=/^width|height|left|top|marginLeft|marginTop$/;function wn(e,l){var t=e.style;it(l,function(d,n){kz.test(n)&&Sl(d)&&(d="".concat(d,"px")),t[n]=d})}function zz(e,l){return e.classList?e.classList.contains(l):e.className.indexOf(l)>-1}function rt(e,l){if(l){if(Sl(e.length)){it(e,function(d){rt(d,l)});return}if(e.classList){e.classList.add(l);return}var t=e.className.trim();t?t.indexOf(l)<0&&(e.className="".concat(t," ").concat(l)):e.className=l}}function bd(e,l){if(l){if(Sl(e.length)){it(e,function(t){bd(t,l)});return}if(e.classList){e.classList.remove(l);return}e.className.indexOf(l)>=0&&(e.className=e.className.replace(l,""))}}function Xs(e,l,t){if(l){if(Sl(e.length)){it(e,function(d){Xs(d,l,t)});return}t?rt(e,l):bd(e,l)}}var Lz=/([a-z\d])([A-Z])/g;function _m(e){return e.replace(Lz,"$1-$2").toLowerCase()}function qm(e,l){return Ka(e[l])?e[l]:e.dataset?e.dataset[l]:e.getAttribute("data-".concat(_m(l)))}function aZ(e,l,t){Ka(t)?e[l]=t:e.dataset?e.dataset[l]=t:e.setAttribute("data-".concat(_m(l)),t)}function Iz(e,l){if(Ka(e[l]))try{delete e[l]}catch{e[l]=void 0}else if(e.dataset)try{delete e.dataset[l]}catch{e.dataset[l]=void 0}else e.removeAttribute("data-".concat(_m(l)))}var K2=/\s\s*/,f2=function(){var e=!1;if(Nh){var l=!1,t=function(){},d=Object.defineProperty({},"once",{get:function(){return e=!0,l},set:function(a){l=a}});Nd.addEventListener("test",t,d),Nd.removeEventListener("test",t,d)}return e}();function $e(e,l,t){var d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},n=t;l.trim().split(K2).forEach(function(a){if(!f2){var i=e.listeners;i&&i[a]&&i[a][t]&&(n=i[a][t],delete i[a][t],Object.keys(i[a]).length===0&&delete i[a],Object.keys(i).length===0&&delete e.listeners)}e.removeEventListener(a,n,d)})}function Ye(e,l,t){var d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},n=t;l.trim().split(K2).forEach(function(a){if(d.once&&!f2){var i=e.listeners,s=i===void 0?{}:i;n=function(){delete s[a][t],e.removeEventListener(a,n,d);for(var F=arguments.length,h=new Array(F),o=0;o<F;o++)h[o]=arguments[o];t.apply(e,h)},s[a]||(s[a]={}),s[a][t]&&e.removeEventListener(a,s[a][t],d),s[a][t]=n,e.listeners=s}e.addEventListener(a,n,d)})}function ys(e,l,t){var d;return Ue(Event)&&Ue(CustomEvent)?d=new CustomEvent(l,{detail:t,bubbles:!0,cancelable:!0}):(d=document.createEvent("CustomEvent"),d.initCustomEvent(l,!0,!0,t)),e.dispatchEvent(d)}function H2(e){var l=e.getBoundingClientRect();return{left:l.left+(window.pageXOffset-document.documentElement.clientLeft),top:l.top+(window.pageYOffset-document.documentElement.clientTop)}}var $m=Nd.location,Dz=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function P2(e){var l=e.match(Dz);return l!==null&&(l[1]!==$m.protocol||l[2]!==$m.hostname||l[3]!==$m.port)}function A2(e){var l="timestamp=".concat(new Date().getTime());return e+(e.indexOf("?")===-1?"?":"&")+l}function iZ(e){var l=e.rotate,t=e.scaleX,d=e.scaleY,n=e.translateX,a=e.translateY,i=[];Sl(n)&&n!==0&&i.push("translateX(".concat(n,"px)")),Sl(a)&&a!==0&&i.push("translateY(".concat(a,"px)")),Sl(l)&&l!==0&&i.push("rotate(".concat(l,"deg)")),Sl(t)&&t!==1&&i.push("scaleX(".concat(t,")")),Sl(d)&&d!==1&&i.push("scaleY(".concat(d,")"));var s=i.length?i.join(" "):"none";return{WebkitTransform:s,msTransform:s,transform:s}}function wz(e){var l=r2({},e),t=0;return it(e,function(d,n){delete l[n],it(l,function(a){var i=Math.abs(d.startX-a.startX),s=Math.abs(d.startY-a.startY),c=Math.abs(d.endX-a.endX),F=Math.abs(d.endY-a.endY),h=Math.sqrt(i*i+s*s),o=Math.sqrt(c*c+F*F),V=(o-h)/h;Math.abs(V)>Math.abs(t)&&(t=V)})}),t}function rh(e,l){var t=e.pageX,d=e.pageY,n={endX:t,endY:d};return l?n:r2({startX:t,startY:d},n)}function Ez(e){var l=0,t=0,d=0;return it(e,function(n){var a=n.startX,i=n.startY;l+=a,t+=i,d+=1}),l/=d,t/=d,{pageX:l,pageY:t}}function En(e){var l=e.aspectRatio,t=e.height,d=e.width,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",a=O2(d),i=O2(t);if(a&&i){var s=t*l;n==="contain"&&s>d||n==="cover"&&s<d?t=d/l:d=t*l}else a?t=d/l:i&&(d=t*l);return{width:d,height:t}}function Cz(e){var l=e.width,t=e.height,d=e.degree;if(d=Math.abs(d)%180,d===90)return{width:t,height:l};var n=d%90*Math.PI/180,a=Math.sin(n),i=Math.cos(n),s=l*i+t*a,c=l*a+t*i;return d>90?{width:c,height:s}:{width:s,height:c}}function xz(e,l,t,d){var n=l.aspectRatio,a=l.naturalWidth,i=l.naturalHeight,s=l.rotate,c=s===void 0?0:s,F=l.scaleX,h=F===void 0?1:F,o=l.scaleY,V=o===void 0?1:o,W=t.aspectRatio,Q=t.naturalWidth,m=t.naturalHeight,R=d.fillColor,r=R===void 0?"transparent":R,b=d.imageSmoothingEnabled,u=b===void 0?!0:b,J=d.imageSmoothingQuality,G=J===void 0?"low":J,T=d.maxWidth,y=T===void 0?1/0:T,k=d.maxHeight,X=k===void 0?1/0:k,L=d.minWidth,D=L===void 0?0:L,C=d.minHeight,I=C===void 0?0:C,H=document.createElement("canvas"),f=H.getContext("2d"),Y=En({aspectRatio:W,width:y,height:X}),B=En({aspectRatio:W,width:D,height:I},"cover"),z=Math.min(Y.width,Math.max(B.width,Q)),g=Math.min(Y.height,Math.max(B.height,m)),w=En({aspectRatio:n,width:y,height:X}),O=En({aspectRatio:n,width:D,height:I},"cover"),K=Math.min(w.width,Math.max(O.width,a)),x=Math.min(w.height,Math.max(O.height,i)),_=[-K/2,-x/2,K,x];return H.width=Gs(z),H.height=Gs(g),f.fillStyle=r,f.fillRect(0,0,z,g),f.save(),f.translate(z/2,g/2),f.rotate(c*Math.PI/180),f.scale(h,V),f.imageSmoothingEnabled=u,f.imageSmoothingQuality=G,f.drawImage.apply(f,[e].concat(S2(_.map(function(al){return Math.floor(Gs(al))})))),f.restore(),H}var _2=String.fromCharCode;function gz(e,l,t){var d="";t+=l;for(var n=l;n<t;n+=1)d+=_2(e.getUint8(n));return d}var jz=/^data:.*,/;function Oz(e){var l=e.replace(jz,""),t=atob(l),d=new ArrayBuffer(t.length),n=new Uint8Array(d);return it(n,function(a,i){n[i]=t.charCodeAt(i)}),d}function vz(e,l){for(var t=[],d=8192,n=new Uint8Array(e);n.length>0;)t.push(_2.apply(null,v2(n.subarray(0,d)))),n=n.subarray(d);return"data:".concat(l,";base64,").concat(btoa(t.join("")))}function Kz(e){var l=new DataView(e),t;try{var d,n,a;if(l.getUint8(0)===255&&l.getUint8(1)===216)for(var i=l.byteLength,s=2;s+1<i;){if(l.getUint8(s)===255&&l.getUint8(s+1)===225){n=s;break}s+=1}if(n){var c=n+4,F=n+10;if(gz(l,c,4)==="Exif"){var h=l.getUint16(F);if(d=h===18761,(d||h===19789)&&l.getUint16(F+2,d)===42){var o=l.getUint32(F+4,d);o>=8&&(a=F+o)}}}if(a){var V=l.getUint16(a,d),W,Q;for(Q=0;Q<V;Q+=1)if(W=a+Q*12+2,l.getUint16(W,d)===274){W+=8,t=l.getUint16(W,d),l.setUint16(W,1,d);break}}}catch{t=1}return t}function fz(e){var l=0,t=1,d=1;switch(e){case 2:t=-1;break;case 3:l=-180;break;case 4:d=-1;break;case 5:l=90,d=-1;break;case 6:l=90;break;case 7:l=90,t=-1;break;case 8:l=-90;break}return{rotate:l,scaleX:t,scaleY:d}}var Hz={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var l=this.element,t=this.options,d=this.container,n=this.cropper,a=Number(t.minContainerWidth),i=Number(t.minContainerHeight);rt(n,ce),bd(l,ce);var s={width:Math.max(d.offsetWidth,a>=0?a:x2),height:Math.max(d.offsetHeight,i>=0?i:g2)};this.containerData=s,wn(n,{width:s.width,height:s.height}),rt(l,ce),bd(n,ce)},initCanvas:function(){var l=this.containerData,t=this.imageData,d=this.options.viewMode,n=Math.abs(t.rotate)%180===90,a=n?t.naturalHeight:t.naturalWidth,i=n?t.naturalWidth:t.naturalHeight,s=a/i,c=l.width,F=l.height;l.height*s>l.width?d===3?c=l.height*s:F=l.width/s:d===3?F=l.width/s:c=l.height*s;var h={aspectRatio:s,naturalWidth:a,naturalHeight:i,width:c,height:F};this.canvasData=h,this.limited=d===1||d===2,this.limitCanvas(!0,!0),h.width=Math.min(Math.max(h.width,h.minWidth),h.maxWidth),h.height=Math.min(Math.max(h.height,h.minHeight),h.maxHeight),h.left=(l.width-h.width)/2,h.top=(l.height-h.height)/2,h.oldLeft=h.left,h.oldTop=h.top,this.initialCanvasData=jl({},h)},limitCanvas:function(l,t){var d=this.options,n=this.containerData,a=this.canvasData,i=this.cropBoxData,s=d.viewMode,c=a.aspectRatio,F=this.cropped&&i;if(l){var h=Number(d.minCanvasWidth)||0,o=Number(d.minCanvasHeight)||0;s>1?(h=Math.max(h,n.width),o=Math.max(o,n.height),s===3&&(o*c>h?h=o*c:o=h/c)):s>0&&(h?h=Math.max(h,F?i.width:0):o?o=Math.max(o,F?i.height:0):F&&(h=i.width,o=i.height,o*c>h?h=o*c:o=h/c));var V=En({aspectRatio:c,width:h,height:o});h=V.width,o=V.height,a.minWidth=h,a.minHeight=o,a.maxWidth=1/0,a.maxHeight=1/0}if(t)if(s>(F?0:1)){var W=n.width-a.width,Q=n.height-a.height;a.minLeft=Math.min(0,W),a.minTop=Math.min(0,Q),a.maxLeft=Math.max(0,W),a.maxTop=Math.max(0,Q),F&&this.limited&&(a.minLeft=Math.min(i.left,i.left+(i.width-a.width)),a.minTop=Math.min(i.top,i.top+(i.height-a.height)),a.maxLeft=i.left,a.maxTop=i.top,s===2&&(a.width>=n.width&&(a.minLeft=Math.min(0,W),a.maxLeft=Math.max(0,W)),a.height>=n.height&&(a.minTop=Math.min(0,Q),a.maxTop=Math.max(0,Q))))}else a.minLeft=-a.width,a.minTop=-a.height,a.maxLeft=n.width,a.maxTop=n.height},renderCanvas:function(l,t){var d=this.canvasData,n=this.imageData;if(t){var a=Cz({width:n.naturalWidth*Math.abs(n.scaleX||1),height:n.naturalHeight*Math.abs(n.scaleY||1),degree:n.rotate||0}),i=a.width,s=a.height,c=d.width*(i/d.naturalWidth),F=d.height*(s/d.naturalHeight);d.left-=(c-d.width)/2,d.top-=(F-d.height)/2,d.width=c,d.height=F,d.aspectRatio=i/s,d.naturalWidth=i,d.naturalHeight=s,this.limitCanvas(!0,!1)}(d.width>d.maxWidth||d.width<d.minWidth)&&(d.left=d.oldLeft),(d.height>d.maxHeight||d.height<d.minHeight)&&(d.top=d.oldTop),d.width=Math.min(Math.max(d.width,d.minWidth),d.maxWidth),d.height=Math.min(Math.max(d.height,d.minHeight),d.maxHeight),this.limitCanvas(!1,!0),d.left=Math.min(Math.max(d.left,d.minLeft),d.maxLeft),d.top=Math.min(Math.max(d.top,d.minTop),d.maxTop),d.oldLeft=d.left,d.oldTop=d.top,wn(this.canvas,jl({width:d.width,height:d.height},iZ({translateX:d.left,translateY:d.top}))),this.renderImage(l),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(l){var t=this.canvasData,d=this.imageData,n=d.naturalWidth*(t.width/t.naturalWidth),a=d.naturalHeight*(t.height/t.naturalHeight);jl(d,{width:n,height:a,left:(t.width-n)/2,top:(t.height-a)/2}),wn(this.image,jl({width:d.width,height:d.height},iZ(jl({translateX:d.left,translateY:d.top},d)))),l&&this.output()},initCropBox:function(){var l=this.options,t=this.canvasData,d=l.aspectRatio||l.initialAspectRatio,n=Number(l.autoCropArea)||.8,a={width:t.width,height:t.height};d&&(t.height*d>t.width?a.height=a.width/d:a.width=a.height*d),this.cropBoxData=a,this.limitCropBox(!0,!0),a.width=Math.min(Math.max(a.width,a.minWidth),a.maxWidth),a.height=Math.min(Math.max(a.height,a.minHeight),a.maxHeight),a.width=Math.max(a.minWidth,a.width*n),a.height=Math.max(a.minHeight,a.height*n),a.left=t.left+(t.width-a.width)/2,a.top=t.top+(t.height-a.height)/2,a.oldLeft=a.left,a.oldTop=a.top,this.initialCropBoxData=jl({},a)},limitCropBox:function(l,t){var d=this.options,n=this.containerData,a=this.canvasData,i=this.cropBoxData,s=this.limited,c=d.aspectRatio;if(l){var F=Number(d.minCropBoxWidth)||0,h=Number(d.minCropBoxHeight)||0,o=s?Math.min(n.width,a.width,a.width+a.left,n.width-a.left):n.width,V=s?Math.min(n.height,a.height,a.height+a.top,n.height-a.top):n.height;F=Math.min(F,n.width),h=Math.min(h,n.height),c&&(F&&h?h*c>F?h=F/c:F=h*c:F?h=F/c:h&&(F=h*c),V*c>o?V=o/c:o=V*c),i.minWidth=Math.min(F,o),i.minHeight=Math.min(h,V),i.maxWidth=o,i.maxHeight=V}t&&(s?(i.minLeft=Math.max(0,a.left),i.minTop=Math.max(0,a.top),i.maxLeft=Math.min(n.width,a.left+a.width)-i.width,i.maxTop=Math.min(n.height,a.top+a.height)-i.height):(i.minLeft=0,i.minTop=0,i.maxLeft=n.width-i.width,i.maxTop=n.height-i.height))},renderCropBox:function(){var l=this.options,t=this.containerData,d=this.cropBoxData;(d.width>d.maxWidth||d.width<d.minWidth)&&(d.left=d.oldLeft),(d.height>d.maxHeight||d.height<d.minHeight)&&(d.top=d.oldTop),d.width=Math.min(Math.max(d.width,d.minWidth),d.maxWidth),d.height=Math.min(Math.max(d.height,d.minHeight),d.maxHeight),this.limitCropBox(!1,!0),d.left=Math.min(Math.max(d.left,d.minLeft),d.maxLeft),d.top=Math.min(Math.max(d.top,d.minTop),d.maxTop),d.oldLeft=d.left,d.oldTop=d.top,l.movable&&l.cropBoxMovable&&aZ(this.face,nZ,d.width>=t.width&&d.height>=t.height?T2:xm),wn(this.cropBox,jl({width:d.width,height:d.height},iZ({translateX:d.left,translateY:d.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),ys(this.element,vm,this.getData())}},Pz={initPreview:function(){var l=this.element,t=this.crossOrigin,d=this.options.preview,n=t?this.crossOriginUrl:this.url,a=l.alt||"The image to preview",i=document.createElement("img");if(t&&(i.crossOrigin=t),i.src=n,i.alt=a,this.viewBox.appendChild(i),this.viewBoxImage=i,!!d){var s=d;typeof d=="string"?s=l.ownerDocument.querySelectorAll(d):d.querySelector&&(s=[d]),this.previews=s,it(s,function(c){var F=document.createElement("img");aZ(c,uh,{width:c.offsetWidth,height:c.offsetHeight,html:c.innerHTML}),t&&(F.crossOrigin=t),F.src=n,F.alt=a,F.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;"',c.innerHTML="",c.appendChild(F)})}},resetPreview:function(){it(this.previews,function(l){var t=qm(l,uh);wn(l,{width:t.width,height:t.height}),l.innerHTML=t.html,Iz(l,uh)})},preview:function(){var l=this.imageData,t=this.canvasData,d=this.cropBoxData,n=d.width,a=d.height,i=l.width,s=l.height,c=d.left-t.left-l.left,F=d.top-t.top-l.top;!this.cropped||this.disabled||(wn(this.viewBoxImage,jl({width:i,height:s},iZ(jl({translateX:-c,translateY:-F},l)))),it(this.previews,function(h){var o=qm(h,uh),V=o.width,W=o.height,Q=V,m=W,R=1;n&&(R=V/n,m=a*R),a&&m>W&&(R=W/a,Q=n*R,m=W),wn(h,{width:Q,height:m}),wn(h.getElementsByTagName("img")[0],jl({width:i*R,height:s*R},iZ(jl({translateX:-c*R,translateY:-F*R},l))))}))}},Az={bind:function(){var l=this.element,t=this.options,d=this.cropper;Ue(t.cropstart)&&Ye(l,Hm,t.cropstart),Ue(t.cropmove)&&Ye(l,fm,t.cropmove),Ue(t.cropend)&&Ye(l,Km,t.cropend),Ue(t.crop)&&Ye(l,vm,t.crop),Ue(t.zoom)&&Ye(l,Pm,t.zoom),Ye(d,z2,this.onCropStart=this.cropStart.bind(this)),t.zoomable&&t.zoomOnWheel&&Ye(d,E2,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&Ye(d,k2,this.onDblclick=this.dblclick.bind(this)),Ye(l.ownerDocument,L2,this.onCropMove=this.cropMove.bind(this)),Ye(l.ownerDocument,I2,this.onCropEnd=this.cropEnd.bind(this)),t.responsive&&Ye(window,w2,this.onResize=this.resize.bind(this))},unbind:function(){var l=this.element,t=this.options,d=this.cropper;Ue(t.cropstart)&&$e(l,Hm,t.cropstart),Ue(t.cropmove)&&$e(l,fm,t.cropmove),Ue(t.cropend)&&$e(l,Km,t.cropend),Ue(t.crop)&&$e(l,vm,t.crop),Ue(t.zoom)&&$e(l,Pm,t.zoom),$e(d,z2,this.onCropStart),t.zoomable&&t.zoomOnWheel&&$e(d,E2,this.onWheel,{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&$e(d,k2,this.onDblclick),$e(l.ownerDocument,L2,this.onCropMove),$e(l.ownerDocument,I2,this.onCropEnd),t.responsive&&$e(window,w2,this.onResize)}},_z={resize:function(){if(!this.disabled){var l=this.options,t=this.container,d=this.containerData,n=t.offsetWidth/d.width,a=t.offsetHeight/d.height,i=Math.abs(n-1)>Math.abs(a-1)?n:a;if(i!==1){var s,c;l.restore&&(s=this.getCanvasData(),c=this.getCropBoxData()),this.render(),l.restore&&(this.setCanvasData(it(s,function(F,h){s[h]=F*i})),this.setCropBoxData(it(c,function(F,h){c[h]=F*i})))}}},dblclick:function(){this.disabled||this.options.dragMode===Y2||this.setDragMode(zz(this.dragBox,gm)?B2:Om)},wheel:function(l){var t=this,d=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(l.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){t.wheeling=!1},50),l.deltaY?n=l.deltaY>0?1:-1:l.wheelDelta?n=-l.wheelDelta/120:l.detail&&(n=l.detail>0?1:-1),this.zoom(-n*d,l)))},cropStart:function(l){var t=l.buttons,d=l.button;if(!(this.disabled||(l.type==="mousedown"||l.type==="pointerdown"&&l.pointerType==="mouse")&&(Sl(t)&&t!==1||Sl(d)&&d!==0||l.ctrlKey))){var n=this.options,a=this.pointers,i;l.changedTouches?it(l.changedTouches,function(s){a[s.identifier]=rh(s)}):a[l.pointerId||0]=rh(l),Object.keys(a).length>1&&n.zoomable&&n.zoomOnTouch?i=G2:i=qm(l.target,nZ),Mz.test(i)&&ys(this.element,Hm,{originalEvent:l,action:i})!==!1&&(l.preventDefault(),this.action=i,this.cropping=!1,i===J2&&(this.cropping=!0,rt(this.dragBox,bh)))}},cropMove:function(l){var t=this.action;if(!(this.disabled||!t)){var d=this.pointers;l.preventDefault(),ys(this.element,fm,{originalEvent:l,action:t})!==!1&&(l.changedTouches?it(l.changedTouches,function(n){jl(d[n.identifier]||{},rh(n,!0))}):jl(d[l.pointerId||0]||{},rh(l,!0)),this.change(l))}},cropEnd:function(l){if(!this.disabled){var t=this.action,d=this.pointers;l.changedTouches?it(l.changedTouches,function(n){delete d[n.identifier]}):delete d[l.pointerId||0],t&&(l.preventDefault(),Object.keys(d).length||(this.action=""),this.cropping&&(this.cropping=!1,Xs(this.dragBox,bh,this.cropped&&this.options.modal)),ys(this.element,Km,{originalEvent:l,action:t}))}}},qz={change:function(l){var t=this.options,d=this.canvasData,n=this.containerData,a=this.cropBoxData,i=this.pointers,s=this.action,c=t.aspectRatio,F=a.left,h=a.top,o=a.width,V=a.height,W=F+o,Q=h+V,m=0,R=0,r=n.width,b=n.height,u=!0,J;!c&&l.shiftKey&&(c=o&&V?o/V:1),this.limited&&(m=a.minLeft,R=a.minTop,r=m+Math.min(n.width,d.width,d.left+d.width),b=R+Math.min(n.height,d.height,d.top+d.height));var G=i[Object.keys(i)[0]],T={x:G.endX-G.startX,y:G.endY-G.startY},y=function(X){switch(X){case Oa:W+T.x>r&&(T.x=r-W);break;case va:F+T.x<m&&(T.x=m-F);break;case Dn:h+T.y<R&&(T.y=R-h);break;case Js:Q+T.y>b&&(T.y=b-Q);break}};switch(s){case xm:F+=T.x,h+=T.y;break;case Oa:if(T.x>=0&&(W>=r||c&&(h<=R||Q>=b))){u=!1;break}y(Oa),o+=T.x,o<0&&(s=va,o=-o,F-=o),c&&(V=o/c,h+=(a.height-V)/2);break;case Dn:if(T.y<=0&&(h<=R||c&&(F<=m||W>=r))){u=!1;break}y(Dn),V-=T.y,h+=T.y,V<0&&(s=Js,V=-V,h-=V),c&&(o=V*c,F+=(a.width-o)/2);break;case va:if(T.x<=0&&(F<=m||c&&(h<=R||Q>=b))){u=!1;break}y(va),o-=T.x,F+=T.x,o<0&&(s=Oa,o=-o,F-=o),c&&(V=o/c,h+=(a.height-V)/2);break;case Js:if(T.y>=0&&(Q>=b||c&&(F<=m||W>=r))){u=!1;break}y(Js),V+=T.y,V<0&&(s=Dn,V=-V,h-=V),c&&(o=V*c,F+=(a.width-o)/2);break;case lZ:if(c){if(T.y<=0&&(h<=R||W>=r)){u=!1;break}y(Dn),V-=T.y,h+=T.y,o=V*c}else y(Dn),y(Oa),T.x>=0?W<r?o+=T.x:T.y<=0&&h<=R&&(u=!1):o+=T.x,T.y<=0?h>R&&(V-=T.y,h+=T.y):(V-=T.y,h+=T.y);o<0&&V<0?(s=dZ,V=-V,o=-o,h-=V,F-=o):o<0?(s=tZ,o=-o,F-=o):V<0&&(s=eZ,V=-V,h-=V);break;case tZ:if(c){if(T.y<=0&&(h<=R||F<=m)){u=!1;break}y(Dn),V-=T.y,h+=T.y,o=V*c,F+=a.width-o}else y(Dn),y(va),T.x<=0?F>m?(o-=T.x,F+=T.x):T.y<=0&&h<=R&&(u=!1):(o-=T.x,F+=T.x),T.y<=0?h>R&&(V-=T.y,h+=T.y):(V-=T.y,h+=T.y);o<0&&V<0?(s=eZ,V=-V,o=-o,h-=V,F-=o):o<0?(s=lZ,o=-o,F-=o):V<0&&(s=dZ,V=-V,h-=V);break;case dZ:if(c){if(T.x<=0&&(F<=m||Q>=b)){u=!1;break}y(va),o-=T.x,F+=T.x,V=o/c}else y(Js),y(va),T.x<=0?F>m?(o-=T.x,F+=T.x):T.y>=0&&Q>=b&&(u=!1):(o-=T.x,F+=T.x),T.y>=0?Q<b&&(V+=T.y):V+=T.y;o<0&&V<0?(s=lZ,V=-V,o=-o,h-=V,F-=o):o<0?(s=eZ,o=-o,F-=o):V<0&&(s=tZ,V=-V,h-=V);break;case eZ:if(c){if(T.x>=0&&(W>=r||Q>=b)){u=!1;break}y(Oa),o+=T.x,V=o/c}else y(Js),y(Oa),T.x>=0?W<r?o+=T.x:T.y>=0&&Q>=b&&(u=!1):o+=T.x,T.y>=0?Q<b&&(V+=T.y):V+=T.y;o<0&&V<0?(s=tZ,V=-V,o=-o,h-=V,F-=o):o<0?(s=dZ,o=-o,F-=o):V<0&&(s=lZ,V=-V,h-=V);break;case T2:this.move(T.x,T.y),u=!1;break;case G2:this.zoom(wz(i),l),u=!1;break;case J2:if(!T.x||!T.y){u=!1;break}J=H2(this.cropper),F=G.startX-J.left,h=G.startY-J.top,o=a.minWidth,V=a.minHeight,T.x>0?s=T.y>0?eZ:lZ:T.x<0&&(F-=o,s=T.y>0?dZ:tZ),T.y<0&&(h-=V),this.cropped||(bd(this.cropBox,ce),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}u&&(a.width=o,a.height=V,a.left=F,a.top=h,this.action=s,this.renderCropBox()),it(i,function(k){k.startX=k.endX,k.startY=k.endY})}},$z={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&rt(this.dragBox,bh),bd(this.cropBox,ce),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=jl({},this.initialImageData),this.canvasData=jl({},this.initialCanvasData),this.cropBoxData=jl({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(jl(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),bd(this.dragBox,bh),rt(this.cropBox,ce)),this},replace:function(l){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&l&&(this.isImg&&(this.element.src=l),t?(this.url=l,this.image.src=l,this.ready&&(this.viewBoxImage.src=l,it(this.previews,function(d){d.getElementsByTagName("img")[0].src=l}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(l))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,bd(this.cropper,X2)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,rt(this.cropper,X2)),this},destroy:function(){var l=this.element;return l[gl]?(l[gl]=void 0,this.isImg&&this.replaced&&(l.src=this.originalUrl),this.uncreate(),this):this},move:function(l){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l,d=this.canvasData,n=d.left,a=d.top;return this.moveTo(Am(l)?l:n+Number(l),Am(t)?t:a+Number(t))},moveTo:function(l){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l,d=this.canvasData,n=!1;return l=Number(l),t=Number(t),this.ready&&!this.disabled&&this.options.movable&&(Sl(l)&&(d.left=l,n=!0),Sl(t)&&(d.top=t,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(l,t){var d=this.canvasData;return l=Number(l),l<0?l=1/(1-l):l=1+l,this.zoomTo(d.width*l/d.naturalWidth,null,t)},zoomTo:function(l,t,d){var n=this.options,a=this.canvasData,i=a.width,s=a.height,c=a.naturalWidth,F=a.naturalHeight;if(l=Number(l),l>=0&&this.ready&&!this.disabled&&n.zoomable){var h=c*l,o=F*l;if(ys(this.element,Pm,{ratio:l,oldRatio:i/c,originalEvent:d})===!1)return this;if(d){var V=this.pointers,W=H2(this.cropper),Q=V&&Object.keys(V).length?Ez(V):{pageX:d.pageX,pageY:d.pageY};a.left-=(h-i)*((Q.pageX-W.left-a.left)/i),a.top-=(o-s)*((Q.pageY-W.top-a.top)/s)}else Ts(t)&&Sl(t.x)&&Sl(t.y)?(a.left-=(h-i)*((t.x-a.left)/i),a.top-=(o-s)*((t.y-a.top)/s)):(a.left-=(h-i)/2,a.top-=(o-s)/2);a.width=h,a.height=o,this.renderCanvas(!0)}return this},rotate:function(l){return this.rotateTo((this.imageData.rotate||0)+Number(l))},rotateTo:function(l){return l=Number(l),Sl(l)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=l%360,this.renderCanvas(!0,!0)),this},scaleX:function(l){var t=this.imageData.scaleY;return this.scale(l,Sl(t)?t:1)},scaleY:function(l){var t=this.imageData.scaleX;return this.scale(Sl(t)?t:1,l)},scale:function(l){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l,d=this.imageData,n=!1;return l=Number(l),t=Number(t),this.ready&&!this.disabled&&this.options.scalable&&(Sl(l)&&(d.scaleX=l,n=!0),Sl(t)&&(d.scaleY=t,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.options,d=this.imageData,n=this.canvasData,a=this.cropBoxData,i;if(this.ready&&this.cropped){i={x:a.left-n.left,y:a.top-n.top,width:a.width,height:a.height};var s=d.width/d.naturalWidth;if(it(i,function(h,o){i[o]=h/s}),l){var c=Math.round(i.y+i.height),F=Math.round(i.x+i.width);i.x=Math.round(i.x),i.y=Math.round(i.y),i.width=F-i.x,i.height=c-i.y}}else i={x:0,y:0,width:0,height:0};return t.rotatable&&(i.rotate=d.rotate||0),t.scalable&&(i.scaleX=d.scaleX||1,i.scaleY=d.scaleY||1),i},setData:function(l){var t=this.options,d=this.imageData,n=this.canvasData,a={};if(this.ready&&!this.disabled&&Ts(l)){var i=!1;t.rotatable&&Sl(l.rotate)&&l.rotate!==d.rotate&&(d.rotate=l.rotate,i=!0),t.scalable&&(Sl(l.scaleX)&&l.scaleX!==d.scaleX&&(d.scaleX=l.scaleX,i=!0),Sl(l.scaleY)&&l.scaleY!==d.scaleY&&(d.scaleY=l.scaleY,i=!0)),i&&this.renderCanvas(!0,!0);var s=d.width/d.naturalWidth;Sl(l.x)&&(a.left=l.x*s+n.left),Sl(l.y)&&(a.top=l.y*s+n.top),Sl(l.width)&&(a.width=l.width*s),Sl(l.height)&&(a.height=l.height*s),this.setCropBoxData(a)}return this},getContainerData:function(){return this.ready?jl({},this.containerData):{}},getImageData:function(){return this.sized?jl({},this.imageData):{}},getCanvasData:function(){var l=this.canvasData,t={};return this.ready&&it(["left","top","width","height","naturalWidth","naturalHeight"],function(d){t[d]=l[d]}),t},setCanvasData:function(l){var t=this.canvasData,d=t.aspectRatio;return this.ready&&!this.disabled&&Ts(l)&&(Sl(l.left)&&(t.left=l.left),Sl(l.top)&&(t.top=l.top),Sl(l.width)?(t.width=l.width,t.height=l.width/d):Sl(l.height)&&(t.height=l.height,t.width=l.height*d),this.renderCanvas(!0)),this},getCropBoxData:function(){var l=this.cropBoxData,t;return this.ready&&this.cropped&&(t={left:l.left,top:l.top,width:l.width,height:l.height}),t||{}},setCropBoxData:function(l){var t=this.cropBoxData,d=this.options.aspectRatio,n,a;return this.ready&&this.cropped&&!this.disabled&&Ts(l)&&(Sl(l.left)&&(t.left=l.left),Sl(l.top)&&(t.top=l.top),Sl(l.width)&&l.width!==t.width&&(n=!0,t.width=l.width),Sl(l.height)&&l.height!==t.height&&(a=!0,t.height=l.height),d&&(n?t.height=t.width/d:a&&(t.width=t.height*d)),this.renderCropBox()),this},getCroppedCanvas:function(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var t=this.canvasData,d=xz(this.image,this.imageData,t,l);if(!this.cropped)return d;var n=this.getData(l.rounded),a=n.x,i=n.y,s=n.width,c=n.height,F=d.width/Math.floor(t.naturalWidth);F!==1&&(a*=F,i*=F,s*=F,c*=F);var h=s/c,o=En({aspectRatio:h,width:l.maxWidth||1/0,height:l.maxHeight||1/0}),V=En({aspectRatio:h,width:l.minWidth||0,height:l.minHeight||0},"cover"),W=En({aspectRatio:h,width:l.width||(F!==1?d.width:s),height:l.height||(F!==1?d.height:c)}),Q=W.width,m=W.height;Q=Math.min(o.width,Math.max(V.width,Q)),m=Math.min(o.height,Math.max(V.height,m));var R=document.createElement("canvas"),r=R.getContext("2d");R.width=Gs(Q),R.height=Gs(m),r.fillStyle=l.fillColor||"transparent",r.fillRect(0,0,Q,m);var b=l.imageSmoothingEnabled,u=b===void 0?!0:b,J=l.imageSmoothingQuality;r.imageSmoothingEnabled=u,J&&(r.imageSmoothingQuality=J);var G=d.width,T=d.height,y=a,k=i,X,L,D,C,I,H;y<=-s||y>G?(y=0,X=0,D=0,I=0):y<=0?(D=-y,y=0,X=Math.min(G,s+y),I=X):y<=G&&(D=0,X=Math.min(s,G-y),I=X),X<=0||k<=-c||k>T?(k=0,L=0,C=0,H=0):k<=0?(C=-k,k=0,L=Math.min(T,c+k),H=L):k<=T&&(C=0,L=Math.min(c,T-k),H=L);var f=[y,k,X,L];if(I>0&&H>0){var Y=Q/s;f.push(D*Y,C*Y,I*Y,H*Y)}return r.drawImage.apply(r,[d].concat(S2(f.map(function(B){return Math.floor(Gs(B))})))),R},setAspectRatio:function(l){var t=this.options;return!this.disabled&&!Am(l)&&(t.aspectRatio=Math.max(0,l)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(l){var t=this.options,d=this.dragBox,n=this.face;if(this.ready&&!this.disabled){var a=l===Om,i=t.movable&&l===B2;l=a||i?l:Y2,t.dragMode=l,aZ(d,nZ,l),Xs(d,gm,a),Xs(d,jm,i),t.cropBoxMovable||(aZ(n,nZ,l),Xs(n,gm,a),Xs(n,jm,i))}return this}},lL=Nd.Cropper,q2=function(){function e(l){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(oz(this,e),!l||!Tz.test(l.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=l,this.options=jl({},j2,Ts(t)&&t),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 Vz(e,[{key:"init",value:function(){var t=this.element,d=t.tagName.toLowerCase(),n;if(!t[gl]){if(t[gl]=this,d==="img"){if(this.isImg=!0,n=t.getAttribute("src")||"",this.originalUrl=n,!n)return;n=t.src}else d==="canvas"&&window.HTMLCanvasElement&&(n=t.toDataURL());this.load(n)}}},{key:"load",value:function(t){var d=this;if(t){this.url=t,this.imageData={};var n=this.element,a=this.options;if(!a.rotatable&&!a.scalable&&(a.checkOrientation=!1),!a.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Sz.test(t)){Jz.test(t)?this.read(Oz(t)):this.clone();return}var i=new XMLHttpRequest,s=this.clone.bind(this);this.reloading=!0,this.xhr=i,i.onabort=s,i.onerror=s,i.ontimeout=s,i.onprogress=function(){i.getResponseHeader("content-type")!==C2&&i.abort()},i.onload=function(){d.read(i.response)},i.onloadend=function(){d.reloading=!1,d.xhr=null},a.checkCrossOrigin&&P2(t)&&n.crossOrigin&&(t=A2(t)),i.open("GET",t,!0),i.responseType="arraybuffer",i.withCredentials=n.crossOrigin==="use-credentials",i.send()}}},{key:"read",value:function(t){var d=this.options,n=this.imageData,a=Kz(t),i=0,s=1,c=1;if(a>1){this.url=vz(t,C2);var F=fz(a);i=F.rotate,s=F.scaleX,c=F.scaleY}d.rotatable&&(n.rotate=i),d.scalable&&(n.scaleX=s,n.scaleY=c),this.clone()}},{key:"clone",value:function(){var t=this.element,d=this.url,n=t.crossOrigin,a=d;this.options.checkCrossOrigin&&P2(d)&&(n||(n="anonymous"),a=A2(d)),this.crossOrigin=n,this.crossOriginUrl=a;var i=document.createElement("img");n&&(i.crossOrigin=n),i.src=a||d,i.alt=t.alt||"The image to crop",this.image=i,i.onload=this.start.bind(this),i.onerror=this.stop.bind(this),rt(i,y2),t.parentNode.insertBefore(i,t.nextSibling)}},{key:"start",value:function(){var t=this,d=this.image;d.onload=null,d.onerror=null,this.sizing=!0;var n=Nd.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(Nd.navigator.userAgent),a=function(F,h){jl(t.imageData,{naturalWidth:F,naturalHeight:h,aspectRatio:F/h}),t.initialImageData=jl({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(d.naturalWidth&&!n){a(d.naturalWidth,d.naturalHeight);return}var i=document.createElement("img"),s=document.body||document.documentElement;this.sizingImage=i,i.onload=function(){a(i.width,i.height),n||s.removeChild(i)},i.src=d.src,n||(i.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;",s.appendChild(i))}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var t=this.element,d=this.options,n=this.image,a=t.parentNode,i=document.createElement("div");i.innerHTML=Gz;var s=i.querySelector(".".concat(gl,"-container")),c=s.querySelector(".".concat(gl,"-canvas")),F=s.querySelector(".".concat(gl,"-drag-box")),h=s.querySelector(".".concat(gl,"-crop-box")),o=h.querySelector(".".concat(gl,"-face"));this.container=a,this.cropper=s,this.canvas=c,this.dragBox=F,this.cropBox=h,this.viewBox=s.querySelector(".".concat(gl,"-view-box")),this.face=o,c.appendChild(n),rt(t,ce),a.insertBefore(s,t.nextSibling),bd(n,y2),this.initPreview(),this.bind(),d.initialAspectRatio=Math.max(0,d.initialAspectRatio)||NaN,d.aspectRatio=Math.max(0,d.aspectRatio)||NaN,d.viewMode=Math.max(0,Math.min(3,Math.round(d.viewMode)))||0,rt(h,ce),d.guides||rt(h.getElementsByClassName("".concat(gl,"-dashed")),ce),d.center||rt(h.getElementsByClassName("".concat(gl,"-center")),ce),d.background&&rt(s,"".concat(gl,"-bg")),d.highlight||rt(o,bz),d.cropBoxMovable&&(rt(o,jm),aZ(o,nZ,xm)),d.cropBoxResizable||(rt(h.getElementsByClassName("".concat(gl,"-line")),ce),rt(h.getElementsByClassName("".concat(gl,"-point")),ce)),this.render(),this.ready=!0,this.setDragMode(d.dragMode),d.autoCrop&&this.crop(),this.setData(d.data),Ue(d.ready)&&Ye(t,D2,d.ready,{once:!0}),ys(t,D2)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var t=this.cropper.parentNode;t&&t.removeChild(this.cropper),bd(this.element,ce)}}},{key:"uncreate",value: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()}}],[{key:"noConflict",value:function(){return window.Cropper=lL,e}},{key:"setDefaults",value:function(t){jl(j2,Ts(t)&&t)}}])}();jl(q2.prototype,Hz,Pz,Az,_z,qz,$z);function tL(e,l){const t=e.width/l.width,d=e.height/l.height,n=Math.min(t,d),a=l.width*n,i=l.height*n,s=(e.width-a)/2,c=(e.height-i)/2;return{width:a,height:i,left:s,top:c}}function eL(e){return e*(Math.PI/180)}function dL(e,l,t){const d=Math.abs(eL(t));return Math.max((Math.sin(d)*e+Math.cos(d)*l)/l,(Math.sin(d)*l+Math.cos(d)*e)/e)}function nL(e,l,t){return l.left<e.left?{left:e.left,width:t.width}:l.top<e.top?{top:e.top,height:t.height}:l.left+l.width>e.left+e.width?{left:e.left+e.width-t.width,width:t.width}:l.top+l.height>e.top+e.height?{top:e.top+e.height-t.height,height:t.height}:null}function aL(e,l,t){return l.left<e.left?{left:e.left,width:t.left+t.width-e.left}:l.top<e.top?{top:e.top,height:t.top+t.height-e.top}:l.left+l.width>e.left+e.width?{left:t.left,width:e.left+e.width-t.left}:l.top+l.height>e.top+e.height?{top:t.top,height:e.top+e.height-t.top}:null}class iL extends se{constructor(t){super(t);E(this,"imgElement");E(this,"cropper");E(this,"onRotate90Deg",()=>{const{angle90Deg:t}=this.state,d=t-90;this.setState({angle90Deg:d,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(d);const n=this.cropper.getCanvasData(),a=this.cropper.getContainerData(),i=tL(a,n);this.cropper.setCanvasData(i),this.cropper.setCropBoxData(i)});E(this,"onRotateGranular",t=>{const d=Number(t.target.value);this.setState({angleGranular:d});const{angle90Deg:n}=this.state,a=n+d;this.cropper.rotateTo(a);const i=this.cropper.getImageData(),s=dL(i.naturalWidth,i.naturalHeight,d),c=this.cropper.getImageData().scaleX<0?-s:s;this.cropper.scale(c,s)});this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){const{opts:t,storeCropperInstance:d}=this.props;this.cropper=new q2(this.imgElement,t.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),d(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(t){const d=this.cropper.getCanvasData(),n=this.cropper.getCropBoxData(),{prevCropboxData:a}=this.state;if(t.detail.action==="all"){const i=nL(d,n,a);i&&this.cropper.setCropBoxData(i)}else{const i=aL(d,n,a);i&&this.cropper.setCropBoxData(i)}}renderGranularRotate(){const{i18n:t}=this.props,{angleGranular:d}=this.state;return S("label",{role:"tooltip","aria-label":`${d}º`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper",children:S("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:d,min:"-45",max:"45","aria-label":t("rotate")})})}renderRevert(){const{i18n:t,opts:d}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("revert"),onClick:()=>{this.cropper.reset(),this.cropper.setAspectRatio(d.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})},children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0z",fill:"none"}),S("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(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("rotate"),onClick:this.onRotate90Deg,children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),S("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(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("flipHorizontal"),onClick:()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1),children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0z",fill:"none"}),S("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(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("zoomIn"),onClick:()=>this.cropper.zoom(.1),children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24",children:[S("path",{d:"M0 0h24v24H0V0z",fill:"none"}),S("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"}),S("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})]})})}renderZoomOut(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("zoomOut"),onClick:()=>this.cropper.zoom(-.1),children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0V0z",fill:"none"}),S("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(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("aspectRatioSquare"),onClick:()=>this.cropper.setAspectRatio(1),children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("path",{d:"M0 0h24v24H0z",fill:"none"}),S("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(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":t("aspectRatioLandscape"),onClick:()=>this.cropper.setAspectRatio(16/9),children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("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"}),S("path",{fill:"none",d:"M0 0h24v24H0z"})]})})}renderCropWidescreenVertical(){const{i18n:t}=this.props;return S("button",{"data-microtip-position":"top",type:"button","aria-label":t("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(9/16),children:S("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[S("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"}),S("path",{d:"M0 0h24v24H0z",fill:"none"})]})})}render(){const{currentImage:t,opts:d}=this.props,{actions:n}=d;if(t.data==null)throw new Error("File data is empty");const a=URL.createObjectURL(t.data);return S("div",{className:"uppy-ImageCropper",children:[S("div",{className:"uppy-ImageCropper-container",children:S("img",{className:"uppy-ImageCropper-image",alt:t.name,src:a,ref:i=>{this.imgElement=i}})}),S("div",{className:"uppy-ImageCropper-controls",children:[n.revert&&this.renderRevert(),n.rotate&&this.renderRotate(),n.granularRotate&&this.renderGranularRotate(),n.flip&&this.renderFlip(),n.zoomIn&&this.renderZoomIn(),n.zoomOut&&this.renderZoomOut(),n.cropSquare&&this.renderCropSquare(),n.cropWidescreen&&this.renderCropWidescreen(),n.cropWidescreenVertical&&this.renderCropWidescreenVertical()]})]})}}const sL={strings:{revert:"Reset",rotate:"Rotate 90°",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}},$2={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},lM={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},cL={quality:.8,actions:lM,cropperOptions:$2};class tM extends Ln{constructor(t,d){super(t,{...cL,...d,actions:{...lM,...d==null?void 0:d.actions},cropperOptions:{...$2,...d==null?void 0:d.cropperOptions}});E(this,"cropper");E(this,"save",()=>{const t=a=>{const{currentImage:i}=this.getPluginState();this.uppy.setFileState(i.id,{data:new File([a],i.name??this.i18n("unnamed"),{type:a.type}),size:a.size,preview:void 0});const s=this.uppy.getFile(i.id);this.uppy.emit("thumbnail:request",s),this.setPluginState({currentImage:s}),this.uppy.emit("file-editor:complete",s)},{currentImage:d}=this.getPluginState(),n=this.cropper.getCroppedCanvas({});n.width%2!==0&&this.cropper.setData({width:n.width-1}),n.height%2!==0&&this.cropper.setData({height:n.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(t,d.type,this.opts.quality)});E(this,"storeCropperInstance",t=>{this.cropper=t});E(this,"selectFile",t=>{this.uppy.emit("file-editor:start",t),this.setPluginState({currentImage:t})});this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=sL,this.i18nInit()}canEditFile(t){if(!t.type||t.isRemote)return!1;const d=t.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(d)}install(){this.setPluginState({currentImage:null});const{target:t}=this.opts;t&&this.mount(t,this)}uninstall(){const{currentImage:t}=this.getPluginState();if(t){const d=this.uppy.getFile(t.id);this.uppy.emit("file-editor:cancel",d)}this.unmount()}render(){const{currentImage:t}=this.getPluginState();return t===null||t.isRemote?null:S(iL,{currentImage:t,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}}E(tM,"VERSION",Fz.version);const UL=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],ZL=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],FL=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],hL=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],eM=(e,l,t)=>{let d=e;return typeof l=="string"||Array.isArray(l)?d=e.toLocaleString(l,t):(l===!0||t!==void 0)&&(d=e.toLocaleString(void 0,t)),d},dM=e=>{if(typeof e=="number")return Math.log10(e);const l=e.toString(10);return l.length+Math.log10(`0.${l.slice(0,15)}`)},oL=e=>typeof e=="number"?Math.log(e):dM(e)*Math.log(10),VL=(e,l)=>{if(typeof e=="number")return e/l;const t=e/BigInt(l),d=e%BigInt(l);return Number(t)+Number(d)/l},nM=(e,l)=>{if(l===void 0)return e;if(typeof l!="number"||!Number.isSafeInteger(l)||l<0)throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof l}: ${l}`);return l===0?e:e.length<l?e.padStart(l," "):e},WL=e=>{const{minimumFractionDigits:l,maximumFractionDigits:t}=e;if(!(l===void 0&&t===void 0))return{...l!==void 0&&{minimumFractionDigits:l},...t!==void 0&&{maximumFractionDigits:t},roundingMode:"trunc"}};function QL(e,l){if(typeof e!="bigint"&&!Number.isFinite(e))throw new TypeError(`Expected a finite number, got ${typeof e}: ${e}`);l={bits:!1,binary:!1,space:!0,nonBreakingSpace:!1,...l};const t=l.bits?l.binary?hL:FL:l.binary?ZL:UL,d=l.space?l.nonBreakingSpace?" ":" ":"",n=typeof e=="number"?e===0:e===0n;if(l.signed&&n){const F=` 0${d}${t[0]}`;return nM(F,l.fixedWidth)}const a=e<0,i=a?"-":l.signed?"+":"";a&&(e=-e);const s=WL(l);let c;if(e<1){const F=eM(e,l.locale,s);c=i+F+d+t[0]}else{const F=Math.min(Math.floor(l.binary?oL(e)/Math.log(1024):dM(e)/3),t.length-1);if(e=VL(e,(l.binary?1024:1e3)**F),!s){const V=Math.max(3,Math.floor(e).toString().length);e=e.toPrecision(V)}const h=eM(Number(e),l.locale,s),o=t[F];c=i+h+d+o}return nM(c,l.fixedWidth)}var mL=Object.defineProperty,aM=e=>{throw TypeError(e)},RL=(e,l,t)=>l in e?mL(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,hl=(e,l,t)=>RL(e,typeof l!="symbol"?l+"":l,t),lR=(e,l,t)=>l.has(e)||aM("Cannot "+t),U=(e,l,t)=>(lR(e,l,"read from private field"),t?t.call(e):l.get(e)),M=(e,l,t)=>l.has(e)?aM("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(e):l.set(e,t),N=(e,l,t,d)=>(lR(e,l,"write to private field"),l.set(e,t),t),p=(e,l,t)=>(lR(e,l,"access private method"),t),le=(e,l,t,d)=>({set _(n){N(e,l,n)},get _(){return U(e,l,d)}}),NL={9306:(e,l,t)=>{var d=t(4901),n=t(6823),a=TypeError;e.exports=function(i){if(d(i))return i;throw new a(n(i)+" is not a function")}},3506:(e,l,t)=>{var d=t(3925),n=String,a=TypeError;e.exports=function(i){if(d(i))return i;throw new a("Can't set "+n(i)+" as a prototype")}},7080:(e,l,t)=>{var d=t(4402).has;e.exports=function(n){return d(n),n}},679:(e,l,t)=>{var d=t(1625),n=TypeError;e.exports=function(a,i){if(d(i,a))return a;throw new n("Incorrect invocation")}},8551:(e,l,t)=>{var d=t(34),n=String,a=TypeError;e.exports=function(i){if(d(i))return i;throw new a(n(i)+" is not an object")}},7811:e=>{e.exports=typeof ArrayBuffer<"u"&&typeof DataView<"u"},7394:(e,l,t)=>{var d=t(4576),n=t(6706),a=t(2195),i=d.ArrayBuffer,s=d.TypeError;e.exports=i&&n(i.prototype,"byteLength","get")||function(c){if(a(c)!=="ArrayBuffer")throw new s("ArrayBuffer expected");return c.byteLength}},3238:(e,l,t)=>{var d=t(4576),n=t(7476),a=t(7394),i=d.ArrayBuffer,s=i&&i.prototype,c=s&&n(s.slice);e.exports=function(F){if(a(F)!==0||!c)return!1;try{return c(F,0,0),!1}catch{return!0}}},5169:(e,l,t)=>{var d=t(3238),n=TypeError;e.exports=function(a){if(d(a))throw new n("ArrayBuffer is detached");return a}},5636:(e,l,t)=>{var d=t(4576),n=t(9504),a=t(6706),i=t(7696),s=t(5169),c=t(7394),F=t(4483),h=t(1548),o=d.structuredClone,V=d.ArrayBuffer,W=d.DataView,Q=Math.min,m=V.prototype,R=W.prototype,r=n(m.slice),b=a(m,"resizable","get"),u=a(m,"maxByteLength","get"),J=n(R.getInt8),G=n(R.setInt8);e.exports=(h||F)&&function(T,y,k){var X=c(T),L=y===void 0?X:i(y),D=!b||!b(T),C;if(s(T),h&&(T=o(T,{transfer:[T]}),X===L&&(k||D)))return T;if(X>=L&&(!k||D))C=r(T,0,L);else{var I=k&&!D&&u?{maxByteLength:u(T)}:void 0;C=new V(L,I);for(var H=new W(T),f=new W(C),Y=Q(L,X),B=0;B<Y;B++)G(f,B,J(H,B))}return h||F(T),C}},4644:(e,l,t)=>{var d=t(7811),n=t(3724),a=t(4576),i=t(4901),s=t(34),c=t(9297),F=t(6955),h=t(6823),o=t(6699),V=t(6840),W=t(2106),Q=t(1625),m=t(2787),R=t(2967),r=t(8227),b=t(3392),u=t(1181),J=u.enforce,G=u.get,T=a.Int8Array,y=T&&T.prototype,k=a.Uint8ClampedArray,X=k&&k.prototype,L=T&&m(T),D=y&&m(y),C=Object.prototype,I=a.TypeError,H=r("toStringTag"),f=b("TYPED_ARRAY_TAG"),Y="TypedArrayConstructor",B=d&&!!R&&F(a.opera)!=="Opera",z=!1,g,w,O,K={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},x={BigInt64Array:8,BigUint64Array:8},_=function(Ql){if(!s(Ql))return!1;var _l=F(Ql);return _l==="DataView"||c(K,_l)||c(x,_l)},al=function(Ql){var _l=m(Ql);if(s(_l)){var Tt=G(_l);return Tt&&c(Tt,Y)?Tt[Y]:al(_l)}},P=function(Ql){if(!s(Ql))return!1;var _l=F(Ql);return c(K,_l)||c(x,_l)},A=function(Ql){if(P(Ql))return Ql;throw new I("Target is not a typed array")},tl=function(Ql){if(i(Ql)&&(!R||Q(L,Ql)))return Ql;throw new I(h(Ql)+" is not a typed array constructor")},el=function(Ql,_l,Tt,Hd){if(n){if(Tt)for(var ie in K){var _t=a[ie];if(_t&&c(_t.prototype,Ql))try{delete _t.prototype[Ql]}catch{try{_t.prototype[Ql]=_l}catch{}}}(!D[Ql]||Tt)&&V(D,Ql,Tt?_l:B&&y[Ql]||_l,Hd)}},Bl=function(Ql,_l,Tt){var Hd,ie;if(n){if(R){if(Tt){for(Hd in K)if(ie=a[Hd],ie&&c(ie,Ql))try{delete ie[Ql]}catch{}}if(!L[Ql]||Tt)try{return V(L,Ql,Tt?_l:B&&L[Ql]||_l)}catch{}else return}for(Hd in K)ie=a[Hd],ie&&(!ie[Ql]||Tt)&&V(ie,Ql,_l)}};for(g in K)w=a[g],O=w&&w.prototype,O?J(O)[Y]=w:B=!1;for(g in x)w=a[g],O=w&&w.prototype,O&&(J(O)[Y]=w);if((!B||!i(L)||L===Function.prototype)&&(L=function(){throw new I("Incorrect invocation")},B))for(g in K)a[g]&&R(a[g],L);if((!B||!D||D===C)&&(D=L.prototype,B))for(g in K)a[g]&&R(a[g].prototype,D);if(B&&m(X)!==D&&R(X,D),n&&!c(D,H)){z=!0,W(D,H,{configurable:!0,get:function(){return s(this)?this[f]:void 0}});for(g in K)a[g]&&o(a[g],f,g)}e.exports={NATIVE_ARRAY_BUFFER_VIEWS:B,TYPED_ARRAY_TAG:z&&f,aTypedArray:A,aTypedArrayConstructor:tl,exportTypedArrayMethod:el,exportTypedArrayStaticMethod:Bl,getTypedArrayConstructor:al,isView:_,isTypedArray:P,TypedArray:L,TypedArrayPrototype:D}},5370:(e,l,t)=>{var d=t(6198);e.exports=function(n,a,i){for(var s=0,c=arguments.length>2?i:d(a),F=new n(c);c>s;)F[s]=a[s++];return F}},9617:(e,l,t)=>{var d=t(5397),n=t(5610),a=t(6198),i=function(s){return function(c,F,h){var o=d(c),V=a(o);if(V===0)return!s&&-1;var W=n(h,V),Q;if(s&&F!==F){for(;V>W;)if(Q=o[W++],Q!==Q)return!0}else for(;V>W;W++)if((s||W in o)&&o[W]===F)return s||W||0;return!s&&-1}};e.exports={includes:i(!0),indexOf:i(!1)}},4527:(e,l,t)=>{var d=t(3724),n=t(4376),a=TypeError,i=Object.getOwnPropertyDescriptor,s=d&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(c){return c instanceof TypeError}}();e.exports=s?function(c,F){if(n(c)&&!i(c,"length").writable)throw new a("Cannot set read only .length");return c.length=F}:function(c,F){return c.length=F}},7680:(e,l,t)=>{var d=t(9504);e.exports=d([].slice)},7628:(e,l,t)=>{var d=t(6198);e.exports=function(n,a){for(var i=d(n),s=new a(i),c=0;c<i;c++)s[c]=n[i-c-1];return s}},9928:(e,l,t)=>{var d=t(6198),n=t(1291),a=RangeError;e.exports=function(i,s,c,F){var h=d(i),o=n(c),V=o<0?h+o:o;if(V>=h||V<0)throw new a("Incorrect index");for(var W=new s(h),Q=0;Q<h;Q++)W[Q]=Q===V?F:i[Q];return W}},6319:(e,l,t)=>{var d=t(8551),n=t(9539);e.exports=function(a,i,s,c){try{return c?i(d(s)[0],s[1]):i(s)}catch(F){n(a,"throw",F)}}},2195:(e,l,t)=>{var d=t(9504),n=d({}.toString),a=d("".slice);e.exports=function(i){return a(n(i),8,-1)}},6955:(e,l,t)=>{var d=t(2140),n=t(4901),a=t(2195),i=t(8227),s=i("toStringTag"),c=Object,F=a(function(){return arguments}())==="Arguments",h=function(o,V){try{return o[V]}catch{}};e.exports=d?a:function(o){var V,W,Q;return o===void 0?"Undefined":o===null?"Null":typeof(W=h(V=c(o),s))=="string"?W:F?a(V):(Q=a(V))==="Object"&&n(V.callee)?"Arguments":Q}},7740:(e,l,t)=>{var d=t(9297),n=t(5031),a=t(7347),i=t(4913);e.exports=function(s,c,F){for(var h=n(c),o=i.f,V=a.f,W=0;W<h.length;W++){var Q=h[W];!d(s,Q)&&!(F&&d(F,Q))&&o(s,Q,V(c,Q))}}},2211:(e,l,t)=>{var d=t(9039);e.exports=!d(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})},2529:e=>{e.exports=function(l,t){return{value:l,done:t}}},6699:(e,l,t)=>{var d=t(3724),n=t(4913),a=t(6980);e.exports=d?function(i,s,c){return n.f(i,s,a(1,c))}:function(i,s,c){return i[s]=c,i}},6980:e=>{e.exports=function(l,t){return{enumerable:!(l&1),configurable:!(l&2),writable:!(l&4),value:t}}},4659:(e,l,t)=>{var d=t(3724),n=t(4913),a=t(6980);e.exports=function(i,s,c){d?n.f(i,s,a(0,c)):i[s]=c}},2106:(e,l,t)=>{var d=t(283),n=t(4913);e.exports=function(a,i,s){return s.get&&d(s.get,i,{getter:!0}),s.set&&d(s.set,i,{setter:!0}),n.f(a,i,s)}},6840:(e,l,t)=>{var d=t(4901),n=t(4913),a=t(283),i=t(9433);e.exports=function(s,c,F,h){h||(h={});var o=h.enumerable,V=h.name!==void 0?h.name:c;if(d(F)&&a(F,V,h),h.global)o?s[c]=F:i(c,F);else{try{h.unsafe?s[c]&&(o=!0):delete s[c]}catch{}o?s[c]=F:n.f(s,c,{value:F,enumerable:!1,configurable:!h.nonConfigurable,writable:!h.nonWritable})}return s}},6279:(e,l,t)=>{var d=t(6840);e.exports=function(n,a,i){for(var s in a)d(n,s,a[s],i);return n}},9433:(e,l,t)=>{var d=t(4576),n=Object.defineProperty;e.exports=function(a,i){try{n(d,a,{value:i,configurable:!0,writable:!0})}catch{d[a]=i}return i}},3724:(e,l,t)=>{var d=t(9039);e.exports=!d(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})},4483:(e,l,t)=>{var d=t(4576),n=t(9429),a=t(1548),i=d.structuredClone,s=d.ArrayBuffer,c=d.MessageChannel,F=!1,h,o,V,W;if(a)F=function(Q){i(Q,{transfer:[Q]})};else if(s)try{c||(h=n("worker_threads"),h&&(c=h.MessageChannel)),c&&(o=new c,V=new s(2),W=function(Q){o.port1.postMessage(null,[Q])},V.byteLength===2&&(W(V),V.byteLength===0&&(F=W)))}catch{}e.exports=F},4055:(e,l,t)=>{var d=t(4576),n=t(34),a=d.document,i=n(a)&&n(a.createElement);e.exports=function(s){return i?a.createElement(s):{}}},6837:e=>{var l=TypeError,t=9007199254740991;e.exports=function(d){if(d>t)throw l("Maximum allowed index exceeded");return d}},5002:e=>{e.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},8727:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6193:(e,l,t)=>{var d=t(4215);e.exports=d==="NODE"},2839:(e,l,t)=>{var d=t(4576),n=d.navigator,a=n&&n.userAgent;e.exports=a?String(a):""},9519:(e,l,t)=>{var d=t(4576),n=t(2839),a=d.process,i=d.Deno,s=a&&a.versions||i&&i.version,c=s&&s.v8,F,h;c&&(F=c.split("."),h=F[0]>0&&F[0]<4?1:+(F[0]+F[1])),!h&&n&&(F=n.match(/Edge\/(\d+)/),(!F||F[1]>=74)&&(F=n.match(/Chrome\/(\d+)/),F&&(h=+F[1]))),e.exports=h},4215:(e,l,t)=>{var d=t(4576),n=t(2839),a=t(2195),i=function(s){return n.slice(0,s.length)===s};e.exports=function(){return i("Bun/")?"BUN":i("Cloudflare-Workers")?"CLOUDFLARE":i("Deno/")?"DENO":i("Node.js/")?"NODE":d.Bun&&typeof Bun.version=="string"?"BUN":d.Deno&&typeof Deno.version=="object"?"DENO":a(d.process)==="process"?"NODE":d.window&&d.document?"BROWSER":"REST"}()},8574:(e,l,t)=>{var d=t(9504),n=Error,a=d("".replace),i=function(F){return String(new n(F).stack)}("zxcasd"),s=/\n\s*at [^:]*:[^\n]*/,c=s.test(i);e.exports=function(F,h){if(c&&typeof F=="string"&&!n.prepareStackTrace)for(;h--;)F=a(F,s,"");return F}},6518:(e,l,t)=>{var d=t(4576),n=t(7347).f,a=t(6699),i=t(6840),s=t(9433),c=t(7740),F=t(2796);e.exports=function(h,o){var V=h.target,W=h.global,Q=h.stat,m,R,r,b,u,J;if(W?R=d:Q?R=d[V]||s(V,{}):R=d[V]&&d[V].prototype,R)for(r in o){if(u=o[r],h.dontCallGetSet?(J=n(R,r),b=J&&J.value):b=R[r],m=F(W?r:V+(Q?".":"#")+r,h.forced),!m&&b!==void 0){if(typeof u==typeof b)continue;c(u,b)}(h.sham||b&&b.sham)&&a(u,"sham",!0),i(R,r,u,h)}}},9039:e=>{e.exports=function(l){try{return!!l()}catch{return!0}}},8745:(e,l,t)=>{var d=t(616),n=Function.prototype,a=n.apply,i=n.call;e.exports=typeof Reflect=="object"&&Reflect.apply||(d?i.bind(a):function(){return i.apply(a,arguments)})},6080:(e,l,t)=>{var d=t(7476),n=t(9306),a=t(616),i=d(d.bind);e.exports=function(s,c){return n(s),c===void 0?s:a?i(s,c):function(){return s.apply(c,arguments)}}},616:(e,l,t)=>{var d=t(9039);e.exports=!d(function(){var n=(function(){}).bind();return typeof n!="function"||n.hasOwnProperty("prototype")})},9565:(e,l,t)=>{var d=t(616),n=Function.prototype.call;e.exports=d?n.bind(n):function(){return n.apply(n,arguments)}},350:(e,l,t)=>{var d=t(3724),n=t(9297),a=Function.prototype,i=d&&Object.getOwnPropertyDescriptor,s=n(a,"name"),c=s&&(function(){}).name==="something",F=s&&(!d||d&&i(a,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:F}},6706:(e,l,t)=>{var d=t(9504),n=t(9306);e.exports=function(a,i,s){try{return d(n(Object.getOwnPropertyDescriptor(a,i)[s]))}catch{}}},7476:(e,l,t)=>{var d=t(2195),n=t(9504);e.exports=function(a){if(d(a)==="Function")return n(a)}},9504:(e,l,t)=>{var d=t(616),n=Function.prototype,a=n.call,i=d&&n.bind.bind(a,a);e.exports=d?i:function(s){return function(){return a.apply(s,arguments)}}},9429:(e,l,t)=>{var d=t(4576),n=t(6193);e.exports=function(a){if(n){try{return d.process.getBuiltinModule(a)}catch{}try{return Function('return require("'+a+'")')()}catch{}}}},7751:(e,l,t)=>{var d=t(4576),n=t(4901),a=function(i){return n(i)?i:void 0};e.exports=function(i,s){return arguments.length<2?a(d[i]):d[i]&&d[i][s]}},1767:e=>{e.exports=function(l){return{iterator:l,next:l.next,done:!1}}},8646:(e,l,t)=>{var d=t(9565),n=t(8551),a=t(1767),i=t(851);e.exports=function(s,c){(!c||typeof s!="string")&&n(s);var F=i(s);return a(n(F!==void 0?d(F,s):s))}},851:(e,l,t)=>{var d=t(6955),n=t(5966),a=t(4117),i=t(6269),s=t(8227),c=s("iterator");e.exports=function(F){if(!a(F))return n(F,c)||n(F,"@@iterator")||i[d(F)]}},81:(e,l,t)=>{var d=t(9565),n=t(9306),a=t(8551),i=t(6823),s=t(851),c=TypeError;e.exports=function(F,h){var o=arguments.length<2?s(F):h;if(n(o))return a(d(o,F));throw new c(i(F)+" is not iterable")}},5966:(e,l,t)=>{var d=t(9306),n=t(4117);e.exports=function(a,i){var s=a[i];return n(s)?void 0:d(s)}},3789:(e,l,t)=>{var d=t(9306),n=t(8551),a=t(9565),i=t(1291),s=t(1767),c="Invalid size",F=RangeError,h=TypeError,o=Math.max,V=function(W,Q){this.set=W,this.size=o(Q,0),this.has=d(W.has),this.keys=d(W.keys)};V.prototype={getIterator:function(){return s(n(a(this.keys,this.set)))},includes:function(W){return a(this.has,this.set,W)}},e.exports=function(W){n(W);var Q=+W.size;if(Q!==Q)throw new h(c);var m=i(Q);if(m<0)throw new F(c);return new V(W,m)}},4576:function(e){var l=function(t){return t&&t.Math===Math&&t};e.exports=l(typeof globalThis=="object"&&globalThis)||l(typeof window=="object"&&window)||l(typeof self=="object"&&self)||l(typeof global=="object"&&global)||l(typeof this=="object"&&this)||function(){return this}()||Function("return this")()},9297:(e,l,t)=>{var d=t(9504),n=t(8981),a=d({}.hasOwnProperty);e.exports=Object.hasOwn||function(i,s){return a(n(i),s)}},421:e=>{e.exports={}},397:(e,l,t)=>{var d=t(7751);e.exports=d("document","documentElement")},5917:(e,l,t)=>{var d=t(3724),n=t(9039),a=t(4055);e.exports=!d&&!n(function(){return Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a!==7})},7055:(e,l,t)=>{var d=t(9504),n=t(9039),a=t(2195),i=Object,s=d("".split);e.exports=n(function(){return!i("z").propertyIsEnumerable(0)})?function(c){return a(c)==="String"?s(c,""):i(c)}:i},3167:(e,l,t)=>{var d=t(4901),n=t(34),a=t(2967);e.exports=function(i,s,c){var F,h;return a&&d(F=s.constructor)&&F!==c&&n(h=F.prototype)&&h!==c.prototype&&a(i,h),i}},3706:(e,l,t)=>{var d=t(9504),n=t(4901),a=t(7629),i=d(Function.toString);n(a.inspectSource)||(a.inspectSource=function(s){return i(s)}),e.exports=a.inspectSource},1181:(e,l,t)=>{var d=t(8622),n=t(4576),a=t(34),i=t(6699),s=t(9297),c=t(7629),F=t(6119),h=t(421),o="Object already initialized",V=n.TypeError,W=n.WeakMap,Q,m,R,r=function(G){return R(G)?m(G):Q(G,{})},b=function(G){return function(T){var y;if(!a(T)||(y=m(T)).type!==G)throw new V("Incompatible receiver, "+G+" required");return y}};if(d||c.state){var u=c.state||(c.state=new W);u.get=u.get,u.has=u.has,u.set=u.set,Q=function(G,T){if(u.has(G))throw new V(o);return T.facade=G,u.set(G,T),T},m=function(G){return u.get(G)||{}},R=function(G){return u.has(G)}}else{var J=F("state");h[J]=!0,Q=function(G,T){if(s(G,J))throw new V(o);return T.facade=G,i(G,J,T),T},m=function(G){return s(G,J)?G[J]:{}},R=function(G){return s(G,J)}}e.exports={set:Q,get:m,has:R,enforce:r,getterFor:b}},4209:(e,l,t)=>{var d=t(8227),n=t(6269),a=d("iterator"),i=Array.prototype;e.exports=function(s){return s!==void 0&&(n.Array===s||i[a]===s)}},4376:(e,l,t)=>{var d=t(2195);e.exports=Array.isArray||function(n){return d(n)==="Array"}},1108:(e,l,t)=>{var d=t(6955);e.exports=function(n){var a=d(n);return a==="BigInt64Array"||a==="BigUint64Array"}},4901:e=>{var l=typeof document=="object"&&document.all;e.exports=typeof l>"u"&&l!==void 0?function(t){return typeof t=="function"||t===l}:function(t){return typeof t=="function"}},2796:(e,l,t)=>{var d=t(9039),n=t(4901),a=/#|\.prototype\./,i=function(o,V){var W=c[s(o)];return W===h?!0:W===F?!1:n(V)?d(V):!!V},s=i.normalize=function(o){return String(o).replace(a,".").toLowerCase()},c=i.data={},F=i.NATIVE="N",h=i.POLYFILL="P";e.exports=i},4117:e=>{e.exports=function(l){return l==null}},34:(e,l,t)=>{var d=t(4901);e.exports=function(n){return typeof n=="object"?n!==null:d(n)}},3925:(e,l,t)=>{var d=t(34);e.exports=function(n){return d(n)||n===null}},6395:e=>{e.exports=!1},757:(e,l,t)=>{var d=t(7751),n=t(4901),a=t(1625),i=t(7040),s=Object;e.exports=i?function(c){return typeof c=="symbol"}:function(c){var F=d("Symbol");return n(F)&&a(F.prototype,s(c))}},507:(e,l,t)=>{var d=t(9565);e.exports=function(n,a,i){for(var s=i?n:n.iterator,c=n.next,F,h;!(F=d(c,s)).done;)if(h=a(F.value),h!==void 0)return h}},2652:(e,l,t)=>{var d=t(6080),n=t(9565),a=t(8551),i=t(6823),s=t(4209),c=t(6198),F=t(1625),h=t(81),o=t(851),V=t(9539),W=TypeError,Q=function(R,r){this.stopped=R,this.result=r},m=Q.prototype;e.exports=function(R,r,b){var u=b&&b.that,J=!!(b&&b.AS_ENTRIES),G=!!(b&&b.IS_RECORD),T=!!(b&&b.IS_ITERATOR),y=!!(b&&b.INTERRUPTED),k=d(r,u),X,L,D,C,I,H,f,Y=function(z){return X&&V(X,"normal",z),new Q(!0,z)},B=function(z){return J?(a(z),y?k(z[0],z[1],Y):k(z[0],z[1])):y?k(z,Y):k(z)};if(G)X=R.iterator;else if(T)X=R;else{if(L=o(R),!L)throw new W(i(R)+" is not iterable");if(s(L)){for(D=0,C=c(R);C>D;D++)if(I=B(R[D]),I&&F(m,I))return I;return new Q(!1)}X=h(R,L)}for(H=G?R.next:X.next;!(f=n(H,X)).done;){try{I=B(f.value)}catch(z){V(X,"throw",z)}if(typeof I=="object"&&I&&F(m,I))return I}return new Q(!1)}},9539:(e,l,t)=>{var d=t(9565),n=t(8551),a=t(5966);e.exports=function(i,s,c){var F,h;n(i);try{if(F=a(i,"return"),!F){if(s==="throw")throw c;return c}F=d(F,i)}catch(o){h=!0,F=o}if(s==="throw")throw c;if(h)throw F;return n(F),c}},9462:(e,l,t)=>{var d=t(9565),n=t(2360),a=t(6699),i=t(6279),s=t(8227),c=t(1181),F=t(5966),h=t(7657).IteratorPrototype,o=t(2529),V=t(9539),W=s("toStringTag"),Q="IteratorHelper",m="WrapForValidIterator",R=c.set,r=function(J){var G=c.getterFor(J?m:Q);return i(n(h),{next:function(){var T=G(this);if(J)return T.nextHandler();try{var y=T.done?void 0:T.nextHandler();return o(y,T.done)}catch(k){throw T.done=!0,k}},return:function(){var T=G(this),y=T.iterator;if(T.done=!0,J){var k=F(y,"return");return k?d(k,y):o(void 0,!0)}if(T.inner)try{V(T.inner.iterator,"normal")}catch(X){return V(y,"throw",X)}return y&&V(y,"normal"),o(void 0,!0)}})},b=r(!0),u=r(!1);a(u,W,"Iterator Helper"),e.exports=function(J,G){var T=function(y,k){k?(k.iterator=y.iterator,k.next=y.next):k=y,k.type=G?m:Q,k.nextHandler=J,k.counter=0,k.done=!1,R(this,k)};return T.prototype=G?b:u,T}},713:(e,l,t)=>{var d=t(9565),n=t(9306),a=t(8551),i=t(1767),s=t(9462),c=t(6319),F=s(function(){var h=this.iterator,o=a(d(this.next,h)),V=this.done=!!o.done;if(!V)return c(h,this.mapper,[o.value,this.counter++],!0)});e.exports=function(h){return a(this),n(h),new F(i(this),{mapper:h})}},7657:(e,l,t)=>{var d=t(9039),n=t(4901),a=t(34),i=t(2360),s=t(2787),c=t(6840),F=t(8227),h=t(6395),o=F("iterator"),V=!1,W,Q,m;[].keys&&(m=[].keys(),"next"in m?(Q=s(s(m)),Q!==Object.prototype&&(W=Q)):V=!0);var R=!a(W)||d(function(){var r={};return W[o].call(r)!==r});R?W={}:h&&(W=i(W)),n(W[o])||c(W,o,function(){return this}),e.exports={IteratorPrototype:W,BUGGY_SAFARI_ITERATORS:V}},6269:e=>{e.exports={}},6198:(e,l,t)=>{var d=t(8014);e.exports=function(n){return d(n.length)}},283:(e,l,t)=>{var d=t(9504),n=t(9039),a=t(4901),i=t(9297),s=t(3724),c=t(350).CONFIGURABLE,F=t(3706),h=t(1181),o=h.enforce,V=h.get,W=String,Q=Object.defineProperty,m=d("".slice),R=d("".replace),r=d([].join),b=s&&!n(function(){return Q(function(){},"length",{value:8}).length!==8}),u=String(String).split("String"),J=e.exports=function(G,T,y){m(W(T),0,7)==="Symbol("&&(T="["+R(W(T),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),y&&y.getter&&(T="get "+T),y&&y.setter&&(T="set "+T),(!i(G,"name")||c&&G.name!==T)&&(s?Q(G,"name",{value:T,configurable:!0}):G.name=T),b&&y&&i(y,"arity")&&G.length!==y.arity&&Q(G,"length",{value:y.arity});try{y&&i(y,"constructor")&&y.constructor?s&&Q(G,"prototype",{writable:!1}):G.prototype&&(G.prototype=void 0)}catch{}var k=o(G);return i(k,"source")||(k.source=r(u,typeof T=="string"?T:"")),G};Function.prototype.toString=J(function(){return a(this)&&V(this).source||F(this)},"toString")},741:e=>{var l=Math.ceil,t=Math.floor;e.exports=Math.trunc||function(d){var n=+d;return(n>0?t:l)(n)}},6043:(e,l,t)=>{var d=t(9306),n=TypeError,a=function(i){var s,c;this.promise=new i(function(F,h){if(s!==void 0||c!==void 0)throw new n("Bad Promise constructor");s=F,c=h}),this.resolve=d(s),this.reject=d(c)};e.exports.f=function(i){return new a(i)}},2603:(e,l,t)=>{var d=t(655);e.exports=function(n,a){return n===void 0?arguments.length<2?"":a:d(n)}},4149:e=>{var l=RangeError;e.exports=function(t){if(t===t)return t;throw new l("NaN is not allowed")}},2360:(e,l,t)=>{var d=t(8551),n=t(6801),a=t(8727),i=t(421),s=t(397),c=t(4055),F=t(6119),h=">",o="<",V="prototype",W="script",Q=F("IE_PROTO"),m=function(){},R=function(G){return o+W+h+G+o+"/"+W+h},r=function(G){G.write(R("")),G.close();var T=G.parentWindow.Object;return G=null,T},b=function(){var G=c("iframe"),T="java"+W+":",y;return G.style.display="none",s.appendChild(G),G.src=String(T),y=G.contentWindow.document,y.open(),y.write(R("document.F=Object")),y.close(),y.F},u,J=function(){try{u=new ActiveXObject("htmlfile")}catch{}J=typeof document<"u"?document.domain&&u?r(u):b():r(u);for(var G=a.length;G--;)delete J[V][a[G]];return J()};i[Q]=!0,e.exports=Object.create||function(G,T){var y;return G!==null?(m[V]=d(G),y=new m,m[V]=null,y[Q]=G):y=J(),T===void 0?y:n.f(y,T)}},6801:(e,l,t)=>{var d=t(3724),n=t(8686),a=t(4913),i=t(8551),s=t(5397),c=t(1072);l.f=d&&!n?Object.defineProperties:function(F,h){i(F);for(var o=s(h),V=c(h),W=V.length,Q=0,m;W>Q;)a.f(F,m=V[Q++],o[m]);return F}},4913:(e,l,t)=>{var d=t(3724),n=t(5917),a=t(8686),i=t(8551),s=t(6969),c=TypeError,F=Object.defineProperty,h=Object.getOwnPropertyDescriptor,o="enumerable",V="configurable",W="writable";l.f=d?a?function(Q,m,R){if(i(Q),m=s(m),i(R),typeof Q=="function"&&m==="prototype"&&"value"in R&&W in R&&!R[W]){var r=h(Q,m);r&&r[W]&&(Q[m]=R.value,R={configurable:V in R?R[V]:r[V],enumerable:o in R?R[o]:r[o],writable:!1})}return F(Q,m,R)}:F:function(Q,m,R){if(i(Q),m=s(m),i(R),n)try{return F(Q,m,R)}catch{}if("get"in R||"set"in R)throw new c("Accessors not supported");return"value"in R&&(Q[m]=R.value),Q}},7347:(e,l,t)=>{var d=t(3724),n=t(9565),a=t(8773),i=t(6980),s=t(5397),c=t(6969),F=t(9297),h=t(5917),o=Object.getOwnPropertyDescriptor;l.f=d?o:function(V,W){if(V=s(V),W=c(W),h)try{return o(V,W)}catch{}if(F(V,W))return i(!n(a.f,V,W),V[W])}},8480:(e,l,t)=>{var d=t(1828),n=t(8727),a=n.concat("length","prototype");l.f=Object.getOwnPropertyNames||function(i){return d(i,a)}},3717:(e,l)=>{l.f=Object.getOwnPropertySymbols},2787:(e,l,t)=>{var d=t(9297),n=t(4901),a=t(8981),i=t(6119),s=t(2211),c=i("IE_PROTO"),F=Object,h=F.prototype;e.exports=s?F.getPrototypeOf:function(o){var V=a(o);if(d(V,c))return V[c];var W=V.constructor;return n(W)&&V instanceof W?W.prototype:V instanceof F?h:null}},1625:(e,l,t)=>{var d=t(9504);e.exports=d({}.isPrototypeOf)},1828:(e,l,t)=>{var d=t(9504),n=t(9297),a=t(5397),i=t(9617).indexOf,s=t(421),c=d([].push);e.exports=function(F,h){var o=a(F),V=0,W=[],Q;for(Q in o)!n(s,Q)&&n(o,Q)&&c(W,Q);for(;h.length>V;)n(o,Q=h[V++])&&(~i(W,Q)||c(W,Q));return W}},1072:(e,l,t)=>{var d=t(1828),n=t(8727);e.exports=Object.keys||function(a){return d(a,n)}},8773:(e,l)=>{var t={}.propertyIsEnumerable,d=Object.getOwnPropertyDescriptor,n=d&&!t.call({1:2},1);l.f=n?function(a){var i=d(this,a);return!!i&&i.enumerable}:t},2967:(e,l,t)=>{var d=t(6706),n=t(34),a=t(7750),i=t(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var s=!1,c={},F;try{F=d(Object.prototype,"__proto__","set"),F(c,[]),s=c instanceof Array}catch{}return function(h,o){return a(h),i(o),n(h)&&(s?F(h,o):h.__proto__=o),h}}():void 0)},4270:(e,l,t)=>{var d=t(9565),n=t(4901),a=t(34),i=TypeError;e.exports=function(s,c){var F,h;if(c==="string"&&n(F=s.toString)&&!a(h=d(F,s))||n(F=s.valueOf)&&!a(h=d(F,s))||c!=="string"&&n(F=s.toString)&&!a(h=d(F,s)))return h;throw new i("Can't convert object to primitive value")}},5031:(e,l,t)=>{var d=t(7751),n=t(9504),a=t(8480),i=t(3717),s=t(8551),c=n([].concat);e.exports=d("Reflect","ownKeys")||function(F){var h=a.f(s(F)),o=i.f;return o?c(h,o(F)):h}},8235:(e,l,t)=>{var d=t(9504),n=t(9297),a=SyntaxError,i=parseInt,s=String.fromCharCode,c=d("".charAt),F=d("".slice),h=d(/./.exec),o={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":`
36
+ `,"\\r":"\r","\\t":" "},V=/^[\da-f]{4}$/i,W=/^[\u0000-\u001F]$/;e.exports=function(Q,m){for(var R=!0,r="";m<Q.length;){var b=c(Q,m);if(b==="\\"){var u=F(Q,m,m+2);if(n(o,u))r+=o[u],m+=2;else if(u==="\\u"){m+=2;var J=F(Q,m,m+4);if(!h(V,J))throw new a("Bad Unicode escape at: "+m);r+=s(i(J,16)),m+=4}else throw new a('Unknown escape sequence: "'+u+'"')}else if(b==='"'){R=!1,m++;break}else{if(h(W,b))throw new a("Bad control character in string literal at: "+m);r+=b,m++}}if(R)throw new a("Unterminated string at: "+m);return{value:r,end:m}}},1103:e=>{e.exports=function(l){try{return{error:!1,value:l()}}catch(t){return{error:!0,value:t}}}},7750:(e,l,t)=>{var d=t(4117),n=TypeError;e.exports=function(a){if(d(a))throw new n("Can't call method on "+a);return a}},9286:(e,l,t)=>{var d=t(4402),n=t(8469),a=d.Set,i=d.add;e.exports=function(s){var c=new a;return n(s,function(F){i(c,F)}),c}},3440:(e,l,t)=>{var d=t(7080),n=t(4402),a=t(9286),i=t(5170),s=t(3789),c=t(8469),F=t(507),h=n.has,o=n.remove;e.exports=function(V){var W=d(this),Q=s(V),m=a(W);return i(W)<=Q.size?c(W,function(R){Q.includes(R)&&o(m,R)}):F(Q.getIterator(),function(R){h(W,R)&&o(m,R)}),m}},4402:(e,l,t)=>{var d=t(9504),n=Set.prototype;e.exports={Set,add:d(n.add),has:d(n.has),remove:d(n.delete),proto:n}},8750:(e,l,t)=>{var d=t(7080),n=t(4402),a=t(5170),i=t(3789),s=t(8469),c=t(507),F=n.Set,h=n.add,o=n.has;e.exports=function(V){var W=d(this),Q=i(V),m=new F;return a(W)>Q.size?c(Q.getIterator(),function(R){o(W,R)&&h(m,R)}):s(W,function(R){Q.includes(R)&&h(m,R)}),m}},4449:(e,l,t)=>{var d=t(7080),n=t(4402).has,a=t(5170),i=t(3789),s=t(8469),c=t(507),F=t(9539);e.exports=function(h){var o=d(this),V=i(h);if(a(o)<=V.size)return s(o,function(Q){if(V.includes(Q))return!1},!0)!==!1;var W=V.getIterator();return c(W,function(Q){if(n(o,Q))return F(W,"normal",!1)})!==!1}},3838:(e,l,t)=>{var d=t(7080),n=t(5170),a=t(8469),i=t(3789);e.exports=function(s){var c=d(this),F=i(s);return n(c)>F.size?!1:a(c,function(h){if(!F.includes(h))return!1},!0)!==!1}},8527:(e,l,t)=>{var d=t(7080),n=t(4402).has,a=t(5170),i=t(3789),s=t(507),c=t(9539);e.exports=function(F){var h=d(this),o=i(F);if(a(h)<o.size)return!1;var V=o.getIterator();return s(V,function(W){if(!n(h,W))return c(V,"normal",!1)})!==!1}},8469:(e,l,t)=>{var d=t(9504),n=t(507),a=t(4402),i=a.Set,s=a.proto,c=d(s.forEach),F=d(s.keys),h=F(new i).next;e.exports=function(o,V,W){return W?n({iterator:F(o),next:h},V):c(o,V)}},4916:(e,l,t)=>{var d=t(7751),n=function(a){return{size:a,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};e.exports=function(a){var i=d("Set");try{new i()[a](n(0));try{return new i()[a](n(-1)),!1}catch{return!0}}catch{return!1}}},5170:(e,l,t)=>{var d=t(6706),n=t(4402);e.exports=d(n.proto,"size","get")||function(a){return a.size}},3650:(e,l,t)=>{var d=t(7080),n=t(4402),a=t(9286),i=t(3789),s=t(507),c=n.add,F=n.has,h=n.remove;e.exports=function(o){var V=d(this),W=i(o).getIterator(),Q=a(V);return s(W,function(m){F(V,m)?h(Q,m):c(Q,m)}),Q}},4204:(e,l,t)=>{var d=t(7080),n=t(4402).add,a=t(9286),i=t(3789),s=t(507);e.exports=function(c){var F=d(this),h=i(c).getIterator(),o=a(F);return s(h,function(V){n(o,V)}),o}},6119:(e,l,t)=>{var d=t(5745),n=t(3392),a=d("keys");e.exports=function(i){return a[i]||(a[i]=n(i))}},7629:(e,l,t)=>{var d=t(6395),n=t(4576),a=t(9433),i="__core-js_shared__",s=e.exports=n[i]||a(i,{});(s.versions||(s.versions=[])).push({version:"3.39.0",mode:d?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(e,l,t)=>{var d=t(7629);e.exports=function(n,a){return d[n]||(d[n]=a||{})}},1548:(e,l,t)=>{var d=t(4576),n=t(9039),a=t(9519),i=t(4215),s=d.structuredClone;e.exports=!!s&&!n(function(){if(i==="DENO"&&a>92||i==="NODE"&&a>94||i==="BROWSER"&&a>97)return!1;var c=new ArrayBuffer(8),F=s(c,{transfer:[c]});return c.byteLength!==0||F.byteLength!==8})},4495:(e,l,t)=>{var d=t(9519),n=t(9039),a=t(4576),i=a.String;e.exports=!!Object.getOwnPropertySymbols&&!n(function(){var s=Symbol("symbol detection");return!i(s)||!(Object(s)instanceof Symbol)||!Symbol.sham&&d&&d<41})},5610:(e,l,t)=>{var d=t(1291),n=Math.max,a=Math.min;e.exports=function(i,s){var c=d(i);return c<0?n(c+s,0):a(c,s)}},5854:(e,l,t)=>{var d=t(2777),n=TypeError;e.exports=function(a){var i=d(a,"number");if(typeof i=="number")throw new n("Can't convert number to bigint");return BigInt(i)}},7696:(e,l,t)=>{var d=t(1291),n=t(8014),a=RangeError;e.exports=function(i){if(i===void 0)return 0;var s=d(i),c=n(s);if(s!==c)throw new a("Wrong length or index");return c}},5397:(e,l,t)=>{var d=t(7055),n=t(7750);e.exports=function(a){return d(n(a))}},1291:(e,l,t)=>{var d=t(741);e.exports=function(n){var a=+n;return a!==a||a===0?0:d(a)}},8014:(e,l,t)=>{var d=t(1291),n=Math.min;e.exports=function(a){var i=d(a);return i>0?n(i,9007199254740991):0}},8981:(e,l,t)=>{var d=t(7750),n=Object;e.exports=function(a){return n(d(a))}},9590:(e,l,t)=>{var d=t(1291),n=RangeError;e.exports=function(a){var i=d(a);if(i<0)throw new n("The argument can't be less than 0");return i}},2777:(e,l,t)=>{var d=t(9565),n=t(34),a=t(757),i=t(5966),s=t(4270),c=t(8227),F=TypeError,h=c("toPrimitive");e.exports=function(o,V){if(!n(o)||a(o))return o;var W=i(o,h),Q;if(W){if(V===void 0&&(V="default"),Q=d(W,o,V),!n(Q)||a(Q))return Q;throw new F("Can't convert object to primitive value")}return V===void 0&&(V="number"),s(o,V)}},6969:(e,l,t)=>{var d=t(2777),n=t(757);e.exports=function(a){var i=d(a,"string");return n(i)?i:i+""}},2140:(e,l,t)=>{var d=t(8227),n=d("toStringTag"),a={};a[n]="z",e.exports=String(a)==="[object z]"},655:(e,l,t)=>{var d=t(6955),n=String;e.exports=function(a){if(d(a)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return n(a)}},6823:e=>{var l=String;e.exports=function(t){try{return l(t)}catch{return"Object"}}},3392:(e,l,t)=>{var d=t(9504),n=0,a=Math.random(),i=d(1 .toString);e.exports=function(s){return"Symbol("+(s===void 0?"":s)+")_"+i(++n+a,36)}},7040:(e,l,t)=>{var d=t(4495);e.exports=d&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},8686:(e,l,t)=>{var d=t(3724),n=t(9039);e.exports=d&&n(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})},2812:e=>{var l=TypeError;e.exports=function(t,d){if(t<d)throw new l("Not enough arguments");return t}},8622:(e,l,t)=>{var d=t(4576),n=t(4901),a=d.WeakMap;e.exports=n(a)&&/native code/.test(String(a))},8227:(e,l,t)=>{var d=t(4576),n=t(5745),a=t(9297),i=t(3392),s=t(4495),c=t(7040),F=d.Symbol,h=n("wks"),o=c?F.for||F:F&&F.withoutSetter||i;e.exports=function(V){return a(h,V)||(h[V]=s&&a(F,V)?F[V]:o("Symbol."+V)),h[V]}},6573:(e,l,t)=>{var d=t(3724),n=t(2106),a=t(3238),i=ArrayBuffer.prototype;d&&!("detached"in i)&&n(i,"detached",{configurable:!0,get:function(){return a(this)}})},7936:(e,l,t)=>{var d=t(6518),n=t(5636);n&&d({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return n(this,arguments.length?arguments[0]:void 0,!1)}})},8100:(e,l,t)=>{var d=t(6518),n=t(5636);n&&d({target:"ArrayBuffer",proto:!0},{transfer:function(){return n(this,arguments.length?arguments[0]:void 0,!0)}})},4114:(e,l,t)=>{var d=t(6518),n=t(8981),a=t(6198),i=t(4527),s=t(6837),c=t(9039),F=c(function(){return[].push.call({length:4294967296},1)!==4294967297}),h=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(V){return V instanceof TypeError}},o=F||!h();d({target:"Array",proto:!0,arity:1,forced:o},{push:function(V){var W=n(this),Q=a(W),m=arguments.length;s(Q+m);for(var R=0;R<m;R++)W[Q]=arguments[R],Q++;return i(W,Q),Q}})},8111:(e,l,t)=>{var d=t(6518),n=t(4576),a=t(679),i=t(8551),s=t(4901),c=t(2787),F=t(2106),h=t(4659),o=t(9039),V=t(9297),W=t(8227),Q=t(7657).IteratorPrototype,m=t(3724),R=t(6395),r="constructor",b="Iterator",u=W("toStringTag"),J=TypeError,G=n[b],T=R||!s(G)||G.prototype!==Q||!o(function(){G({})}),y=function(){if(a(this,Q),c(this)===Q)throw new J("Abstract class Iterator not directly constructable")},k=function(X,L){m?F(Q,X,{configurable:!0,get:function(){return L},set:function(D){if(i(this),this===Q)throw new J("You can't redefine this property");V(this,X)?this[X]=D:h(this,X,D)}}):Q[X]=L};V(Q,u)||k(u,b),(T||!V(Q,r)||Q[r]===Object)&&k(r,y),y.prototype=Q,d({global:!0,constructor:!0,forced:T},{Iterator:y})},9314:(e,l,t)=>{var d=t(6518),n=t(9565),a=t(8551),i=t(1767),s=t(4149),c=t(9590),F=t(9462),h=t(6395),o=F(function(){for(var V=this.iterator,W=this.next,Q,m;this.remaining;)if(this.remaining--,Q=a(n(W,V)),m=this.done=!!Q.done,m)return;if(Q=a(n(W,V)),m=this.done=!!Q.done,!m)return Q.value});d({target:"Iterator",proto:!0,real:!0,forced:h},{drop:function(V){a(this);var W=c(s(+V));return new o(i(this),{remaining:W})}})},1148:(e,l,t)=>{var d=t(6518),n=t(2652),a=t(9306),i=t(8551),s=t(1767);d({target:"Iterator",proto:!0,real:!0},{every:function(c){i(this),a(c);var F=s(this),h=0;return!n(F,function(o,V){if(!c(o,h++))return V()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2489:(e,l,t)=>{var d=t(6518),n=t(9565),a=t(9306),i=t(8551),s=t(1767),c=t(9462),F=t(6319),h=t(6395),o=c(function(){for(var V=this.iterator,W=this.predicate,Q=this.next,m,R,r;;){if(m=i(n(Q,V)),R=this.done=!!m.done,R)return;if(r=m.value,F(V,W,[r,this.counter++],!0))return r}});d({target:"Iterator",proto:!0,real:!0,forced:h},{filter:function(V){return i(this),a(V),new o(s(this),{predicate:V})}})},531:(e,l,t)=>{var d=t(6518),n=t(9565),a=t(9306),i=t(8551),s=t(1767),c=t(8646),F=t(9462),h=t(9539),o=t(6395),V=F(function(){for(var W=this.iterator,Q=this.mapper,m,R;;){if(R=this.inner)try{if(m=i(n(R.next,R.iterator)),!m.done)return m.value;this.inner=null}catch(r){h(W,"throw",r)}if(m=i(n(this.next,W)),this.done=!!m.done)return;try{this.inner=c(Q(m.value,this.counter++),!1)}catch(r){h(W,"throw",r)}}});d({target:"Iterator",proto:!0,real:!0,forced:o},{flatMap:function(W){return i(this),a(W),new V(s(this),{mapper:W,inner:null})}})},1701:(e,l,t)=>{var d=t(6518),n=t(713),a=t(6395);d({target:"Iterator",proto:!0,real:!0,forced:a},{map:n})},3579:(e,l,t)=>{var d=t(6518),n=t(2652),a=t(9306),i=t(8551),s=t(1767);d({target:"Iterator",proto:!0,real:!0},{some:function(c){i(this),a(c);var F=s(this),h=0;return n(F,function(o,V){if(c(o,h++))return V()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1689:(e,l,t)=>{var d=t(6518),n=t(4576),a=t(8745),i=t(7680),s=t(6043),c=t(9306),F=t(1103),h=n.Promise,o=!1,V=!h||!h.try||F(function(){h.try(function(W){o=W===8},8)}).error||!o;d({target:"Promise",stat:!0,forced:V},{try:function(W){var Q=arguments.length>1?i(arguments,1):[],m=s.f(this),R=F(function(){return a(c(W),void 0,Q)});return(R.error?m.reject:m.resolve)(R.value),m.promise}})},4628:(e,l,t)=>{var d=t(6518),n=t(6043);d({target:"Promise",stat:!0},{withResolvers:function(){var a=n.f(this);return{promise:a.promise,resolve:a.resolve,reject:a.reject}}})},7642:(e,l,t)=>{var d=t(6518),n=t(3440),a=t(4916);d({target:"Set",proto:!0,real:!0,forced:!a("difference")},{difference:n})},8004:(e,l,t)=>{var d=t(6518),n=t(9039),a=t(8750),i=t(4916),s=!i("intersection")||n(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});d({target:"Set",proto:!0,real:!0,forced:s},{intersection:a})},3853:(e,l,t)=>{var d=t(6518),n=t(4449),a=t(4916);d({target:"Set",proto:!0,real:!0,forced:!a("isDisjointFrom")},{isDisjointFrom:n})},5876:(e,l,t)=>{var d=t(6518),n=t(3838),a=t(4916);d({target:"Set",proto:!0,real:!0,forced:!a("isSubsetOf")},{isSubsetOf:n})},2475:(e,l,t)=>{var d=t(6518),n=t(8527),a=t(4916);d({target:"Set",proto:!0,real:!0,forced:!a("isSupersetOf")},{isSupersetOf:n})},5024:(e,l,t)=>{var d=t(6518),n=t(3650),a=t(4916);d({target:"Set",proto:!0,real:!0,forced:!a("symmetricDifference")},{symmetricDifference:n})},1698:(e,l,t)=>{var d=t(6518),n=t(4204),a=t(4916);d({target:"Set",proto:!0,real:!0,forced:!a("union")},{union:n})},7467:(e,l,t)=>{var d=t(7628),n=t(4644),a=n.aTypedArray,i=n.exportTypedArrayMethod,s=n.getTypedArrayConstructor;i("toReversed",function(){return d(a(this),s(this))})},4732:(e,l,t)=>{var d=t(4644),n=t(9504),a=t(9306),i=t(5370),s=d.aTypedArray,c=d.getTypedArrayConstructor,F=d.exportTypedArrayMethod,h=n(d.TypedArrayPrototype.sort);F("toSorted",function(o){o!==void 0&&a(o);var V=s(this),W=i(c(V),V);return h(W,o)})},9577:(e,l,t)=>{var d=t(9928),n=t(4644),a=t(1108),i=t(1291),s=t(5854),c=n.aTypedArray,F=n.getTypedArrayConstructor,h=n.exportTypedArrayMethod,o=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(V){return V===8}}();h("with",function(V,W){var Q=c(this),m=i(V),R=a(Q)?s(W):+W;return d(Q,F(Q),m,R)},!o)},8992:(e,l,t)=>{t(8111)},4743:(e,l,t)=>{t(9314)},3215:(e,l,t)=>{t(1148)},4520:(e,l,t)=>{t(2489)},670:(e,l,t)=>{t(531)},1454:(e,l,t)=>{t(1701)},7550:(e,l,t)=>{t(3579)},8335:(e,l,t)=>{var d=t(6518),n=t(3724),a=t(4576),i=t(7751),s=t(9504),c=t(9565),F=t(4901),h=t(34),o=t(4376),V=t(9297),W=t(655),Q=t(6198),m=t(4659),R=t(9039),r=t(8235),b=t(4495),u=a.JSON,J=a.Number,G=a.SyntaxError,T=u&&u.parse,y=i("Object","keys"),k=Object.getOwnPropertyDescriptor,X=s("".charAt),L=s("".slice),D=s(/./.exec),C=s([].push),I=/^\d$/,H=/^[1-9]$/,f=/^[\d-]$/,Y=/^[\t\n\r ]$/,B=0,z=1,g=function(P,A){P=W(P);var tl=new x(P,0),el=tl.parse(),Bl=el.value,Ql=tl.skip(Y,el.end);if(Ql<P.length)throw new G('Unexpected extra character: "'+X(P,Ql)+'" after the parsed data at: '+Ql);return F(A)?w({"":Bl},"",A,el):Bl},w=function(P,A,tl,el){var Bl=P[A],Ql=el&&Bl===el.value,_l=Ql&&typeof el.source=="string"?{source:el.source}:{},Tt,Hd,ie,_t,g0;if(h(Bl)){var PX=o(Bl),ZQ=Ql?el.nodes:PX?[]:{};if(PX)for(Tt=ZQ.length,ie=Q(Bl),_t=0;_t<ie;_t++)O(Bl,_t,w(Bl,""+_t,tl,_t<Tt?ZQ[_t]:void 0));else for(Hd=y(Bl),ie=Q(Hd),_t=0;_t<ie;_t++)g0=Hd[_t],O(Bl,g0,w(Bl,g0,tl,V(ZQ,g0)?ZQ[g0]:void 0))}return c(tl,P,A,Bl,_l)},O=function(P,A,tl){if(n){var el=k(P,A);if(el&&!el.configurable)return}tl===void 0?delete P[A]:m(P,A,tl)},K=function(P,A,tl,el){this.value=P,this.end=A,this.source=tl,this.nodes=el},x=function(P,A){this.source=P,this.index=A};x.prototype={fork:function(P){return new x(this.source,P)},parse:function(){var P=this.source,A=this.skip(Y,this.index),tl=this.fork(A),el=X(P,A);if(D(f,el))return tl.number();switch(el){case"{":return tl.object();case"[":return tl.array();case'"':return tl.string();case"t":return tl.keyword(!0);case"f":return tl.keyword(!1);case"n":return tl.keyword(null)}throw new G('Unexpected character: "'+el+'" at: '+A)},node:function(P,A,tl,el,Bl){return new K(A,el,P?null:L(this.source,tl,el),Bl)},object:function(){for(var P=this.source,A=this.index+1,tl=!1,el={},Bl={};A<P.length;){if(A=this.until(['"',"}"],A),X(P,A)==="}"&&!tl){A++;break}var Ql=this.fork(A).string(),_l=Ql.value;A=Ql.end,A=this.until([":"],A)+1,A=this.skip(Y,A),Ql=this.fork(A).parse(),m(Bl,_l,Ql),m(el,_l,Ql.value),A=this.until([",","}"],Ql.end);var Tt=X(P,A);if(Tt===",")tl=!0,A++;else if(Tt==="}"){A++;break}}return this.node(z,el,this.index,A,Bl)},array:function(){for(var P=this.source,A=this.index+1,tl=!1,el=[],Bl=[];A<P.length;){if(A=this.skip(Y,A),X(P,A)==="]"&&!tl){A++;break}var Ql=this.fork(A).parse();if(C(Bl,Ql),C(el,Ql.value),A=this.until([",","]"],Ql.end),X(P,A)===",")tl=!0,A++;else if(X(P,A)==="]"){A++;break}}return this.node(z,el,this.index,A,Bl)},string:function(){var P=this.index,A=r(this.source,this.index+1);return this.node(B,A.value,P,A.end)},number:function(){var P=this.source,A=this.index,tl=A;if(X(P,tl)==="-"&&tl++,X(P,tl)==="0")tl++;else if(D(H,X(P,tl)))tl=this.skip(I,tl+1);else throw new G("Failed to parse number at: "+tl);if(X(P,tl)==="."&&(tl=this.skip(I,tl+1)),X(P,tl)==="e"||X(P,tl)==="E"){tl++,(X(P,tl)==="+"||X(P,tl)==="-")&&tl++;var el=tl;if(tl=this.skip(I,tl),el===tl)throw new G("Failed to parse number's exponent value at: "+tl)}return this.node(B,J(L(P,A,tl)),A,tl)},keyword:function(P){var A=""+P,tl=this.index,el=tl+A.length;if(L(this.source,tl,el)!==A)throw new G("Failed to parse value at: "+tl);return this.node(B,P,tl,el)},skip:function(P,A){for(var tl=this.source;A<tl.length&&D(P,X(tl,A));A++);return A},until:function(P,A){A=this.skip(Y,A);for(var tl=X(this.source,A),el=0;el<P.length;el++)if(P[el]===tl)return A;throw new G('Unexpected character: "'+tl+'" at: '+A)}};var _=R(function(){var P="9007199254740993",A;return T(P,function(tl,el,Bl){A=Bl.source}),A!==P}),al=b&&!R(function(){return 1/T("-0 ")!==-1/0});d({target:"JSON",stat:!0,forced:_},{parse:function(P,A){return al&&!F(A)?T(P):g(P,A)}})},5247:(e,l,t)=>{t(1689)},4979:(e,l,t)=>{var d=t(6518),n=t(4576),a=t(7751),i=t(6980),s=t(4913).f,c=t(9297),F=t(679),h=t(3167),o=t(2603),V=t(5002),W=t(8574),Q=t(3724),m=t(6395),R="DOMException",r=a("Error"),b=a(R),u=function(){F(this,J);var f=arguments.length,Y=o(f<1?void 0:arguments[0]),B=o(f<2?void 0:arguments[1],"Error"),z=new b(Y,B),g=new r(Y);return g.name=R,s(z,"stack",i(1,W(g.stack,1))),h(z,this,u),z},J=u.prototype=b.prototype,G="stack"in new r(R),T="stack"in new b(1,2),y=b&&Q&&Object.getOwnPropertyDescriptor(n,R),k=!!y&&!(y.writable&&y.configurable),X=G&&!k&&!T;d({global:!0,constructor:!0,forced:m||X},{DOMException:X?u:b});var L=a(R),D=L.prototype;if(D.constructor!==L){m||s(D,"constructor",i(1,L));for(var C in V)if(c(V,C)){var I=V[C],H=I.s;c(L,H)||s(L,H,i(6,I.c))}}},4603:(e,l,t)=>{var d=t(6840),n=t(9504),a=t(655),i=t(2812),s=URLSearchParams,c=s.prototype,F=n(c.append),h=n(c.delete),o=n(c.forEach),V=n([].push),W=new s("a=1&a=2&b=3");W.delete("a",1),W.delete("b",void 0),W+""!="a=2"&&d(c,"delete",function(Q){var m=arguments.length,R=m<2?void 0:arguments[1];if(m&&R===void 0)return h(this,Q);var r=[];o(this,function(X,L){V(r,{key:L,value:X})}),i(m,1);for(var b=a(Q),u=a(R),J=0,G=0,T=!1,y=r.length,k;J<y;)k=r[J++],T||k.key===b?(T=!0,h(this,k.key)):G++;for(;G<y;)k=r[G++],k.key===b&&k.value===u||F(this,k.key,k.value)},{enumerable:!0,unsafe:!0})},7566:(e,l,t)=>{var d=t(6840),n=t(9504),a=t(655),i=t(2812),s=URLSearchParams,c=s.prototype,F=n(c.getAll),h=n(c.has),o=new s("a=1");(o.has("a",2)||!o.has("a",void 0))&&d(c,"has",function(V){var W=arguments.length,Q=W<2?void 0:arguments[1];if(W&&Q===void 0)return h(this,V);var m=F(this,V);i(W,1);for(var R=a(Q),r=0;r<m.length;)if(m[r++]===R)return!0;return!1},{enumerable:!0,unsafe:!0})},8721:(e,l,t)=>{var d=t(3724),n=t(9504),a=t(2106),i=URLSearchParams.prototype,s=n(i.forEach);d&&!("size"in i)&&a(i,"size",{get:function(){var c=0;return s(this,function(){c++}),c},configurable:!0,enumerable:!0})}},iM={};function Tl(e){var l=iM[e];if(l!==void 0)return l.exports;var t=iM[e]={exports:{}};return NL[e].call(t.exports,t,t.exports,Tl),t.exports}Tl.d=(e,l)=>{for(var t in l)Tl.o(l,t)&&!Tl.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:l[t]})},Tl.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l);var ml=globalThis.pdfjsLib={};Tl.d(ml,{AbortException:()=>gn,AnnotationEditorLayer:()=>zD,AnnotationEditorParamsType:()=>Jl,AnnotationEditorType:()=>ul,AnnotationEditorUIManager:()=>MZ,AnnotationLayer:()=>rD,AnnotationMode:()=>Cn,ColorPicker:()=>mJ,DOMSVGFactory:()=>nN,DrawLayer:()=>LD,FeatureTest:()=>te,GlobalWorkerOptions:()=>ac,ImageKind:()=>ph,InvalidPDFException:()=>nR,MissingPDFException:()=>cZ,OPS:()=>ld,OutputScale:()=>WR,PDFDataRangeTransport:()=>kS,PDFDateString:()=>hM,PDFWorker:()=>xo,PasswordResponses:()=>pL,PermissionFlag:()=>rL,PixelsPerInch:()=>Bs,RenderingCancelledException:()=>FR,TextLayer:()=>$R,TouchManager:()=>IM,UnexpectedResponseException:()=>Th,Util:()=>sl,VerbosityLevel:()=>Mh,XfaLayer:()=>wS,build:()=>tD,createValidAbsoluteUrl:()=>TL,fetchData:()=>yh,getDocument:()=>OI,getFilenameFromUrl:()=>IL,getPdfFilenameFromUrl:()=>DL,getXfaPageViewport:()=>wL,isDataScheme:()=>Bh,isPdfFile:()=>hR,noContextMenu:()=>td,normalizeUnicode:()=>kL,setLayerDimensions:()=>Pa,shadow:()=>rl,stopEvent:()=>ue,version:()=>lD}),Tl(4114),Tl(6573),Tl(8100),Tl(7936),Tl(7467),Tl(4732),Tl(9577),Tl(5247),Tl(4979),Tl(4603),Tl(7566),Tl(8721);const Et=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),sM=[1,0,0,1,0,0],tR=[.001,0,0,.001,0,0],bL=1e7,eR=1.35,be={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Cn={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},uL="pdfjs_internal_editor_",ul={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},Jl={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35,DRAW_STEP:41},rL={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Ct={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},ph={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},ht={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,WIDGET:20},sZ={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Mh={ERRORS:0,WARNINGS:1,INFOS:5},ld={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},pL={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Sh=Mh.WARNINGS;function ML(e){Number.isInteger(e)&&(Sh=e)}function SL(){return Sh}function Jh(e){Sh>=Mh.INFOS&&console.log(`Info: ${e}`)}function Rl(e){Sh>=Mh.WARNINGS&&console.log(`Warning: ${e}`)}function Cl(e){throw new Error(e)}function st(e,l){e||Cl(l)}function JL(e){switch(e==null?void 0:e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function TL(e,l=null,t=null){if(!e)return null;try{if(t&&typeof e=="string"){if(t.addDefaultProtocol&&e.startsWith("www.")){const n=e.match(/\./g);(n==null?void 0:n.length)>=2&&(e=`http://${e}`)}if(t.tryConvertEncoding)try{e=YL(e)}catch{}}const d=l?new URL(e,l):new URL(e);if(JL(d))return d}catch{}return null}function rl(e,l,t,d=!1){return Object.defineProperty(e,l,{value:t,enumerable:!d,configurable:!0,writable:!1}),t}const xn=function(){function e(l,t){this.message=l,this.name=t}return e.prototype=new Error,e.constructor=e,e}();class cM extends xn{constructor(l,t){super(l,"PasswordException"),this.code=t}}class dR extends xn{constructor(l,t){super(l,"UnknownErrorException"),this.details=t}}let nR=class extends xn{constructor(e){super(e,"InvalidPDFException")}},cZ=class extends xn{constructor(e){super(e,"MissingPDFException")}},Th=class extends xn{constructor(e,l){super(e,"UnexpectedResponseException"),this.status=l}};class GL extends xn{constructor(l){super(l,"FormatError")}}let gn=class extends xn{constructor(e){super(e,"AbortException")}};function UM(e){(typeof e!="object"||(e==null?void 0:e.length)===void 0)&&Cl("Invalid argument for bytesToString");const l=e.length,t=8192;if(l<t)return String.fromCharCode.apply(null,e);const d=[];for(let n=0;n<l;n+=t){const a=Math.min(n+t,l),i=e.subarray(n,a);d.push(String.fromCharCode.apply(null,i))}return d.join("")}function Gh(e){typeof e!="string"&&Cl("Invalid argument for stringToBytes");const l=e.length,t=new Uint8Array(l);for(let d=0;d<l;++d)t[d]=e.charCodeAt(d)&255;return t}function XL(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function aR(e){const l=Object.create(null);for(const[t,d]of e)l[t]=d;return l}function yL(){const e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}function BL(){try{return new Function(""),!0}catch{return!1}}class te{static get isLittleEndian(){return rl(this,"isLittleEndian",yL())}static get isEvalSupported(){return rl(this,"isEvalSupported",BL())}static get isOffscreenCanvasSupported(){return rl(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return rl(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?rl(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof(navigator==null?void 0:navigator.userAgent)=="string"&&navigator.userAgent.includes("Firefox")}):rl(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var l,t;return rl(this,"isCSSRoundSupported",(t=(l=globalThis.CSS)==null?void 0:l.supports)==null?void 0:t.call(l,"width: round(1.5px, 1px)"))}}const iR=Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,"0"));var fa,sR,Xh,cR;let sl=(sR=class{static makeHexColor(e,l,t){return`#${iR[e]}${iR[l]}${iR[t]}`}static scaleMinMax(e,l){let t;e[0]?(e[0]<0&&(t=l[0],l[0]=l[2],l[2]=t),l[0]*=e[0],l[2]*=e[0],e[3]<0&&(t=l[1],l[1]=l[3],l[3]=t),l[1]*=e[3],l[3]*=e[3]):(t=l[0],l[0]=l[1],l[1]=t,t=l[2],l[2]=l[3],l[3]=t,e[1]<0&&(t=l[1],l[1]=l[3],l[3]=t),l[1]*=e[1],l[3]*=e[1],e[2]<0&&(t=l[0],l[0]=l[2],l[2]=t),l[0]*=e[2],l[2]*=e[2]),l[0]+=e[4],l[1]+=e[5],l[2]+=e[4],l[3]+=e[5]}static transform(e,l){return[e[0]*l[0]+e[2]*l[1],e[1]*l[0]+e[3]*l[1],e[0]*l[2]+e[2]*l[3],e[1]*l[2]+e[3]*l[3],e[0]*l[4]+e[2]*l[5]+e[4],e[1]*l[4]+e[3]*l[5]+e[5]]}static applyTransform(e,l){const t=e[0]*l[0]+e[1]*l[2]+l[4],d=e[0]*l[1]+e[1]*l[3]+l[5];return[t,d]}static applyInverseTransform(e,l){const t=l[0]*l[3]-l[1]*l[2],d=(e[0]*l[3]-e[1]*l[2]+l[2]*l[5]-l[4]*l[3])/t,n=(-e[0]*l[1]+e[1]*l[0]+l[4]*l[1]-l[5]*l[0])/t;return[d,n]}static getAxialAlignedBoundingBox(e,l){const t=this.applyTransform(e,l),d=this.applyTransform(e.slice(2,4),l),n=this.applyTransform([e[0],e[3]],l),a=this.applyTransform([e[2],e[1]],l);return[Math.min(t[0],d[0],n[0],a[0]),Math.min(t[1],d[1],n[1],a[1]),Math.max(t[0],d[0],n[0],a[0]),Math.max(t[1],d[1],n[1],a[1])]}static inverseTransform(e){const l=e[0]*e[3]-e[1]*e[2];return[e[3]/l,-e[1]/l,-e[2]/l,e[0]/l,(e[2]*e[5]-e[4]*e[3])/l,(e[4]*e[1]-e[5]*e[0])/l]}static singularValueDecompose2dScale(e){const l=[e[0],e[2],e[1],e[3]],t=e[0]*l[0]+e[1]*l[2],d=e[0]*l[1]+e[1]*l[3],n=e[2]*l[0]+e[3]*l[2],a=e[2]*l[1]+e[3]*l[3],i=(t+a)/2,s=Math.sqrt((t+a)**2-4*(t*a-n*d))/2,c=i+s||1,F=i-s||1;return[Math.sqrt(c),Math.sqrt(F)]}static normalizeRect(e){const l=e.slice(0);return e[0]>e[2]&&(l[0]=e[2],l[2]=e[0]),e[1]>e[3]&&(l[1]=e[3],l[3]=e[1]),l}static intersect(e,l){const t=Math.max(Math.min(e[0],e[2]),Math.min(l[0],l[2])),d=Math.min(Math.max(e[0],e[2]),Math.max(l[0],l[2]));if(t>d)return null;const n=Math.max(Math.min(e[1],e[3]),Math.min(l[1],l[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(l[1],l[3]));return n>a?null:[t,n,d,a]}static bezierBoundingBox(e,l,t,d,n,a,i,s,c){return c?(c[0]=Math.min(c[0],e,i),c[1]=Math.min(c[1],l,s),c[2]=Math.max(c[2],e,i),c[3]=Math.max(c[3],l,s)):c=[Math.min(e,i),Math.min(l,s),Math.max(e,i),Math.max(l,s)],p(this,fa,cR).call(this,e,t,n,i,l,d,a,s,3*(-e+3*(t-n)+i),6*(e-2*t+n),3*(t-e),c),p(this,fa,cR).call(this,e,t,n,i,l,d,a,s,3*(-l+3*(d-a)+s),6*(l-2*d+a),3*(d-l),c),c}},fa=new WeakSet,Xh=function(e,l,t,d,n,a,i,s,c,F){if(c<=0||c>=1)return;const h=1-c,o=c*c,V=o*c,W=h*(h*(h*e+3*c*l)+3*o*t)+V*d,Q=h*(h*(h*n+3*c*a)+3*o*i)+V*s;F[0]=Math.min(F[0],W),F[1]=Math.min(F[1],Q),F[2]=Math.max(F[2],W),F[3]=Math.max(F[3],Q)},cR=function(e,l,t,d,n,a,i,s,c,F,h,o){if(Math.abs(c)<1e-12){Math.abs(F)>=1e-12&&p(this,fa,Xh).call(this,e,l,t,d,n,a,i,s,-h/F,o);return}const V=F**2-4*h*c;if(V<0)return;const W=Math.sqrt(V),Q=2*c;p(this,fa,Xh).call(this,e,l,t,d,n,a,i,s,(-F+W)/Q,o),p(this,fa,Xh).call(this,e,l,t,d,n,a,i,s,(-F-W)/Q,o)},M(sR,fa),sR);function YL(e){return decodeURIComponent(escape(e))}let UR=null,ZM=null;function kL(e){return UR||(UR=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,ZM=new Map([["ſt","ſt"]])),e.replaceAll(UR,(l,t,d)=>t?t.normalize("NFKC"):ZM.get(d))}function zL(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=new Uint8Array(32);return crypto.getRandomValues(e),UM(e)}const ZR="pdfjs_internal_id_";function LL(e){return Uint8Array.prototype.toBase64?e.toBase64():btoa(UM(e))}Tl(4628),Tl(7642),Tl(8004),Tl(3853),Tl(5876),Tl(2475),Tl(5024),Tl(1698),Tl(1454),Tl(8992),Tl(4743),Tl(3215),Tl(7550),Tl(8335);const Ad="http://www.w3.org/2000/svg";var Ha;let Bs=(Ha=class{},hl(Ha,"CSS",96),hl(Ha,"PDF",72),hl(Ha,"PDF_TO_CSS_UNITS",Ha.CSS/Ha.PDF),Ha);async function yh(e,l="text"){if(ZZ(e,document.baseURI)){const t=await fetch(e);if(!t.ok)throw new Error(t.statusText);switch(l){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json()}return t.text()}return new Promise((t,d)=>{const n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType=l,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE){if(n.status===200||n.status===0){switch(l){case"arraybuffer":case"blob":case"json":t(n.response);return}t(n.responseText);return}d(new Error(n.statusText))}},n.send(null)})}class UZ{constructor({viewBox:l,userUnit:t,scale:d,rotation:n,offsetX:a=0,offsetY:i=0,dontFlip:s=!1}){this.viewBox=l,this.userUnit=t,this.scale=d,this.rotation=n,this.offsetX=a,this.offsetY=i,d*=t;const c=(l[2]+l[0])/2,F=(l[3]+l[1])/2;let h,o,V,W;switch(n%=360,n<0&&(n+=360),n){case 180:h=-1,o=0,V=0,W=1;break;case 90:h=0,o=1,V=1,W=0;break;case 270:h=0,o=-1,V=-1,W=0;break;case 0:h=1,o=0,V=0,W=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}s&&(V=-V,W=-W);let Q,m,R,r;h===0?(Q=Math.abs(F-l[1])*d+a,m=Math.abs(c-l[0])*d+i,R=(l[3]-l[1])*d,r=(l[2]-l[0])*d):(Q=Math.abs(c-l[0])*d+a,m=Math.abs(F-l[1])*d+i,R=(l[2]-l[0])*d,r=(l[3]-l[1])*d),this.transform=[h*d,o*d,V*d,W*d,Q-h*d*c-V*d*F,m-o*d*c-W*d*F],this.width=R,this.height=r}get rawDims(){const{userUnit:l,viewBox:t}=this,d=t.map(n=>n*l);return rl(this,"rawDims",{pageWidth:d[2]-d[0],pageHeight:d[3]-d[1],pageX:d[0],pageY:d[1]})}clone({scale:l=this.scale,rotation:t=this.rotation,offsetX:d=this.offsetX,offsetY:n=this.offsetY,dontFlip:a=!1}={}){return new UZ({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:l,rotation:t,offsetX:d,offsetY:n,dontFlip:a})}convertToViewportPoint(l,t){return sl.applyTransform([l,t],this.transform)}convertToViewportRectangle(l){const t=sl.applyTransform([l[0],l[1]],this.transform),d=sl.applyTransform([l[2],l[3]],this.transform);return[t[0],t[1],d[0],d[1]]}convertToPdfPoint(l,t){return sl.applyInverseTransform([l,t],this.transform)}}let FR=class extends xn{constructor(e,l=0){super(e,"RenderingCancelledException"),this.extraDelay=l}};function Bh(e){const l=e.length;let t=0;for(;t<l&&e[t].trim()==="";)t++;return e.substring(t,t+5).toLowerCase()==="data:"}function hR(e){return typeof e=="string"&&/\.pdf$/i.test(e)}function IL(e){return[e]=e.split(/[#?]/,1),e.substring(e.lastIndexOf("/")+1)}function DL(e,l="document.pdf"){if(typeof e!="string")return l;if(Bh(e))return Rl('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),l;const t=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,d=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=t.exec(e);let a=d.exec(n[1])||d.exec(n[2])||d.exec(n[3]);if(a&&(a=a[0],a.includes("%")))try{a=d.exec(decodeURIComponent(a))[0]}catch{}return a||l}class FM{constructor(){hl(this,"started",Object.create(null)),hl(this,"times",[])}time(l){l in this.started&&Rl(`Timer is already running for ${l}`),this.started[l]=Date.now()}timeEnd(l){l in this.started||Rl(`Timer has not been started for ${l}`),this.times.push({name:l,start:this.started[l],end:Date.now()}),delete this.started[l]}toString(){const l=[];let t=0;for(const{name:d}of this.times)t=Math.max(d.length,t);for(const{name:d,start:n,end:a}of this.times)l.push(`${d.padEnd(t)} ${a-n}ms
37
+ `);return l.join("")}}function ZZ(e,l){try{const{protocol:t}=l?new URL(e,l):new URL(e);return t==="http:"||t==="https:"}catch{return!1}}function td(e){e.preventDefault()}function ue(e){e.preventDefault(),e.stopPropagation()}var oR,FZ;let hM=(oR=class{static toDateObject(e){if(!e||typeof e!="string")return null;U(this,FZ)||N(this,FZ,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const l=U(this,FZ).exec(e);if(!l)return null;const t=parseInt(l[1],10);let d=parseInt(l[2],10);d=d>=1&&d<=12?d-1:0;let n=parseInt(l[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(l[4],10);a=a>=0&&a<=23?a:0;let i=parseInt(l[5],10);i=i>=0&&i<=59?i:0;let s=parseInt(l[6],10);s=s>=0&&s<=59?s:0;const c=l[7]||"Z";let F=parseInt(l[8],10);F=F>=0&&F<=23?F:0;let h=parseInt(l[9],10)||0;return h=h>=0&&h<=59?h:0,c==="-"?(a+=F,i+=h):c==="+"&&(a-=F,i-=h),new Date(Date.UTC(t,d,n,a,i,s))}},FZ=new WeakMap,M(oR,FZ),oR);function wL(e,{scale:l=1,rotation:t=0}){const{width:d,height:n}=e.attributes.style,a=[0,0,parseInt(d),parseInt(n)];return new UZ({viewBox:a,userUnit:1,scale:l,rotation:t})}function VR(e){if(e.startsWith("#")){const l=parseInt(e.slice(1),16);return[(l&16711680)>>16,(l&65280)>>8,l&255]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map(l=>parseInt(l)):e.startsWith("rgba(")?e.slice(5,-1).split(",").map(l=>parseInt(l)).slice(0,3):(Rl(`Not a valid color format: "${e}"`),[0,0,0])}function EL(e){const l=document.createElement("span");l.style.visibility="hidden",document.body.append(l);for(const t of e.keys()){l.style.color=t;const d=window.getComputedStyle(l).color;e.set(t,VR(d))}l.remove()}function Ol(e){const{a:l,b:t,c:d,d:n,e:a,f:i}=e.getTransform();return[l,t,d,n,a,i]}function ud(e){const{a:l,b:t,c:d,d:n,e:a,f:i}=e.getTransform().invertSelf();return[l,t,d,n,a,i]}function Pa(e,l,t=!1,d=!0){if(l instanceof UZ){const{pageWidth:n,pageHeight:a}=l.rawDims,{style:i}=e,s=te.isCSSRoundSupported,c=`var(--scale-factor) * ${n}px`,F=`var(--scale-factor) * ${a}px`,h=s?`round(down, ${c}, var(--scale-round-x, 1px))`:`calc(${c})`,o=s?`round(down, ${F}, var(--scale-round-y, 1px))`:`calc(${F})`;!t||l.rotation%180===0?(i.width=h,i.height=o):(i.width=o,i.height=h)}d&&e.setAttribute("data-main-rotation",l.rotation)}let WR=class{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}};var Aa,Ys,rd,ks,Yh,hZ,QR,oM,pd,VM,WM,kh,QM,mR;const zh=class FQ{constructor(l){M(this,pd),M(this,Aa,null),M(this,Ys,null),M(this,rd),M(this,ks,null),M(this,Yh,null),N(this,rd,l),U(FQ,hZ)||N(FQ,hZ,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const l=N(this,Aa,document.createElement("div"));l.classList.add("editToolbar","hidden"),l.setAttribute("role","toolbar");const t=U(this,rd)._uiManager._signal;l.addEventListener("contextmenu",td,{signal:t}),l.addEventListener("pointerdown",p(FQ,QR,oM),{signal:t});const d=N(this,ks,document.createElement("div"));d.className="buttons",l.append(d);const n=U(this,rd).toolbarPosition;if(n){const{style:a}=l,i=U(this,rd)._uiManager.direction==="ltr"?1-n[0]:n[0];a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return p(this,pd,QM).call(this),l}get div(){return U(this,Aa)}hide(){var l;U(this,Aa).classList.add("hidden"),(l=U(this,Ys))==null||l.hideDropdown()}show(){var l;U(this,Aa).classList.remove("hidden"),(l=U(this,Yh))==null||l.shown()}async addAltText(l){const t=await l.render();p(this,pd,kh).call(this,t),U(this,ks).prepend(t,U(this,pd,mR)),N(this,Yh,l)}addColorPicker(l){N(this,Ys,l);const t=l.renderButton();p(this,pd,kh).call(this,t),U(this,ks).prepend(t,U(this,pd,mR))}remove(){var l;U(this,Aa).remove(),(l=U(this,Ys))==null||l.destroy(),N(this,Ys,null)}};Aa=new WeakMap,Ys=new WeakMap,rd=new WeakMap,ks=new WeakMap,Yh=new WeakMap,hZ=new WeakMap,QR=new WeakSet,oM=function(e){e.stopPropagation()},pd=new WeakSet,VM=function(e){U(this,rd)._focusEventsAllowed=!1,ue(e)},WM=function(e){U(this,rd)._focusEventsAllowed=!0,ue(e)},kh=function(e){const l=U(this,rd)._uiManager._signal;e.addEventListener("focusin",p(this,pd,VM).bind(this),{capture:!0,signal:l}),e.addEventListener("focusout",p(this,pd,WM).bind(this),{capture:!0,signal:l}),e.addEventListener("contextmenu",td,{signal:l})},QM=function(){const{editorType:e,_uiManager:l}=U(this,rd),t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",U(zh,hZ)[e]),p(this,pd,kh).call(this,t),t.addEventListener("click",d=>{l.delete()},{signal:l._signal}),U(this,ks).append(t)},mR=function(){const e=document.createElement("div");return e.className="divider",e},M(zh,QR),M(zh,hZ,null);let CL=zh;var Lh,_a,zs,oZ,mM,RM,NM;class xL{constructor(l){M(this,oZ),M(this,Lh,null),M(this,_a,null),M(this,zs),N(this,zs,l)}show(l,t,d){const[n,a]=p(this,oZ,RM).call(this,t,d),{style:i}=U(this,_a)||N(this,_a,p(this,oZ,mM).call(this));l.append(U(this,_a)),i.insetInlineEnd=`${100*n}%`,i.top=`calc(${100*a}% + var(--editor-toolbar-vert-offset))`}hide(){U(this,_a).remove()}}Lh=new WeakMap,_a=new WeakMap,zs=new WeakMap,oZ=new WeakSet,mM=function(){const e=N(this,_a,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",td,{signal:U(this,zs)._signal});const l=N(this,Lh,document.createElement("div"));return l.className="buttons",e.append(l),p(this,oZ,NM).call(this),e},RM=function(e,l){let t=0,d=0;for(const n of e){const a=n.y+n.height;if(a<t)continue;const i=n.x+(l?n.width:0);if(a>t){d=i,t=a;continue}l?i>d&&(d=i):i<d&&(d=i)}return[l?1-d:d,t]},NM=function(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const l=document.createElement("span");e.append(l),l.className="visuallyHidden",l.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const t=U(this,zs)._signal;e.addEventListener("contextmenu",td,{signal:t}),e.addEventListener("click",()=>{U(this,zs).highlightSelection("floating_button")},{signal:t}),U(this,Lh).append(e)};function Ih(e,l,t){for(const d of t)l.addEventListener(d,e[d].bind(e))}var RR;class gL{constructor(){M(this,RR,0)}get id(){return`${uL}${le(this,RR)._++}`}}RR=new WeakMap;var VZ,Dh,ot,WZ,wh;const bM=class{constructor(){M(this,WZ),M(this,VZ,zL()),M(this,Dh,0),M(this,ot,null)}static get _isSVGFittingCanvas(){const l='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),d=new Image;d.src=l;const n=d.decode().then(()=>(t.drawImage(d,0,0,1,1,0,0,1,3),new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]===0));return rl(this,"_isSVGFittingCanvas",n)}async getFromFile(l){const{lastModified:t,name:d,size:n,type:a}=l;return p(this,WZ,wh).call(this,`${t}_${d}_${n}_${a}`,l)}async getFromUrl(l){return p(this,WZ,wh).call(this,l,l)}async getFromBlob(l,t){const d=await t;return p(this,WZ,wh).call(this,l,d)}async getFromId(l){U(this,ot)||N(this,ot,new Map);const t=U(this,ot).get(l);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:d}=t;return delete t.blobPromise,this.getFromBlob(t.id,d)}return this.getFromUrl(t.url)}getFromCanvas(l,t){U(this,ot)||N(this,ot,new Map);let d=U(this,ot).get(l);if(d!=null&&d.bitmap)return d.refCounter+=1,d;const n=new OffscreenCanvas(t.width,t.height);return n.getContext("2d").drawImage(t,0,0),d={bitmap:n.transferToImageBitmap(),id:`image_${U(this,VZ)}_${le(this,Dh)._++}`,refCounter:1,isSvg:!1},U(this,ot).set(l,d),U(this,ot).set(d.id,d),d}getSvgUrl(l){const t=U(this,ot).get(l);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(l){var t;U(this,ot)||N(this,ot,new Map);const d=U(this,ot).get(l);if(!d||(d.refCounter-=1,d.refCounter!==0))return;const{bitmap:n}=d;if(!d.url&&!d.file){const a=new OffscreenCanvas(n.width,n.height);a.getContext("bitmaprenderer").transferFromImageBitmap(n),d.blobPromise=a.convertToBlob()}(t=n.close)==null||t.call(n),d.bitmap=null}isValidId(l){return l.startsWith(`image_${U(this,VZ)}_`)}};VZ=new WeakMap,Dh=new WeakMap,ot=new WeakMap,WZ=new WeakSet,wh=async function(e,l){U(this,ot)||N(this,ot,new Map);let t=U(this,ot).get(e);if(t===null)return null;if(t!=null&&t.bitmap)return t.refCounter+=1,t;try{t||(t={bitmap:null,id:`image_${U(this,VZ)}_${le(this,Dh)._++}`,refCounter:0,isSvg:!1});let d;if(typeof l=="string"?(t.url=l,d=await yh(l,"blob")):l instanceof File?d=t.file=l:l instanceof Blob&&(d=l),d.type==="image/svg+xml"){const n=bM._isSVGFittingCanvas,a=new FileReader,i=new Image,s=new Promise((c,F)=>{i.onload=()=>{t.bitmap=i,t.isSvg=!0,c()},a.onload=async()=>{const h=t.svgUrl=a.result;i.src=await n?`${h}#svgView(preserveAspectRatio(none))`:h},i.onerror=a.onerror=F});a.readAsDataURL(d),await s}else t.bitmap=await createImageBitmap(d);t.refCounter=1}catch(d){Rl(d),t=null}return U(this,ot).set(e,t),t&&U(this,ot).set(t.id,t),t};let jL=bM;var ct,qa,Eh,vl;class OL{constructor(l=128){M(this,ct,[]),M(this,qa,!1),M(this,Eh),M(this,vl,-1),N(this,Eh,l)}add({cmd:l,undo:t,post:d,mustExec:n,type:a=NaN,overwriteIfSameType:i=!1,keepUndo:s=!1}){if(n&&l(),U(this,qa))return;const c={cmd:l,undo:t,post:d,type:a};if(U(this,vl)===-1){U(this,ct).length>0&&(U(this,ct).length=0),N(this,vl,0),U(this,ct).push(c);return}if(i&&U(this,ct)[U(this,vl)].type===a){s&&(c.undo=U(this,ct)[U(this,vl)].undo),U(this,ct)[U(this,vl)]=c;return}const F=U(this,vl)+1;F===U(this,Eh)?U(this,ct).splice(0,1):(N(this,vl,F),F<U(this,ct).length&&U(this,ct).splice(F)),U(this,ct).push(c)}undo(){if(U(this,vl)===-1)return;N(this,qa,!0);const{undo:l,post:t}=U(this,ct)[U(this,vl)];l(),t==null||t(),N(this,qa,!1),N(this,vl,U(this,vl)-1)}redo(){if(U(this,vl)<U(this,ct).length-1){N(this,vl,U(this,vl)+1),N(this,qa,!0);const{cmd:l,post:t}=U(this,ct)[U(this,vl)];l(),t==null||t(),N(this,qa,!1)}}hasSomethingToUndo(){return U(this,vl)!==-1}hasSomethingToRedo(){return U(this,vl)<U(this,ct).length-1}cleanType(l){if(U(this,vl)!==-1){for(let t=U(this,vl);t>=0;t--)if(U(this,ct)[t].type!==l){U(this,ct).splice(t+1,U(this,vl)-t),N(this,vl,t);return}U(this,ct).length=0,N(this,vl,-1)}}destroy(){N(this,ct,null)}}ct=new WeakMap,qa=new WeakMap,Eh=new WeakMap,vl=new WeakMap;var NR,uM;class QZ{constructor(l){M(this,NR),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=te.platform;for(const[d,n,a={}]of l)for(const i of d){const s=i.startsWith("mac+");t&&s?(this.callbacks.set(i.slice(4),{callback:n,options:a}),this.allKeys.add(i.split("+").at(-1))):!t&&!s&&(this.callbacks.set(i,{callback:n,options:a}),this.allKeys.add(i.split("+").at(-1)))}}exec(l,t){if(!this.allKeys.has(t.key))return;const d=this.callbacks.get(p(this,NR,uM).call(this,t));if(!d)return;const{callback:n,options:{bubbles:a=!1,args:i=[],checker:s=null}}=d;s&&!s(l,t)||(n.bind(l,...i,t)(),a||ue(t))}}NR=new WeakSet,uM=function(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const l=this.buffer.join("+");return this.buffer.length=0,l};const rM=class oy{get _colors(){const l=new Map([["CanvasText",null],["Canvas",null]]);return EL(l),rl(this,"_colors",l)}convert(l){const t=VR(l);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[d,n]of this._colors)if(n.every((a,i)=>a===t[i]))return oy._colorsMapping.get(d);return t}getHexCode(l){const t=this._colors.get(l);return t?sl.makeHexColor(...t):l}};hl(rM,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let vL=rM;var mZ,ke,pt,xt,RZ,jn,Ls,ed,$a,Is,NZ,Ds,_d,Md,ws,Ch,xh,bZ,gh,qd,li,uZ,ti,Sd,bR,ei,jh,di,Es,Oh,vh,Xt,Dl,On,Cs,rZ,Kh,ni,$d,vn,fh,dd,xs,Ul,Hh,uR,pM,MM,Ph,SM,JM,TM,rR,GM,pR,MR,XM,ee,ln,yM,BM,SR,YM,pZ,JR;let MZ=(xs=class{constructor(e,l,t,d,n,a,i,s,c,F,h,o,V){M(this,Ul),M(this,mZ,new AbortController),M(this,ke,null),M(this,pt,new Map),M(this,xt,new Map),M(this,RZ,null),M(this,jn,null),M(this,Ls,null),M(this,ed,new OL),M(this,$a,null),M(this,Is,null),M(this,NZ,0),M(this,Ds,new Set),M(this,_d,null),M(this,Md,null),M(this,ws,new Set),hl(this,"_editorUndoBar",null),M(this,Ch,!1),M(this,xh,!1),M(this,bZ,!1),M(this,gh,null),M(this,qd,null),M(this,li,null),M(this,uZ,null),M(this,ti,!1),M(this,Sd,null),M(this,bR,new gL),M(this,ei,!1),M(this,jh,!1),M(this,di,null),M(this,Es,null),M(this,Oh,null),M(this,vh,null),M(this,Xt,ul.NONE),M(this,Dl,new Set),M(this,On,null),M(this,Cs,null),M(this,rZ,null),M(this,Kh,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),M(this,ni,[0,0]),M(this,$d,null),M(this,vn,null),M(this,fh,null),M(this,dd,null);const W=this._signal=U(this,mZ).signal;N(this,vn,e),N(this,fh,l),N(this,RZ,t),this._eventBus=d,d._on("editingaction",this.onEditingAction.bind(this),{signal:W}),d._on("pagechanging",this.onPageChanging.bind(this),{signal:W}),d._on("scalechanging",this.onScaleChanging.bind(this),{signal:W}),d._on("rotationchanging",this.onRotationChanging.bind(this),{signal:W}),d._on("setpreference",this.onSetPreference.bind(this),{signal:W}),d._on("switchannotationeditorparams",Q=>this.updateParams(Q.type,Q.value),{signal:W}),p(this,Ul,SM).call(this),p(this,Ul,XM).call(this),p(this,Ul,rR).call(this),N(this,jn,n.annotationStorage),N(this,gh,n.filterFactory),N(this,Cs,a),N(this,uZ,i||null),N(this,Ch,s),N(this,xh,c),N(this,bZ,F),N(this,vh,h||null),this.viewParameters={realScale:Bs.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=o||null,this._supportsPinchToZoom=V!==!1}static get _keyboardManager(){const e=xs.prototype,l=a=>U(a,vn).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),t=(a,{target:i})=>{if(i instanceof HTMLInputElement){const{type:s}=i;return s!=="text"&&s!=="number"}return!0},d=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return rl(this,"_keyboardManager",new QZ([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:t}],[["ctrl+z","mac+meta+z"],e.undo,{checker:t}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:t}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:t}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(a,{target:i})=>!(i instanceof HTMLButtonElement)&&U(a,vn).contains(i)&&!a.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(a,{target:i})=>!(i instanceof HTMLButtonElement)&&U(a,vn).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-d,0],checker:l}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:l}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[d,0],checker:l}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:l}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-d],checker:l}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:l}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,d],checker:l}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:l}]]))}destroy(){var e,l,t,d,n;(e=U(this,dd))==null||e.resolve(),N(this,dd,null),(l=U(this,mZ))==null||l.abort(),N(this,mZ,null),this._signal=null;for(const a of U(this,xt).values())a.destroy();U(this,xt).clear(),U(this,pt).clear(),U(this,ws).clear(),N(this,ke,null),U(this,Dl).clear(),U(this,ed).destroy(),(t=U(this,RZ))==null||t.destroy(),(d=U(this,Sd))==null||d.hide(),N(this,Sd,null),U(this,qd)&&(clearTimeout(U(this,qd)),N(this,qd,null)),U(this,$d)&&(clearTimeout(U(this,$d)),N(this,$d,null)),(n=this._editorUndoBar)==null||n.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return U(this,vh)}get useNewAltTextFlow(){return U(this,xh)}get useNewAltTextWhenAddingImage(){return U(this,bZ)}get hcmFilter(){return rl(this,"hcmFilter",U(this,Cs)?U(this,gh).addHCMFilter(U(this,Cs).foreground,U(this,Cs).background):"none")}get direction(){return rl(this,"direction",getComputedStyle(U(this,vn)).direction)}get highlightColors(){return rl(this,"highlightColors",U(this,uZ)?new Map(U(this,uZ).split(",").map(e=>e.split("=").map(l=>l.trim()))):null)}get highlightColorNames(){return rl(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),N(this,Is,e)}setMainHighlightColorPicker(e){N(this,Oh,e)}editAltText(e,l=!1){var t;(t=U(this,RZ))==null||t.editAltText(this,e,l)}switchToMode(e,l){this._eventBus.on("annotationeditormodechanged",l,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,l){this._eventBus.dispatch("setpreference",{source:this,name:e,value:l})}onSetPreference({name:e,value:l}){switch(e){case"enableNewAltTextWhenAddingImage":N(this,bZ,l);break}}onPageChanging({pageNumber:e}){N(this,NZ,e-1)}focusMainContainer(){U(this,vn).focus()}findParent(e,l){for(const t of U(this,xt).values()){const{x:d,y:n,width:a,height:i}=t.div.getBoundingClientRect();if(e>=d&&e<=d+a&&l>=n&&l<=n+i)return t}return null}disableUserSelect(e=!1){U(this,fh).classList.toggle("noUserSelect",e)}addShouldRescale(e){U(this,ws).add(e)}removeShouldRescale(e){U(this,ws).delete(e)}onScaleChanging({scale:e}){var l;this.commitOrRemove(),this.viewParameters.realScale=e*Bs.PDF_TO_CSS_UNITS;for(const t of U(this,ws))t.onScaleChanging();(l=U(this,Is))==null||l.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const l=document.getSelection();if(!l||l.isCollapsed)return;const{anchorNode:t,anchorOffset:d,focusNode:n,focusOffset:a}=l,i=l.toString(),s=p(this,Ul,Hh).call(this,l).closest(".textLayer"),c=this.getSelectionBoxes(s);if(!c)return;l.empty();const F=p(this,Ul,uR).call(this,s),h=U(this,Xt)===ul.NONE,o=()=>{F==null||F.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:c,anchorNode:t,anchorOffset:d,focusNode:n,focusOffset:a,text:i}),h&&this.showAllEditors("highlight",!0,!0)};if(h){this.switchToMode(ul.HIGHLIGHT,o);return}o()}addToAnnotationStorage(e){!e.isEmpty()&&U(this,jn)&&!U(this,jn).has(e.id)&&U(this,jn).setValue(e.id,e)}blur(){if(this.isShiftKeyDown=!1,U(this,ti)&&(N(this,ti,!1),p(this,Ul,Ph).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const l of U(this,Dl))if(l.div.contains(e)){N(this,Es,[l,e]),l._focusEventsAllowed=!1;break}}focus(){if(!U(this,Es))return;const[e,l]=U(this,Es);N(this,Es,null),l.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),l.focus()}addEditListeners(){p(this,Ul,rR).call(this),p(this,Ul,pR).call(this)}removeEditListeners(){p(this,Ul,GM).call(this),p(this,Ul,MR).call(this)}dragOver(e){for(const{type:l}of e.dataTransfer.items)for(const t of U(this,Md))if(t.isHandlingMimeForPasting(l)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const l of e.dataTransfer.items)for(const t of U(this,Md))if(t.isHandlingMimeForPasting(l.type)){t.paste(l,this.currentLayer),e.preventDefault();return}}copy(e){var l;if(e.preventDefault(),(l=U(this,ke))==null||l.commitOrRemove(),!this.hasSelection)return;const t=[];for(const d of U(this,Dl)){const n=d.serialize(!0);n&&t.push(n)}t.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:l}=e;for(const n of l.items)for(const a of U(this,Md))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let t=l.getData("application/pdfjs");if(!t)return;try{t=JSON.parse(t)}catch(n){Rl(`paste: "${n.message}".`);return}if(!Array.isArray(t))return;this.unselectAll();const d=this.currentLayer;try{const n=[];for(const s of t){const c=await d.deserialize(s);if(!c)return;n.push(c)}const a=()=>{for(const s of n)p(this,Ul,SR).call(this,s);p(this,Ul,JR).call(this,n)},i=()=>{for(const s of n)s.remove()};this.addCommands({cmd:a,undo:i,mustExec:!0})}catch(n){Rl(`paste: "${n.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),U(this,Xt)!==ul.NONE&&!this.isEditorHandlingKeyboard&&xs._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,U(this,ti)&&(N(this,ti,!1),p(this,Ul,Ph).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(e){e?(p(this,Ul,JM).call(this),p(this,Ul,pR).call(this),p(this,Ul,ee).call(this,{isEditing:U(this,Xt)!==ul.NONE,isEmpty:p(this,Ul,pZ).call(this),hasSomethingToUndo:U(this,ed).hasSomethingToUndo(),hasSomethingToRedo:U(this,ed).hasSomethingToRedo(),hasSelectedEditor:!1})):(p(this,Ul,TM).call(this),p(this,Ul,MR).call(this),p(this,Ul,ee).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!U(this,Md)){N(this,Md,e);for(const l of U(this,Md))p(this,Ul,ln).call(this,l.defaultPropertiesToUpdate)}}getId(){return U(this,bR).id}get currentLayer(){return U(this,xt).get(U(this,NZ))}getLayer(e){return U(this,xt).get(e)}get currentPageIndex(){return U(this,NZ)}addLayer(e){U(this,xt).set(e.pageIndex,e),U(this,ei)?e.enable():e.disable()}removeLayer(e){U(this,xt).delete(e.pageIndex)}async updateMode(e,l=null,t=!1){var d;if(U(this,Xt)!==e&&!(U(this,dd)&&(await U(this,dd).promise,!U(this,dd)))){if(N(this,dd,Promise.withResolvers()),N(this,Xt,e),e===ul.NONE){this.setEditingState(!1),p(this,Ul,BM).call(this),(d=this._editorUndoBar)==null||d.hide(),U(this,dd).resolve();return}this.setEditingState(!0),await p(this,Ul,yM).call(this),this.unselectAll();for(const n of U(this,xt).values())n.updateMode(e);if(!l){t&&this.addNewEditorFromKeyboard(),U(this,dd).resolve();return}for(const n of U(this,pt).values())n.annotationElementId===l?(this.setSelected(n),n.enterInEditMode()):n.unselect();U(this,dd).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==U(this,Xt)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,l){var t;if(U(this,Md)){switch(e){case Jl.CREATE:this.currentLayer.addNewEditor();return;case Jl.HIGHLIGHT_DEFAULT_COLOR:(t=U(this,Oh))==null||t.updateColor(l);break;case Jl.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(U(this,rZ)||N(this,rZ,new Map)).set(e,l),this.showAllEditors("highlight",l);break}for(const d of U(this,Dl))d.updateParams(e,l);for(const d of U(this,Md))d.updateDefaultParams(e,l)}}showAllEditors(e,l,t=!1){var d;for(const n of U(this,pt).values())n.editorType===e&&n.show(l);(((d=U(this,rZ))==null?void 0:d.get(Jl.HIGHLIGHT_SHOW_ALL))??!0)!==l&&p(this,Ul,ln).call(this,[[Jl.HIGHLIGHT_SHOW_ALL,l]])}enableWaiting(e=!1){if(U(this,jh)!==e){N(this,jh,e);for(const l of U(this,xt).values())e?l.disableClick():l.enableClick(),l.div.classList.toggle("waiting",e)}}getEditors(e){const l=[];for(const t of U(this,pt).values())t.pageIndex===e&&l.push(t);return l}getEditor(e){return U(this,pt).get(e)}addEditor(e){U(this,pt).set(e.id,e)}removeEditor(e){var l;e.div.contains(document.activeElement)&&(U(this,qd)&&clearTimeout(U(this,qd)),N(this,qd,setTimeout(()=>{this.focusMainContainer(),N(this,qd,null)},0))),U(this,pt).delete(e.id),this.unselect(e),(!e.annotationElementId||!U(this,Ds).has(e.annotationElementId))&&((l=U(this,jn))==null||l.remove(e.id))}addDeletedAnnotationElement(e){U(this,Ds).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return U(this,Ds).has(e)}removeDeletedAnnotationElement(e){U(this,Ds).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){U(this,ke)!==e&&(N(this,ke,e),e&&p(this,Ul,ln).call(this,e.propertiesToUpdate))}updateUI(e){U(this,Ul,YM)===e&&p(this,Ul,ln).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){p(this,Ul,ln).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(U(this,Dl).has(e)){U(this,Dl).delete(e),e.unselect(),p(this,Ul,ee).call(this,{hasSelectedEditor:this.hasSelection});return}U(this,Dl).add(e),e.select(),p(this,Ul,ln).call(this,e.propertiesToUpdate),p(this,Ul,ee).call(this,{hasSelectedEditor:!0})}setSelected(e){var l;(l=U(this,Is))==null||l.commitOrRemove();for(const t of U(this,Dl))t!==e&&t.unselect();U(this,Dl).clear(),U(this,Dl).add(e),e.select(),p(this,Ul,ln).call(this,e.propertiesToUpdate),p(this,Ul,ee).call(this,{hasSelectedEditor:!0})}isSelected(e){return U(this,Dl).has(e)}get firstSelectedEditor(){return U(this,Dl).values().next().value}unselect(e){e.unselect(),U(this,Dl).delete(e),p(this,Ul,ee).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return U(this,Dl).size!==0}get isEnterHandled(){return U(this,Dl).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;U(this,ed).undo(),p(this,Ul,ee).call(this,{hasSomethingToUndo:U(this,ed).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:p(this,Ul,pZ).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){U(this,ed).redo(),p(this,Ul,ee).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:U(this,ed).hasSomethingToRedo(),isEmpty:p(this,Ul,pZ).call(this)})}addCommands(e){U(this,ed).add(e),p(this,Ul,ee).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:p(this,Ul,pZ).call(this)})}cleanUndoStack(e){U(this,ed).cleanType(e)}delete(){var e;this.commitOrRemove();const l=(e=this.currentLayer)==null?void 0:e.endDrawingSession(!0);if(!this.hasSelection&&!l)return;const t=l?[l]:[...U(this,Dl)],d=()=>{var a;(a=this._editorUndoBar)==null||a.show(n,t.length===1?t[0].editorType:t.length);for(const i of t)i.remove()},n=()=>{for(const a of t)p(this,Ul,SR).call(this,a)};this.addCommands({cmd:d,undo:n,mustExec:!0})}commitOrRemove(){var e;(e=U(this,ke))==null||e.commitOrRemove()}hasSomethingToControl(){return U(this,ke)||this.hasSelection}selectAll(){for(const e of U(this,Dl))e.commit();p(this,Ul,JR).call(this,U(this,pt).values())}unselectAll(){var e;if(!(U(this,ke)&&(U(this,ke).commitOrRemove(),U(this,Xt)!==ul.NONE))&&!((e=U(this,Is))!=null&&e.commitOrRemove())&&this.hasSelection){for(const l of U(this,Dl))l.unselect();U(this,Dl).clear(),p(this,Ul,ee).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,l,t=!1){if(t||this.commitOrRemove(),!this.hasSelection)return;U(this,ni)[0]+=e,U(this,ni)[1]+=l;const[d,n]=U(this,ni),a=[...U(this,Dl)];U(this,$d)&&clearTimeout(U(this,$d)),N(this,$d,setTimeout(()=>{N(this,$d,null),U(this,ni)[0]=U(this,ni)[1]=0,this.addCommands({cmd:()=>{for(const s of a)U(this,pt).has(s.id)&&s.translateInPage(d,n)},undo:()=>{for(const s of a)U(this,pt).has(s.id)&&s.translateInPage(-d,-n)},mustExec:!1})},1e3));for(const s of a)s.translateInPage(e,l)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),N(this,_d,new Map);for(const e of U(this,Dl))U(this,_d).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!U(this,_d))return!1;this.disableUserSelect(!1);const e=U(this,_d);N(this,_d,null);let l=!1;for(const[{x:d,y:n,pageIndex:a},i]of e)i.newX=d,i.newY=n,i.newPageIndex=a,l||(l=d!==i.savedX||n!==i.savedY||a!==i.savedPageIndex);if(!l)return!1;const t=(d,n,a,i)=>{if(U(this,pt).has(d.id)){const s=U(this,xt).get(i);s?d._setParentAndPosition(s,n,a):(d.pageIndex=i,d.x=n,d.y=a)}};return this.addCommands({cmd:()=>{for(const[d,{newX:n,newY:a,newPageIndex:i}]of e)t(d,n,a,i)},undo:()=>{for(const[d,{savedX:n,savedY:a,savedPageIndex:i}]of e)t(d,n,a,i)},mustExec:!0}),!0}dragSelectedEditors(e,l){if(U(this,_d))for(const t of U(this,_d).keys())t.drag(e,l)}rebuild(e){if(e.parent===null){const l=this.getLayer(e.pageIndex);l?(l.changeParent(e),l.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||U(this,Dl).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return U(this,ke)===e}getActive(){return U(this,ke)}getMode(){return U(this,Xt)}get imageManager(){return rl(this,"imageManager",new jL)}getSelectionBoxes(e){if(!e)return null;const l=document.getSelection();for(let c=0,F=l.rangeCount;c<F;c++)if(!e.contains(l.getRangeAt(c).commonAncestorContainer))return null;const{x:t,y:d,width:n,height:a}=e.getBoundingClientRect();let i;switch(e.getAttribute("data-main-rotation")){case"90":i=(c,F,h,o)=>({x:(F-d)/a,y:1-(c+h-t)/n,width:o/a,height:h/n});break;case"180":i=(c,F,h,o)=>({x:1-(c+h-t)/n,y:1-(F+o-d)/a,width:h/n,height:o/a});break;case"270":i=(c,F,h,o)=>({x:1-(F+o-d)/a,y:(c-t)/n,width:o/a,height:h/n});break;default:i=(c,F,h,o)=>({x:(c-t)/n,y:(F-d)/a,width:h/n,height:o/a});break}const s=[];for(let c=0,F=l.rangeCount;c<F;c++){const h=l.getRangeAt(c);if(!h.collapsed)for(const{x:o,y:V,width:W,height:Q}of h.getClientRects())W===0||Q===0||s.push(i(o,V,W,Q))}return s.length===0?null:s}addChangedExistingAnnotation({annotationElementId:e,id:l}){(U(this,Ls)||N(this,Ls,new Map)).set(e,l)}removeChangedExistingAnnotation({annotationElementId:e}){var l;(l=U(this,Ls))==null||l.delete(e)}renderAnnotationElement(e){var l;const t=(l=U(this,Ls))==null?void 0:l.get(e.data.id);if(!t)return;const d=U(this,jn).getRawValue(t);d&&(U(this,Xt)===ul.NONE&&!d.hasBeenModified||d.renderAnnotationElement(e))}},mZ=new WeakMap,ke=new WeakMap,pt=new WeakMap,xt=new WeakMap,RZ=new WeakMap,jn=new WeakMap,Ls=new WeakMap,ed=new WeakMap,$a=new WeakMap,Is=new WeakMap,NZ=new WeakMap,Ds=new WeakMap,_d=new WeakMap,Md=new WeakMap,ws=new WeakMap,Ch=new WeakMap,xh=new WeakMap,bZ=new WeakMap,gh=new WeakMap,qd=new WeakMap,li=new WeakMap,uZ=new WeakMap,ti=new WeakMap,Sd=new WeakMap,bR=new WeakMap,ei=new WeakMap,jh=new WeakMap,di=new WeakMap,Es=new WeakMap,Oh=new WeakMap,vh=new WeakMap,Xt=new WeakMap,Dl=new WeakMap,On=new WeakMap,Cs=new WeakMap,rZ=new WeakMap,Kh=new WeakMap,ni=new WeakMap,$d=new WeakMap,vn=new WeakMap,fh=new WeakMap,dd=new WeakMap,Ul=new WeakSet,Hh=function({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},uR=function(e){const{currentLayer:l}=this;if(l.hasTextLayer(e))return l;for(const t of U(this,xt).values())if(t.hasTextLayer(e))return t;return null},pM=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const l=p(this,Ul,Hh).call(this,e).closest(".textLayer"),t=this.getSelectionBoxes(l);t&&(U(this,Sd)||N(this,Sd,new xL(this)),U(this,Sd).show(l,t,this.direction==="ltr"))},MM=function(){var e,l,t;const d=document.getSelection();if(!d||d.isCollapsed){U(this,On)&&((e=U(this,Sd))==null||e.hide(),N(this,On,null),p(this,Ul,ee).call(this,{hasSelectedText:!1}));return}const{anchorNode:n}=d;if(n===U(this,On))return;const a=p(this,Ul,Hh).call(this,d).closest(".textLayer");if(!a){U(this,On)&&((l=U(this,Sd))==null||l.hide(),N(this,On,null),p(this,Ul,ee).call(this,{hasSelectedText:!1}));return}if((t=U(this,Sd))==null||t.hide(),N(this,On,n),p(this,Ul,ee).call(this,{hasSelectedText:!0}),!(U(this,Xt)!==ul.HIGHLIGHT&&U(this,Xt)!==ul.NONE)&&(U(this,Xt)===ul.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),N(this,ti,this.isShiftKeyDown),!this.isShiftKeyDown)){const i=U(this,Xt)===ul.HIGHLIGHT?p(this,Ul,uR).call(this,a):null;i==null||i.toggleDrawing();const s=new AbortController,c=this.combinedSignal(s),F=h=>{h.type==="pointerup"&&h.button!==0||(s.abort(),i==null||i.toggleDrawing(!0),h.type==="pointerup"&&p(this,Ul,Ph).call(this,"main_toolbar"))};window.addEventListener("pointerup",F,{signal:c}),window.addEventListener("blur",F,{signal:c})}},Ph=function(e=""){U(this,Xt)===ul.HIGHLIGHT?this.highlightSelection(e):U(this,Ch)&&p(this,Ul,pM).call(this)},SM=function(){document.addEventListener("selectionchange",p(this,Ul,MM).bind(this),{signal:this._signal})},JM=function(){if(U(this,li))return;N(this,li,new AbortController);const e=this.combinedSignal(U(this,li));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},TM=function(){var e;(e=U(this,li))==null||e.abort(),N(this,li,null)},rR=function(){if(U(this,di))return;N(this,di,new AbortController);const e=this.combinedSignal(U(this,di));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},GM=function(){var e;(e=U(this,di))==null||e.abort(),N(this,di,null)},pR=function(){if(U(this,$a))return;N(this,$a,new AbortController);const e=this.combinedSignal(U(this,$a));document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})},MR=function(){var e;(e=U(this,$a))==null||e.abort(),N(this,$a,null)},XM=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},ee=function(e){Object.entries(e).some(([l,t])=>U(this,Kh)[l]!==t)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(U(this,Kh),e)}),U(this,Xt)===ul.HIGHLIGHT&&e.hasSelectedEditor===!1&&p(this,Ul,ln).call(this,[[Jl.HIGHLIGHT_FREE,!0]]))},ln=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},yM=async function(){if(!U(this,ei)){N(this,ei,!0);const e=[];for(const l of U(this,xt).values())e.push(l.enable());await Promise.all(e);for(const l of U(this,pt).values())l.enable()}},BM=function(){if(this.unselectAll(),U(this,ei)){N(this,ei,!1);for(const e of U(this,xt).values())e.disable();for(const e of U(this,pt).values())e.disable()}},SR=function(e){const l=U(this,xt).get(e.pageIndex);l?l.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},YM=function(){let e=null;for(e of U(this,Dl));return e},pZ=function(){if(U(this,pt).size===0)return!0;if(U(this,pt).size===1)for(const e of U(this,pt).values())return e.isEmpty();return!1},JR=function(e){for(const l of U(this,Dl))l.unselect();U(this,Dl).clear();for(const l of e)l.isEmpty()||(U(this,Dl).add(l),l.select());p(this,Ul,ee).call(this,{hasSelectedEditor:this.hasSelection})},hl(xs,"TRANSLATE_SMALL",1),hl(xs,"TRANSLATE_BIG",10),xs);var yt,tn,Jd,SZ,en,ze,JZ,dn,re,Kn,gs,nn,fn,an,TZ,Ah;const GZ=class Da{constructor(l){M(this,an),M(this,yt,null),M(this,tn,!1),M(this,Jd,null),M(this,SZ,null),M(this,en,null),M(this,ze,null),M(this,JZ,!1),M(this,dn,null),M(this,re,null),M(this,Kn,null),M(this,gs,null),M(this,nn,!1),N(this,re,l),N(this,nn,l._uiManager.useNewAltTextFlow),U(Da,fn)||N(Da,fn,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(l){Da._l10n??(Da._l10n=l)}async render(){const l=N(this,Jd,document.createElement("button"));l.className="altText",l.tabIndex="0";const t=N(this,SZ,document.createElement("span"));l.append(t),U(this,nn)?(l.classList.add("new"),l.setAttribute("data-l10n-id",U(Da,fn).missing),t.setAttribute("data-l10n-id",U(Da,fn)["missing-label"])):(l.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const d=U(this,re)._uiManager._signal;l.addEventListener("contextmenu",td,{signal:d}),l.addEventListener("pointerdown",a=>a.stopPropagation(),{signal:d});const n=a=>{a.preventDefault(),U(this,re)._uiManager.editAltText(U(this,re)),U(this,nn)&&U(this,re)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:U(this,an,TZ)}})};return l.addEventListener("click",n,{capture:!0,signal:d}),l.addEventListener("keydown",a=>{a.target===l&&a.key==="Enter"&&(N(this,JZ,!0),n(a))},{signal:d}),await p(this,an,Ah).call(this),l}finish(){U(this,Jd)&&(U(this,Jd).focus({focusVisible:U(this,JZ)}),N(this,JZ,!1))}isEmpty(){return U(this,nn)?U(this,yt)===null:!U(this,yt)&&!U(this,tn)}hasData(){return U(this,nn)?U(this,yt)!==null||!!U(this,Kn):this.isEmpty()}get guessedText(){return U(this,Kn)}async setGuessedText(l){U(this,yt)===null&&(N(this,Kn,l),N(this,gs,await Da._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:l})),p(this,an,Ah).call(this))}toggleAltTextBadge(l=!1){var t;if(!U(this,nn)||U(this,yt)){(t=U(this,dn))==null||t.remove(),N(this,dn,null);return}if(!U(this,dn)){const d=N(this,dn,document.createElement("div"));d.className="noAltTextBadge",U(this,re).div.append(d)}U(this,dn).classList.toggle("hidden",!l)}serialize(l){let t=U(this,yt);return!l&&U(this,Kn)===t&&(t=U(this,gs)),{altText:t,decorative:U(this,tn),guessedText:U(this,Kn),textWithDisclaimer:U(this,gs)}}get data(){return{altText:U(this,yt),decorative:U(this,tn)}}set data({altText:l,decorative:t,guessedText:d,textWithDisclaimer:n,cancel:a=!1}){d&&(N(this,Kn,d),N(this,gs,n)),!(U(this,yt)===l&&U(this,tn)===t)&&(a||(N(this,yt,l),N(this,tn,t)),p(this,an,Ah).call(this))}toggle(l=!1){U(this,Jd)&&(!l&&U(this,ze)&&(clearTimeout(U(this,ze)),N(this,ze,null)),U(this,Jd).disabled=!l)}shown(){U(this,re)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:U(this,an,TZ)}})}destroy(){var l,t;(l=U(this,Jd))==null||l.remove(),N(this,Jd,null),N(this,SZ,null),N(this,en,null),(t=U(this,dn))==null||t.remove(),N(this,dn,null)}};yt=new WeakMap,tn=new WeakMap,Jd=new WeakMap,SZ=new WeakMap,en=new WeakMap,ze=new WeakMap,JZ=new WeakMap,dn=new WeakMap,re=new WeakMap,Kn=new WeakMap,gs=new WeakMap,nn=new WeakMap,fn=new WeakMap,an=new WeakSet,TZ=function(){return U(this,yt)&&"added"||U(this,yt)===null&&this.guessedText&&"review"||"missing"},Ah=async function(){var e,l,t;const d=U(this,Jd);if(!d)return;if(U(this,nn)){if(d.classList.toggle("done",!!U(this,yt)),d.setAttribute("data-l10n-id",U(GZ,fn)[U(this,an,TZ)]),(e=U(this,SZ))==null||e.setAttribute("data-l10n-id",U(GZ,fn)[`${U(this,an,TZ)}-label`]),!U(this,yt)){(l=U(this,en))==null||l.remove();return}}else{if(!U(this,yt)&&!U(this,tn)){d.classList.remove("done"),(t=U(this,en))==null||t.remove();return}d.classList.add("done"),d.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let n=U(this,en);if(!n){N(this,en,n=document.createElement("span")),n.className="tooltip",n.setAttribute("role","tooltip"),n.id=`alt-text-tooltip-${U(this,re).id}`;const i=100,s=U(this,re)._uiManager._signal;s.addEventListener("abort",()=>{clearTimeout(U(this,ze)),N(this,ze,null)},{once:!0}),d.addEventListener("mouseenter",()=>{N(this,ze,setTimeout(()=>{N(this,ze,null),U(this,en).classList.add("show"),U(this,re)._reportTelemetry({action:"alt_text_tooltip"})},i))},{signal:s}),d.addEventListener("mouseleave",()=>{var c;U(this,ze)&&(clearTimeout(U(this,ze)),N(this,ze,null)),(c=U(this,en))==null||c.classList.remove("show")},{signal:s})}U(this,tn)?n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(n.removeAttribute("data-l10n-id"),n.textContent=U(this,yt)),n.parentNode||d.append(n);const a=U(this,re).getImageForAltText();a==null||a.setAttribute("aria-describedby",n.id)},M(GZ,fn,null),hl(GZ,"_l10n",null);let kM=GZ;var _h,js,qh,$h,lo,to,eo,XZ,Hn,Os,ai,vs,zM,LM,TR,GR;let IM=(GR=class{constructor({container:e,isPinchingDisabled:l=null,isPinchingStopped:t=null,onPinchStart:d=null,onPinching:n=null,onPinchEnd:a=null,signal:i}){M(this,vs),M(this,_h),M(this,js,!1),M(this,qh,null),M(this,$h),M(this,lo),M(this,to),M(this,eo),M(this,XZ),M(this,Hn,null),M(this,Os),M(this,ai,null),N(this,_h,e),N(this,qh,t),N(this,$h,l),N(this,lo,d),N(this,to,n),N(this,eo,a),N(this,Os,new AbortController),N(this,XZ,AbortSignal.any([i,U(this,Os).signal])),e.addEventListener("touchstart",p(this,vs,zM).bind(this),{passive:!1,signal:U(this,XZ)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return rl(this,"MIN_TOUCH_DISTANCE_TO_PINCH",35/(window.devicePixelRatio||1))}destroy(){var e;(e=U(this,Os))==null||e.abort(),N(this,Os,null)}},_h=new WeakMap,js=new WeakMap,qh=new WeakMap,$h=new WeakMap,lo=new WeakMap,to=new WeakMap,eo=new WeakMap,XZ=new WeakMap,Hn=new WeakMap,Os=new WeakMap,ai=new WeakMap,vs=new WeakSet,zM=function(e){var l,t,d;if((l=U(this,$h))!=null&&l.call(this)||e.touches.length<2)return;if(!U(this,ai)){N(this,ai,new AbortController);const i=AbortSignal.any([U(this,XZ),U(this,ai).signal]),s=U(this,_h),c={signal:i,passive:!1};s.addEventListener("touchmove",p(this,vs,LM).bind(this),c),s.addEventListener("touchend",p(this,vs,TR).bind(this),c),s.addEventListener("touchcancel",p(this,vs,TR).bind(this),c),(t=U(this,lo))==null||t.call(this)}if(ue(e),e.touches.length!==2||(d=U(this,qh))!=null&&d.call(this)){N(this,Hn,null);return}let[n,a]=e.touches;n.identifier>a.identifier&&([n,a]=[a,n]),N(this,Hn,{touch0X:n.screenX,touch0Y:n.screenY,touch1X:a.screenX,touch1Y:a.screenY})},LM=function(e){var l;if(!U(this,Hn)||e.touches.length!==2)return;let[t,d]=e.touches;t.identifier>d.identifier&&([t,d]=[d,t]);const{screenX:n,screenY:a}=t,{screenX:i,screenY:s}=d,c=U(this,Hn),{touch0X:F,touch0Y:h,touch1X:o,touch1Y:V}=c,W=o-F,Q=V-h,m=i-n,R=s-a,r=Math.hypot(m,R)||1,b=Math.hypot(W,Q)||1;if(!U(this,js)&&Math.abs(b-r)<=GR.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=n,c.touch0Y=a,c.touch1X=i,c.touch1Y=s,e.preventDefault(),!U(this,js)){N(this,js,!0);return}const u=[(n+i)/2,(a+s)/2];(l=U(this,to))==null||l.call(this,u,b,r)},TR=function(e){var l;U(this,ai).abort(),N(this,ai,null),(l=U(this,eo))==null||l.call(this),U(this,Hn)&&(e.preventDefault(),N(this,Hn,null),N(this,js,!1))},GR);var Ks,Td,Kl,yZ,ii,no,fs,gt,Hs,Pn,si,ao,Ps,jt,io,As,An,sn,BZ,YZ,Le,ci,so,XR,yl,yR,co,BR,Uo,DM,wM,YR,Zo,kR,EM,CM,xM,zR,gM,LR,jM,OM,vM,IR,kZ;const et=class Dt{constructor(l){M(this,yl),M(this,Ks,null),M(this,Td,null),M(this,Kl,null),M(this,yZ,!1),M(this,ii,null),M(this,no,""),M(this,fs,!1),M(this,gt,null),M(this,Hs,null),M(this,Pn,null),M(this,si,null),M(this,ao,""),M(this,Ps,!1),M(this,jt,null),M(this,io,!1),M(this,As,!1),M(this,An,!1),M(this,sn,null),M(this,BZ,0),M(this,YZ,0),M(this,Le,null),M(this,ci,null),hl(this,"_editToolbar",null),hl(this,"_initialOptions",Object.create(null)),hl(this,"_initialData",null),hl(this,"_isVisible",!0),hl(this,"_uiManager",null),hl(this,"_focusEventsAllowed",!0),M(this,so,!1),M(this,XR,Dt._zIndex++),this.parent=l.parent,this.id=l.id,this.width=this.height=null,this.pageIndex=l.parent.pageIndex,this.name=l.name,this.div=null,this._uiManager=l.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=l.isCentered,this._structTreeParentId=null;const{rotation:t,rawDims:{pageWidth:d,pageHeight:n,pageX:a,pageY:i}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[d,n],this.pageTranslation=[a,i];const[s,c]=this.parentDimensions;this.x=l.x/s,this.y=l.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const l=Dt.prototype._resizeWithKeyboard,t=MZ.TRANSLATE_SMALL,d=MZ.TRANSLATE_BIG;return rl(this,"_resizerKeyboardManager",new QZ([[["ArrowLeft","mac+ArrowLeft"],l,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],l,{args:[-d,0]}],[["ArrowRight","mac+ArrowRight"],l,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],l,{args:[d,0]}],[["ArrowUp","mac+ArrowUp"],l,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],l,{args:[0,-d]}],[["ArrowDown","mac+ArrowDown"],l,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],l,{args:[0,d]}],[["Escape","mac+Escape"],Dt.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get isDrawer(){return!1}static get _defaultLineColor(){return rl(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(l){const t=new KL({id:l.parent.getNextId(),parent:l.parent,uiManager:l._uiManager});t.annotationElementId=l.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(l,t){if(Dt._l10n??(Dt._l10n=l),Dt._l10nResizer||(Dt._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),Dt._borderLineWidth!==-1)return;const d=getComputedStyle(document.documentElement);Dt._borderLineWidth=parseFloat(d.getPropertyValue("--outline-width"))||0}static updateDefaultParams(l,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(l){return!1}static paste(l,t){Cl("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return U(this,so)}set _isDraggable(l){var t;N(this,so,l),(t=this.div)==null||t.classList.toggle("draggable",l)}get isEnterHandled(){return!0}center(){const[l,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(l*2),this.y+=this.width*l/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(l*2),this.y-=this.width*l/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(l){this._uiManager.addCommands(l)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=U(this,XR)}setParent(l){l!==null?(this.pageIndex=l.pageIndex,this.pageDimensions=l.pageDimensions):p(this,yl,kZ).call(this),this.parent=l}focusin(l){this._focusEventsAllowed&&(U(this,Ps)?N(this,Ps,!1):this.parent.setSelected(this))}focusout(l){var t;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const d=l.relatedTarget;d!=null&&d.closest(`#${this.id}`)||(l.preventDefault(),(t=this.parent)!=null&&t.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(l,t,d,n){const[a,i]=this.parentDimensions;[d,n]=this.screenToPageTranslation(d,n),this.x=(l+d)/a,this.y=(t+n)/i,this.fixAndSetPosition()}translate(l,t){p(this,yl,yR).call(this,this.parentDimensions,l,t)}translateInPage(l,t){U(this,jt)||N(this,jt,[this.x,this.y,this.width,this.height]),p(this,yl,yR).call(this,this.pageDimensions,l,t),this.div.scrollIntoView({block:"nearest"})}drag(l,t){U(this,jt)||N(this,jt,[this.x,this.y,this.width,this.height]);const{div:d,parentDimensions:[n,a]}=this;if(this.x+=l/n,this.y+=t/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:o,y:V}=this.div.getBoundingClientRect();this.parent.findNewParent(this,o,V)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:i,y:s}=this;const[c,F]=this.getBaseTranslation();i+=c,s+=F;const{style:h}=d;h.left=`${(100*i).toFixed(2)}%`,h.top=`${(100*s).toFixed(2)}%`,this._onTranslating(i,s),d.scrollIntoView({block:"nearest"})}_onTranslating(l,t){}_onTranslated(l,t){}get _hasBeenMoved(){return!!U(this,jt)&&(U(this,jt)[0]!==this.x||U(this,jt)[1]!==this.y)}get _hasBeenResized(){return!!U(this,jt)&&(U(this,jt)[2]!==this.width||U(this,jt)[3]!==this.height)}getBaseTranslation(){const[l,t]=this.parentDimensions,{_borderLineWidth:d}=Dt,n=d/l,a=d/t;switch(this.rotation){case 90:return[-n,a];case 180:return[n,a];case 270:return[n,-a];default:return[-n,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(l=this.rotation){const{div:{style:t},pageDimensions:[d,n]}=this;let{x:a,y:i,width:s,height:c}=this;if(s*=d,c*=n,a*=d,i*=n,this._mustFixPosition)switch(l){case 0:a=Math.max(0,Math.min(d-s,a)),i=Math.max(0,Math.min(n-c,i));break;case 90:a=Math.max(0,Math.min(d-c,a)),i=Math.min(n,Math.max(s,i));break;case 180:a=Math.min(d,Math.max(s,a)),i=Math.min(n,Math.max(c,i));break;case 270:a=Math.min(d,Math.max(c,a)),i=Math.max(0,Math.min(n-s,i));break}this.x=a/=d,this.y=i/=n;const[F,h]=this.getBaseTranslation();a+=F,i+=h,t.left=`${(100*a).toFixed(2)}%`,t.top=`${(100*i).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(l,t){var d;return p(d=Dt,co,BR).call(d,l,t,this.parentRotation)}pageTranslationToScreen(l,t){var d;return p(d=Dt,co,BR).call(d,l,t,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:l,pageDimensions:[t,d]}=this;return[t*l,d*l]}setDims(l,t){const[d,n]=this.parentDimensions,{style:a}=this.div;a.width=`${(100*l/d).toFixed(2)}%`,U(this,fs)||(a.height=`${(100*t/n).toFixed(2)}%`)}fixDims(){const{style:l}=this.div,{height:t,width:d}=l,n=d.endsWith("%"),a=!U(this,fs)&&t.endsWith("%");if(n&&a)return;const[i,s]=this.parentDimensions;n||(l.width=`${(100*parseFloat(d)/i).toFixed(2)}%`),!U(this,fs)&&!a&&(l.height=`${(100*parseFloat(t)/s).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}_onResized(){}static _round(l){return Math.round(l*1e4)/1e4}_onResizing(){}altTextFinish(){var l;(l=U(this,Kl))==null||l.finish()}async addEditToolbar(){return this._editToolbar||U(this,As)?this._editToolbar:(this._editToolbar=new CL(this),this.div.append(this._editToolbar.render()),U(this,Kl)&&await this._editToolbar.addAltText(U(this,Kl)),this._editToolbar)}removeEditToolbar(){var l;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(l=U(this,Kl))==null||l.destroy())}addContainer(l){var t;const d=(t=this._editToolbar)==null?void 0:t.div;d?d.before(l):this.div.append(l)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){U(this,Kl)||(kM.initialize(Dt._l10n),N(this,Kl,new kM(this)),U(this,Ks)&&(U(this,Kl).data=U(this,Ks),N(this,Ks,null)),await this.addEditToolbar())}get altTextData(){var l;return(l=U(this,Kl))==null?void 0:l.data}set altTextData(l){U(this,Kl)&&(U(this,Kl).data=l)}get guessedAltText(){var l;return(l=U(this,Kl))==null?void 0:l.guessedText}async setGuessedAltText(l){var t;await((t=U(this,Kl))==null?void 0:t.setGuessedText(l))}serializeAltText(l){var t;return(t=U(this,Kl))==null?void 0:t.serialize(l)}hasAltText(){return!!U(this,Kl)&&!U(this,Kl).isEmpty()}hasAltTextData(){var l;return((l=U(this,Kl))==null?void 0:l.hasData())??!1}render(){var l;this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=U(this,yZ)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),p(this,yl,LR).call(this);const[t,d]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*d/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/d).toFixed(2)}%`);const[n,a]=this.getInitialTranslation();return this.translate(n,a),Ih(this,this.div,["pointerdown"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(U(this,ci)||N(this,ci,new IM({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:p(this,yl,EM).bind(this),onPinching:p(this,yl,CM).bind(this),onPinchEnd:p(this,yl,xM).bind(this),signal:this._uiManager._signal}))),(l=this._uiManager._editorUndoBar)==null||l.hide(),this.div}pointerdown(l){const{isMac:t}=te.platform;if(l.button!==0||l.ctrlKey&&t){l.preventDefault();return}if(N(this,Ps,!0),this._isDraggable){p(this,yl,gM).call(this,l);return}p(this,yl,zR).call(this,l)}get isSelected(){return this._uiManager.isSelected(this)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){U(this,sn)&&clearTimeout(U(this,sn)),N(this,sn,setTimeout(()=>{var l;N(this,sn,null),(l=this.parent)==null||l.moveEditorInDOM(this)},0))}_setParentAndPosition(l,t,d){l.changeParent(this),this.x=t,this.y=d,this.fixAndSetPosition(),this._onTranslated()}getRect(l,t,d=this.rotation){const n=this.parentScale,[a,i]=this.pageDimensions,[s,c]=this.pageTranslation,F=l/n,h=t/n,o=this.x*a,V=this.y*i,W=this.width*a,Q=this.height*i;switch(d){case 0:return[o+F+s,i-V-h-Q+c,o+F+W+s,i-V-h+c];case 90:return[o+h+s,i-V+F+c,o+h+Q+s,i-V+F+W+c];case 180:return[o-F-W+s,i-V+h+c,o-F+s,i-V+h+Q+c];case 270:return[o-h-Q+s,i-V-F-W+c,o-h+s,i-V-F+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(l,t){const[d,n,a,i]=l,s=a-d,c=i-n;switch(this.rotation){case 0:return[d,t-i,s,c];case 90:return[d,t-n,c,s];case 180:return[a,t-n,s,c];case 270:return[a,t-i,c,s];default:throw new Error("Invalid rotation")}}onceAdded(l){}isEmpty(){return!1}enableEditMode(){N(this,As,!0)}disableEditMode(){N(this,As,!1)}isInEditMode(){return U(this,As)}shouldGetKeyboardEvents(){return U(this,An)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:l,left:t,bottom:d,right:n}=this.getClientDimensions(),{innerHeight:a,innerWidth:i}=window;return t<i&&n>0&&l<a&&d>0}rebuild(){p(this,yl,LR).call(this)}rotate(l){}resize(){}serializeDeleted(){var l;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((l=this._initialData)==null?void 0:l.popupRef)||""}}serialize(l=!1,t=null){Cl("An editor must be serializable")}static async deserialize(l,t,d){const n=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:d});n.rotation=l.rotation,N(n,Ks,l.accessibilityData);const[a,i]=n.pageDimensions,[s,c,F,h]=n.getRectInCurrentCoords(l.rect,i);return n.x=s/a,n.y=c/i,n.width=F/a,n.height=h/i,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var l,t;if((l=U(this,si))==null||l.abort(),N(this,si,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),U(this,sn)&&(clearTimeout(U(this,sn)),N(this,sn,null)),p(this,yl,kZ).call(this),this.removeEditToolbar(),U(this,Le)){for(const d of U(this,Le).values())clearTimeout(d);N(this,Le,null)}this.parent=null,(t=U(this,ci))==null||t.destroy(),N(this,ci,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(p(this,yl,DM).call(this),U(this,gt).classList.remove("hidden"),Ih(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(l){if(!this.isResizable||l.target!==this.div||l.key!=="Enter")return;this._uiManager.setSelected(this),N(this,Pn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=U(this,gt).children;if(!U(this,Td)){N(this,Td,Array.from(t));const i=p(this,yl,jM).bind(this),s=p(this,yl,OM).bind(this),c=this._uiManager._signal;for(const F of U(this,Td)){const h=F.getAttribute("data-resizer-name");F.setAttribute("role","spinbutton"),F.addEventListener("keydown",i,{signal:c}),F.addEventListener("blur",s,{signal:c}),F.addEventListener("focus",p(this,yl,vM).bind(this,h),{signal:c}),F.setAttribute("data-l10n-id",Dt._l10nResizer[h])}}const d=U(this,Td)[0];let n=0;for(const i of t){if(i===d)break;n++}const a=(360-this.rotation+this.parentRotation)%360/90*(U(this,Td).length/4);if(a!==n){if(a<n)for(let s=0;s<n-a;s++)U(this,gt).append(U(this,gt).firstChild);else if(a>n)for(let s=0;s<a-n;s++)U(this,gt).firstChild.before(U(this,gt).lastChild);let i=0;for(const s of t){const c=U(this,Td)[i++].getAttribute("data-resizer-name");s.setAttribute("data-l10n-id",Dt._l10nResizer[c])}}p(this,yl,IR).call(this,0),N(this,An,!0),U(this,gt).firstChild.focus({focusVisible:!0}),l.preventDefault(),l.stopImmediatePropagation()}_resizeWithKeyboard(l,t){U(this,An)&&p(this,yl,kR).call(this,U(this,ao),{deltaX:l,deltaY:t,fromKeyboard:!0})}_stopResizingWithKeyboard(){p(this,yl,kZ).call(this),this.div.focus()}select(){var l,t,d;if(this.makeResizable(),(l=this.div)==null||l.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var n,a;(n=this.div)!=null&&n.classList.contains("selectedEditor")&&((a=this._editToolbar)==null||a.show())});return}(t=this._editToolbar)==null||t.show(),(d=U(this,Kl))==null||d.toggleAltTextBadge(!1)}unselect(){var l,t,d,n,a;(l=U(this,gt))==null||l.classList.add("hidden"),(t=this.div)==null||t.classList.remove("selectedEditor"),(d=this.div)!=null&&d.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(n=this._editToolbar)==null||n.hide(),(a=U(this,Kl))==null||a.toggleAltTextBadge(!0)}updateParams(l,t){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return U(this,io)}set isEditing(l){N(this,io,l),this.parent&&(l?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(l,t){N(this,fs,!0);const d=l/t,{style:n}=this.div;n.aspectRatio=d,n.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(l,t=!1){if(t){U(this,Le)||N(this,Le,new Map);const{action:d}=l;let n=U(this,Le).get(d);n&&clearTimeout(n),n=setTimeout(()=>{this._reportTelemetry(l),U(this,Le).delete(d),U(this,Le).size===0&&N(this,Le,null)},Dt._telemetryTimeout),U(this,Le).set(d,n);return}l.type||(l.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:l}})}show(l=this._isVisible){this.div.classList.toggle("hidden",!l),this._isVisible=l}enable(){this.div&&(this.div.tabIndex=0),N(this,yZ,!1)}disable(){this.div&&(this.div.tabIndex=-1),N(this,yZ,!0)}renderAnnotationElement(l){let t=l.container.querySelector(".annotationContent");if(!t)t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),l.container.prepend(t);else if(t.nodeName==="CANVAS"){const d=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),d.before(t)}return t}resetAnnotationElement(l){const{firstChild:t}=l.container;(t==null?void 0:t.nodeName)==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}};Ks=new WeakMap,Td=new WeakMap,Kl=new WeakMap,yZ=new WeakMap,ii=new WeakMap,no=new WeakMap,fs=new WeakMap,gt=new WeakMap,Hs=new WeakMap,Pn=new WeakMap,si=new WeakMap,ao=new WeakMap,Ps=new WeakMap,jt=new WeakMap,io=new WeakMap,As=new WeakMap,An=new WeakMap,sn=new WeakMap,BZ=new WeakMap,YZ=new WeakMap,Le=new WeakMap,ci=new WeakMap,so=new WeakMap,XR=new WeakMap,yl=new WeakSet,yR=function([e,l],t,d){[t,d]=this.screenToPageTranslation(t,d),this.x+=t/e,this.y+=d/l,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},co=new WeakSet,BR=function(e,l,t){switch(t){case 90:return[l,-e];case 180:return[-e,-l];case 270:return[-l,e];default:return[e,l]}},Uo=function(e){switch(e){case 90:{const[l,t]=this.pageDimensions;return[0,-l/t,t/l,0]}case 180:return[-1,0,0,-1];case 270:{const[l,t]=this.pageDimensions;return[0,l/t,-t/l,0]}default:return[1,0,0,1]}},DM=function(){if(U(this,gt))return;N(this,gt,document.createElement("div")),U(this,gt).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],l=this._uiManager._signal;for(const t of e){const d=document.createElement("div");U(this,gt).append(d),d.classList.add("resizer",t),d.setAttribute("data-resizer-name",t),d.addEventListener("pointerdown",p(this,yl,wM).bind(this,t),{signal:l}),d.addEventListener("contextmenu",td,{signal:l}),d.tabIndex=-1}this.div.prepend(U(this,gt))},wM=function(e,l){var t;l.preventDefault();const{isMac:d}=te.platform;if(l.button!==0||l.ctrlKey&&d)return;(t=U(this,Kl))==null||t.toggle(!1);const n=this._isDraggable;this._isDraggable=!1,N(this,Hs,[l.screenX,l.screenY]);const a=new AbortController,i=this._uiManager.combinedSignal(a);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",p(this,yl,kR).bind(this,e),{passive:!0,capture:!0,signal:i}),window.addEventListener("touchmove",ue,{passive:!1,signal:i}),window.addEventListener("contextmenu",td,{signal:i}),N(this,Pn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const s=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(l.target).cursor;const F=()=>{var h;a.abort(),this.parent.togglePointerEvents(!0),(h=U(this,Kl))==null||h.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=s,this.div.style.cursor=c,p(this,yl,Zo).call(this)};window.addEventListener("pointerup",F,{signal:i}),window.addEventListener("blur",F,{signal:i})},YR=function(e,l,t,d){this.width=t,this.height=d,this.x=e,this.y=l;const[n,a]=this.parentDimensions;this.setDims(n*t,a*d),this.fixAndSetPosition(),this._onResized()},Zo=function(){if(!U(this,Pn))return;const{savedX:e,savedY:l,savedWidth:t,savedHeight:d}=U(this,Pn);N(this,Pn,null);const n=this.x,a=this.y,i=this.width,s=this.height;n===e&&a===l&&i===t&&s===d||this.addCommands({cmd:p(this,yl,YR).bind(this,n,a,i,s),undo:p(this,yl,YR).bind(this,e,l,t,d),mustExec:!0})},kR=function(e,l){const[t,d]=this.parentDimensions,n=this.x,a=this.y,i=this.width,s=this.height,c=et.MIN_SIZE/t,F=et.MIN_SIZE/d,h=p(this,yl,Uo).call(this,this.rotation),o=(f,Y)=>[h[0]*f+h[2]*Y,h[1]*f+h[3]*Y],V=p(this,yl,Uo).call(this,360-this.rotation),W=(f,Y)=>[V[0]*f+V[2]*Y,V[1]*f+V[3]*Y];let Q,m,R=!1,r=!1;switch(e){case"topLeft":R=!0,Q=(f,Y)=>[0,0],m=(f,Y)=>[f,Y];break;case"topMiddle":Q=(f,Y)=>[f/2,0],m=(f,Y)=>[f/2,Y];break;case"topRight":R=!0,Q=(f,Y)=>[f,0],m=(f,Y)=>[0,Y];break;case"middleRight":r=!0,Q=(f,Y)=>[f,Y/2],m=(f,Y)=>[0,Y/2];break;case"bottomRight":R=!0,Q=(f,Y)=>[f,Y],m=(f,Y)=>[0,0];break;case"bottomMiddle":Q=(f,Y)=>[f/2,Y],m=(f,Y)=>[f/2,0];break;case"bottomLeft":R=!0,Q=(f,Y)=>[0,Y],m=(f,Y)=>[f,0];break;case"middleLeft":r=!0,Q=(f,Y)=>[0,Y/2],m=(f,Y)=>[f,Y/2];break}const b=Q(i,s),u=m(i,s);let J=o(...u);const G=et._round(n+J[0]),T=et._round(a+J[1]);let y=1,k=1,X,L;if(l.fromKeyboard)({deltaX:X,deltaY:L}=l);else{const{screenX:f,screenY:Y}=l,[B,z]=U(this,Hs);[X,L]=this.screenToPageTranslation(f-B,Y-z),U(this,Hs)[0]=f,U(this,Hs)[1]=Y}if([X,L]=W(X/t,L/d),R){const f=Math.hypot(i,s);y=k=Math.max(Math.min(Math.hypot(u[0]-b[0]-X,u[1]-b[1]-L)/f,1/i,1/s),c/i,F/s)}else r?y=Math.max(c,Math.min(1,Math.abs(u[0]-b[0]-X)))/i:k=Math.max(F,Math.min(1,Math.abs(u[1]-b[1]-L)))/s;const D=et._round(i*y),C=et._round(s*k);J=o(...m(D,C));const I=G-J[0],H=T-J[1];U(this,jt)||N(this,jt,[this.x,this.y,this.width,this.height]),this.width=D,this.height=C,this.x=I,this.y=H,this.setDims(t*D,d*C),this.fixAndSetPosition(),this._onResizing()},EM=function(){var e;N(this,Pn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=U(this,Kl))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)},CM=function(e,l,t){let d=.7*(t/l)+1-.7;if(d===1)return;const n=p(this,yl,Uo).call(this,this.rotation),a=(J,G)=>[n[0]*J+n[2]*G,n[1]*J+n[3]*G],[i,s]=this.parentDimensions,c=this.x,F=this.y,h=this.width,o=this.height,V=et.MIN_SIZE/i,W=et.MIN_SIZE/s;d=Math.max(Math.min(d,1/h,1/o),V/h,W/o);const Q=et._round(h*d),m=et._round(o*d);if(Q===h&&m===o)return;U(this,jt)||N(this,jt,[c,F,h,o]);const R=a(h/2,o/2),r=et._round(c+R[0]),b=et._round(F+R[1]),u=a(Q/2,m/2);this.x=r-u[0],this.y=b-u[1],this.width=Q,this.height=m,this.setDims(i*Q,s*m),this.fixAndSetPosition(),this._onResizing()},xM=function(){var e;(e=U(this,Kl))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),p(this,yl,Zo).call(this)},zR=function(e){const{isMac:l}=te.platform;e.ctrlKey&&!l||e.shiftKey||e.metaKey&&l?this.parent.toggleSelected(this):this.parent.setSelected(this)},gM=function(e){const{isSelected:l}=this;this._uiManager.setUpDragSession();let t=!1;const d=new AbortController,n=this._uiManager.combinedSignal(d),a={capture:!0,passive:!1,signal:n},i=c=>{d.abort(),N(this,ii,null),N(this,Ps,!1),this._uiManager.endDragSession()||p(this,yl,zR).call(this,c),t&&this._onStopDragging()};l&&(N(this,BZ,e.clientX),N(this,YZ,e.clientY),N(this,ii,e.pointerId),N(this,no,e.pointerType),window.addEventListener("pointermove",c=>{t||(t=!0,this._onStartDragging());const{clientX:F,clientY:h,pointerId:o}=c;if(o!==U(this,ii)){ue(c);return}const[V,W]=this.screenToPageTranslation(F-U(this,BZ),h-U(this,YZ));N(this,BZ,F),N(this,YZ,h),this._uiManager.dragSelectedEditors(V,W)},a),window.addEventListener("touchmove",ue,a),window.addEventListener("pointerdown",c=>{c.pointerType===U(this,no)&&(U(this,ci)||c.isPrimary)&&i(c),ue(c)},a));const s=c=>{if(!U(this,ii)||U(this,ii)===c.pointerId){i(c);return}ue(c)};window.addEventListener("pointerup",s,{signal:n}),window.addEventListener("blur",s,{signal:n})},LR=function(){if(U(this,si)||!this.div)return;N(this,si,new AbortController);const e=this._uiManager.combinedSignal(U(this,si));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},jM=function(e){et._resizerKeyboardManager.exec(this,e)},OM=function(e){var l;U(this,An)&&((l=e.relatedTarget)==null?void 0:l.parentNode)!==U(this,gt)&&p(this,yl,kZ).call(this)},vM=function(e){N(this,ao,U(this,An)?e:"")},IR=function(e){if(U(this,Td))for(const l of U(this,Td))l.tabIndex=e},kZ=function(){N(this,An,!1),p(this,yl,IR).call(this,-1),p(this,yl,Zo).call(this)},M(et,co),hl(et,"_l10n",null),hl(et,"_l10nResizer",null),hl(et,"_borderLineWidth",-1),hl(et,"_colorManager",new vL),hl(et,"_zIndex",1),hl(et,"_telemetryTimeout",1e3);let dt=et;class KL extends dt{constructor(l){super(l),this.annotationElementId=l.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const KM=3285377520,Ie=4294901760,Gd=65535;class fM{constructor(l){this.h1=l?l&4294967295:KM,this.h2=l?l&4294967295:KM}update(l){let t,d;if(typeof l=="string"){t=new Uint8Array(l.length*2),d=0;for(let m=0,R=l.length;m<R;m++){const r=l.charCodeAt(m);r<=255?t[d++]=r:(t[d++]=r>>>8,t[d++]=r&255)}}else if(ArrayBuffer.isView(l))t=l.slice(),d=t.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const n=d>>2,a=d-n*4,i=new Uint32Array(t.buffer,0,n);let s=0,c=0,F=this.h1,h=this.h2;const o=3432918353,V=461845907,W=o&Gd,Q=V&Gd;for(let m=0;m<n;m++)m&1?(s=i[m],s=s*o&Ie|s*W&Gd,s=s<<15|s>>>17,s=s*V&Ie|s*Q&Gd,F^=s,F=F<<13|F>>>19,F=F*5+3864292196):(c=i[m],c=c*o&Ie|c*W&Gd,c=c<<15|c>>>17,c=c*V&Ie|c*Q&Gd,h^=c,h=h<<13|h>>>19,h=h*5+3864292196);switch(s=0,a){case 3:s^=t[n*4+2]<<16;case 2:s^=t[n*4+1]<<8;case 1:s^=t[n*4],s=s*o&Ie|s*W&Gd,s=s<<15|s>>>17,s=s*V&Ie|s*Q&Gd,n&1?F^=s:h^=s}this.h1=F,this.h2=h}hexdigest(){let l=this.h1,t=this.h2;return l^=t>>>1,l=l*3981806797&Ie|l*36045&Gd,t=t*4283543511&Ie|((t<<16|l>>>16)*2950163797&Ie)>>>16,l^=t>>>1,l=l*444984403&Ie|l*60499&Gd,t=t*3301882366&Ie|((t<<16|l>>>16)*3120437893&Ie)>>>16,l^=t>>>1,(l>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const DR=Object.freeze({map:null,hash:"",transfer:void 0});var _s,qs,Bt,wR,HM;class ER{constructor(){M(this,wR),M(this,_s,!1),M(this,qs,null),M(this,Bt,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(l,t){const d=U(this,Bt).get(l);return d===void 0?t:Object.assign(t,d)}getRawValue(l){return U(this,Bt).get(l)}remove(l){if(U(this,Bt).delete(l),U(this,Bt).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const t of U(this,Bt).values())if(t instanceof dt)return;this.onAnnotationEditor(null)}}setValue(l,t){const d=U(this,Bt).get(l);let n=!1;if(d!==void 0)for(const[a,i]of Object.entries(t))d[a]!==i&&(n=!0,d[a]=i);else n=!0,U(this,Bt).set(l,t);n&&p(this,wR,HM).call(this),t instanceof dt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(t.constructor._type)}has(l){return U(this,Bt).has(l)}getAll(){return U(this,Bt).size>0?aR(U(this,Bt)):null}setAll(l){for(const[t,d]of Object.entries(l))this.setValue(t,d)}get size(){return U(this,Bt).size}resetModified(){U(this,_s)&&(N(this,_s,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new PM(this)}get serializable(){if(U(this,Bt).size===0)return DR;const l=new Map,t=new fM,d=[],n=Object.create(null);let a=!1;for(const[i,s]of U(this,Bt)){const c=s instanceof dt?s.serialize(!1,n):s;c&&(l.set(i,c),t.update(`${i}:${JSON.stringify(c)}`),a||(a=!!c.bitmap))}if(a)for(const i of l.values())i.bitmap&&d.push(i.bitmap);return l.size>0?{map:l,hash:t.hexdigest(),transfer:d}:DR}get editorStats(){let l=null;const t=new Map;for(const d of U(this,Bt).values()){if(!(d instanceof dt))continue;const n=d.telemetryFinalData;if(!n)continue;const{type:a}=n;t.has(a)||t.set(a,Object.getPrototypeOf(d).constructor),l||(l=Object.create(null));const i=l[a]||(l[a]=new Map);for(const[s,c]of Object.entries(n)){if(s==="type")continue;let F=i.get(s);F||(F=new Map,i.set(s,F));const h=F.get(c)??0;F.set(c,h+1)}}for(const[d,n]of t)l[d]=n.computeTelemetryFinalData(l[d]);return l}resetModifiedIds(){N(this,qs,null)}get modifiedIds(){if(U(this,qs))return U(this,qs);const l=[];for(const t of U(this,Bt).values())!(t instanceof dt)||!t.annotationElementId||!t.serialize()||l.push(t.annotationElementId);return N(this,qs,{ids:new Set(l),hash:l.join(",")})}}_s=new WeakMap,qs=new WeakMap,Bt=new WeakMap,wR=new WeakSet,HM=function(){U(this,_s)||(N(this,_s,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var Fo;class PM extends ER{constructor(l){super(),M(this,Fo);const{map:t,hash:d,transfer:n}=l.serializable,a=structuredClone(t,n?{transfer:n}:null);N(this,Fo,{map:a,hash:d,transfer:n})}get print(){Cl("Should not call PrintAnnotationStorage.print")}get serializable(){return U(this,Fo)}get modifiedIds(){return rl(this,"modifiedIds",{ids:new Set,hash:""})}}Fo=new WeakMap;var zZ;class fL{constructor({ownerDocument:l=globalThis.document,styleElement:t=null}){M(this,zZ,new Set),this._document=l,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(l){this.nativeFontFaces.add(l),this._document.fonts.add(l)}removeNativeFontFace(l){this.nativeFontFaces.delete(l),this._document.fonts.delete(l)}insertRule(l){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(l,t.cssRules.length)}clear(){for(const l of this.nativeFontFaces)this._document.fonts.delete(l);this.nativeFontFaces.clear(),U(this,zZ).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:l,_inspectFont:t}){if(!(!l||U(this,zZ).has(l.loadedName))){if(st(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:d,src:n,style:a}=l,i=new FontFace(d,n,a);this.addNativeFontFace(i);try{await i.load(),U(this,zZ).add(d),t==null||t(l)}catch{Rl(`Cannot load system font: ${l.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(i)}return}Cl("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(l){if(l.attached||l.missingFile&&!l.systemFontInfo)return;if(l.attached=!0,l.systemFontInfo){await this.loadSystemFont(l);return}if(this.isFontLoadingAPISupported){const d=l.createNativeFontFace();if(d){this.addNativeFontFace(d);try{await d.loaded}catch(n){throw Rl(`Failed to load font '${d.family}': '${n}'.`),l.disableFontFace=!0,n}}return}const t=l.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(d=>{const n=this._queueLoadingCallback(d);this._prepareFontLoadEvent(l,n)})}}get isFontLoadingAPISupported(){var l;const t=!!((l=this._document)!=null&&l.fonts);return rl(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let l=!1;return(Et||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(l=!0),rl(this,"isSyncFontLoadingSupported",l)}_queueLoadingCallback(l){function t(){for(st(!n.done,"completeRequest() cannot be called twice."),n.done=!0;d.length>0&&d[0].done;){const a=d.shift();setTimeout(a.callback,0)}}const{loadingRequests:d}=this,n={done:!1,complete:t,callback:l};return d.push(n),n}get _loadTestFont(){const l=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return rl(this,"_loadTestFont",l)}_prepareFontLoadEvent(l,t){function d(u,J){return u.charCodeAt(J)<<24|u.charCodeAt(J+1)<<16|u.charCodeAt(J+2)<<8|u.charCodeAt(J+3)&255}function n(u,J,G,T){const y=u.substring(0,J),k=u.substring(J+G);return y+T+k}let a,i;const s=this._document.createElement("canvas");s.width=1,s.height=1;const c=s.getContext("2d");let F=0;function h(u,J){if(++F>30){Rl("Load test font never loaded."),J();return}if(c.font="30px "+u,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){J();return}setTimeout(h.bind(null,u,J))}const o=`lt${Date.now()}${this.loadTestFontId++}`;let V=this._loadTestFont;V=n(V,976,o.length,o);const W=16,Q=1482184792;let m=d(V,W);for(a=0,i=o.length-3;a<i;a+=4)m=m-Q+d(o,a)|0;a<o.length&&(m=m-Q+d(o+"XXX",a)|0),V=n(V,W,4,XL(m));const R=`url(data:font/opentype;base64,${btoa(V)});`,r=`@font-face {font-family:"${o}";src:${R}}`;this.insertRule(r);const b=this._document.createElement("div");b.style.visibility="hidden",b.style.width=b.style.height="10px",b.style.position="absolute",b.style.top=b.style.left="0px";for(const u of[l.loadedName,o]){const J=this._document.createElement("span");J.textContent="Hi",J.style.fontFamily=u,b.append(J)}this._document.body.append(b),h(o,()=>{b.remove(),t.complete()})}}zZ=new WeakMap;class HL{constructor(l,{disableFontFace:t=!1,fontExtraProperties:d=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const a in l)this[a]=l[a];this.disableFontFace=t===!0,this.fontExtraProperties=d===!0,this._inspectFont=n}createNativeFontFace(){var l;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const d={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(d.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,d)}return(l=this._inspectFont)==null||l.call(this,this),t}createFontFaceRule(){var l;if(!this.data||this.disableFontFace)return null;const t=`url(data:${this.mimetype};base64,${LL(this.data)});`;let d;if(!this.cssFontInfo)d=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),d=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${t}}`}return(l=this._inspectFont)==null||l.call(this,this,t),d}getPathGenerator(l,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];const d=this.loadedName+"_path_"+t;let n;try{n=l.get(d)}catch(i){Rl(`getPathGenerator - ignoring character: "${i}".`)}const a=new Path2D(n||"");return this.fontExtraProperties||l.delete(d),this.compiledGlyphs[t]=a}}const ho={DATA:1,ERROR:2},Ut={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function AM(){}function Ze(e){if(e instanceof gn||e instanceof nR||e instanceof cZ||e instanceof cM||e instanceof Th||e instanceof dR)return e;switch(e instanceof Error||typeof e=="object"&&e!==null||Cl('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new gn(e.message);case"InvalidPDFException":return new nR(e.message);case"MissingPDFException":return new cZ(e.message);case"PasswordException":return new cM(e.message,e.code);case"UnexpectedResponseException":return new Th(e.message,e.status);case"UnknownErrorException":return new dR(e.message,e.details)}return new dR(e.message,e.toString())}var LZ,_n,_M,qM,$M,oo;class IZ{constructor(l,t,d){M(this,_n),M(this,LZ,new AbortController),this.sourceName=l,this.targetName=t,this.comObj=d,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),d.addEventListener("message",p(this,_n,_M).bind(this),{signal:U(this,LZ).signal})}on(l,t){const d=this.actionHandler;if(d[l])throw new Error(`There is already an actionName called "${l}"`);d[l]=t}send(l,t,d){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:l,data:t},d)}sendWithPromise(l,t,d){const n=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[n]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:l,callbackId:n,data:t},d)}catch(i){a.reject(i)}return a.promise}sendWithStream(l,t,d,n){const a=this.streamId++,i=this.sourceName,s=this.targetName,c=this.comObj;return new ReadableStream({start:F=>{const h=Promise.withResolvers();return this.streamControllers[a]={controller:F,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:i,targetName:s,action:l,streamId:a,data:t,desiredSize:F.desiredSize},n),h.promise},pull:F=>{const h=Promise.withResolvers();return this.streamControllers[a].pullCall=h,c.postMessage({sourceName:i,targetName:s,stream:Ut.PULL,streamId:a,desiredSize:F.desiredSize}),h.promise},cancel:F=>{st(F instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[a].cancelCall=h,this.streamControllers[a].isClosed=!0,c.postMessage({sourceName:i,targetName:s,stream:Ut.CANCEL,streamId:a,reason:Ze(F)}),h.promise}},d)}destroy(){var l;(l=U(this,LZ))==null||l.abort(),N(this,LZ,null)}}LZ=new WeakMap,_n=new WeakSet,_M=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){p(this,_n,$M).call(this,e);return}if(e.callback){const t=e.callbackId,d=this.callbackCapabilities[t];if(!d)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===ho.DATA)d.resolve(e.data);else if(e.callback===ho.ERROR)d.reject(Ze(e.reason));else throw new Error("Unexpected callback case");return}const l=this.actionHandler[e.action];if(!l)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const t=this.sourceName,d=e.sourceName,n=this.comObj;Promise.try(l,e.data).then(function(a){n.postMessage({sourceName:t,targetName:d,callback:ho.DATA,callbackId:e.callbackId,data:a})},function(a){n.postMessage({sourceName:t,targetName:d,callback:ho.ERROR,callbackId:e.callbackId,reason:Ze(a)})});return}if(e.streamId){p(this,_n,qM).call(this,e);return}l(e.data)},qM=function(e){const l=e.streamId,t=this.sourceName,d=e.sourceName,n=this.comObj,a=this,i=this.actionHandler[e.action],s={enqueue(c,F=1,h){if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=F,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:t,targetName:d,stream:Ut.ENQUEUE,streamId:l,chunk:c},h)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:t,targetName:d,stream:Ut.CLOSE,streamId:l}),delete a.streamSinks[l])},error(c){st(c instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:t,targetName:d,stream:Ut.ERROR,streamId:l,reason:Ze(c)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,this.streamSinks[l]=s,Promise.try(i,e.data,s).then(function(){n.postMessage({sourceName:t,targetName:d,stream:Ut.START_COMPLETE,streamId:l,success:!0})},function(c){n.postMessage({sourceName:t,targetName:d,stream:Ut.START_COMPLETE,streamId:l,reason:Ze(c)})})},$M=function(e){const l=e.streamId,t=this.sourceName,d=e.sourceName,n=this.comObj,a=this.streamControllers[l],i=this.streamSinks[l];switch(e.stream){case Ut.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(Ze(e.reason));break;case Ut.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(Ze(e.reason));break;case Ut.PULL:if(!i){n.postMessage({sourceName:t,targetName:d,stream:Ut.PULL_COMPLETE,streamId:l,success:!0});break}i.desiredSize<=0&&e.desiredSize>0&&i.sinkCapability.resolve(),i.desiredSize=e.desiredSize,Promise.try(i.onPull||AM).then(function(){n.postMessage({sourceName:t,targetName:d,stream:Ut.PULL_COMPLETE,streamId:l,success:!0})},function(c){n.postMessage({sourceName:t,targetName:d,stream:Ut.PULL_COMPLETE,streamId:l,reason:Ze(c)})});break;case Ut.ENQUEUE:if(st(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(e.chunk);break;case Ut.CLOSE:if(st(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),p(this,_n,oo).call(this,a,l);break;case Ut.ERROR:st(a,"error should have stream controller"),a.controller.error(Ze(e.reason)),p(this,_n,oo).call(this,a,l);break;case Ut.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(Ze(e.reason)),p(this,_n,oo).call(this,a,l);break;case Ut.CANCEL:if(!i)break;const s=Ze(e.reason);Promise.try(i.onCancel||AM,s).then(function(){n.postMessage({sourceName:t,targetName:d,stream:Ut.CANCEL_COMPLETE,streamId:l,success:!0})},function(c){n.postMessage({sourceName:t,targetName:d,stream:Ut.CANCEL_COMPLETE,streamId:l,reason:Ze(c)})}),i.sinkCapability.reject(s),i.isCancelled=!0,delete this.streamSinks[l];break;default:throw new Error("Unexpected stream case")}},oo=async function(e,l){var t,d,n;await Promise.allSettled([(t=e.startCall)==null?void 0:t.promise,(d=e.pullCall)==null?void 0:d.promise,(n=e.cancelCall)==null?void 0:n.promise]),delete this.streamControllers[l]};var Vo;class lS{constructor({enableHWA:l=!1}){M(this,Vo,!1),N(this,Vo,l)}create(l,t){if(l<=0||t<=0)throw new Error("Invalid canvas size");const d=this._createCanvas(l,t);return{canvas:d,context:d.getContext("2d",{willReadFrequently:!U(this,Vo)})}}reset(l,t,d){if(!l.canvas)throw new Error("Canvas is not specified");if(t<=0||d<=0)throw new Error("Invalid canvas size");l.canvas.width=t,l.canvas.height=d}destroy(l){if(!l.canvas)throw new Error("Canvas is not specified");l.canvas.width=0,l.canvas.height=0,l.canvas=null,l.context=null}_createCanvas(l,t){Cl("Abstract method `_createCanvas` called.")}}Vo=new WeakMap;class PL extends lS{constructor({ownerDocument:l=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=l}_createCanvas(l,t){const d=this._document.createElement("canvas");return d.width=l,d.height=t,d}}class tS{constructor({baseUrl:l=null,isCompressed:t=!0}){this.baseUrl=l,this.isCompressed=t}async fetch({name:l}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!l)throw new Error("CMap name must be specified.");const t=this.baseUrl+l+(this.isCompressed?".bcmap":"");return this._fetch(t).then(d=>({cMapData:d,isCompressed:this.isCompressed})).catch(d=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)})}async _fetch(l){Cl("Abstract method `_fetch` called.")}}class eS extends tS{async _fetch(l){const t=await yh(l,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):Gh(t)}}Tl(4520);class dS{addFilter(l){return"none"}addHCMFilter(l,t){return"none"}addAlphaFilter(l){return"none"}addLuminosityFilter(l){return"none"}addHighlightHCMFilter(l,t,d,n,a){return"none"}destroy(l=!1){}}var $s,lc,qn,$n,de,Ui,tc,Zl,Ot,DZ,ec,Wo,dc,nS,CR,nc,wZ,EZ,xR,CZ;class AL extends dS{constructor({docId:l,ownerDocument:t=globalThis.document}){super(),M(this,Zl),M(this,$s),M(this,lc),M(this,qn),M(this,$n),M(this,de),M(this,Ui),M(this,tc,0),N(this,$n,l),N(this,de,t)}addFilter(l){if(!l)return"none";let t=U(this,Zl,Ot).get(l);if(t)return t;const[d,n,a]=p(this,Zl,Wo).call(this,l),i=l.length===1?d:`${d}${n}${a}`;if(t=U(this,Zl,Ot).get(i),t)return U(this,Zl,Ot).set(l,t),t;const s=`g_${U(this,$n)}_transfer_map_${le(this,tc)._++}`,c=p(this,Zl,dc).call(this,s);U(this,Zl,Ot).set(l,c),U(this,Zl,Ot).set(i,c);const F=p(this,Zl,nc).call(this,s);return p(this,Zl,EZ).call(this,d,n,a,F),c}addHCMFilter(l,t){var d;const n=`${l}-${t}`,a="base";let i=U(this,Zl,DZ).get(a);if((i==null?void 0:i.key)===n||(i?((d=i.filter)==null||d.remove(),i.key=n,i.url="none",i.filter=null):(i={key:n,url:"none",filter:null},U(this,Zl,DZ).set(a,i)),!l||!t))return i.url;const s=p(this,Zl,CZ).call(this,l);l=sl.makeHexColor(...s);const c=p(this,Zl,CZ).call(this,t);if(t=sl.makeHexColor(...c),U(this,Zl,ec).style.color="",l==="#000000"&&t==="#ffffff"||l===t)return i.url;const F=new Array(256);for(let Q=0;Q<=255;Q++){const m=Q/255;F[Q]=m<=.03928?m/12.92:((m+.055)/1.055)**2.4}const h=F.join(","),o=`g_${U(this,$n)}_hcm_filter`,V=i.filter=p(this,Zl,nc).call(this,o);p(this,Zl,EZ).call(this,h,h,h,V),p(this,Zl,CR).call(this,V);const W=(Q,m)=>{const R=s[Q]/255,r=c[Q]/255,b=new Array(m+1);for(let u=0;u<=m;u++)b[u]=R+u/m*(r-R);return b.join(",")};return p(this,Zl,EZ).call(this,W(0,5),W(1,5),W(2,5),V),i.url=p(this,Zl,dc).call(this,o),i.url}addAlphaFilter(l){let t=U(this,Zl,Ot).get(l);if(t)return t;const[d]=p(this,Zl,Wo).call(this,[l]),n=`alpha_${d}`;if(t=U(this,Zl,Ot).get(n),t)return U(this,Zl,Ot).set(l,t),t;const a=`g_${U(this,$n)}_alpha_map_${le(this,tc)._++}`,i=p(this,Zl,dc).call(this,a);U(this,Zl,Ot).set(l,i),U(this,Zl,Ot).set(n,i);const s=p(this,Zl,nc).call(this,a);return p(this,Zl,xR).call(this,d,s),i}addLuminosityFilter(l){let t=U(this,Zl,Ot).get(l||"luminosity");if(t)return t;let d,n;if(l?([d]=p(this,Zl,Wo).call(this,[l]),n=`luminosity_${d}`):n="luminosity",t=U(this,Zl,Ot).get(n),t)return U(this,Zl,Ot).set(l,t),t;const a=`g_${U(this,$n)}_luminosity_map_${le(this,tc)._++}`,i=p(this,Zl,dc).call(this,a);U(this,Zl,Ot).set(l,i),U(this,Zl,Ot).set(n,i);const s=p(this,Zl,nc).call(this,a);return p(this,Zl,nS).call(this,s),l&&p(this,Zl,xR).call(this,d,s),i}addHighlightHCMFilter(l,t,d,n,a){var i;const s=`${t}-${d}-${n}-${a}`;let c=U(this,Zl,DZ).get(l);if((c==null?void 0:c.key)===s||(c?((i=c.filter)==null||i.remove(),c.key=s,c.url="none",c.filter=null):(c={key:s,url:"none",filter:null},U(this,Zl,DZ).set(l,c)),!t||!d))return c.url;const[F,h]=[t,d].map(p(this,Zl,CZ).bind(this));let o=Math.round(.2126*F[0]+.7152*F[1]+.0722*F[2]),V=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[W,Q]=[n,a].map(p(this,Zl,CZ).bind(this));V<o&&([o,V,W,Q]=[V,o,Q,W]),U(this,Zl,ec).style.color="";const m=(b,u,J)=>{const G=new Array(256),T=(V-o)/J,y=b/255,k=(u-b)/(255*J);let X=0;for(let L=0;L<=J;L++){const D=Math.round(o+L*T),C=y+L*k;for(let I=X;I<=D;I++)G[I]=C;X=D+1}for(let L=X;L<256;L++)G[L]=G[X-1];return G.join(",")},R=`g_${U(this,$n)}_hcm_${l}_filter`,r=c.filter=p(this,Zl,nc).call(this,R);return p(this,Zl,CR).call(this,r),p(this,Zl,EZ).call(this,m(W[0],Q[0],5),m(W[1],Q[1],5),m(W[2],Q[2],5),r),c.url=p(this,Zl,dc).call(this,R),c.url}destroy(l=!1){var t,d,n,a;l&&(t=U(this,Ui))!=null&&t.size||((d=U(this,qn))==null||d.parentNode.parentNode.remove(),N(this,qn,null),(n=U(this,lc))==null||n.clear(),N(this,lc,null),(a=U(this,Ui))==null||a.clear(),N(this,Ui,null),N(this,tc,0))}}$s=new WeakMap,lc=new WeakMap,qn=new WeakMap,$n=new WeakMap,de=new WeakMap,Ui=new WeakMap,tc=new WeakMap,Zl=new WeakSet,Ot=function(){return U(this,lc)||N(this,lc,new Map)},DZ=function(){return U(this,Ui)||N(this,Ui,new Map)},ec=function(){if(!U(this,qn)){const e=U(this,de).createElement("div"),{style:l}=e;l.visibility="hidden",l.contain="strict",l.width=l.height=0,l.position="absolute",l.top=l.left=0,l.zIndex=-1;const t=U(this,de).createElementNS(Ad,"svg");t.setAttribute("width",0),t.setAttribute("height",0),N(this,qn,U(this,de).createElementNS(Ad,"defs")),e.append(t),t.append(U(this,qn)),U(this,de).body.append(e)}return U(this,qn)},Wo=function(e){if(e.length===1){const s=e[0],c=new Array(256);for(let h=0;h<256;h++)c[h]=s[h]/255;const F=c.join(",");return[F,F,F]}const[l,t,d]=e,n=new Array(256),a=new Array(256),i=new Array(256);for(let s=0;s<256;s++)n[s]=l[s]/255,a[s]=t[s]/255,i[s]=d[s]/255;return[n.join(","),a.join(","),i.join(",")]},dc=function(e){if(U(this,$s)===void 0){N(this,$s,"");const l=U(this,de).URL;l!==U(this,de).baseURI&&(Bh(l)?Rl('#createUrl: ignore "data:"-URL for performance reasons.'):N(this,$s,l.split("#",1)[0]))}return`url(${U(this,$s)}#${e})`},nS=function(e){const l=U(this,de).createElementNS(Ad,"feColorMatrix");l.setAttribute("type","matrix"),l.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(l)},CR=function(e){const l=U(this,de).createElementNS(Ad,"feColorMatrix");l.setAttribute("type","matrix"),l.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(l)},nc=function(e){const l=U(this,de).createElementNS(Ad,"filter");return l.setAttribute("color-interpolation-filters","sRGB"),l.setAttribute("id",e),U(this,Zl,ec).append(l),l},wZ=function(e,l,t){const d=U(this,de).createElementNS(Ad,l);d.setAttribute("type","discrete"),d.setAttribute("tableValues",t),e.append(d)},EZ=function(e,l,t,d){const n=U(this,de).createElementNS(Ad,"feComponentTransfer");d.append(n),p(this,Zl,wZ).call(this,n,"feFuncR",e),p(this,Zl,wZ).call(this,n,"feFuncG",l),p(this,Zl,wZ).call(this,n,"feFuncB",t)},xR=function(e,l){const t=U(this,de).createElementNS(Ad,"feComponentTransfer");l.append(t),p(this,Zl,wZ).call(this,t,"feFuncA",e)},CZ=function(e){return U(this,Zl,ec).style.color=e,VR(getComputedStyle(U(this,Zl,ec)).getPropertyValue("color"))};class aS{constructor({baseUrl:l=null}){this.baseUrl=l}async fetch({filename:l}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!l)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${l}`;return this._fetch(t).catch(d=>{throw new Error(`Unable to load font data at: ${t}`)})}async _fetch(l){Cl("Abstract method `_fetch` called.")}}class iS extends aS{async _fetch(l){const t=await yh(l,"arraybuffer");return new Uint8Array(t)}}if(Et){let e;try{const l=process.getBuiltinModule("module").createRequire(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:os&&os.tagName.toUpperCase()==="SCRIPT"&&os.src||new URL("index.umd.cjs",document.baseURI).href);try{e=l("@napi-rs/canvas")}catch(t){Rl(`Cannot load "@napi-rs/canvas" package: "${t}".`)}}catch(l){Rl(`Cannot access the \`require\` function: "${l}".`)}globalThis.DOMMatrix||(e!=null&&e.DOMMatrix?globalThis.DOMMatrix=e.DOMMatrix:Rl("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.ImageData||(e!=null&&e.ImageData?globalThis.ImageData=e.ImageData:Rl("Cannot polyfill `ImageData`, rendering may be broken.")),globalThis.Path2D||(e!=null&&e.Path2D?globalThis.Path2D=e.Path2D:Rl("Cannot polyfill `Path2D`, rendering may be broken."))}async function sS(e){const l=await process.getBuiltinModule("fs").promises.readFile(e);return new Uint8Array(l)}class _L extends dS{}class qL extends lS{_createCanvas(l,t){return process.getBuiltinModule("module").createRequire(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:os&&os.tagName.toUpperCase()==="SCRIPT"&&os.src||new URL("index.umd.cjs",document.baseURI).href)("@napi-rs/canvas").createCanvas(l,t)}}class $L extends tS{async _fetch(l){return sS(l)}}class lI extends aS{async _fetch(l){return sS(l)}}const vt={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function gR(e,l){if(!l)return;const t=l[2]-l[0],d=l[3]-l[1],n=new Path2D;n.rect(l[0],l[1],t,d),e.clip(n)}class jR{getPattern(){Cl("Abstract method `getPattern` called.")}}class tI extends jR{constructor(l){super(),this._type=l[1],this._bbox=l[2],this._colorStops=l[3],this._p0=l[4],this._p1=l[5],this._r0=l[6],this._r1=l[7],this.matrix=null}_createGradient(l){let t;this._type==="axial"?t=l.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(t=l.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const d of this._colorStops)t.addColorStop(d[0],d[1]);return t}getPattern(l,t,d,n){let a;if(n===vt.STROKE||n===vt.FILL){const i=t.current.getClippedPathBoundingBox(n,Ol(l))||[0,0,0,0],s=Math.ceil(i[2]-i[0])||1,c=Math.ceil(i[3]-i[1])||1,F=t.cachedCanvases.getCanvas("pattern",s,c),h=F.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-i[0],-i[1]),d=sl.transform(d,[1,0,0,1,i[0],i[1]]),h.transform(...t.baseTransform),this.matrix&&h.transform(...this.matrix),gR(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),a=l.createPattern(F.canvas,"no-repeat");const o=new DOMMatrix(d);a.setTransform(o)}else gR(l,this._bbox),a=this._createGradient(l);return a}}function OR(e,l,t,d,n,a,i,s){const c=l.coords,F=l.colors,h=e.data,o=e.width*4;let V;c[t+1]>c[d+1]&&(V=t,t=d,d=V,V=a,a=i,i=V),c[d+1]>c[n+1]&&(V=d,d=n,n=V,V=i,i=s,s=V),c[t+1]>c[d+1]&&(V=t,t=d,d=V,V=a,a=i,i=V);const W=(c[t]+l.offsetX)*l.scaleX,Q=(c[t+1]+l.offsetY)*l.scaleY,m=(c[d]+l.offsetX)*l.scaleX,R=(c[d+1]+l.offsetY)*l.scaleY,r=(c[n]+l.offsetX)*l.scaleX,b=(c[n+1]+l.offsetY)*l.scaleY;if(Q>=b)return;const u=F[a],J=F[a+1],G=F[a+2],T=F[i],y=F[i+1],k=F[i+2],X=F[s],L=F[s+1],D=F[s+2],C=Math.round(Q),I=Math.round(b);let H,f,Y,B,z,g,w,O;for(let K=C;K<=I;K++){if(K<R){const A=K<Q?0:(Q-K)/(Q-R);H=W-(W-m)*A,f=u-(u-T)*A,Y=J-(J-y)*A,B=G-(G-k)*A}else{let A;K>b?A=1:R===b?A=0:A=(R-K)/(R-b),H=m-(m-r)*A,f=T-(T-X)*A,Y=y-(y-L)*A,B=k-(k-D)*A}let x;K<Q?x=0:K>b?x=1:x=(Q-K)/(Q-b),z=W-(W-r)*x,g=u-(u-X)*x,w=J-(J-L)*x,O=G-(G-D)*x;const _=Math.round(Math.min(H,z)),al=Math.round(Math.max(H,z));let P=o*K+_*4;for(let A=_;A<=al;A++)x=(H-A)/(H-z),x<0?x=0:x>1&&(x=1),h[P++]=f-(f-g)*x|0,h[P++]=Y-(Y-w)*x|0,h[P++]=B-(B-O)*x|0,h[P++]=255}}function eI(e,l,t){const d=l.coords,n=l.colors;let a,i;switch(l.type){case"lattice":const s=l.verticesPerRow,c=Math.floor(d.length/s)-1,F=s-1;for(a=0;a<c;a++){let h=a*s;for(let o=0;o<F;o++,h++)OR(e,t,d[h],d[h+1],d[h+s],n[h],n[h+1],n[h+s]),OR(e,t,d[h+s+1],d[h+1],d[h+s],n[h+s+1],n[h+1],n[h+s])}break;case"triangles":for(a=0,i=d.length;a<i;a+=3)OR(e,t,d[a],d[a+1],d[a+2],n[a],n[a+1],n[a+2]);break;default:throw new Error("illegal figure")}}class dI extends jR{constructor(l){super(),this._coords=l[2],this._colors=l[3],this._figures=l[4],this._bounds=l[5],this._bbox=l[7],this._background=l[8],this.matrix=null}_createMeshCanvas(l,t,d){const n=Math.floor(this._bounds[0]),a=Math.floor(this._bounds[1]),i=Math.ceil(this._bounds[2])-n,s=Math.ceil(this._bounds[3])-a,c=Math.min(Math.ceil(Math.abs(i*l[0]*1.1)),3e3),F=Math.min(Math.ceil(Math.abs(s*l[1]*1.1)),3e3),h=i/c,o=s/F,V={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-a,scaleX:1/h,scaleY:1/o},W=c+4,Q=F+4,m=d.getCanvas("mesh",W,Q),R=m.context,r=R.createImageData(c,F);if(t){const b=r.data;for(let u=0,J=b.length;u<J;u+=4)b[u]=t[0],b[u+1]=t[1],b[u+2]=t[2],b[u+3]=255}for(const b of this._figures)eI(r,b,V);return R.putImageData(r,2,2),{canvas:m.canvas,offsetX:n-2*h,offsetY:a-2*o,scaleX:h,scaleY:o}}getPattern(l,t,d,n){gR(l,this._bbox);let a;if(n===vt.SHADING)a=sl.singularValueDecompose2dScale(Ol(l));else if(a=sl.singularValueDecompose2dScale(t.baseTransform),this.matrix){const s=sl.singularValueDecompose2dScale(this.matrix);a=[a[0]*s[0],a[1]*s[1]]}const i=this._createMeshCanvas(a,n===vt.SHADING?null:this._background,t.cachedCanvases);return n!==vt.SHADING&&(l.setTransform(...t.baseTransform),this.matrix&&l.transform(...this.matrix)),l.translate(i.offsetX,i.offsetY),l.scale(i.scaleX,i.scaleY),l.createPattern(i.canvas,"no-repeat")}}class nI extends jR{getPattern(){return"hotpink"}}function aI(e){switch(e[0]){case"RadialAxial":return new tI(e);case"Mesh":return new dI(e);case"Dummy":return new nI}throw new Error(`Unknown IR type: ${e[0]}`)}const cS={COLORED:1,UNCOLORED:2},US=class Vy{constructor(l,t,d,n,a){this.operatorList=l[2],this.matrix=l[3],this.bbox=l[4],this.xstep=l[5],this.ystep=l[6],this.paintType=l[7],this.tilingType=l[8],this.color=t,this.ctx=d,this.canvasGraphicsFactory=n,this.baseTransform=a}createPatternCanvas(l){const{bbox:t,operatorList:d,paintType:n,tilingType:a,color:i,canvasGraphicsFactory:s}=this;let{xstep:c,ystep:F}=this;c=Math.abs(c),F=Math.abs(F),Jh("TilingType: "+a);const h=t[0],o=t[1],V=t[2],W=t[3],Q=V-h,m=W-o,R=sl.singularValueDecompose2dScale(this.matrix),r=sl.singularValueDecompose2dScale(this.baseTransform),b=R[0]*r[0],u=R[1]*r[1];let J=Q,G=m,T=!1,y=!1;const k=Math.ceil(c*b),X=Math.ceil(F*u),L=Math.ceil(Q*b),D=Math.ceil(m*u);k>=L?J=c:T=!0,X>=D?G=F:y=!0;const C=this.getSizeAndScale(J,this.ctx.canvas.width,b),I=this.getSizeAndScale(G,this.ctx.canvas.height,u),H=l.cachedCanvases.getCanvas("pattern",C.size,I.size),f=H.context,Y=s.createCanvasGraphics(f);if(Y.groupLevel=l.groupLevel,this.setFillAndStrokeStyleToContext(Y,n,i),f.translate(-C.scale*h,-I.scale*o),Y.transform(C.scale,0,0,I.scale,0,0),f.save(),this.clipBbox(Y,h,o,V,W),Y.baseTransform=Ol(Y.ctx),Y.executeOperatorList(d),Y.endDrawing(),f.restore(),T||y){const B=H.canvas;T&&(J=c),y&&(G=F);const z=this.getSizeAndScale(J,this.ctx.canvas.width,b),g=this.getSizeAndScale(G,this.ctx.canvas.height,u),w=z.size,O=g.size,K=l.cachedCanvases.getCanvas("pattern-workaround",w,O),x=K.context,_=T?Math.floor(Q/c):0,al=y?Math.floor(m/F):0;for(let P=0;P<=_;P++)for(let A=0;A<=al;A++)x.drawImage(B,w*P,O*A,w,O,0,0,w,O);return{canvas:K.canvas,scaleX:z.scale,scaleY:g.scale,offsetX:h,offsetY:o}}return{canvas:H.canvas,scaleX:C.scale,scaleY:I.scale,offsetX:h,offsetY:o}}getSizeAndScale(l,t,d){const n=Math.max(Vy.MAX_PATTERN_SIZE,t);let a=Math.ceil(l*d);return a>=n?a=n:d=a/l,{scale:d,size:a}}clipBbox(l,t,d,n,a){const i=n-t,s=a-d;l.ctx.rect(t,d,i,s),l.current.updateRectMinMax(Ol(l.ctx),[t,d,n,a]),l.clip(),l.endPath()}setFillAndStrokeStyleToContext(l,t,d){const n=l.ctx,a=l.current;switch(t){case cS.COLORED:const i=this.ctx;n.fillStyle=i.fillStyle,n.strokeStyle=i.strokeStyle,a.fillColor=i.fillStyle,a.strokeColor=i.strokeStyle;break;case cS.UNCOLORED:const s=sl.makeHexColor(d[0],d[1],d[2]);n.fillStyle=s,n.strokeStyle=s,a.fillColor=s,a.strokeColor=s;break;default:throw new GL(`Unsupported paint type: ${t}`)}}getPattern(l,t,d,n){let a=d;n!==vt.SHADING&&(a=sl.transform(a,t.baseTransform),this.matrix&&(a=sl.transform(a,this.matrix)));const i=this.createPatternCanvas(t);let s=new DOMMatrix(a);s=s.translate(i.offsetX,i.offsetY),s=s.scale(1/i.scaleX,1/i.scaleY);const c=l.createPattern(i.canvas,"repeat");return c.setTransform(s),c}};hl(US,"MAX_PATTERN_SIZE",3e3);let iI=US;function sI({src:e,srcPos:l=0,dest:t,width:d,height:n,nonBlackColor:a=4294967295,inverseDecode:i=!1}){const s=te.isLittleEndian?4278190080:255,[c,F]=i?[a,s]:[s,a],h=d>>3,o=d&7,V=e.length;t=new Uint32Array(t.buffer);let W=0;for(let Q=0;Q<n;Q++){for(const R=l+h;l<R;l++){const r=l<V?e[l]:255;t[W++]=r&128?F:c,t[W++]=r&64?F:c,t[W++]=r&32?F:c,t[W++]=r&16?F:c,t[W++]=r&8?F:c,t[W++]=r&4?F:c,t[W++]=r&2?F:c,t[W++]=r&1?F:c}if(o===0)continue;const m=l<V?e[l++]:255;for(let R=0;R<o;R++)t[W++]=m&1<<7-R?F:c}return{srcPos:l,destPos:W}}const ZS=16,FS=100,cI=15,hS=10,oS=1e3,Fe=16;function UI(e,l){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){l.save(),this.__originalSave()},e.restore=function(){l.restore(),this.__originalRestore()},e.translate=function(t,d){l.translate(t,d),this.__originalTranslate(t,d)},e.scale=function(t,d){l.scale(t,d),this.__originalScale(t,d)},e.transform=function(t,d,n,a,i,s){l.transform(t,d,n,a,i,s),this.__originalTransform(t,d,n,a,i,s)},e.setTransform=function(t,d,n,a,i,s){l.setTransform(t,d,n,a,i,s),this.__originalSetTransform(t,d,n,a,i,s)},e.resetTransform=function(){l.resetTransform(),this.__originalResetTransform()},e.rotate=function(t){l.rotate(t),this.__originalRotate(t)},e.clip=function(t){l.clip(t),this.__originalClip(t)},e.moveTo=function(t,d){l.moveTo(t,d),this.__originalMoveTo(t,d)},e.lineTo=function(t,d){l.lineTo(t,d),this.__originalLineTo(t,d)},e.bezierCurveTo=function(t,d,n,a,i,s){l.bezierCurveTo(t,d,n,a,i,s),this.__originalBezierCurveTo(t,d,n,a,i,s)},e.rect=function(t,d,n,a){l.rect(t,d,n,a),this.__originalRect(t,d,n,a)},e.closePath=function(){l.closePath(),this.__originalClosePath()},e.beginPath=function(){l.beginPath(),this.__originalBeginPath()}}class ZI{constructor(l){this.canvasFactory=l,this.cache=Object.create(null)}getCanvas(l,t,d){let n;return this.cache[l]!==void 0?(n=this.cache[l],this.canvasFactory.reset(n,t,d)):(n=this.canvasFactory.create(t,d),this.cache[l]=n),n}delete(l){delete this.cache[l]}clear(){for(const l in this.cache){const t=this.cache[l];this.canvasFactory.destroy(t),delete this.cache[l]}}}function Qo(e,l,t,d,n,a,i,s,c,F){const[h,o,V,W,Q,m]=Ol(e);if(o===0&&V===0){const b=i*h+Q,u=Math.round(b),J=s*W+m,G=Math.round(J),T=(i+c)*h+Q,y=Math.abs(Math.round(T)-u)||1,k=(s+F)*W+m,X=Math.abs(Math.round(k)-G)||1;return e.setTransform(Math.sign(h),0,0,Math.sign(W),u,G),e.drawImage(l,t,d,n,a,0,0,y,X),e.setTransform(h,o,V,W,Q,m),[y,X]}if(h===0&&W===0){const b=s*V+Q,u=Math.round(b),J=i*o+m,G=Math.round(J),T=(s+F)*V+Q,y=Math.abs(Math.round(T)-u)||1,k=(i+c)*o+m,X=Math.abs(Math.round(k)-G)||1;return e.setTransform(0,Math.sign(o),Math.sign(V),0,u,G),e.drawImage(l,t,d,n,a,0,0,X,y),e.setTransform(h,o,V,W,Q,m),[X,y]}e.drawImage(l,t,d,n,a,i,s,c,F);const R=Math.hypot(h,o),r=Math.hypot(V,W);return[R*c,r*F]}function FI(e){const{width:l,height:t}=e;if(l>oS||t>oS)return null;const d=1e3,n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),a=l+1;let i=new Uint8Array(a*(t+1)),s,c,F;const h=l+7&-8;let o=new Uint8Array(h*t),V=0;for(const R of e.data){let r=128;for(;r>0;)o[V++]=R&r?0:255,r>>=1}let W=0;for(V=0,o[V]!==0&&(i[0]=1,++W),c=1;c<l;c++)o[V]!==o[V+1]&&(i[c]=o[V]?2:1,++W),V++;for(o[V]!==0&&(i[c]=2,++W),s=1;s<t;s++){V=s*h,F=s*a,o[V-h]!==o[V]&&(i[F]=o[V]?1:8,++W);let R=(o[V]?4:0)+(o[V-h]?8:0);for(c=1;c<l;c++)R=(R>>2)+(o[V+1]?4:0)+(o[V-h+1]?8:0),n[R]&&(i[F+c]=n[R],++W),V++;if(o[V-h]!==o[V]&&(i[F+c]=o[V]?2:4,++W),W>d)return null}for(V=h*(t-1),F=s*a,o[V]!==0&&(i[F]=8,++W),c=1;c<l;c++)o[V]!==o[V+1]&&(i[F+c]=o[V]?4:8,++W),V++;if(o[V]!==0&&(i[F+c]=4,++W),W>d)return null;const Q=new Int32Array([0,a,-1,0,-a,0,0,0,1]),m=new Path2D;for(s=0;W&&s<=t;s++){let R=s*a;const r=R+l;for(;R<r&&!i[R];)R++;if(R===r)continue;m.moveTo(R%a,s);const b=R;let u=i[R];do{const J=Q[u];do R+=J;while(!i[R]);const G=i[R];G!==5&&G!==10?(u=G,i[R]=0):(u=G&51*u>>4,i[R]&=u>>2|u<<2),m.lineTo(R%a,R/a|0),i[R]||--W}while(b!==R);--s}return o=null,i=null,function(R){R.save(),R.scale(1/l,-1/t),R.translate(0,-t),R.fill(m),R.beginPath(),R.restore()}}class VS{constructor(l,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=sM,this.textMatrixScale=1,this.fontMatrix=tR,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=Ct.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.patternStroke=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,l,t])}clone(){const l=Object.create(this);return l.clipBox=this.clipBox.slice(),l}setCurrentPoint(l,t){this.x=l,this.y=t}updatePathMinMax(l,t,d){[t,d]=sl.applyTransform([t,d],l),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,d),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,d)}updateRectMinMax(l,t){const d=sl.applyTransform(t,l),n=sl.applyTransform(t.slice(2),l),a=sl.applyTransform([t[0],t[3]],l),i=sl.applyTransform([t[2],t[1]],l);this.minX=Math.min(this.minX,d[0],n[0],a[0],i[0]),this.minY=Math.min(this.minY,d[1],n[1],a[1],i[1]),this.maxX=Math.max(this.maxX,d[0],n[0],a[0],i[0]),this.maxY=Math.max(this.maxY,d[1],n[1],a[1],i[1])}updateScalingPathMinMax(l,t){sl.scaleMinMax(l,t),this.minX=Math.min(this.minX,t[0]),this.minY=Math.min(this.minY,t[1]),this.maxX=Math.max(this.maxX,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(l,t,d,n,a,i,s,c,F,h){const o=sl.bezierBoundingBox(t,d,n,a,i,s,c,F,h);h||this.updateRectMinMax(l,o)}getPathBoundingBox(l=vt.FILL,t=null){const d=[this.minX,this.minY,this.maxX,this.maxY];if(l===vt.STROKE){t||Cl("Stroke bounding box must include transform.");const n=sl.singularValueDecompose2dScale(t),a=n[0]*this.lineWidth/2,i=n[1]*this.lineWidth/2;d[0]-=a,d[1]-=i,d[2]+=a,d[3]+=i}return d}updateClipFromPath(){const l=sl.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(l||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(l){this.clipBox=l,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(l=vt.FILL,t=null){return sl.intersect(this.clipBox,this.getPathBoundingBox(l,t))}}function WS(e,l){if(l instanceof ImageData){e.putImageData(l,0,0);return}const t=l.height,d=l.width,n=t%Fe,a=(t-n)/Fe,i=n===0?a:a+1,s=e.createImageData(d,Fe);let c=0,F;const h=l.data,o=s.data;let V,W,Q,m;if(l.kind===ph.GRAYSCALE_1BPP){const R=h.byteLength,r=new Uint32Array(o.buffer,0,o.byteLength>>2),b=r.length,u=d+7>>3,J=4294967295,G=te.isLittleEndian?4278190080:255;for(V=0;V<i;V++){for(Q=V<a?Fe:n,F=0,W=0;W<Q;W++){const T=R-c;let y=0;const k=T>u?d:T*8-7,X=k&-8;let L=0,D=0;for(;y<X;y+=8)D=h[c++],r[F++]=D&128?J:G,r[F++]=D&64?J:G,r[F++]=D&32?J:G,r[F++]=D&16?J:G,r[F++]=D&8?J:G,r[F++]=D&4?J:G,r[F++]=D&2?J:G,r[F++]=D&1?J:G;for(;y<k;y++)L===0&&(D=h[c++],L=128),r[F++]=D&L?J:G,L>>=1}for(;F<b;)r[F++]=0;e.putImageData(s,0,V*Fe)}}else if(l.kind===ph.RGBA_32BPP){for(W=0,m=d*Fe*4,V=0;V<a;V++)o.set(h.subarray(c,c+m)),c+=m,e.putImageData(s,0,W),W+=Fe;V<i&&(m=d*n*4,o.set(h.subarray(c,c+m)),e.putImageData(s,0,W))}else if(l.kind===ph.RGB_24BPP)for(Q=Fe,m=d*Q,V=0;V<i;V++){for(V>=a&&(Q=n,m=d*Q),F=0,W=m;W--;)o[F++]=h[c++],o[F++]=h[c++],o[F++]=h[c++],o[F++]=255;e.putImageData(s,0,V*Fe)}else throw new Error(`bad image kind: ${l.kind}`)}function QS(e,l){if(l.bitmap){e.drawImage(l.bitmap,0,0);return}const t=l.height,d=l.width,n=t%Fe,a=(t-n)/Fe,i=n===0?a:a+1,s=e.createImageData(d,Fe);let c=0;const F=l.data,h=s.data;for(let o=0;o<i;o++){const V=o<a?Fe:n;({srcPos:c}=sI({src:F,srcPos:c,dest:h,width:d,height:V,nonBlackColor:0})),e.putImageData(s,0,o*Fe)}}function xZ(e,l){const t=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const d of t)e[d]!==void 0&&(l[d]=e[d]);e.setLineDash!==void 0&&(l.setLineDash(e.getLineDash()),l.lineDashOffset=e.lineDashOffset)}function mo(e){if(e.strokeStyle=e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",e.setLineDash!==void 0&&(e.setLineDash([]),e.lineDashOffset=0),!Et){const{filter:l}=e;l!=="none"&&l!==""&&(e.filter="none")}}function mS(e,l){if(l)return!0;const t=sl.singularValueDecompose2dScale(e);t[0]=Math.fround(t[0]),t[1]=Math.fround(t[1]);const d=Math.fround((globalThis.devicePixelRatio||1)*Bs.PDF_TO_CSS_UNITS);return t[0]<=d&&t[1]<=d}const hI=["butt","round","square"],oI=["miter","round","bevel"],VI={},RS={};var la,vR,KR,fR;const WI=class Wy{constructor(l,t,d,n,a,{optionalContentConfig:i,markedContentStack:s=null},c,F){M(this,la),this.ctx=l,this.current=new VS(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=d,this.canvasFactory=n,this.filterFactory=a,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=s||[],this.optionalContentConfig=i,this.cachedCanvases=new ZI(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=F,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(l,t=null){return typeof l=="string"?l.startsWith("g_")?this.commonObjs.get(l):this.objs.get(l):t}beginDrawing({transform:l,viewport:t,transparency:d=!1,background:n=null}){const a=this.ctx.canvas.width,i=this.ctx.canvas.height,s=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,a,i),this.ctx.fillStyle=s,d){const c=this.cachedCanvases.getCanvas("transparent",a,i);this.compositeCtx=this.ctx,this.transparentCanvas=c.canvas,this.ctx=c.context,this.ctx.save(),this.ctx.transform(...Ol(this.compositeCtx))}this.ctx.save(),mo(this.ctx),l&&(this.ctx.transform(...l),this.outputScaleX=l[0],this.outputScaleY=l[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=Ol(this.ctx)}executeOperatorList(l,t,d,n){const a=l.argsArray,i=l.fnArray;let s=t||0;const c=a.length;if(c===s)return s;const F=c-s>hS&&typeof d=="function",h=F?Date.now()+cI:0;let o=0;const V=this.commonObjs,W=this.objs;let Q;for(;;){if(n!==void 0&&s===n.nextBreakPoint)return n.breakIt(s,d),s;if(Q=i[s],Q!==ld.dependency)this[Q].apply(this,a[s]);else for(const m of a[s]){const R=m.startsWith("g_")?V:W;if(!R.has(m))return R.get(m,d),s}if(s++,s===c)return s;if(F&&++o>hS){if(Date.now()>h)return d(),s;o=0}}}endDrawing(){p(this,la,vR).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const l of this._cachedBitmapsMap.values()){for(const t of l.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);l.clear()}this._cachedBitmapsMap.clear(),p(this,la,KR).call(this)}_scaleImage(l,t){const d=l.width??l.displayWidth,n=l.height??l.displayHeight;let a=Math.max(Math.hypot(t[0],t[1]),1),i=Math.max(Math.hypot(t[2],t[3]),1),s=d,c=n,F="prescale1",h,o;for(;a>2&&s>1||i>2&&c>1;){let V=s,W=c;a>2&&s>1&&(V=s>=16384?Math.floor(s/2)-1||1:Math.ceil(s/2),a/=s/V),i>2&&c>1&&(W=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,i/=c/W),h=this.cachedCanvases.getCanvas(F,V,W),o=h.context,o.clearRect(0,0,V,W),o.drawImage(l,0,0,s,c,0,0,V,W),l=h.canvas,s=V,c=W,F=F==="prescale1"?"prescale2":"prescale1"}return{img:l,paintWidth:s,paintHeight:c}}_createMaskCanvas(l){const t=this.ctx,{width:d,height:n}=l,a=this.current.fillColor,i=this.current.patternFill,s=Ol(t);let c,F,h,o;if((l.bitmap||l.data)&&l.count>1){const k=l.bitmap||l.data.buffer;F=JSON.stringify(i?s:[s.slice(0,4),a]),c=this._cachedBitmapsMap.get(k),c||(c=new Map,this._cachedBitmapsMap.set(k,c));const X=c.get(F);if(X&&!i){const L=Math.round(Math.min(s[0],s[2])+s[4]),D=Math.round(Math.min(s[1],s[3])+s[5]);return{canvas:X,offsetX:L,offsetY:D}}h=X}h||(o=this.cachedCanvases.getCanvas("maskCanvas",d,n),QS(o.context,l));let V=sl.transform(s,[1/d,0,0,-1/n,0,0]);V=sl.transform(V,[1,0,0,1,0,-n]);const[W,Q,m,R]=sl.getAxialAlignedBoundingBox([0,0,d,n],V),r=Math.round(m-W)||1,b=Math.round(R-Q)||1,u=this.cachedCanvases.getCanvas("fillCanvas",r,b),J=u.context,G=W,T=Q;J.translate(-G,-T),J.transform(...V),h||(h=this._scaleImage(o.canvas,ud(J)),h=h.img,c&&i&&c.set(F,h)),J.imageSmoothingEnabled=mS(Ol(J),l.interpolate),Qo(J,h,0,0,h.width,h.height,0,0,d,n),J.globalCompositeOperation="source-in";const y=sl.transform(ud(J),[1,0,0,1,-G,-T]);return J.fillStyle=i?a.getPattern(t,this,y,vt.FILL):a,J.fillRect(0,0,d,n),c&&!i&&(this.cachedCanvases.delete("fillCanvas"),c.set(F,u.canvas)),{canvas:u.canvas,offsetX:Math.round(G),offsetY:Math.round(T)}}setLineWidth(l){l!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=l,this.ctx.lineWidth=l}setLineCap(l){this.ctx.lineCap=hI[l]}setLineJoin(l){this.ctx.lineJoin=oI[l]}setMiterLimit(l){this.ctx.miterLimit=l}setDash(l,t){const d=this.ctx;d.setLineDash!==void 0&&(d.setLineDash(l),d.lineDashOffset=t)}setRenderingIntent(l){}setFlatness(l){}setGState(l){for(const[t,d]of l)switch(t){case"LW":this.setLineWidth(d);break;case"LC":this.setLineCap(d);break;case"LJ":this.setLineJoin(d);break;case"ML":this.setMiterLimit(d);break;case"D":this.setDash(d[0],d[1]);break;case"RI":this.setRenderingIntent(d);break;case"FL":this.setFlatness(d);break;case"Font":this.setFont(d[0],d[1]);break;case"CA":this.current.strokeAlpha=d;break;case"ca":this.current.fillAlpha=d,this.ctx.globalAlpha=d;break;case"BM":this.ctx.globalCompositeOperation=d;break;case"SMask":this.current.activeSMask=d?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(d);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const l=this.inSMaskMode;this.current.activeSMask&&!l?this.beginSMaskMode():!this.current.activeSMask&&l&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const l=this.ctx.canvas.width,t=this.ctx.canvas.height,d="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(d,l,t);this.suspendedCtx=this.ctx,this.ctx=n.context;const a=this.ctx;a.setTransform(...Ol(this.suspendedCtx)),xZ(this.suspendedCtx,a),UI(a,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),xZ(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(l){if(!this.current.activeSMask)return;l?(l[0]=Math.floor(l[0]),l[1]=Math.floor(l[1]),l[2]=Math.ceil(l[2]),l[3]=Math.ceil(l[3])):l=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,d=this.suspendedCtx;this.composeSMask(d,t,this.ctx,l),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(l,t,d,n){const a=n[0],i=n[1],s=n[2]-a,c=n[3]-i;s===0||c===0||(this.genericComposeSMask(t.context,d,s,c,t.subtype,t.backdrop,t.transferMap,a,i,t.offsetX,t.offsetY),l.save(),l.globalAlpha=1,l.globalCompositeOperation="source-over",l.setTransform(1,0,0,1,0,0),l.drawImage(d.canvas,0,0),l.restore())}genericComposeSMask(l,t,d,n,a,i,s,c,F,h,o){let V=l.canvas,W=c-h,Q=F-o;if(i){const R=sl.makeHexColor(...i);if(W<0||Q<0||W+d>V.width||Q+n>V.height){const r=this.cachedCanvases.getCanvas("maskExtension",d,n),b=r.context;b.drawImage(V,-W,-Q),b.globalCompositeOperation="destination-atop",b.fillStyle=R,b.fillRect(0,0,d,n),b.globalCompositeOperation="source-over",V=r.canvas,W=Q=0}else{l.save(),l.globalAlpha=1,l.setTransform(1,0,0,1,0,0);const r=new Path2D;r.rect(W,Q,d,n),l.clip(r),l.globalCompositeOperation="destination-atop",l.fillStyle=R,l.fillRect(W,Q,d,n),l.restore()}}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),a==="Alpha"&&s?t.filter=this.filterFactory.addAlphaFilter(s):a==="Luminosity"&&(t.filter=this.filterFactory.addLuminosityFilter(s));const m=new Path2D;m.rect(c,F,d,n),t.clip(m),t.globalCompositeOperation="destination-in",t.drawImage(V,W,Q,d,n,c,F,d,n),t.restore()}save(){this.inSMaskMode?(xZ(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const l=this.current;this.stateStack.push(l),this.current=l.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),xZ(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(l,t,d,n,a,i){this.ctx.transform(l,t,d,n,a,i),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(l,t,d){const n=this.ctx,a=this.current;let i=a.x,s=a.y,c,F;const h=Ol(n),o=h[0]===0&&h[3]===0||h[1]===0&&h[2]===0,V=o?d.slice(0):null;for(let W=0,Q=0,m=l.length;W<m;W++)switch(l[W]|0){case ld.rectangle:i=t[Q++],s=t[Q++];const R=t[Q++],r=t[Q++],b=i+R,u=s+r;n.moveTo(i,s),R===0||r===0?n.lineTo(b,u):(n.lineTo(b,s),n.lineTo(b,u),n.lineTo(i,u)),o||a.updateRectMinMax(h,[i,s,b,u]),n.closePath();break;case ld.moveTo:i=t[Q++],s=t[Q++],n.moveTo(i,s),o||a.updatePathMinMax(h,i,s);break;case ld.lineTo:i=t[Q++],s=t[Q++],n.lineTo(i,s),o||a.updatePathMinMax(h,i,s);break;case ld.curveTo:c=i,F=s,i=t[Q+4],s=t[Q+5],n.bezierCurveTo(t[Q],t[Q+1],t[Q+2],t[Q+3],i,s),a.updateCurvePathMinMax(h,c,F,t[Q],t[Q+1],t[Q+2],t[Q+3],i,s,V),Q+=6;break;case ld.curveTo2:c=i,F=s,n.bezierCurveTo(i,s,t[Q],t[Q+1],t[Q+2],t[Q+3]),a.updateCurvePathMinMax(h,c,F,i,s,t[Q],t[Q+1],t[Q+2],t[Q+3],V),i=t[Q+2],s=t[Q+3],Q+=4;break;case ld.curveTo3:c=i,F=s,i=t[Q+2],s=t[Q+3],n.bezierCurveTo(t[Q],t[Q+1],i,s,i,s),a.updateCurvePathMinMax(h,c,F,t[Q],t[Q+1],i,s,i,s,V),Q+=4;break;case ld.closePath:n.closePath();break}o&&a.updateScalingPathMinMax(h,V),a.setCurrentPoint(i,s)}closePath(){this.ctx.closePath()}stroke(l=!0){const t=this.ctx,d=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof d=="object"&&d!=null&&d.getPattern?(t.save(),t.strokeStyle=d.getPattern(t,this,ud(t),vt.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),l&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(l=!0){const t=this.ctx,d=this.current.fillColor,n=this.current.patternFill;let a=!1;n&&(t.save(),t.fillStyle=d.getPattern(t,this,ud(t),vt.FILL),a=!0);const i=this.current.getClippedPathBoundingBox();this.contentVisible&&i!==null&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),a&&t.restore(),l&&this.consumePath(i)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=VI}eoClip(){this.pendingClip=RS}beginText(){this.current.textMatrix=sM,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const l=this.pendingTextPaths,t=this.ctx;if(l===void 0){t.beginPath();return}const d=new Path2D,n=t.getTransform().invertSelf();for(const{transform:a,x:i,y:s,fontSize:c,path:F}of l)d.addPath(F,new DOMMatrix(a).preMultiplySelf(n).translate(i,s).scale(c,-c));t.clip(d),t.beginPath(),delete this.pendingTextPaths}setCharSpacing(l){this.current.charSpacing=l}setWordSpacing(l){this.current.wordSpacing=l}setHScale(l){this.current.textHScale=l/100}setLeading(l){this.current.leading=-l}setFont(l,t){var d;const n=this.commonObjs.get(l),a=this.current;if(!n)throw new Error(`Can't find font for ${l}`);if(a.fontMatrix=n.fontMatrix||tR,(a.fontMatrix[0]===0||a.fontMatrix[3]===0)&&Rl("Invalid font matrix for font "+l),t<0?(t=-t,a.fontDirection=-1):a.fontDirection=1,this.current.font=n,this.current.fontSize=t,n.isType3Font)return;const i=n.loadedName||"sans-serif",s=((d=n.systemFontInfo)==null?void 0:d.css)||`"${i}", ${n.fallbackName}`;let c="normal";n.black?c="900":n.bold&&(c="bold");const F=n.italic?"italic":"normal";let h=t;t<ZS?h=ZS:t>FS&&(h=FS),this.current.fontSizeScale=t/h,this.ctx.font=`${F} ${c} ${h}px ${s}`}setTextRenderingMode(l){this.current.textRenderingMode=l}setTextRise(l){this.current.textRise=l}moveText(l,t){this.current.x=this.current.lineX+=l,this.current.y=this.current.lineY+=t}setLeadingMoveText(l,t){this.setLeading(-t),this.moveText(l,t)}setTextMatrix(l,t,d,n,a,i){this.current.textMatrix=[l,t,d,n,a,i],this.current.textMatrixScale=Math.hypot(l,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(l,t,d,n,a){const i=this.ctx,s=this.current,c=s.font,F=s.textRenderingMode,h=s.fontSize/s.fontSizeScale,o=F&Ct.FILL_STROKE_MASK,V=!!(F&Ct.ADD_TO_PATH_FLAG),W=s.patternFill&&!c.missingFile,Q=s.patternStroke&&!c.missingFile;let m;if((c.disableFontFace||V||W||Q)&&(m=c.getPathGenerator(this.commonObjs,l)),c.disableFontFace||W||Q){if(i.save(),i.translate(t,d),i.scale(h,-h),o===Ct.FILL||o===Ct.FILL_STROKE)if(n){const R=i.getTransform();i.setTransform(...n),i.fill(p(this,la,fR).call(this,m,R,n))}else i.fill(m);if(o===Ct.STROKE||o===Ct.FILL_STROKE)if(a){const R=i.getTransform();i.setTransform(...a),i.stroke(p(this,la,fR).call(this,m,R,a))}else i.lineWidth/=h,i.stroke(m);i.restore()}else(o===Ct.FILL||o===Ct.FILL_STROKE)&&i.fillText(l,t,d),(o===Ct.STROKE||o===Ct.FILL_STROKE)&&i.strokeText(l,t,d);V&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Ol(i),x:t,y:d,fontSize:h,path:m})}get isFontSubpixelAAEnabled(){const{context:l}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);l.scale(1.5,1),l.fillText("I",0,10);const t=l.getImageData(0,0,10,10).data;let d=!1;for(let n=3;n<t.length;n+=4)if(t[n]>0&&t[n]<255){d=!0;break}return rl(this,"isFontSubpixelAAEnabled",d)}showText(l){const t=this.current,d=t.font;if(d.isType3Font)return this.showType3Text(l);const n=t.fontSize;if(n===0)return;const a=this.ctx,i=t.fontSizeScale,s=t.charSpacing,c=t.wordSpacing,F=t.fontDirection,h=t.textHScale*F,o=l.length,V=d.vertical,W=V?1:-1,Q=d.defaultVMetrics,m=n*t.fontMatrix[0],R=t.textRenderingMode===Ct.FILL&&!d.disableFontFace&&!t.patternFill;a.save(),a.transform(...t.textMatrix),a.translate(t.x,t.y+t.textRise),F>0?a.scale(h,-1):a.scale(h,1);let r,b;if(t.patternFill){a.save();const y=t.fillColor.getPattern(a,this,ud(a),vt.FILL);r=Ol(a),a.restore(),a.fillStyle=y}if(t.patternStroke){a.save();const y=t.strokeColor.getPattern(a,this,ud(a),vt.STROKE);b=Ol(a),a.restore(),a.strokeStyle=y}let u=t.lineWidth;const J=t.textMatrixScale;if(J===0||u===0){const y=t.textRenderingMode&Ct.FILL_STROKE_MASK;(y===Ct.STROKE||y===Ct.FILL_STROKE)&&(u=this.getSinglePixelWidth())}else u/=J;if(i!==1&&(a.scale(i,i),u/=i),a.lineWidth=u,d.isInvalidPDFjsFont){const y=[];let k=0;for(const X of l)y.push(X.unicode),k+=X.width;a.fillText(y.join(""),0,0),t.x+=k*m*h,a.restore(),this.compose();return}let G=0,T;for(T=0;T<o;++T){const y=l[T];if(typeof y=="number"){G+=W*y*n/1e3;continue}let k=!1;const X=(y.isSpace?c:0)+s,L=y.fontChar,D=y.accent;let C,I,H=y.width;if(V){const Y=y.vmetric||Q,B=-(y.vmetric?Y[1]:H*.5)*m,z=Y[2]*m;H=Y?-Y[0]:H,C=B/i,I=(G+z)/i}else C=G/i,I=0;if(d.remeasure&&H>0){const Y=a.measureText(L).width*1e3/n*i;if(H<Y&&this.isFontSubpixelAAEnabled){const B=H/Y;k=!0,a.save(),a.scale(B,1),C/=B}else H!==Y&&(C+=(H-Y)/2e3*n/i)}if(this.contentVisible&&(y.isInFont||d.missingFile)){if(R&&!D)a.fillText(L,C,I);else if(this.paintChar(L,C,I,r,b),D){const Y=C+n*D.offset.x/i,B=I-n*D.offset.y/i;this.paintChar(D.fontChar,Y,B,r,b)}}const f=V?H*m-X*F:H*m+X*F;G+=f,k&&a.restore()}V?t.y-=G:t.x+=G*h,a.restore(),this.compose()}showType3Text(l){const t=this.ctx,d=this.current,n=d.font,a=d.fontSize,i=d.fontDirection,s=n.vertical?1:-1,c=d.charSpacing,F=d.wordSpacing,h=d.textHScale*i,o=d.fontMatrix||tR,V=l.length,W=d.textRenderingMode===Ct.INVISIBLE;let Q,m,R,r;if(!(W||a===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...d.textMatrix),t.translate(d.x,d.y),t.scale(h,i),Q=0;Q<V;++Q){if(m=l[Q],typeof m=="number"){r=s*m*a/1e3,this.ctx.translate(r,0),d.x+=r*h;continue}const b=(m.isSpace?F:0)+c,u=n.charProcOperatorList[m.operatorListId];if(!u){Rl(`Type3 character "${m.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=m,this.save(),t.scale(a,a),t.transform(...o),this.executeOperatorList(u),this.restore()),R=sl.applyTransform([m.width,0],o)[0]*a+b,t.translate(R,0),d.x+=R*h}t.restore(),this.processingType3=null}}setCharWidth(l,t){}setCharWidthAndBounds(l,t,d,n,a,i){this.ctx.rect(d,n,a-d,i-n),this.ctx.clip(),this.endPath()}getColorN_Pattern(l){let t;if(l[0]==="TilingPattern"){const d=l[1],n=this.baseTransform||Ol(this.ctx),a={createCanvasGraphics:i=>new Wy(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new iI(l,d,this.ctx,a,n)}else t=this._getPattern(l[1],l[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(l,t,d){this.ctx.strokeStyle=this.current.strokeColor=sl.makeHexColor(l,t,d),this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(l,t,d){this.ctx.fillStyle=this.current.fillColor=sl.makeHexColor(l,t,d),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(l,t=null){let d;return this.cachedPatterns.has(l)?d=this.cachedPatterns.get(l):(d=aI(this.getObject(l)),this.cachedPatterns.set(l,d)),t&&(d.matrix=t),d}shadingFill(l){if(!this.contentVisible)return;const t=this.ctx;this.save();const d=this._getPattern(l);t.fillStyle=d.getPattern(t,this,ud(t),vt.SHADING);const n=ud(t);if(n){const{width:a,height:i}=t.canvas,[s,c,F,h]=sl.getAxialAlignedBoundingBox([0,0,a,i],n);this.ctx.fillRect(s,c,F-s,h-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Cl("Should not call beginInlineImage")}beginImageData(){Cl("Should not call beginImageData")}paintFormXObjectBegin(l,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),l&&this.transform(...l),this.baseTransform=Ol(this.ctx),t)){const d=t[2]-t[0],n=t[3]-t[1];this.ctx.rect(t[0],t[1],d,n),this.current.updateRectMinMax(Ol(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(l){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;l.isolated||Jh("TODO: Support non-isolated groups."),l.knockout&&Rl("Knockout groups not supported.");const d=Ol(t);if(l.matrix&&t.transform(...l.matrix),!l.bbox)throw new Error("Bounding box is required.");let n=sl.getAxialAlignedBoundingBox(l.bbox,Ol(t));const a=[0,0,t.canvas.width,t.canvas.height];n=sl.intersect(n,a)||[0,0,0,0];const i=Math.floor(n[0]),s=Math.floor(n[1]),c=Math.max(Math.ceil(n[2])-i,1),F=Math.max(Math.ceil(n[3])-s,1);this.current.startNewPathAndClipBox([0,0,c,F]);let h="groupAt"+this.groupLevel;l.smask&&(h+="_smask_"+this.smaskCounter++%2);const o=this.cachedCanvases.getCanvas(h,c,F),V=o.context;V.translate(-i,-s),V.transform(...d),l.smask?this.smaskStack.push({canvas:o.canvas,context:V,offsetX:i,offsetY:s,subtype:l.smask.subtype,backdrop:l.smask.backdrop,transferMap:l.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(i,s),t.save()),xZ(t,V),this.ctx=V,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(l){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,d=this.groupStack.pop();if(this.ctx=d,this.ctx.imageSmoothingEnabled=!1,l.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const n=Ol(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...n);const a=sl.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],n);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(a)}}beginAnnotation(l,t,d,n,a){if(p(this,la,vR).call(this),mo(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const i=t[2]-t[0],s=t[3]-t[1];if(a&&this.annotationCanvasMap){d=d.slice(),d[4]-=t[0],d[5]-=t[1],t=t.slice(),t[0]=t[1]=0,t[2]=i,t[3]=s;const[c,F]=sl.singularValueDecompose2dScale(Ol(this.ctx)),{viewportScale:h}=this,o=Math.ceil(i*this.outputScaleX*h),V=Math.ceil(s*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(o,V);const{canvas:W,context:Q}=this.annotationCanvas;this.annotationCanvasMap.set(l,W),this.annotationCanvas.savedCtx=this.ctx,this.ctx=Q,this.ctx.save(),this.ctx.setTransform(c,0,0,-F,0,s*F),mo(this.ctx)}else mo(this.ctx),this.endPath(),this.ctx.rect(t[0],t[1],i,s),this.ctx.clip(),this.ctx.beginPath()}this.current=new VS(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...d),this.transform(...n)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),p(this,la,KR).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(l){if(!this.contentVisible)return;const t=l.count;l=this.getObject(l.data,l),l.count=t;const d=this.ctx,n=this.processingType3;if(n&&(n.compiled===void 0&&(n.compiled=FI(l)),n.compiled)){n.compiled(d);return}const a=this._createMaskCanvas(l),i=a.canvas;d.save(),d.setTransform(1,0,0,1,0,0),d.drawImage(i,a.offsetX,a.offsetY),d.restore(),this.compose()}paintImageMaskXObjectRepeat(l,t,d=0,n=0,a,i){if(!this.contentVisible)return;l=this.getObject(l.data,l);const s=this.ctx;s.save();const c=Ol(s);s.transform(t,d,n,a,0,0);const F=this._createMaskCanvas(l);s.setTransform(1,0,0,1,F.offsetX-c[4],F.offsetY-c[5]);for(let h=0,o=i.length;h<o;h+=2){const V=sl.transform(c,[t,d,n,a,i[h],i[h+1]]),[W,Q]=sl.applyTransform([0,0],V);s.drawImage(F.canvas,W,Q)}s.restore(),this.compose()}paintImageMaskXObjectGroup(l){if(!this.contentVisible)return;const t=this.ctx,d=this.current.fillColor,n=this.current.patternFill;for(const a of l){const{data:i,width:s,height:c,transform:F}=a,h=this.cachedCanvases.getCanvas("maskCanvas",s,c),o=h.context;o.save();const V=this.getObject(i,a);QS(o,V),o.globalCompositeOperation="source-in",o.fillStyle=n?d.getPattern(o,this,ud(t),vt.FILL):d,o.fillRect(0,0,s,c),o.restore(),t.save(),t.transform(...F),t.scale(1,-1),Qo(t,h.canvas,0,0,s,c,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(l){if(!this.contentVisible)return;const t=this.getObject(l);if(!t){Rl("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t)}paintImageXObjectRepeat(l,t,d,n){if(!this.contentVisible)return;const a=this.getObject(l);if(!a){Rl("Dependent image isn't ready yet");return}const i=a.width,s=a.height,c=[];for(let F=0,h=n.length;F<h;F+=2)c.push({transform:[t,0,0,d,n[F],n[F+1]],x:0,y:0,w:i,h:s});this.paintInlineImageXObjectGroup(a,c)}applyTransferMapsToCanvas(l){return this.current.transferMaps!=="none"&&(l.filter=this.current.transferMaps,l.drawImage(l.canvas,0,0),l.filter="none"),l.canvas}applyTransferMapsToBitmap(l){if(this.current.transferMaps==="none")return l.bitmap;const{bitmap:t,width:d,height:n}=l,a=this.cachedCanvases.getCanvas("inlineImage",d,n),i=a.context;return i.filter=this.current.transferMaps,i.drawImage(t,0,0),i.filter="none",a.canvas}paintInlineImageXObject(l){if(!this.contentVisible)return;const t=l.width,d=l.height,n=this.ctx;if(this.save(),!Et){const{filter:s}=n;s!=="none"&&s!==""&&(n.filter="none")}n.scale(1/t,-1/d);let a;if(l.bitmap)a=this.applyTransferMapsToBitmap(l);else if(typeof HTMLElement=="function"&&l instanceof HTMLElement||!l.data)a=l;else{const s=this.cachedCanvases.getCanvas("inlineImage",t,d).context;WS(s,l),a=this.applyTransferMapsToCanvas(s)}const i=this._scaleImage(a,ud(n));n.imageSmoothingEnabled=mS(Ol(n),l.interpolate),Qo(n,i.img,0,0,i.paintWidth,i.paintHeight,0,-d,t,d),this.compose(),this.restore()}paintInlineImageXObjectGroup(l,t){if(!this.contentVisible)return;const d=this.ctx;let n;if(l.bitmap)n=l.bitmap;else{const a=l.width,i=l.height,s=this.cachedCanvases.getCanvas("inlineImage",a,i).context;WS(s,l),n=this.applyTransferMapsToCanvas(s)}for(const a of t)d.save(),d.transform(...a.transform),d.scale(1,-1),Qo(d,n,a.x,a.y,a.w,a.h,0,-1,1,1),d.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(l){}markPointProps(l,t){}beginMarkedContent(l){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(l,t){l==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(l){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(l);const d=this.ctx;this.pendingClip&&(t||(this.pendingClip===RS?d.clip("evenodd"):d.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),d.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const l=Ol(this.ctx);if(l[1]===0&&l[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(l[0]),Math.abs(l[3]));else{const t=Math.abs(l[0]*l[3]-l[2]*l[1]),d=Math.hypot(l[0],l[2]),n=Math.hypot(l[1],l[3]);this._cachedGetSinglePixelWidth=Math.max(d,n)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:l}=this.current,{a:t,b:d,c:n,d:a}=this.ctx.getTransform();let i,s;if(d===0&&n===0){const c=Math.abs(t),F=Math.abs(a);if(c===F)if(l===0)i=s=1/c;else{const h=c*l;i=s=h<1?1/h:1}else if(l===0)i=1/c,s=1/F;else{const h=c*l,o=F*l;i=h<1?1/h:1,s=o<1?1/o:1}}else{const c=Math.abs(t*a-d*n),F=Math.hypot(t,d),h=Math.hypot(n,a);if(l===0)i=h/c,s=F/c;else{const o=l*c;i=h>o?h/o:1,s=F>o?F/o:1}}this._cachedScaleForStroking[0]=i,this._cachedScaleForStroking[1]=s}return this._cachedScaleForStroking}rescaleAndStroke(l){const{ctx:t}=this,{lineWidth:d}=this.current,[n,a]=this.getScaleForStroking();if(t.lineWidth=d||1,n===1&&a===1){t.stroke();return}const i=t.getLineDash();if(l&&t.save(),t.scale(n,a),i.length>0){const s=Math.max(n,a);t.setLineDash(i.map(c=>c/s)),t.lineDashOffset/=s}t.stroke(),l&&t.restore()}isContentVisible(){for(let l=this.markedContentStack.length-1;l>=0;l--)if(!this.markedContentStack[l].visible)return!1;return!0}};la=new WeakSet,vR=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)},KR=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const l=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=l}}},fR=function(e,l,t){const d=new Path2D;return d.addPath(e,new DOMMatrix(t).invertSelf().multiplySelf(l)),d};let Ro=WI;for(const e in ld)Ro.prototype[e]!==void 0&&(Ro.prototype[ld[e]]=Ro.prototype[e]);var No,bo,uo;let ac=(No=class{static get workerPort(){return U(this,bo)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");N(this,bo,e)}static get workerSrc(){return U(this,uo)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");N(this,uo,e)}},bo=new WeakMap,uo=new WeakMap,M(No,bo,null),M(No,uo,""),No);var ic,ro;class QI{constructor({parsedData:l,rawData:t}){M(this,ic),M(this,ro),N(this,ic,l),N(this,ro,t)}getRaw(){return U(this,ro)}get(l){return U(this,ic).get(l)??null}getAll(){return aR(U(this,ic))}has(l){return U(this,ic).has(l)}}ic=new WeakMap,ro=new WeakMap;const sc=Symbol("INTERNAL");var po,Mo,So,gZ;class mI{constructor(l,{name:t,intent:d,usage:n,rbGroups:a}){M(this,po,!1),M(this,Mo,!1),M(this,So,!1),M(this,gZ,!0),N(this,po,!!(l&be.DISPLAY)),N(this,Mo,!!(l&be.PRINT)),this.name=t,this.intent=d,this.usage=n,this.rbGroups=a}get visible(){if(U(this,So))return U(this,gZ);if(!U(this,gZ))return!1;const{print:l,view:t}=this.usage;return U(this,po)?(t==null?void 0:t.viewState)!=="OFF":U(this,Mo)?(l==null?void 0:l.printState)!=="OFF":!0}_setVisible(l,t,d=!1){l!==sc&&Cl("Internal method `_setVisible` called."),N(this,So,d),N(this,gZ,t)}}po=new WeakMap,Mo=new WeakMap,So=new WeakMap,gZ=new WeakMap;var Zi,wl,jZ,OZ,Jo,HR;class RI{constructor(l,t=be.DISPLAY){if(M(this,Jo),M(this,Zi,null),M(this,wl,new Map),M(this,jZ,null),M(this,OZ,null),this.renderingIntent=t,this.name=null,this.creator=null,l!==null){this.name=l.name,this.creator=l.creator,N(this,OZ,l.order);for(const d of l.groups)U(this,wl).set(d.id,new mI(t,d));if(l.baseState==="OFF")for(const d of U(this,wl).values())d._setVisible(sc,!1);for(const d of l.on)U(this,wl).get(d)._setVisible(sc,!0);for(const d of l.off)U(this,wl).get(d)._setVisible(sc,!1);N(this,jZ,this.getHash())}}isVisible(l){if(U(this,wl).size===0)return!0;if(!l)return Jh("Optional content group not defined."),!0;if(l.type==="OCG")return U(this,wl).has(l.id)?U(this,wl).get(l.id).visible:(Rl(`Optional content group not found: ${l.id}`),!0);if(l.type==="OCMD"){if(l.expression)return p(this,Jo,HR).call(this,l.expression);if(!l.policy||l.policy==="AnyOn"){for(const t of l.ids){if(!U(this,wl).has(t))return Rl(`Optional content group not found: ${t}`),!0;if(U(this,wl).get(t).visible)return!0}return!1}else if(l.policy==="AllOn"){for(const t of l.ids){if(!U(this,wl).has(t))return Rl(`Optional content group not found: ${t}`),!0;if(!U(this,wl).get(t).visible)return!1}return!0}else if(l.policy==="AnyOff"){for(const t of l.ids){if(!U(this,wl).has(t))return Rl(`Optional content group not found: ${t}`),!0;if(!U(this,wl).get(t).visible)return!0}return!1}else if(l.policy==="AllOff"){for(const t of l.ids){if(!U(this,wl).has(t))return Rl(`Optional content group not found: ${t}`),!0;if(U(this,wl).get(t).visible)return!1}return!0}return Rl(`Unknown optional content policy ${l.policy}.`),!0}return Rl(`Unknown group type ${l.type}.`),!0}setVisibility(l,t=!0,d=!0){var n;const a=U(this,wl).get(l);if(!a){Rl(`Optional content group not found: ${l}`);return}if(d&&t&&a.rbGroups.length)for(const i of a.rbGroups)for(const s of i)s!==l&&((n=U(this,wl).get(s))==null||n._setVisible(sc,!1,!0));a._setVisible(sc,!!t,!0),N(this,Zi,null)}setOCGState({state:l,preserveRB:t}){let d;for(const n of l){switch(n){case"ON":case"OFF":case"Toggle":d=n;continue}const a=U(this,wl).get(n);if(a)switch(d){case"ON":this.setVisibility(n,!0,t);break;case"OFF":this.setVisibility(n,!1,t);break;case"Toggle":this.setVisibility(n,!a.visible,t);break}}N(this,Zi,null)}get hasInitialVisibility(){return U(this,jZ)===null||this.getHash()===U(this,jZ)}getOrder(){return U(this,wl).size?U(this,OZ)?U(this,OZ).slice():[...U(this,wl).keys()]:null}getGroups(){return U(this,wl).size>0?aR(U(this,wl)):null}getGroup(l){return U(this,wl).get(l)||null}getHash(){if(U(this,Zi)!==null)return U(this,Zi);const l=new fM;for(const[t,d]of U(this,wl))l.update(`${t}:${d.visible}`);return N(this,Zi,l.hexdigest())}}Zi=new WeakMap,wl=new WeakMap,jZ=new WeakMap,OZ=new WeakMap,Jo=new WeakSet,HR=function(e){const l=e.length;if(l<2)return!0;const t=e[0];for(let d=1;d<l;d++){const n=e[d];let a;if(Array.isArray(n))a=p(this,Jo,HR).call(this,n);else if(U(this,wl).has(n))a=U(this,wl).get(n).visible;else return Rl(`Optional content group not found: ${n}`),!0;switch(t){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return t==="And"};class NI{constructor(l,{disableRange:t=!1,disableStream:d=!1}){st(l,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:a,progressiveDone:i,contentDispositionFilename:s}=l;if(this._queuedChunks=[],this._progressiveDone=i,this._contentDispositionFilename=s,(a==null?void 0:a.length)>0){const c=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=l,this._isStreamingSupported=!d,this._isRangeSupported=!t,this._contentLength=n,this._fullRequestReader=null,this._rangeReaders=[],l.addRangeListener((c,F)=>{this._onReceiveData({begin:c,chunk:F})}),l.addProgressListener((c,F)=>{this._onProgress({loaded:c,total:F})}),l.addProgressiveReadListener(c=>{this._onReceiveData({chunk:c})}),l.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),l.transportReady()}_onReceiveData({begin:l,chunk:t}){const d=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(l===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(d):this._queuedChunks.push(d);else{const n=this._rangeReaders.some(function(a){return a._begin!==l?!1:(a._enqueue(d),!0)});st(n,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var l;return((l=this._fullRequestReader)==null?void 0:l._loaded)??0}_onProgress(l){var t,d,n,a;l.total===void 0?(d=(t=this._rangeReaders[0])==null?void 0:t.onProgress)==null||d.call(t,{loaded:l.loaded}):(a=(n=this._fullRequestReader)==null?void 0:n.onProgress)==null||a.call(n,{loaded:l.loaded,total:l.total})}_onProgressiveDone(){var l;(l=this._fullRequestReader)==null||l.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(l){const t=this._rangeReaders.indexOf(l);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){st(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const l=this._queuedChunks;return this._queuedChunks=null,new bI(this,l,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(l,t){if(t<=this._progressiveDataLength)return null;const d=new uI(this,l,t);return this._pdfDataRangeTransport.requestDataRange(l,t),this._rangeReaders.push(d),d}cancelAllRequests(l){var t;(t=this._fullRequestReader)==null||t.cancel(l);for(const d of this._rangeReaders.slice(0))d.cancel(l);this._pdfDataRangeTransport.abort()}}class bI{constructor(l,t,d=!1,n=null){this._stream=l,this._done=d||!1,this._filename=hR(n)?n:null,this._queuedChunks=t||[],this._loaded=0;for(const a of this._queuedChunks)this._loaded+=a.byteLength;this._requests=[],this._headersReady=Promise.resolve(),l._fullRequestReader=this,this.onProgress=null}_enqueue(l){this._done||(this._requests.length>0?this._requests.shift().resolve({value:l,done:!1}):this._queuedChunks.push(l),this._loaded+=l.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const l=Promise.withResolvers();return this._requests.push(l),l.promise}cancel(l){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class uI{constructor(l,t,d){this._stream=l,this._begin=t,this._end=d,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(l){if(!this._done){if(this._requests.length===0)this._queuedChunk=l;else{this._requests.shift().resolve({value:l,done:!1});for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const l=Promise.withResolvers();return this._requests.push(l),l.promise}cancel(l){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function rI(e){let l=!0,t=d("filename\\*","i").exec(e);if(t){t=t[1];let h=s(t);return h=unescape(h),h=c(h),h=F(h),a(h)}if(t=i(e),t){const h=F(t);return a(h)}if(t=d("filename","i").exec(e),t){t=t[1];let h=s(t);return h=F(h),a(h)}function d(h,o){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',o)}function n(h,o){if(h){if(!/^[\x00-\xFF]+$/.test(o))return o;try{const V=new TextDecoder(h,{fatal:!0}),W=Gh(o);o=V.decode(W),l=!1}catch{}}return o}function a(h){return l&&/[\x80-\xff]/.test(h)&&(h=n("utf-8",h),l&&(h=n("iso-8859-1",h))),h}function i(h){const o=[];let V;const W=d("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(V=W.exec(h))!==null;){let[,m,R,r]=V;if(m=parseInt(m,10),m in o){if(m===0)break;continue}o[m]=[R,r]}const Q=[];for(let m=0;m<o.length&&m in o;++m){let[R,r]=o[m];r=s(r),R&&(r=unescape(r),m===0&&(r=c(r))),Q.push(r)}return Q.join("")}function s(h){if(h.startsWith('"')){const o=h.slice(1).split('\\"');for(let V=0;V<o.length;++V){const W=o[V].indexOf('"');W!==-1&&(o[V]=o[V].slice(0,W),o.length=V+1),o[V]=o[V].replaceAll(/\\(.)/g,"$1")}h=o.join('"')}return h}function c(h){const o=h.indexOf("'");if(o===-1)return h;const V=h.slice(0,o),W=h.slice(o+1).replace(/^[^']*'/,"");return n(V,W)}function F(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(o,V,W,Q){if(W==="q"||W==="Q")return Q=Q.replaceAll("_"," "),Q=Q.replaceAll(/=([0-9a-fA-F]{2})/g,function(m,R){return String.fromCharCode(parseInt(R,16))}),n(V,Q);try{Q=atob(Q)}catch{}return n(V,Q)})}return""}function NS(e,l){const t=new Headers;if(!e||!l||typeof l!="object")return t;for(const d in l){const n=l[d];n!==void 0&&t.append(d,n)}return t}function To(e){try{return new URL(e).origin}catch{}return null}function bS({responseHeaders:e,isHttp:l,rangeChunkSize:t,disableRange:d}){const n={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(e.get("Content-Length"),10);return!Number.isInteger(a)||(n.suggestedLength=a,a<=2*t)||d||!l||e.get("Accept-Ranges")!=="bytes"||(e.get("Content-Encoding")||"identity")!=="identity"||(n.allowRangeRequests=!0),n}function uS(e){const l=e.get("Content-Disposition");if(l){let t=rI(l);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(hR(t))return t}return null}function Go(e,l){return e===404||e===0&&l.startsWith("file:")?new cZ('Missing PDF "'+l+'".'):new Th(`Unexpected server response (${e}) while retrieving PDF "${l}".`,e)}function rS(e){return e===200||e===206}function pS(e,l,t){return{method:"GET",headers:e,signal:t.signal,mode:"cors",credentials:l?"include":"same-origin",redirect:"follow"}}function MS(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:(Rl(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class SS{constructor(l){hl(this,"_responseOrigin",null),this.source=l,this.isHttp=/^https?:/i.test(l.url),this.headers=NS(this.isHttp,l.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var l;return((l=this._fullRequestReader)==null?void 0:l._loaded)??0}getFullReader(){return st(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new pI(this),this._fullRequestReader}getRangeReader(l,t){if(t<=this._progressiveDataLength)return null;const d=new MI(this,l,t);return this._rangeRequestReaders.push(d),d}cancelAllRequests(l){var t;(t=this._fullRequestReader)==null||t.cancel(l);for(const d of this._rangeRequestReaders.slice(0))d.cancel(l)}}class pI{constructor(l){this._stream=l,this._reader=null,this._loaded=0,this._filename=null;const t=l.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange;const d=new Headers(l.headers),n=t.url;fetch(n,pS(d,this._withCredentials,this._abortController)).then(a=>{if(l._responseOrigin=To(a.url),!rS(a.status))throw Go(a.status,n);this._reader=a.body.getReader(),this._headersCapability.resolve();const i=a.headers,{allowRangeRequests:s,suggestedLength:c}=bS({responseHeaders:i,isHttp:l.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=c||this._contentLength,this._filename=uS(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new gn("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var l;await this._headersCapability.promise;const{value:t,done:d}=await this._reader.read();return d?{value:t,done:d}:(this._loaded+=t.byteLength,(l=this.onProgress)==null||l.call(this,{loaded:this._loaded,total:this._contentLength}),{value:MS(t),done:!1})}cancel(l){var t;(t=this._reader)==null||t.cancel(l),this._abortController.abort()}}class MI{constructor(l,t,d){this._stream=l,this._reader=null,this._loaded=0;const n=l.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const a=new Headers(l.headers);a.append("Range",`bytes=${t}-${d-1}`);const i=n.url;fetch(i,pS(a,this._withCredentials,this._abortController)).then(s=>{const c=To(s.url);if(c!==l._responseOrigin)throw new Error(`Expected range response-origin "${c}" to match "${l._responseOrigin}".`);if(!rS(s.status))throw Go(s.status,i);this._readCapability.resolve(),this._reader=s.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var l;await this._readCapability.promise;const{value:t,done:d}=await this._reader.read();return d?{value:t,done:d}:(this._loaded+=t.byteLength,(l=this.onProgress)==null||l.call(this,{loaded:this._loaded}),{value:MS(t),done:!1})}cancel(l){var t;(t=this._reader)==null||t.cancel(l),this._abortController.abort()}}const PR=200,AR=206;function SI(e){const l=e.response;return typeof l!="string"?l:Gh(l).buffer}class JI{constructor({url:l,httpHeaders:t,withCredentials:d}){hl(this,"_responseOrigin",null),this.url=l,this.isHttp=/^https?:/i.test(l),this.headers=NS(this.isHttp,t),this.withCredentials=d||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(l){const t=new XMLHttpRequest,d=this.currXhrId++,n=this.pendingRequests[d]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const[a,i]of this.headers)t.setRequestHeader(a,i);return this.isHttp&&"begin"in l&&"end"in l?(t.setRequestHeader("Range",`bytes=${l.begin}-${l.end-1}`),n.expectedStatus=AR):n.expectedStatus=PR,t.responseType="arraybuffer",st(l.onError,"Expected `onError` callback to be provided."),t.onerror=()=>{l.onError(t.status)},t.onreadystatechange=this.onStateChange.bind(this,d),t.onprogress=this.onProgress.bind(this,d),n.onHeadersReceived=l.onHeadersReceived,n.onDone=l.onDone,n.onError=l.onError,n.onProgress=l.onProgress,t.send(null),d}onProgress(l,t){var d;const n=this.pendingRequests[l];n&&((d=n.onProgress)==null||d.call(n,t))}onStateChange(l,t){const d=this.pendingRequests[l];if(!d)return;const n=d.xhr;if(n.readyState>=2&&d.onHeadersReceived&&(d.onHeadersReceived(),delete d.onHeadersReceived),n.readyState!==4||!(l in this.pendingRequests))return;if(delete this.pendingRequests[l],n.status===0&&this.isHttp){d.onError(n.status);return}const a=n.status||PR;if(!(a===PR&&d.expectedStatus===AR)&&a!==d.expectedStatus){d.onError(n.status);return}const i=SI(n);if(a===AR){const s=n.getResponseHeader("Content-Range"),c=/bytes (\d+)-(\d+)\/(\d+)/.exec(s);c?d.onDone({begin:parseInt(c[1],10),chunk:i}):(Rl('Missing or invalid "Content-Range" header.'),d.onError(0))}else i?d.onDone({begin:0,chunk:i}):d.onError(n.status)}getRequestXhr(l){return this.pendingRequests[l].xhr}isPendingRequest(l){return l in this.pendingRequests}abortRequest(l){const t=this.pendingRequests[l].xhr;delete this.pendingRequests[l],t.abort()}}class TI{constructor(l){this._source=l,this._manager=new JI(l),this._rangeChunkSize=l.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(l){const t=this._rangeRequestReaders.indexOf(l);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return st(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new GI(this._manager,this._source),this._fullRequestReader}getRangeReader(l,t){const d=new XI(this._manager,l,t);return d.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(d),d}cancelAllRequests(l){var t;(t=this._fullRequestReader)==null||t.cancel(l);for(const d of this._rangeRequestReaders.slice(0))d.cancel(l)}}class GI{constructor(l,t){this._manager=l,this._url=t.url,this._fullRequestId=l.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const l=this._fullRequestId,t=this._manager.getRequestXhr(l);this._manager._responseOrigin=To(t.responseURL);const d=t.getAllResponseHeaders(),n=new Headers(d?d.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(s=>{const[c,...F]=s.split(": ");return[c,F.join(": ")]}):[]),{allowRangeRequests:a,suggestedLength:i}=bS({responseHeaders:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=i||this._contentLength,this._filename=uS(n),this._isRangeSupported&&this._manager.abortRequest(l),this._headersCapability.resolve()}_onDone(l){if(l&&(this._requests.length>0?this._requests.shift().resolve({value:l.chunk,done:!1}):this._cachedChunks.push(l.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(l){this._storedError=Go(l,this._url),this._headersCapability.reject(this._storedError);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(l){var t;(t=this.onProgress)==null||t.call(this,{loaded:l.loaded,total:l.lengthComputable?l.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const l=Promise.withResolvers();return this._requests.push(l),l.promise}cancel(l){this._done=!0,this._headersCapability.reject(l);for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class XI{constructor(l,t,d){this._manager=l,this._url=l.url,this._requestId=l.request({begin:t,end:d,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var l;const t=To((l=this._manager.getRequestXhr(this._requestId))==null?void 0:l.responseURL);t!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${t}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var l;(l=this.onClosed)==null||l.call(this,this)}_onDone(l){const t=l.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const d of this._requests)d.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(l){this._storedError??(this._storedError=Go(l,this._url));for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(l){var t;this.isStreamingSupported||(t=this.onProgress)==null||t.call(this,{loaded:l.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const l=Promise.withResolvers();return this._requests.push(l),l.promise}cancel(l){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const yI=/^[a-z][a-z0-9\-+.]+:/i;function BI(e){if(yI.test(e))return new URL(e);const l=process.getBuiltinModule("url");return new URL(l.pathToFileURL(e))}class YI{constructor(l){this.source=l,this.url=BI(l.url),st(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var l;return((l=this._fullRequestReader)==null?void 0:l._loaded)??0}getFullReader(){return st(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new kI(this),this._fullRequestReader}getRangeReader(l,t){if(t<=this._progressiveDataLength)return null;const d=new zI(this,l,t);return this._rangeRequestReaders.push(d),d}cancelAllRequests(l){var t;(t=this._fullRequestReader)==null||t.cancel(l);for(const d of this._rangeRequestReaders.slice(0))d.cancel(l)}}class kI{constructor(l){this._url=l.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=l.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const d=process.getBuiltinModule("fs");d.promises.lstat(this._url).then(n=>{this._contentLength=n.size,this._setReadableStream(d.createReadStream(this._url)),this._headersCapability.resolve()},n=>{n.code==="ENOENT"&&(n=new cZ(`Missing PDF "${this._url}".`)),this._storedError=n,this._headersCapability.reject(n)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var l;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(l=this.onProgress)==null||l.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(l){if(!this._readableStream){this._error(l);return}this._readableStream.destroy(l)}_error(l){this._storedError=l,this._readCapability.resolve()}_setReadableStream(l){this._readableStream=l,l.on("readable",()=>{this._readCapability.resolve()}),l.on("end",()=>{l.destroy(),this._done=!0,this._readCapability.resolve()}),l.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new gn("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class zI{constructor(l,t,d){this._url=l.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const n=l.source;this._isStreamingSupported=!n.disableStream;const a=process.getBuiltinModule("fs");this._setReadableStream(a.createReadStream(this._url,{start:t,end:d-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var l;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(l=this.onProgress)==null||l.call(this,{loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(l){if(!this._readableStream){this._error(l);return}this._readableStream.destroy(l)}_error(l){this._storedError=l,this._readCapability.resolve()}_setReadableStream(l){this._readableStream=l,l.on("readable",()=>{this._readCapability.resolve()}),l.on("end",()=>{l.destroy(),this._done=!0,this._readCapability.resolve()}),l.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const LI=1e5,he=30,II=.8;var JS,Fi,pe,Xo,yo,hi,ta,Bo,Yo,cc,vZ,KZ,oi,fZ,ko,HZ,Uc,zo,Lo,Vt,Zc,Fc,Io,Vi,PZ,hc,TS,GS,_R,cn,Do,qR,XS,yS;let $R=(Vt=class{constructor({textContentSource:e,container:l,viewport:t}){M(this,hc),M(this,Fi,Promise.withResolvers()),M(this,pe,null),M(this,Xo,!1),M(this,yo,!!((JS=globalThis.FontInspector)!=null&&JS.enabled)),M(this,hi,null),M(this,ta,null),M(this,Bo,0),M(this,Yo,0),M(this,cc,null),M(this,vZ,null),M(this,KZ,0),M(this,oi,0),M(this,fZ,Object.create(null)),M(this,ko,[]),M(this,HZ,null),M(this,Uc,[]),M(this,zo,new WeakMap),M(this,Lo,null);var d;if(e instanceof ReadableStream)N(this,HZ,e);else if(typeof e=="object")N(this,HZ,new ReadableStream({start(c){c.enqueue(e),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');N(this,pe,N(this,vZ,l)),N(this,oi,t.scale*(globalThis.devicePixelRatio||1)),N(this,KZ,t.rotation),N(this,ta,{div:null,properties:null,ctx:null});const{pageWidth:n,pageHeight:a,pageX:i,pageY:s}=t.rawDims;N(this,Lo,[1,0,0,-1,-i,s+a]),N(this,Yo,n),N(this,Bo,a),p(d=Vt,cn,XS).call(d),Pa(l,t),U(this,Fi).promise.finally(()=>{U(Vt,PZ).delete(this),N(this,ta,null),N(this,fZ,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:l}=te.platform;return rl(this,"fontFamilyMap",new Map([["sans-serif",`${e&&l?"Calibri, ":""}sans-serif`],["monospace",`${e&&l?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{U(this,cc).read().then(({value:l,done:t})=>{if(t){U(this,Fi).resolve();return}U(this,hi)??N(this,hi,l.lang),Object.assign(U(this,fZ),l.styles),p(this,hc,TS).call(this,l.items),e()},U(this,Fi).reject)};return N(this,cc,U(this,HZ).getReader()),U(Vt,PZ).add(this),e(),U(this,Fi).promise}update({viewport:e,onBefore:l=null}){var t;const d=e.scale*(globalThis.devicePixelRatio||1),n=e.rotation;if(n!==U(this,KZ)&&(l==null||l(),N(this,KZ,n),Pa(U(this,vZ),{rotation:n})),d!==U(this,oi)){l==null||l(),N(this,oi,d);const a={div:null,properties:null,ctx:p(t=Vt,cn,Do).call(t,U(this,hi))};for(const i of U(this,Uc))a.properties=U(this,zo).get(i),a.div=i,p(this,hc,_R).call(this,a)}}cancel(){var e;const l=new gn("TextLayer task cancelled.");(e=U(this,cc))==null||e.cancel(l).catch(()=>{}),N(this,cc,null),U(this,Fi).reject(l)}get textDivs(){return U(this,Uc)}get textContentItemsStr(){return U(this,ko)}static cleanup(){if(!(U(this,PZ).size>0)){U(this,Zc).clear();for(const{canvas:e}of U(this,Fc).values())e.remove();U(this,Fc).clear()}}},Fi=new WeakMap,pe=new WeakMap,Xo=new WeakMap,yo=new WeakMap,hi=new WeakMap,ta=new WeakMap,Bo=new WeakMap,Yo=new WeakMap,cc=new WeakMap,vZ=new WeakMap,KZ=new WeakMap,oi=new WeakMap,fZ=new WeakMap,ko=new WeakMap,HZ=new WeakMap,Uc=new WeakMap,zo=new WeakMap,Lo=new WeakMap,Zc=new WeakMap,Fc=new WeakMap,Io=new WeakMap,Vi=new WeakMap,PZ=new WeakMap,hc=new WeakSet,TS=function(e){var l,t;if(U(this,Xo))return;(t=U(this,ta)).ctx??(t.ctx=p(l=Vt,cn,Do).call(l,U(this,hi)));const d=U(this,Uc),n=U(this,ko);for(const a of e){if(d.length>LI){Rl("Ignoring additional textDivs for performance reasons."),N(this,Xo,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const i=U(this,pe);N(this,pe,document.createElement("span")),U(this,pe).classList.add("markedContent"),a.id!==null&&U(this,pe).setAttribute("id",`${a.id}`),i.append(U(this,pe))}else a.type==="endMarkedContent"&&N(this,pe,U(this,pe).parentNode);continue}n.push(a.str),p(this,hc,GS).call(this,a)}},GS=function(e){var l;const t=document.createElement("span"),d={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};U(this,Uc).push(t);const n=sl.transform(U(this,Lo),e.transform);let a=Math.atan2(n[1],n[0]);const i=U(this,fZ)[e.fontName];i.vertical&&(a+=Math.PI/2);let s=U(this,yo)&&i.fontSubstitution||i.fontFamily;s=Vt.fontFamilyMap.get(s)||s;const c=Math.hypot(n[2],n[3]),F=c*p(l=Vt,cn,yS).call(l,s,U(this,hi));let h,o;a===0?(h=n[4],o=n[5]-F):(h=n[4]+F*Math.sin(a),o=n[5]-F*Math.cos(a));const V="calc(var(--scale-factor)*",W=t.style;U(this,pe)===U(this,vZ)?(W.left=`${(100*h/U(this,Yo)).toFixed(2)}%`,W.top=`${(100*o/U(this,Bo)).toFixed(2)}%`):(W.left=`${V}${h.toFixed(2)}px)`,W.top=`${V}${o.toFixed(2)}px)`),W.fontSize=`${V}${(U(Vt,Vi)*c).toFixed(2)}px)`,W.fontFamily=s,d.fontSize=c,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,U(this,yo)&&(t.dataset.fontName=i.fontSubstitutionLoadedName||e.fontName),a!==0&&(d.angle=a*(180/Math.PI));let Q=!1;if(e.str.length>1)Q=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const m=Math.abs(e.transform[0]),R=Math.abs(e.transform[3]);m!==R&&Math.max(m,R)/Math.min(m,R)>1.5&&(Q=!0)}if(Q&&(d.canvasWidth=i.vertical?e.height:e.width),U(this,zo).set(t,d),U(this,ta).div=t,U(this,ta).properties=d,p(this,hc,_R).call(this,U(this,ta)),d.hasText&&U(this,pe).append(t),d.hasEOL){const m=document.createElement("br");m.setAttribute("role","presentation"),U(this,pe).append(m)}},_R=function(e){var l;const{div:t,properties:d,ctx:n}=e,{style:a}=t;let i="";if(U(Vt,Vi)>1&&(i=`scale(${1/U(Vt,Vi)})`),d.canvasWidth!==0&&d.hasText){const{fontFamily:s}=a,{canvasWidth:c,fontSize:F}=d;p(l=Vt,cn,qR).call(l,n,F*U(this,oi),s);const{width:h}=n.measureText(t.textContent);h>0&&(i=`scaleX(${c*U(this,oi)/h}) ${i}`)}d.angle!==0&&(i=`rotate(${d.angle}deg) ${i}`),i.length>0&&(a.transform=i)},cn=new WeakSet,Do=function(e=null){let l=U(this,Fc).get(e||(e=""));if(!l){const t=document.createElement("canvas");t.className="hiddenCanvasElement",t.lang=e,document.body.append(t),l=t.getContext("2d",{alpha:!1,willReadFrequently:!0}),U(this,Fc).set(e,l),U(this,Io).set(l,{size:0,family:""})}return l},qR=function(e,l,t){const d=U(this,Io).get(e);l===d.size&&t===d.family||(e.font=`${l}px ${t}`,d.size=l,d.family=t)},XS=function(){if(U(this,Vi)!==null)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),N(this,Vi,e.getBoundingClientRect().height),e.remove()},yS=function(e,l){const t=U(this,Zc).get(e);if(t)return t;const d=p(this,cn,Do).call(this,l);d.canvas.width=d.canvas.height=he,p(this,cn,qR).call(this,d,he,e);const n=d.measureText("");let a=n.fontBoundingBoxAscent,i=Math.abs(n.fontBoundingBoxDescent);if(a){const F=a/(a+i);return U(this,Zc).set(e,F),d.canvas.width=d.canvas.height=0,F}d.strokeStyle="red",d.clearRect(0,0,he,he),d.strokeText("g",0,0);let s=d.getImageData(0,0,he,he).data;i=0;for(let F=s.length-1-3;F>=0;F-=4)if(s[F]>0){i=Math.ceil(F/4/he);break}d.clearRect(0,0,he,he),d.strokeText("A",0,he),s=d.getImageData(0,0,he,he).data,a=0;for(let F=0,h=s.length;F<h;F+=4)if(s[F]>0){a=he-Math.floor(F/4/he);break}d.canvas.width=d.canvas.height=0;const c=a?a/(a+i):II;return U(this,Zc).set(e,c),c},M(Vt,cn),M(Vt,Zc,new Map),M(Vt,Fc,new Map),M(Vt,Io,new WeakMap),M(Vt,Vi,null),M(Vt,PZ,new Set),Vt);class AZ{static textContent(l){const t=[],d={items:t,styles:Object.create(null)};function n(a){var i;if(!a)return;let s=null;const c=a.name;if(c==="#text")s=a.value;else if(AZ.shouldBuildText(c))(i=a==null?void 0:a.attributes)!=null&&i.textContent?s=a.attributes.textContent:a.value&&(s=a.value);else return;if(s!==null&&t.push({str:s}),!!a.children)for(const F of a.children)n(F)}return n(l),d}static shouldBuildText(l){return!(l==="textarea"||l==="input"||l==="option"||l==="select")}}const DI=65536,wI=100,EI=5e3,CI=Et?qL:PL,xI=Et?$L:eS,gI=Et?_L:AL,jI=Et?lI:iS;function OI(e={}){typeof e=="string"||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const l=new fI,{docId:t}=l,d=e.url?vI(e.url):null,n=e.data?KI(e.data):null,a=e.httpHeaders||null,i=e.withCredentials===!0,s=e.password??null,c=e.range instanceof kS?e.range:null,F=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:DI;let h=e.worker instanceof xo?e.worker:null;const o=e.verbosity,V=typeof e.docBaseUrl=="string"&&!Bh(e.docBaseUrl)?e.docBaseUrl:null,W=typeof e.cMapUrl=="string"?e.cMapUrl:null,Q=e.cMapPacked!==!1,m=e.CMapReaderFactory||xI,R=typeof e.standardFontDataUrl=="string"?e.standardFontDataUrl:null,r=e.StandardFontDataFactory||jI,b=e.stopAtErrors!==!0,u=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,J=e.isEvalSupported!==!1,G=typeof e.isOffscreenCanvasSupported=="boolean"?e.isOffscreenCanvasSupported:!Et,T=typeof e.isImageDecoderSupported=="boolean"?e.isImageDecoderSupported:!Et&&(te.platform.isFirefox||!globalThis.chrome),y=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,k=typeof e.disableFontFace=="boolean"?e.disableFontFace:Et,X=e.fontExtraProperties===!0,L=e.enableXfa===!0,D=e.ownerDocument||globalThis.document,C=e.disableRange===!0,I=e.disableStream===!0,H=e.disableAutoFetch===!0,f=e.pdfBug===!0,Y=e.CanvasFactory||CI,B=e.FilterFactory||gI,z=e.enableHWA===!0,g=c?c.length:e.length??NaN,w=typeof e.useSystemFonts=="boolean"?e.useSystemFonts:!Et&&!k,O=typeof e.useWorkerFetch=="boolean"?e.useWorkerFetch:m===eS&&r===iS&&W&&R&&ZZ(W,document.baseURI)&&ZZ(R,document.baseURI),K=null;ML(o);const x={canvasFactory:new Y({ownerDocument:D,enableHWA:z}),filterFactory:new B({docId:t,ownerDocument:D}),cMapReaderFactory:O?null:new m({baseUrl:W,isCompressed:Q}),standardFontDataFactory:O?null:new r({baseUrl:R})};if(!h){const P={verbosity:o,port:ac.workerPort};h=P.port?xo.fromPort(P):new xo(P),l._worker=h}const _={docId:t,apiVersion:"4.10.38",data:n,password:s,disableAutoFetch:H,rangeChunkSize:F,length:g,docBaseUrl:V,enableXfa:L,evaluatorOptions:{maxImageSize:u,disableFontFace:k,ignoreErrors:b,isEvalSupported:J,isOffscreenCanvasSupported:G,isImageDecoderSupported:T,canvasMaxAreaInBytes:y,fontExtraProperties:X,useSystemFonts:w,cMapUrl:O?W:null,standardFontDataUrl:O?R:null}},al={disableFontFace:k,fontExtraProperties:X,ownerDocument:D,pdfBug:f,styleElement:K,loadingParams:{disableAutoFetch:H,enableXfa:L}};return h.promise.then(function(){if(l.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const P=h.messageHandler.sendWithPromise("GetDocRequest",_,n?[n.buffer]:null);let A;if(c)A=new NI(c,{disableRange:C,disableStream:I});else if(!n){if(!d)throw new Error("getDocument - no `url` parameter provided.");let tl;if(Et)if(ZZ(d)){if(typeof fetch>"u"||typeof Response>"u"||!("body"in Response.prototype))throw new Error("getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`.");tl=SS}else tl=YI;else tl=ZZ(d)?SS:TI;A=new tl({url:d,length:g,httpHeaders:a,withCredentials:i,rangeChunkSize:F,disableRange:C,disableStream:I})}return P.then(tl=>{if(l.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const el=new IZ(t,tl,h.port),Bl=new _I(el,l,A,al,x);l._transport=Bl,el.send("Ready",null)})}).catch(l._capability.reject),l}function vI(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(Et&&typeof e=="string")return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function KI(e){if(Et&&typeof Buffer<"u"&&e instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e=="string")return Gh(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof e=="object"&&!isNaN(e==null?void 0:e.length))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function BS(e){return typeof e=="object"&&Number.isInteger(e==null?void 0:e.num)&&e.num>=0&&Number.isInteger(e==null?void 0:e.gen)&&e.gen>=0}var lN;const YS=class Qy{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${le(Qy,lN)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var l,t,d,n;this.destroyed=!0;try{(l=this._worker)!=null&&l.port&&(this._worker._pendingDestroy=!0),await((t=this._transport)==null?void 0:t.destroy())}catch(a){throw(d=this._worker)!=null&&d.port&&delete this._worker._pendingDestroy,a}this._transport=null,(n=this._worker)==null||n.destroy(),this._worker=null}};lN=new WeakMap,M(YS,lN,0);let fI=YS,kS=class{constructor(e,l,t=!1,d=null){this.length=e,this.initialData=l,this.progressiveDone=t,this.contentDispositionFilename=d,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,l){for(const t of this._rangeListeners)t(e,l)}onDataProgress(e,l){this._readyCapability.promise.then(()=>{for(const t of this._progressListeners)t(e,l)})}onDataProgressiveRead(e){this._readyCapability.promise.then(()=>{for(const l of this._progressiveReadListeners)l(e)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const e of this._progressiveDoneListeners)e()})}transportReady(){this._readyCapability.resolve()}requestDataRange(e,l){Cl("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class HI{constructor(l,t){this._pdfInfo=l,this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return rl(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(l){return this._transport.getPage(l)}getPageIndex(l){return this._transport.getPageIndex(l)}getDestinations(){return this._transport.getDestinations()}getDestination(l){return this._transport.getDestination(l)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:l="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(l);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(l=!1){return this._transport.startCleanup(l||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(l){return this._transport.cachedPageNumber(l)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Wi,ea,Xd,oc,wo;class PI{constructor(l,t,d,n=!1){M(this,Xd),M(this,Wi,null),M(this,ea,!1),this._pageIndex=l,this._pageInfo=t,this._transport=d,this._stats=n?new FM:null,this._pdfBug=n,this.commonObjs=d.commonObjs,this.objs=new zS,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:l,rotation:t=this.rotate,offsetX:d=0,offsetY:n=0,dontFlip:a=!1}={}){return new UZ({viewBox:this.view,userUnit:this.userUnit,scale:l,rotation:t,offsetX:d,offsetY:n,dontFlip:a})}getAnnotations({intent:l="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(l);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return rl(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var l;return((l=this._transport._htmlForXfa)==null?void 0:l.children[this._pageIndex])||null}render({canvasContext:l,viewport:t,intent:d="display",annotationMode:n=Cn.ENABLE,transform:a=null,background:i=null,optionalContentConfigPromise:s=null,annotationCanvasMap:c=null,pageColors:F=null,printAnnotationStorage:h=null,isEditing:o=!1}){var V,W;(V=this._stats)==null||V.time("Overall");const Q=this._transport.getRenderingIntent(d,n,h,o),{renderingIntent:m,cacheKey:R}=Q;N(this,ea,!1),p(this,Xd,wo).call(this),s||(s=this._transport.getOptionalContentConfig(m));let r=this._intentStates.get(R);r||(r=Object.create(null),this._intentStates.set(R,r)),r.streamReaderCancelTimeout&&(clearTimeout(r.streamReaderCancelTimeout),r.streamReaderCancelTimeout=null);const b=!!(m&be.PRINT);r.displayReadyCapability||(r.displayReadyCapability=Promise.withResolvers(),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(W=this._stats)==null||W.time("Page Request"),this._pumpOperatorList(Q));const u=T=>{var y;r.renderTasks.delete(J),(this._maybeCleanupAfterRender||b)&&N(this,ea,!0),p(this,Xd,oc).call(this,!b),T?(J.capability.reject(T),this._abortOperatorList({intentState:r,reason:T instanceof Error?T:new Error(T)})):J.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(y=globalThis.Stats)!=null&&y.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},J=new $I({callback:u,params:{canvasContext:l,viewport:t,transform:a,background:i},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:r.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!b,pdfBug:this._pdfBug,pageColors:F});(r.renderTasks||(r.renderTasks=new Set)).add(J);const G=J.task;return Promise.all([r.displayReadyCapability.promise,s]).then(([T,y])=>{var k;if(this.destroyed){u();return}if((k=this._stats)==null||k.time("Rendering"),!(y.renderingIntent&m))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");J.initializeGraphics({transparency:T,optionalContentConfig:y}),J.operatorListChanged()}).catch(u),G}getOperatorList({intent:l="display",annotationMode:t=Cn.ENABLE,printAnnotationStorage:d=null,isEditing:n=!1}={}){var a;function i(){c.operatorList.lastChunk&&(c.opListReadCapability.resolve(c.operatorList),c.renderTasks.delete(F))}const s=this._transport.getRenderingIntent(l,t,d,n,!0);let c=this._intentStates.get(s.cacheKey);c||(c=Object.create(null),this._intentStates.set(s.cacheKey,c));let F;return c.opListReadCapability||(F=Object.create(null),F.operatorListChanged=i,c.opListReadCapability=Promise.withResolvers(),(c.renderTasks||(c.renderTasks=new Set)).add(F),c.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(a=this._stats)==null||a.time("Page Request"),this._pumpOperatorList(s)),c.opListReadCapability.promise}streamTextContent({includeMarkedContent:l=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:l===!0,disableNormalization:t===!0},{highWaterMark:100,size(d){return d.items.length}})}getTextContent(l={}){if(this._transport._htmlForXfa)return this.getXfa().then(d=>AZ.textContent(d));const t=this.streamTextContent(l);return new Promise(function(d,n){function a(){i.read().then(function({value:c,done:F}){if(F){d(s);return}s.lang??(s.lang=c.lang),Object.assign(s.styles,c.styles),s.items.push(...c.items),a()},n)}const i=t.getReader(),s={items:[],styles:Object.create(null),lang:null};a()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const l=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const d of t.renderTasks)l.push(d.completed),d.cancel();return this.objs.clear(),N(this,ea,!1),p(this,Xd,wo).call(this),Promise.all(l)}cleanup(l=!1){N(this,ea,!0);const t=p(this,Xd,oc).call(this,!1);return l&&t&&this._stats&&(this._stats=new FM),t}_startRenderPage(l,t){var d,n;const a=this._intentStates.get(t);a&&((d=this._stats)==null||d.timeEnd("Page Request"),(n=a.displayReadyCapability)==null||n.resolve(l))}_renderPageChunk(l,t){for(let d=0,n=l.length;d<n;d++)t.operatorList.fnArray.push(l.fnArray[d]),t.operatorList.argsArray.push(l.argsArray[d]);t.operatorList.lastChunk=l.lastChunk,t.operatorList.separateAnnots=l.separateAnnots;for(const d of t.renderTasks)d.operatorListChanged();l.lastChunk&&p(this,Xd,oc).call(this,!0)}_pumpOperatorList({renderingIntent:l,cacheKey:t,annotationStorageSerializable:d,modifiedIds:n}){const{map:a,transfer:i}=d,s=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:l,cacheKey:t,annotationStorage:a,modifiedIds:n},i).getReader(),c=this._intentStates.get(t);c.streamReader=s;const F=()=>{s.read().then(({value:h,done:o})=>{if(o){c.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,c),F())},h=>{if(c.streamReader=null,!this._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;for(const o of c.renderTasks)o.operatorListChanged();p(this,Xd,oc).call(this,!0)}if(c.displayReadyCapability)c.displayReadyCapability.reject(h);else if(c.opListReadCapability)c.opListReadCapability.reject(h);else throw h}})};F()}_abortOperatorList({intentState:l,reason:t,force:d=!1}){if(l.streamReader){if(l.streamReaderCancelTimeout&&(clearTimeout(l.streamReaderCancelTimeout),l.streamReaderCancelTimeout=null),!d){if(l.renderTasks.size>0)return;if(t instanceof FR){let n=wI;t.extraDelay>0&&t.extraDelay<1e3&&(n+=t.extraDelay),l.streamReaderCancelTimeout=setTimeout(()=>{l.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:l,reason:t,force:!0})},n);return}}if(l.streamReader.cancel(new gn(t.message)).catch(()=>{}),l.streamReader=null,!this._transport.destroyed){for(const[n,a]of this._intentStates)if(a===l){this._intentStates.delete(n);break}this.cleanup()}}}get stats(){return this._stats}}Wi=new WeakMap,ea=new WeakMap,Xd=new WeakSet,oc=function(e=!1){if(p(this,Xd,wo).call(this),!U(this,ea)||this.destroyed)return!1;if(e)return N(this,Wi,setTimeout(()=>{N(this,Wi,null),p(this,Xd,oc).call(this,!1)},EI)),!1;for(const{renderTasks:l,operatorList:t}of this._intentStates.values())if(l.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),N(this,ea,!1),!0},wo=function(){U(this,Wi)&&(clearTimeout(U(this,Wi)),N(this,Wi,null))};var da,tN;class AI{constructor(){M(this,da,new Map),M(this,tN,Promise.resolve())}postMessage(l,t){const d={data:structuredClone(l,t?{transfer:t}:null)};U(this,tN).then(()=>{for(const[n]of U(this,da))n.call(this,d)})}addEventListener(l,t,d=null){let n=null;if((d==null?void 0:d.signal)instanceof AbortSignal){const{signal:a}=d;if(a.aborted){Rl("LoopbackPort - cannot use an `aborted` signal.");return}const i=()=>this.removeEventListener(l,t);n=()=>a.removeEventListener("abort",i),a.addEventListener("abort",i)}U(this,da).set(t,n)}removeEventListener(l,t){const d=U(this,da).get(t);d==null||d(),U(this,da).delete(t)}terminate(){for(const[,l]of U(this,da))l==null||l();U(this,da).clear()}}da=new WeakMap,tN=new WeakMap;var Pl,eN,Vc,Qi,_Z,Eo,qZ,Co;let xo=(Pl=class{constructor({name:e=null,port:l=null,verbosity:t=SL()}={}){M(this,_Z);var d;if(this.name=e,this.destroyed=!1,this.verbosity=t,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,l){if((d=U(Pl,Qi))!=null&&d.has(l))throw new Error("Cannot use more than one PDFWorker per port.");(U(Pl,Qi)||N(Pl,Qi,new WeakMap)).set(l,this),this._initializeFromPort(l);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new IZ("main","worker",e),this._messageHandler.on("ready",function(){}),p(this,_Z,Eo).call(this)}_initialize(){if(U(Pl,Vc)||U(Pl,qZ,Co)){this._setupFakeWorker();return}let{workerSrc:e}=Pl;try{Pl._isSameOrigin(window.location.href,e)||(e=Pl._createCDNWrapper(new URL(e,window.location).href));const l=new Worker(e,{type:"module"}),t=new IZ("main","worker",l),d=()=>{n.abort(),t.destroy(),l.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;l.addEventListener("error",()=>{this._webWorker||d()},{signal:n.signal}),t.on("test",i=>{if(n.abort(),this.destroyed||!i){d();return}this._messageHandler=t,this._port=l,this._webWorker=l,p(this,_Z,Eo).call(this)}),t.on("ready",i=>{if(n.abort(),this.destroyed){d();return}try{a()}catch{this._setupFakeWorker()}});const a=()=>{const i=new Uint8Array;t.send("test",i,[i.buffer])};a();return}catch{Jh("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){U(Pl,Vc)||(Rl("Setting up fake worker."),N(Pl,Vc,!0)),Pl._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const l=new AI;this._port=l;const t=`fake${le(Pl,eN)._++}`,d=new IZ(t+"_worker",t,l);e.setup(d,l),this._messageHandler=new IZ(t,t+"_worker",l),p(this,_Z,Eo).call(this)}).catch(e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){var e,l,t;this.destroyed=!0,(e=this._webWorker)==null||e.terminate(),this._webWorker=null,(l=U(Pl,Qi))==null||l.delete(this._port),this._port=null,(t=this._messageHandler)==null||t.destroy(),this._messageHandler=null}static fromPort(e){var l;if(!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const t=(l=U(this,Qi))==null?void 0:l.get(e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new Pl(e)}static get workerSrc(){if(ac.workerSrc)return ac.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return rl(this,"_setupFakeWorkerGlobal",(async()=>U(this,qZ,Co)?U(this,qZ,Co):(await import(this.workerSrc)).WorkerMessageHandler)())}},eN=new WeakMap,Vc=new WeakMap,Qi=new WeakMap,_Z=new WeakSet,Eo=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},qZ=new WeakSet,Co=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},M(Pl,qZ),M(Pl,eN,0),M(Pl,Vc,!1),M(Pl,Qi),Et&&(N(Pl,Vc,!0),ac.workerSrc||(ac.workerSrc="./pdf.worker.mjs")),Pl._isSameOrigin=(e,l)=>{let t;try{if(t=new URL(e),!t.origin||t.origin==="null")return!1}catch{return!1}const d=new URL(l,t);return t.origin===d.origin},Pl._createCDNWrapper=e=>{const l=`await import("${e}");`;return URL.createObjectURL(new Blob([l],{type:"text/javascript"}))},Pl);var na,Un,$Z,lF,aa,Wc,tF;class _I{constructor(l,t,d,n,a){M(this,Wc),M(this,na,new Map),M(this,Un,new Map),M(this,$Z,new Map),M(this,lF,new Map),M(this,aa,null),this.messageHandler=l,this.loadingTask=t,this.commonObjs=new zS,this.fontLoader=new fL({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=a.canvasFactory,this.filterFactory=a.filterFactory,this.cMapReaderFactory=a.cMapReaderFactory,this.standardFontDataFactory=a.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=d,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return rl(this,"annotationStorage",new ER)}getRenderingIntent(l,t=Cn.ENABLE,d=null,n=!1,a=!1){let i=be.DISPLAY,s=DR;switch(l){case"any":i=be.ANY;break;case"display":break;case"print":i=be.PRINT;break;default:Rl(`getRenderingIntent - invalid intent: ${l}`)}const c=i&be.PRINT&&d instanceof PM?d:this.annotationStorage;switch(t){case Cn.DISABLE:i+=be.ANNOTATIONS_DISABLE;break;case Cn.ENABLE:break;case Cn.ENABLE_FORMS:i+=be.ANNOTATIONS_FORMS;break;case Cn.ENABLE_STORAGE:i+=be.ANNOTATIONS_STORAGE,s=c.serializable;break;default:Rl(`getRenderingIntent - invalid annotationMode: ${t}`)}n&&(i+=be.IS_EDITING),a&&(i+=be.OPLIST);const{ids:F,hash:h}=c.modifiedIds,o=[i,s.hash,h];return{renderingIntent:i,cacheKey:o.join("_"),annotationStorageSerializable:s,modifiedIds:F}}destroy(){var l;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(l=U(this,aa))==null||l.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const n of U(this,Un).values())t.push(n._destroy());U(this,Un).clear(),U(this,$Z).clear(),U(this,lF).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const d=this.messageHandler.sendWithPromise("Terminate",null);return t.push(d),Promise.all(t).then(()=>{var n,a;this.commonObjs.clear(),this.fontLoader.clear(),U(this,na).clear(),this.filterFactory.destroy(),$R.cleanup(),(n=this._networkStream)==null||n.cancelAllRequests(new gn("Worker was terminated.")),(a=this.messageHandler)==null||a.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:l,loadingTask:t}=this;l.on("GetReader",(d,n)=>{st(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=a=>{this._lastProgress={loaded:a.loaded,total:a.total}},n.onPull=()=>{this._fullReader.read().then(function({value:a,done:i}){if(i){n.close();return}st(a instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{n.error(a)})},n.onCancel=a=>{this._fullReader.cancel(a),n.ready.catch(i=>{if(!this.destroyed)throw i})}}),l.on("ReaderHeadersReady",async d=>{var n;await this._fullReader.headersReady;const{isStreamingSupported:a,isRangeSupported:i,contentLength:s}=this._fullReader;return(!a||!i)&&(this._lastProgress&&((n=t.onProgress)==null||n.call(t,this._lastProgress)),this._fullReader.onProgress=c=>{var F;(F=t.onProgress)==null||F.call(t,{loaded:c.loaded,total:c.total})}),{isStreamingSupported:a,isRangeSupported:i,contentLength:s}}),l.on("GetRangeReader",(d,n)=>{st(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const a=this._networkStream.getRangeReader(d.begin,d.end);if(!a){n.close();return}n.onPull=()=>{a.read().then(function({value:i,done:s}){if(s){n.close();return}st(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(i),1,[i])}).catch(i=>{n.error(i)})},n.onCancel=i=>{a.cancel(i),n.ready.catch(s=>{if(!this.destroyed)throw s})}}),l.on("GetDoc",({pdfInfo:d})=>{this._numPages=d.numPages,this._htmlForXfa=d.htmlForXfa,delete d.htmlForXfa,t._capability.resolve(new HI(d,this))}),l.on("DocException",d=>{t._capability.reject(Ze(d))}),l.on("PasswordRequest",d=>{N(this,aa,Promise.withResolvers());try{if(!t.onPassword)throw Ze(d);const n=a=>{a instanceof Error?U(this,aa).reject(a):U(this,aa).resolve({password:a})};t.onPassword(n,d.code)}catch(n){U(this,aa).reject(n)}return U(this,aa).promise}),l.on("DataLoaded",d=>{var n;(n=t.onProgress)==null||n.call(t,{loaded:d.length,total:d.length}),this.downloadInfoCapability.resolve(d)}),l.on("StartRenderPage",d=>{this.destroyed||U(this,Un).get(d.pageIndex)._startRenderPage(d.transparency,d.cacheKey)}),l.on("commonobj",([d,n,a])=>{var i;if(this.destroyed||this.commonObjs.has(d))return null;switch(n){case"Font":const{disableFontFace:s,fontExtraProperties:c,pdfBug:F}=this._params;if("error"in a){const W=a.error;Rl(`Error during font loading: ${W}`),this.commonObjs.resolve(d,W);break}const h=F&&(i=globalThis.FontInspector)!=null&&i.enabled?(W,Q)=>globalThis.FontInspector.fontAdded(W,Q):null,o=new HL(a,{disableFontFace:s,fontExtraProperties:c,inspectFont:h});this.fontLoader.bind(o).catch(()=>l.sendWithPromise("FontFallback",{id:d})).finally(()=>{!c&&o.data&&(o.data=null),this.commonObjs.resolve(d,o)});break;case"CopyLocalImage":const{imageRef:V}=a;st(V,"The imageRef must be defined.");for(const W of U(this,Un).values())for(const[,Q]of W.objs)if((Q==null?void 0:Q.ref)===V)return Q.dataLen?(this.commonObjs.resolve(d,structuredClone(Q)),Q.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(d,a);break;default:throw new Error(`Got unknown common object type ${n}`)}return null}),l.on("obj",([d,n,a,i])=>{var s;if(this.destroyed)return;const c=U(this,Un).get(n);if(!c.objs.has(d)){if(c._intentStates.size===0){(s=i==null?void 0:i.bitmap)==null||s.close();return}switch(a){case"Image":c.objs.resolve(d,i),(i==null?void 0:i.dataLen)>bL&&(c._maybeCleanupAfterRender=!0);break;case"Pattern":c.objs.resolve(d,i);break;default:throw new Error(`Got unknown object type ${a}`)}}}),l.on("DocProgress",d=>{var n;this.destroyed||(n=t.onProgress)==null||n.call(t,{loaded:d.loaded,total:d.total})}),l.on("FetchBuiltInCMap",async d=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(d)}),l.on("FetchStandardFontData",async d=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(d)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var l;this.annotationStorage.size<=0&&Rl("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:d}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:((l=this._fullReader)==null?void 0:l.filename)??null},d).finally(()=>{this.annotationStorage.resetModified()})}getPage(l){if(!Number.isInteger(l)||l<=0||l>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=l-1,d=U(this,$Z).get(t);if(d)return d;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then(a=>{if(this.destroyed)throw new Error("Transport destroyed");a.refStr&&U(this,lF).set(a.refStr,l);const i=new PI(t,a,this,this._params.pdfBug);return U(this,Un).set(t,i),i});return U(this,$Z).set(t,n),n}getPageIndex(l){return BS(l)?this.messageHandler.sendWithPromise("GetPageIndex",{num:l.num,gen:l.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(l,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:l,intent:t})}getFieldObjects(){return p(this,Wc,tF).call(this,"GetFieldObjects")}hasJSActions(){return p(this,Wc,tF).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(l){return typeof l!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:l})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return p(this,Wc,tF).call(this,"GetDocJSActions")}getPageJSActions(l){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:l})}getStructTree(l){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:l})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(l){return p(this,Wc,tF).call(this,"GetOptionalContentConfig").then(t=>new RI(t,l))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const l="GetMetadata",t=U(this,na).get(l);if(t)return t;const d=this.messageHandler.sendWithPromise(l,null).then(n=>{var a,i;return{info:n[0],metadata:n[1]?new QI(n[1]):null,contentDispositionFilename:((a=this._fullReader)==null?void 0:a.filename)??null,contentLength:((i=this._fullReader)==null?void 0:i.contentLength)??null}});return U(this,na).set(l,d),d}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(l=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of U(this,Un).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),l||this.fontLoader.clear(),U(this,na).clear(),this.filterFactory.destroy(!0),$R.cleanup()}}cachedPageNumber(l){if(!BS(l))return null;const t=l.gen===0?`${l.num}R`:`${l.num}R${l.gen}`;return U(this,lF).get(t)??null}}na=new WeakMap,Un=new WeakMap,$Z=new WeakMap,lF=new WeakMap,aa=new WeakMap,Wc=new WeakSet,tF=function(e,l=null){const t=U(this,na).get(e);if(t)return t;const d=this.messageHandler.sendWithPromise(e,l);return U(this,na).set(e,d),d};const eF=Symbol("INITIAL_DATA");var De,go,dN;class zS{constructor(){M(this,go),M(this,De,Object.create(null))}get(l,t=null){if(t){const n=p(this,go,dN).call(this,l);return n.promise.then(()=>t(n.data)),null}const d=U(this,De)[l];if(!d||d.data===eF)throw new Error(`Requesting object that isn't resolved yet ${l}.`);return d.data}has(l){const t=U(this,De)[l];return!!t&&t.data!==eF}delete(l){const t=U(this,De)[l];return!t||t.data===eF?!1:(delete U(this,De)[l],!0)}resolve(l,t=null){const d=p(this,go,dN).call(this,l);d.data=t,d.resolve()}clear(){var l;for(const t in U(this,De)){const{data:d}=U(this,De)[t];(l=d==null?void 0:d.bitmap)==null||l.close()}N(this,De,Object.create(null))}*[Symbol.iterator](){for(const l in U(this,De)){const{data:t}=U(this,De)[l];t!==eF&&(yield[l,t])}}}De=new WeakMap,go=new WeakSet,dN=function(e){var l;return(l=U(this,De))[e]||(l[e]={...Promise.withResolvers(),data:eF})};var mi;class qI{constructor(l){M(this,mi,null),N(this,mi,l),this.onContinue=null}get promise(){return U(this,mi).capability.promise}cancel(l=0){U(this,mi).cancel(null,l)}get separateAnnots(){const{separateAnnots:l}=U(this,mi).operatorList;if(!l)return!1;const{annotationCanvasMap:t}=U(this,mi);return l.form||l.canvas&&(t==null?void 0:t.size)>0}}mi=new WeakMap;var Ri,Qc;const LS=class K0{constructor({callback:l,params:t,objs:d,commonObjs:n,annotationCanvasMap:a,operatorList:i,pageIndex:s,canvasFactory:c,filterFactory:F,useRequestAnimationFrame:h=!1,pdfBug:o=!1,pageColors:V=null}){M(this,Ri,null),this.callback=l,this.params=t,this.objs=d,this.commonObjs=n,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=i,this._pageIndex=s,this.canvasFactory=c,this.filterFactory=F,this._pdfBug=o,this.pageColors=V,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new qI(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:l=!1,optionalContentConfig:t}){var d,n;if(this.cancelled)return;if(this._canvas){if(U(K0,Qc).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");U(K0,Qc).add(this._canvas)}this._pdfBug&&(d=globalThis.StepperManager)!=null&&d.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:a,viewport:i,transform:s,background:c}=this.params;this.gfx=new Ro(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:i,transparency:l,background:c}),this.operatorListIdx=0,this.graphicsReady=!0,(n=this.graphicsReadyCallback)==null||n.call(this)}cancel(l=null,t=0){var d;this.running=!1,this.cancelled=!0,(d=this.gfx)==null||d.endDrawing(),U(this,Ri)&&(window.cancelAnimationFrame(U(this,Ri)),N(this,Ri,null)),U(K0,Qc).delete(this._canvas),this.callback(l||new FR(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){var l;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(l=this.stepper)==null||l.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?N(this,Ri,window.requestAnimationFrame(()=>{N(this,Ri,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),U(K0,Qc).delete(this._canvas),this.callback())))}};Ri=new WeakMap,Qc=new WeakMap,M(LS,Qc,new WeakSet);let $I=LS;const lD="4.10.38",tD="f9bea397f";Tl(670);function IS(e){return Math.floor(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,"0")}function dF(e){return Math.max(0,Math.min(255,255*e))}class DS{static CMYK_G([l,t,d,n]){return["G",1-Math.min(1,.3*l+.59*d+.11*t+n)]}static G_CMYK([l]){return["CMYK",0,0,0,1-l]}static G_RGB([l]){return["RGB",l,l,l]}static G_rgb([l]){return l=dF(l),[l,l,l]}static G_HTML([l]){const t=IS(l);return`#${t}${t}${t}`}static RGB_G([l,t,d]){return["G",.3*l+.59*t+.11*d]}static RGB_rgb(l){return l.map(dF)}static RGB_HTML(l){return`#${l.map(IS).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([l,t,d,n]){return["RGB",1-Math.min(1,l+n),1-Math.min(1,d+n),1-Math.min(1,t+n)]}static CMYK_rgb([l,t,d,n]){return[dF(1-Math.min(1,l+n)),dF(1-Math.min(1,d+n)),dF(1-Math.min(1,t+n))]}static CMYK_HTML(l){const t=this.CMYK_RGB(l).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([l,t,d]){const n=1-l,a=1-t,i=1-d,s=Math.min(n,a,i);return["CMYK",n,a,i,s]}}class eD{create(l,t,d=!1){if(l<=0||t<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),d||(n.setAttribute("width",`${l}px`),n.setAttribute("height",`${t}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${l} ${t}`),n}createElement(l){if(typeof l!="string")throw new Error("Invalid SVG element type");return this._createSVG(l)}_createSVG(l){Cl("Abstract method `_createSVG` called.")}}let nN=class extends eD{_createSVG(e){return document.createElementNS(Ad,e)}},wS=class{static setupStorage(e,l,t,d,n){const a=d.getValue(l,{value:null});switch(t.name){case"textarea":if(a.value!==null&&(e.textContent=a.value),n==="print")break;e.addEventListener("input",i=>{d.setValue(l,{value:i.target.value})});break;case"input":if(t.attributes.type==="radio"||t.attributes.type==="checkbox"){if(a.value===t.attributes.xfaOn?e.setAttribute("checked",!0):a.value===t.attributes.xfaOff&&e.removeAttribute("checked"),n==="print")break;e.addEventListener("change",i=>{d.setValue(l,{value:i.target.checked?i.target.getAttribute("xfaOn"):i.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&e.setAttribute("value",a.value),n==="print")break;e.addEventListener("input",i=>{d.setValue(l,{value:i.target.value})})}break;case"select":if(a.value!==null){e.setAttribute("value",a.value);for(const i of t.children)i.attributes.value===a.value?i.attributes.selected=!0:i.attributes.hasOwnProperty("selected")&&delete i.attributes.selected}e.addEventListener("input",i=>{const s=i.target.options,c=s.selectedIndex===-1?"":s[s.selectedIndex].value;d.setValue(l,{value:c})});break}}static setAttributes({html:e,element:l,storage:t=null,intent:d,linkService:n}){const{attributes:a}=l,i=e instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${d}`);for(const[s,c]of Object.entries(a))if(c!=null)switch(s){case"class":c.length&&e.setAttribute(s,c.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",c);break;case"style":Object.assign(e.style,c);break;case"textContent":e.textContent=c;break;default:(!i||s!=="href"&&s!=="newWindow")&&e.setAttribute(s,c)}i&&n.addLinkAttributes(e,a.href,a.newWindow),t&&a.dataId&&this.setupStorage(e,a.dataId,l,t)}static render(e){var l,t;const d=e.annotationStorage,n=e.linkService,a=e.xfaHtml,i=e.intent||"display",s=document.createElement(a.name);a.attributes&&this.setAttributes({html:s,element:a,intent:i,linkService:n});const c=i!=="richText",F=e.div;if(F.append(s),e.viewport){const V=`matrix(${e.viewport.transform.join(",")})`;F.style.transform=V}c&&F.setAttribute("class","xfaLayer xfaFont");const h=[];if(a.children.length===0){if(a.value){const V=document.createTextNode(a.value);s.append(V),c&&AZ.shouldBuildText(a.name)&&h.push(V)}return{textDivs:h}}const o=[[a,-1,s]];for(;o.length>0;){const[V,W,Q]=o.at(-1);if(W+1===V.children.length){o.pop();continue}const m=V.children[++o.at(-1)[1]];if(m===null)continue;const{name:R}=m;if(R==="#text"){const b=document.createTextNode(m.value);h.push(b),Q.append(b);continue}const r=(l=m==null?void 0:m.attributes)!=null&&l.xmlns?document.createElementNS(m.attributes.xmlns,R):document.createElement(R);if(Q.append(r),m.attributes&&this.setAttributes({html:r,element:m,storage:d,intent:i,linkService:n}),((t=m.children)==null?void 0:t.length)>0)o.push([m,-1,r]);else if(m.value){const b=document.createTextNode(m.value);c&&AZ.shouldBuildText(R)&&h.push(b),r.append(b)}}for(const V of F.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))V.setAttribute("readOnly",!0);return{textDivs:h}}static update(e){const l=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=l,e.div.hidden=!1}};const nF=1e3,dD=9,Ni=new WeakSet;function ia(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class nD{static create(l){switch(l.data.annotationType){case ht.LINK:return new xS(l);case ht.TEXT:return new iD(l);case ht.WIDGET:switch(l.data.fieldType){case"Tx":return new sD(l);case"Btn":return l.data.radioButton?new gS(l):l.data.checkBox?new UD(l):new ZD(l);case"Ch":return new FD(l);case"Sig":return new cD(l)}return new ri(l);case ht.POPUP:return new iN(l);case ht.FREETEXT:return new fS(l);case ht.LINE:return new oD(l);case ht.SQUARE:return new VD(l);case ht.CIRCLE:return new WD(l);case ht.POLYLINE:return new HS(l);case ht.CARET:return new mD(l);case ht.INK:return new hN(l);case ht.POLYGON:return new QD(l);case ht.HIGHLIGHT:return new PS(l);case ht.UNDERLINE:return new RD(l);case ht.SQUIGGLY:return new ND(l);case ht.STRIKEOUT:return new bD(l);case ht.STAMP:return new AS(l);case ht.FILEATTACHMENT:return new uD(l);default:return new Wt(l)}}}var bi,aF,iF,jo,aN;const aD=class my{constructor(l,{isRenderable:t=!1,ignoreBorder:d=!1,createQuadrilaterals:n=!1}={}){M(this,jo),M(this,bi,null),M(this,aF,!1),M(this,iF,null),this.isRenderable=t,this.data=l.data,this.layer=l.layer,this.linkService=l.linkService,this.downloadManager=l.downloadManager,this.imageResourcesPath=l.imageResourcesPath,this.renderForms=l.renderForms,this.svgFactory=l.svgFactory,this.annotationStorage=l.annotationStorage,this.enableScripting=l.enableScripting,this.hasJSActions=l.hasJSActions,this._fieldObjects=l.fieldObjects,this.parent=l.parent,t&&(this.container=this._createContainer(d)),n&&this._createQuadrilaterals()}static _hasPopupData({titleObj:l,contentsObj:t,richText:d}){return!!(l!=null&&l.str||t!=null&&t.str||d!=null&&d.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return my._hasPopupData(this.data)}updateEdited(l){var t;if(!this.container)return;U(this,bi)||N(this,bi,{rect:this.data.rect.slice(0)});const{rect:d}=l;d&&p(this,jo,aN).call(this,d),(t=U(this,iF))==null||t.popup.updateEdited(l)}resetEdited(){var l;U(this,bi)&&(p(this,jo,aN).call(this,U(this,bi).rect),(l=U(this,iF))==null||l.popup.resetEdited(),N(this,bi,null))}_createContainer(l){const{data:t,parent:{page:d,viewport:n}}=this,a=document.createElement("section");a.setAttribute("data-annotation-id",t.id),this instanceof ri||(a.tabIndex=nF);const{style:i}=a;if(i.zIndex=this.parent.zIndex++,t.alternativeText&&(a.title=t.alternativeText),t.noRotate&&a.classList.add("norotate"),!t.rect||this instanceof iN){const{rotation:m}=t;return!t.hasOwnCanvas&&m!==0&&this.setRotation(m,a),a}const{width:s,height:c}=ia(t.rect);if(!l&&t.borderStyle.width>0){i.borderWidth=`${t.borderStyle.width}px`;const m=t.borderStyle.horizontalCornerRadius,R=t.borderStyle.verticalCornerRadius;if(m>0||R>0){const b=`calc(${m}px * var(--scale-factor)) / calc(${R}px * var(--scale-factor))`;i.borderRadius=b}else if(this instanceof gS){const b=`calc(${s}px * var(--scale-factor)) / calc(${c}px * var(--scale-factor))`;i.borderRadius=b}switch(t.borderStyle.style){case sZ.SOLID:i.borderStyle="solid";break;case sZ.DASHED:i.borderStyle="dashed";break;case sZ.BEVELED:Rl("Unimplemented border style: beveled");break;case sZ.INSET:Rl("Unimplemented border style: inset");break;case sZ.UNDERLINE:i.borderBottomStyle="solid";break}const r=t.borderColor||null;r?(N(this,aF,!0),i.borderColor=sl.makeHexColor(r[0]|0,r[1]|0,r[2]|0)):i.borderWidth=0}const F=sl.normalizeRect([t.rect[0],d.view[3]-t.rect[1]+d.view[1],t.rect[2],d.view[3]-t.rect[3]+d.view[1]]),{pageWidth:h,pageHeight:o,pageX:V,pageY:W}=n.rawDims;i.left=`${100*(F[0]-V)/h}%`,i.top=`${100*(F[1]-W)/o}%`;const{rotation:Q}=t;return t.hasOwnCanvas||Q===0?(i.width=`${100*s/h}%`,i.height=`${100*c/o}%`):this.setRotation(Q,a),a}setRotation(l,t=this.container){if(!this.data.rect)return;const{pageWidth:d,pageHeight:n}=this.parent.viewport.rawDims,{width:a,height:i}=ia(this.data.rect);let s,c;l%180===0?(s=100*a/d,c=100*i/n):(s=100*i/d,c=100*a/n),t.style.width=`${s}%`,t.style.height=`${c}%`,t.setAttribute("data-main-rotation",(360-l)%360)}get _commonActions(){const l=(t,d,n)=>{const a=n.detail[t],i=a[0],s=a.slice(1);n.target.style[d]=DS[`${i}_HTML`](s),this.annotationStorage.setValue(this.data.id,{[d]:DS[`${i}_rgb`](s)})};return rl(this,"_commonActions",{display:t=>{const{display:d}=t.detail,n=d%2===1;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:d===1||d===2})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:d}=t.detail;this.container.style.visibility=d?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:d,noView:d})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:t=>{l("bgColor","backgroundColor",t)},fillColor:t=>{l("fillColor","backgroundColor",t)},fgColor:t=>{l("fgColor","color",t)},textColor:t=>{l("textColor","color",t)},borderColor:t=>{l("borderColor","borderColor",t)},strokeColor:t=>{l("strokeColor","borderColor",t)},rotation:t=>{const d=t.detail.rotation;this.setRotation(d),this.annotationStorage.setValue(this.data.id,{rotation:d})}})}_dispatchEventFromSandbox(l,t){const d=this._commonActions;for(const n of Object.keys(t.detail)){const a=l[n]||d[n];a==null||a(t)}}_setDefaultPropertiesFromJS(l){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const d=this._commonActions;for(const[n,a]of Object.entries(t)){const i=d[n];if(i){const s={detail:{[n]:a},target:l};i(s),delete t[n]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:l}=this.data;if(!l)return;const[t,d,n,a]=this.data.rect.map(m=>Math.fround(m));if(l.length===8){const[m,R,r,b]=l.subarray(2,6);if(n===m&&a===R&&t===r&&d===b)return}const{style:i}=this.container;let s;if(U(this,aF)){const{borderColor:m,borderWidth:R}=i;i.borderWidth=0,s=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${m}" stroke-width="${R}">`],this.container.classList.add("hasBorder")}const c=n-t,F=a-d,{svgFactory:h}=this,o=h.createElement("svg");o.classList.add("quadrilateralsContainer"),o.setAttribute("width",0),o.setAttribute("height",0);const V=h.createElement("defs");o.append(V);const W=h.createElement("clipPath"),Q=`clippath_${this.data.id}`;W.setAttribute("id",Q),W.setAttribute("clipPathUnits","objectBoundingBox"),V.append(W);for(let m=2,R=l.length;m<R;m+=8){const r=l[m],b=l[m+1],u=l[m+2],J=l[m+3],G=h.createElement("rect"),T=(u-t)/c,y=(a-b)/F,k=(r-u)/c,X=(b-J)/F;G.setAttribute("x",T),G.setAttribute("y",y),G.setAttribute("width",k),G.setAttribute("height",X),W.append(G),s==null||s.push(`<rect vector-effect="non-scaling-stroke" x="${T}" y="${y}" width="${k}" height="${X}"/>`)}U(this,aF)&&(s.push("</g></svg>')"),i.backgroundImage=s.join("")),this.container.append(o),this.container.style.clipPath=`url(#${Q})`}_createPopup(){const{data:l}=this,t=N(this,iF,new iN({data:{color:l.color,titleObj:l.titleObj,modificationDate:l.modificationDate,contentsObj:l.contentsObj,richText:l.richText,parentRect:l.rect,borderStyle:0,id:`popup_${l.id}`,rotation:l.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(t.render())}render(){Cl("Abstract method `AnnotationElement.render` called")}_getElementsByName(l,t=null){const d=[];if(this._fieldObjects){const n=this._fieldObjects[l];if(n)for(const{page:a,id:i,exportValues:s}of n){if(a===-1||i===t)continue;const c=typeof s=="string"?s:null,F=document.querySelector(`[data-element-id="${i}"]`);if(F&&!Ni.has(F)){Rl(`_getElementsByName - element not allowed: ${i}`);continue}d.push({id:i,exportValue:c,domElement:F})}return d}for(const n of document.getElementsByName(l)){const{exportValue:a}=n,i=n.getAttribute("data-element-id");i!==t&&Ni.has(n)&&d.push({id:i,exportValue:a,domElement:n})}return d}show(){var l;this.container&&(this.container.hidden=!1),(l=this.popup)==null||l.maybeShow()}hide(){var l;this.container&&(this.container.hidden=!0),(l=this.popup)==null||l.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const l=this.getElementsToTriggerPopup();if(Array.isArray(l))for(const t of l)t.classList.add("highlightArea");else l.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:l,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{var d;(d=this.linkService.eventBus)==null||d.dispatch("switchannotationeditormode",{source:this,mode:l,editId:t})})}};bi=new WeakMap,aF=new WeakMap,iF=new WeakMap,jo=new WeakSet,aN=function(e){const{container:{style:l},data:{rect:t,rotation:d},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:i,pageY:s}}}}=this;t==null||t.splice(0,4,...e);const{width:c,height:F}=ia(e);l.left=`${100*(e[0]-i)/n}%`,l.top=`${100*(a-e[3]+s)/a}%`,d===0?(l.width=`${100*c/n}%`,l.height=`${100*F/a}%`):this.setRotation(d)};let Wt=aD;var yd,ui,ES,CS;class xS extends Wt{constructor(l,t=null){super(l,{isRenderable:!0,ignoreBorder:!!(t!=null&&t.ignoreBorder),createQuadrilaterals:!0}),M(this,yd),this.isTooltipOnly=l.data.isTooltipOnly}render(){const{data:l,linkService:t}=this,d=document.createElement("a");d.setAttribute("data-element-id",l.id);let n=!1;return l.url?(t.addLinkAttributes(d,l.url,l.newWindow),n=!0):l.action?(this._bindNamedAction(d,l.action),n=!0):l.attachment?(p(this,yd,ES).call(this,d,l.attachment,l.attachmentDest),n=!0):l.setOCGState?(p(this,yd,CS).call(this,d,l.setOCGState),n=!0):l.dest?(this._bindLink(d,l.dest),n=!0):(l.actions&&(l.actions.Action||l.actions["Mouse Up"]||l.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(d,l),n=!0),l.resetForm?(this._bindResetFormAction(d,l.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(d,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(d),this.container}_bindLink(l,t){l.href=this.linkService.getDestinationHash(t),l.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||t==="")&&p(this,yd,ui).call(this)}_bindNamedAction(l,t){l.href=this.linkService.getAnchorUrl(""),l.onclick=()=>(this.linkService.executeNamedAction(t),!1),p(this,yd,ui).call(this)}_bindJSAction(l,t){l.href=this.linkService.getAnchorUrl("");const d=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(t.actions)){const a=d.get(n);a&&(l[a]=()=>{var i;return(i=this.linkService.eventBus)==null||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:n}}),!1})}l.onclick||(l.onclick=()=>!1),p(this,yd,ui).call(this)}_bindResetFormAction(l,t){const d=l.onclick;if(d||(l.href=this.linkService.getAnchorUrl("")),p(this,yd,ui).call(this),!this._fieldObjects){Rl('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),d||(l.onclick=()=>!1);return}l.onclick=()=>{var n;d==null||d();const{fields:a,refs:i,include:s}=t,c=[];if(a.length!==0||i.length!==0){const o=new Set(i);for(const V of a){const W=this._fieldObjects[V]||[];for(const{id:Q}of W)o.add(Q)}for(const V of Object.values(this._fieldObjects))for(const W of V)o.has(W.id)===s&&c.push(W)}else for(const o of Object.values(this._fieldObjects))c.push(...o);const F=this.annotationStorage,h=[];for(const o of c){const{id:V}=o;switch(h.push(V),o.type){case"text":{const Q=o.defaultValue||"";F.setValue(V,{value:Q});break}case"checkbox":case"radiobutton":{const Q=o.defaultValue===o.exportValues;F.setValue(V,{value:Q});break}case"combobox":case"listbox":{const Q=o.defaultValue||"";F.setValue(V,{value:Q});break}default:continue}const W=document.querySelector(`[data-element-id="${V}"]`);if(W){if(!Ni.has(W)){Rl(`_bindResetFormAction - element not allowed: ${V}`);continue}}else continue;W.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((n=this.linkService.eventBus)==null||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}})),!1}}}yd=new WeakSet,ui=function(){this.container.setAttribute("data-internal-link","")},ES=function(e,l,t=null){e.href=this.linkService.getAnchorUrl(""),l.description&&(e.title=l.description),e.onclick=()=>{var d;return(d=this.downloadManager)==null||d.openOrDownloadData(l.content,l.filename,t),!1},p(this,yd,ui).call(this)},CS=function(e,l){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(l),!1),p(this,yd,ui).call(this)};class iD extends Wt{constructor(l){super(l,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const l=document.createElement("img");return l.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",l.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),l.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(l),this.container}}class ri extends Wt{render(){return this.container}showElementAndHideCanvas(l){var t;this.data.hasOwnCanvas&&(((t=l.previousSibling)==null?void 0:t.nodeName)==="CANVAS"&&(l.previousSibling.hidden=!0),l.hidden=!1)}_getKeyModifier(l){return te.platform.isMac?l.metaKey:l.ctrlKey}_setEventListener(l,t,d,n,a){d.includes("mouse")?l.addEventListener(d,i=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:a(i),shift:i.shiftKey,modifier:this._getKeyModifier(i)}})}):l.addEventListener(d,i=>{var s;if(d==="blur"){if(!t.focused||!i.relatedTarget)return;t.focused=!1}else if(d==="focus"){if(t.focused)return;t.focused=!0}a&&((s=this.linkService.eventBus)==null||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:a(i)}}))})}_setEventListeners(l,t,d,n){var a,i,s;for(const[c,F]of d)(F==="Action"||(a=this.data.actions)!=null&&a[F])&&((F==="Focus"||F==="Blur")&&(t||(t={focused:!1})),this._setEventListener(l,t,c,F,n),F==="Focus"&&!((i=this.data.actions)!=null&&i.Blur)?this._setEventListener(l,t,"blur","Blur",null):F==="Blur"&&!((s=this.data.actions)!=null&&s.Focus)&&this._setEventListener(l,t,"focus","Focus",null))}_setBackgroundColor(l){const t=this.data.backgroundColor||null;l.style.backgroundColor=t===null?"transparent":sl.makeHexColor(t[0],t[1],t[2])}_setTextStyle(l){const t=["left","center","right"],{fontColor:d}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||dD,a=l.style;let i;const s=2,c=F=>Math.round(10*F)/10;if(this.data.multiLine){const F=Math.abs(this.data.rect[3]-this.data.rect[1]-s),h=Math.round(F/(eR*n))||1,o=F/h;i=Math.min(n,c(o/eR))}else{const F=Math.abs(this.data.rect[3]-this.data.rect[1]-s);i=Math.min(n,c(F/eR))}a.fontSize=`calc(${i}px * var(--scale-factor))`,a.color=sl.makeHexColor(d[0],d[1],d[2]),this.data.textAlignment!==null&&(a.textAlign=t[this.data.textAlignment])}_setRequired(l,t){t?l.setAttribute("required",!0):l.removeAttribute("required"),l.setAttribute("aria-required",t)}}class sD extends ri{constructor(l){const t=l.renderForms||l.data.hasOwnCanvas||!l.data.hasAppearance&&!!l.data.fieldValue;super(l,{isRenderable:t})}setPropertyOnSiblings(l,t,d,n){const a=this.annotationStorage;for(const i of this._getElementsByName(l.name,l.id))i.domElement&&(i.domElement[t]=d),a.setValue(i.id,{[n]:d})}render(){var l,t;const d=this.annotationStorage,n=this.data.id;this.container.classList.add("textWidgetAnnotation");let a=null;if(this.renderForms){const i=d.getValue(n,{value:this.data.fieldValue});let s=i.value||"";const c=d.getValue(n,{charLimit:this.data.maxLen}).charLimit;c&&s.length>c&&(s=s.slice(0,c));let F=i.formattedValue||((l=this.data.textContent)==null?void 0:l.join(`
38
38
  `))||null;F&&this.data.comb&&(F=F.replaceAll(/\s+/g,""));const h={userValue:s,formattedValue:F,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(a=document.createElement("textarea"),a.textContent=F??s,this.data.doNotScroll&&(a.style.overflowY="hidden")):(a=document.createElement("input"),a.type="text",a.setAttribute("value",F??s),this.data.doNotScroll&&(a.style.overflowX="hidden")),this.data.hasOwnCanvas&&(a.hidden=!0),Ni.add(a),a.setAttribute("data-element-id",n),a.disabled=this.data.readOnly,a.name=this.data.fieldName,a.tabIndex=nF,this._setRequired(a,this.data.required),c&&(a.maxLength=c),a.addEventListener("input",V=>{d.setValue(n,{value:V.target.value}),this.setPropertyOnSiblings(a,"value",V.target.value,"value"),h.formattedValue=null}),a.addEventListener("resetform",V=>{const W=this.data.defaultFieldValue??"";a.value=h.userValue=W,h.formattedValue=null});let o=V=>{const{formattedValue:W}=h;W!=null&&(V.target.value=W),V.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){a.addEventListener("focus",W=>{var Q;if(h.focused)return;const{target:m}=W;h.userValue&&(m.value=h.userValue),h.lastCommittedValue=m.value,h.commitKey=1,(Q=this.data.actions)!=null&&Q.Focus||(h.focused=!0)}),a.addEventListener("updatefromsandbox",W=>{this.showElementAndHideCanvas(W.target);const Q={value(m){h.userValue=m.detail.value??"",d.setValue(n,{value:h.userValue.toString()}),m.target.value=h.userValue},formattedValue(m){const{formattedValue:R}=m.detail;h.formattedValue=R,R!=null&&m.target!==document.activeElement&&(m.target.value=R),d.setValue(n,{formattedValue:R})},selRange(m){m.target.setSelectionRange(...m.detail.selRange)},charLimit:m=>{var R;const{charLimit:r}=m.detail,{target:b}=m;if(r===0){b.removeAttribute("maxLength");return}b.setAttribute("maxLength",r);let u=h.userValue;!u||u.length<=r||(u=u.slice(0,r),b.value=h.userValue=u,d.setValue(n,{value:u}),(R=this.linkService.eventBus)==null||R.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:u,willCommit:!0,commitKey:1,selStart:b.selectionStart,selEnd:b.selectionEnd}}))}};this._dispatchEventFromSandbox(Q,W)}),a.addEventListener("keydown",W=>{var Q;h.commitKey=1;let m=-1;if(W.key==="Escape"?m=0:W.key==="Enter"&&!this.data.multiLine?m=2:W.key==="Tab"&&(h.commitKey=3),m===-1)return;const{value:R}=W.target;h.lastCommittedValue!==R&&(h.lastCommittedValue=R,h.userValue=R,(Q=this.linkService.eventBus)==null||Q.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:R,willCommit:!0,commitKey:m,selStart:W.target.selectionStart,selEnd:W.target.selectionEnd}}))});const V=o;o=null,a.addEventListener("blur",W=>{var Q,m;if(!h.focused||!W.relatedTarget)return;(Q=this.data.actions)!=null&&Q.Blur||(h.focused=!1);const{value:R}=W.target;h.userValue=R,h.lastCommittedValue!==R&&((m=this.linkService.eventBus)==null||m.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:R,willCommit:!0,commitKey:h.commitKey,selStart:W.target.selectionStart,selEnd:W.target.selectionEnd}})),V(W)}),(t=this.data.actions)!=null&&t.Keystroke&&a.addEventListener("beforeinput",W=>{var Q;h.lastCommittedValue=null;const{data:m,target:R}=W,{value:r,selectionStart:b,selectionEnd:u}=R;let J=b,G=u;switch(W.inputType){case"deleteWordBackward":{const T=r.substring(0,b).match(/\w*[^\w]*$/);T&&(J-=T[0].length);break}case"deleteWordForward":{const T=r.substring(b).match(/^[^\w]*\w*/);T&&(G+=T[0].length);break}case"deleteContentBackward":b===u&&(J-=1);break;case"deleteContentForward":b===u&&(G+=1);break}W.preventDefault(),(Q=this.linkService.eventBus)==null||Q.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:r,change:m||"",willCommit:!1,selStart:J,selEnd:G}})}),this._setEventListeners(a,h,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],W=>W.target.value)}if(o&&a.addEventListener("blur",o),this.data.comb){const V=(this.data.rect[2]-this.data.rect[0])/c;a.classList.add("comb"),a.style.letterSpacing=`calc(${V}px * var(--scale-factor) - 1ch)`}}else a=document.createElement("div"),a.textContent=this.data.fieldValue,a.style.verticalAlign="middle",a.style.display="table-cell",this.data.hasOwnCanvas&&(a.hidden=!0);return this._setTextStyle(a),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class cD extends ri{constructor(l){super(l,{isRenderable:!!l.data.hasOwnCanvas})}}class UD extends ri{constructor(l){super(l,{isRenderable:l.renderForms})}render(){const l=this.annotationStorage,t=this.data,d=t.id;let n=l.getValue(d,{value:t.exportValue===t.fieldValue}).value;typeof n=="string"&&(n=n!=="Off",l.setValue(d,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const a=document.createElement("input");return Ni.add(a),a.setAttribute("data-element-id",d),a.disabled=t.readOnly,this._setRequired(a,this.data.required),a.type="checkbox",a.name=t.fieldName,n&&a.setAttribute("checked",!0),a.setAttribute("exportValue",t.exportValue),a.tabIndex=nF,a.addEventListener("change",i=>{const{name:s,checked:c}=i.target;for(const F of this._getElementsByName(s,d)){const h=c&&F.exportValue===t.exportValue;F.domElement&&(F.domElement.checked=h),l.setValue(F.id,{value:h})}l.setValue(d,{value:c})}),a.addEventListener("resetform",i=>{const s=t.defaultFieldValue||"Off";i.target.checked=s===t.exportValue}),this.enableScripting&&this.hasJSActions&&(a.addEventListener("updatefromsandbox",i=>{const s={value(c){c.target.checked=c.detail.value!=="Off",l.setValue(d,{value:c.target.checked})}};this._dispatchEventFromSandbox(s,i)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],i=>i.target.checked)),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class gS extends ri{constructor(l){super(l,{isRenderable:l.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const l=this.annotationStorage,t=this.data,d=t.id;let n=l.getValue(d,{value:t.fieldValue===t.buttonValue}).value;if(typeof n=="string"&&(n=n!==t.buttonValue,l.setValue(d,{value:n})),n)for(const i of this._getElementsByName(t.fieldName,d))l.setValue(i.id,{value:!1});const a=document.createElement("input");if(Ni.add(a),a.setAttribute("data-element-id",d),a.disabled=t.readOnly,this._setRequired(a,this.data.required),a.type="radio",a.name=t.fieldName,n&&a.setAttribute("checked",!0),a.tabIndex=nF,a.addEventListener("change",i=>{const{name:s,checked:c}=i.target;for(const F of this._getElementsByName(s,d))l.setValue(F.id,{value:!1});l.setValue(d,{value:c})}),a.addEventListener("resetform",i=>{const s=t.defaultFieldValue;i.target.checked=s!=null&&s===t.buttonValue}),this.enableScripting&&this.hasJSActions){const i=t.buttonValue;a.addEventListener("updatefromsandbox",s=>{const c={value:F=>{const h=i===F.detail.value;for(const o of this._getElementsByName(F.target.name)){const V=h&&o.id===d;o.domElement&&(o.domElement.checked=V),l.setValue(o.id,{value:V})}}};this._dispatchEventFromSandbox(c,s)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],s=>s.target.checked)}return this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class ZD extends xS{constructor(l){super(l,{ignoreBorder:l.data.hasAppearance})}render(){const l=super.render();l.classList.add("buttonWidgetAnnotation","pushButton");const t=l.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",d=>{this._dispatchEventFromSandbox({},d)})),l}}class FD extends ri{constructor(l){super(l,{isRenderable:l.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const l=this.annotationStorage,t=this.data.id,d=l.getValue(t,{value:this.data.fieldValue}),n=document.createElement("select");Ni.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=nF;let a=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",h=>{const o=this.data.defaultFieldValue;for(const V of n.options)V.selected=V.value===o});for(const h of this.data.options){const o=document.createElement("option");o.textContent=h.displayValue,o.value=h.exportValue,d.value.includes(h.exportValue)&&(o.setAttribute("selected",!0),a=!1),n.append(o)}let i=null;if(a){const h=document.createElement("option");h.value=" ",h.setAttribute("hidden",!0),h.setAttribute("selected",!0),n.prepend(h),i=()=>{h.remove(),n.removeEventListener("input",i),i=null},n.addEventListener("input",i)}const s=h=>{const o=h?"value":"textContent",{options:V,multiple:W}=n;return W?Array.prototype.filter.call(V,Q=>Q.selected).map(Q=>Q[o]):V.selectedIndex===-1?null:V[V.selectedIndex][o]};let c=s(!1);const F=h=>{const o=h.target.options;return Array.prototype.map.call(o,V=>({displayValue:V.textContent,exportValue:V.value}))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",h=>{const o={value(V){i==null||i();const W=V.detail.value,Q=new Set(Array.isArray(W)?W:[W]);for(const m of n.options)m.selected=Q.has(m.value);l.setValue(t,{value:s(!0)}),c=s(!1)},multipleSelection(V){n.multiple=!0},remove(V){const W=n.options,Q=V.detail.remove;W[Q].selected=!1,n.remove(Q),W.length>0&&Array.prototype.findIndex.call(W,m=>m.selected)===-1&&(W[0].selected=!0),l.setValue(t,{value:s(!0),items:F(V)}),c=s(!1)},clear(V){for(;n.length!==0;)n.remove(0);l.setValue(t,{value:null,items:[]}),c=s(!1)},insert(V){const{index:W,displayValue:Q,exportValue:m}=V.detail.insert,R=n.children[W],r=document.createElement("option");r.textContent=Q,r.value=m,R?R.before(r):n.append(r),l.setValue(t,{value:s(!0),items:F(V)}),c=s(!1)},items(V){const{items:W}=V.detail;for(;n.length!==0;)n.remove(0);for(const Q of W){const{displayValue:m,exportValue:R}=Q,r=document.createElement("option");r.textContent=m,r.value=R,n.append(r)}n.options.length>0&&(n.options[0].selected=!0),l.setValue(t,{value:s(!0),items:F(V)}),c=s(!1)},indices(V){const W=new Set(V.detail.indices);for(const Q of V.target.options)Q.selected=W.has(Q.index);l.setValue(t,{value:s(!0)}),c=s(!1)},editable(V){V.target.disabled=!V.detail.editable}};this._dispatchEventFromSandbox(o,h)}),n.addEventListener("input",h=>{var o;const V=s(!0),W=s(!1);l.setValue(t,{value:V}),h.preventDefault(),(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:c,change:W,changeEx:V,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],h=>h.target.value)):n.addEventListener("input",function(h){l.setValue(t,{value:s(!0)})}),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class iN extends Wt{constructor(l){const{data:t,elements:d}=l;super(l,{isRenderable:Wt._hasPopupData(t)}),this.elements=d,this.popup=null}render(){this.container.classList.add("popupAnnotation");const l=this.popup=new hD({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),t=[];for(const d of this.elements)d.popup=l,d.container.ariaHasPopup="dialog",t.push(d.data.id),d.addHighlightArea();return this.container.setAttribute("aria-controls",t.map(d=>`${ZR}${d}`).join(",")),this.container}}var sF,sN,cN,cF,mc,nt,sa,UF,Oo,vo,ZF,ca,Bd,Ua,Ko,Za,fo,pi,Rc,Qt,Ho,UN,jS,OS,vS,KS,Po,Ao,ZN;class hD{constructor({container:l,color:t,elements:d,titleObj:n,modificationDate:a,contentsObj:i,richText:s,parent:c,rect:F,parentRect:h,open:o}){M(this,Qt),M(this,sF,p(this,Qt,vS).bind(this)),M(this,sN,p(this,Qt,ZN).bind(this)),M(this,cN,p(this,Qt,Ao).bind(this)),M(this,cF,p(this,Qt,Po).bind(this)),M(this,mc,null),M(this,nt,null),M(this,sa,null),M(this,UF,null),M(this,Oo,null),M(this,vo,null),M(this,ZF,null),M(this,ca,!1),M(this,Bd,null),M(this,Ua,null),M(this,Ko,null),M(this,Za,null),M(this,fo,null),M(this,pi,null),M(this,Rc,!1);var V;N(this,nt,l),N(this,fo,n),N(this,sa,i),N(this,Za,s),N(this,vo,c),N(this,mc,t),N(this,Ko,F),N(this,ZF,h),N(this,Oo,d),N(this,UF,hM.toDateObject(a)),this.trigger=d.flatMap(W=>W.getElementsToTriggerPopup());for(const W of this.trigger)W.addEventListener("click",U(this,cF)),W.addEventListener("mouseenter",U(this,cN)),W.addEventListener("mouseleave",U(this,sN)),W.classList.add("popupTriggerArea");for(const W of d)(V=W.container)==null||V.addEventListener("keydown",U(this,sF));U(this,nt).hidden=!0,o&&p(this,Qt,Po).call(this)}render(){if(U(this,Bd))return;const l=N(this,Bd,document.createElement("div"));if(l.className="popup",U(this,mc)){const a=l.style.outlineColor=sl.makeHexColor(...U(this,mc));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?l.style.backgroundColor=`color-mix(in srgb, ${a} 30%, white)`:l.style.backgroundColor=sl.makeHexColor(...U(this,mc).map(i=>Math.floor(.7*(255-i)+i)))}const t=document.createElement("span");t.className="header";const d=document.createElement("h1");if(t.append(d),{dir:d.dir,str:d.textContent}=U(this,fo),l.append(t),U(this,UF)){const a=document.createElement("span");a.classList.add("popupDate"),a.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),a.setAttribute("data-l10n-args",JSON.stringify({dateObj:U(this,UF).valueOf()})),t.append(a)}const n=U(this,Qt,Ho);if(n)wS.render({xfaHtml:n,intent:"richText",div:l}),l.lastChild.classList.add("richText","popupContent");else{const a=this._formatContents(U(this,sa));l.append(a)}U(this,nt).append(l)}_formatContents({str:l,dir:t}){const d=document.createElement("p");d.classList.add("popupContent"),d.dir=t;const n=l.split(/(?:\r\n?|\n)/);for(let a=0,i=n.length;a<i;++a){const s=n[a];d.append(document.createTextNode(s)),a<i-1&&d.append(document.createElement("br"))}return d}updateEdited({rect:l,popupContent:t}){var d;U(this,pi)||N(this,pi,{contentsObj:U(this,sa),richText:U(this,Za)}),l&&N(this,Ua,null),t&&(N(this,Za,p(this,Qt,OS).call(this,t)),N(this,sa,null)),(d=U(this,Bd))==null||d.remove(),N(this,Bd,null)}resetEdited(){var l;U(this,pi)&&({contentsObj:le(this,sa)._,richText:le(this,Za)._}=U(this,pi),N(this,pi,null),(l=U(this,Bd))==null||l.remove(),N(this,Bd,null),N(this,Ua,null))}forceHide(){N(this,Rc,this.isVisible),U(this,Rc)&&(U(this,nt).hidden=!0)}maybeShow(){U(this,Rc)&&(U(this,Bd)||p(this,Qt,Ao).call(this),N(this,Rc,!1),U(this,nt).hidden=!1)}get isVisible(){return U(this,nt).hidden===!1}}sF=new WeakMap,sN=new WeakMap,cN=new WeakMap,cF=new WeakMap,mc=new WeakMap,nt=new WeakMap,sa=new WeakMap,UF=new WeakMap,Oo=new WeakMap,vo=new WeakMap,ZF=new WeakMap,ca=new WeakMap,Bd=new WeakMap,Ua=new WeakMap,Ko=new WeakMap,Za=new WeakMap,fo=new WeakMap,pi=new WeakMap,Rc=new WeakMap,Qt=new WeakSet,Ho=function(){const e=U(this,Za),l=U(this,sa);return e!=null&&e.str&&(!(l!=null&&l.str)||l.str===e.str)&&U(this,Za).html||null},UN=function(){var e,l,t;return((t=(l=(e=U(this,Qt,Ho))==null?void 0:e.attributes)==null?void 0:l.style)==null?void 0:t.fontSize)||0},jS=function(){var e,l,t;return((t=(l=(e=U(this,Qt,Ho))==null?void 0:e.attributes)==null?void 0:l.style)==null?void 0:t.color)||null},OS=function(e){const l=[],t={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:l}]}},d={style:{color:U(this,Qt,jS),fontSize:U(this,Qt,UN)?`calc(${U(this,Qt,UN)}px * var(--scale-factor))`:""}};for(const n of e.split(`
39
39
  `))l.push({name:"span",value:n,attributes:d});return t},vS=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&U(this,ca))&&p(this,Qt,Po).call(this)},KS=function(){if(U(this,Ua)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:l,pageHeight:t,pageX:d,pageY:n}}}=U(this,vo);let a=!!U(this,ZF),i=a?U(this,ZF):U(this,Ko);for(const V of U(this,Oo))if(!i||sl.intersect(V.data.rect,i)!==null){i=V.data.rect,a=!0;break}const s=sl.normalizeRect([i[0],e[3]-i[1]+e[1],i[2],e[3]-i[3]+e[1]]),c=a?i[2]-i[0]+5:0,F=s[0]+c,h=s[1];N(this,Ua,[100*(F-d)/l,100*(h-n)/t]);const{style:o}=U(this,nt);o.left=`${U(this,Ua)[0]}%`,o.top=`${U(this,Ua)[1]}%`},Po=function(){N(this,ca,!U(this,ca)),U(this,ca)?(p(this,Qt,Ao).call(this),U(this,nt).addEventListener("click",U(this,cF)),U(this,nt).addEventListener("keydown",U(this,sF))):(p(this,Qt,ZN).call(this),U(this,nt).removeEventListener("click",U(this,cF)),U(this,nt).removeEventListener("keydown",U(this,sF)))},Ao=function(){U(this,Bd)||this.render(),this.isVisible?U(this,ca)&&U(this,nt).classList.add("focused"):(p(this,Qt,KS).call(this),U(this,nt).hidden=!1,U(this,nt).style.zIndex=parseInt(U(this,nt).style.zIndex)+1e3)},ZN=function(){U(this,nt).classList.remove("focused"),!(U(this,ca)||!this.isVisible)&&(U(this,nt).hidden=!0,U(this,nt).style.zIndex=parseInt(U(this,nt).style.zIndex)-1e3)};class fS extends Wt{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0}),this.textContent=l.data.textContent,this.textPosition=l.data.textPosition,this.annotationEditorType=ul.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const l=document.createElement("div");l.classList.add("annotationTextContent"),l.setAttribute("role","comment");for(const t of this.textContent){const d=document.createElement("span");d.textContent=t,l.append(d)}this.container.append(l)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var _o;class oD extends Wt{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0}),M(this,_o,null)}render(){this.container.classList.add("lineAnnotation");const l=this.data,{width:t,height:d}=ia(l.rect),n=this.svgFactory.create(t,d,!0),a=N(this,_o,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",l.rect[2]-l.lineCoordinates[0]),a.setAttribute("y1",l.rect[3]-l.lineCoordinates[1]),a.setAttribute("x2",l.rect[2]-l.lineCoordinates[2]),a.setAttribute("y2",l.rect[3]-l.lineCoordinates[3]),a.setAttribute("stroke-width",l.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),n.append(a),this.container.append(n),!l.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return U(this,_o)}addHighlightArea(){this.container.classList.add("highlightArea")}}_o=new WeakMap;var qo;class VD extends Wt{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0}),M(this,qo,null)}render(){this.container.classList.add("squareAnnotation");const l=this.data,{width:t,height:d}=ia(l.rect),n=this.svgFactory.create(t,d,!0),a=l.borderStyle.width,i=N(this,qo,this.svgFactory.createElement("svg:rect"));return i.setAttribute("x",a/2),i.setAttribute("y",a/2),i.setAttribute("width",t-a),i.setAttribute("height",d-a),i.setAttribute("stroke-width",a||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),n.append(i),this.container.append(n),!l.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return U(this,qo)}addHighlightArea(){this.container.classList.add("highlightArea")}}qo=new WeakMap;var $o;class WD extends Wt{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0}),M(this,$o,null)}render(){this.container.classList.add("circleAnnotation");const l=this.data,{width:t,height:d}=ia(l.rect),n=this.svgFactory.create(t,d,!0),a=l.borderStyle.width,i=N(this,$o,this.svgFactory.createElement("svg:ellipse"));return i.setAttribute("cx",t/2),i.setAttribute("cy",d/2),i.setAttribute("rx",t/2-a/2),i.setAttribute("ry",d/2-a/2),i.setAttribute("stroke-width",a||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),n.append(i),this.container.append(n),!l.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return U(this,$o)}addHighlightArea(){this.container.classList.add("highlightArea")}}$o=new WeakMap;var lV;class HS extends Wt{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0}),M(this,lV,null),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:l,vertices:t,borderStyle:d,popupRef:n}}=this;if(!t)return this.container;const{width:a,height:i}=ia(l),s=this.svgFactory.create(a,i,!0);let c=[];for(let h=0,o=t.length;h<o;h+=2){const V=t[h]-l[0],W=l[3]-t[h+1];c.push(`${V},${W}`)}c=c.join(" ");const F=N(this,lV,this.svgFactory.createElement(this.svgElementName));return F.setAttribute("points",c),F.setAttribute("stroke-width",d.width||1),F.setAttribute("stroke","transparent"),F.setAttribute("fill","transparent"),s.append(F),this.container.append(s),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return U(this,lV)}addHighlightArea(){this.container.classList.add("highlightArea")}}lV=new WeakMap;class QD extends HS{constructor(l){super(l),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class mD extends Wt{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var tV,Nc,eV,FN;class hN extends Wt{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0}),M(this,eV),M(this,tV,null),M(this,Nc,[]),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?ul.HIGHLIGHT:ul.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:l,rotation:t,inkLists:d,borderStyle:n,popupRef:a}}=this,{transform:i,width:s,height:c}=p(this,eV,FN).call(this,t,l),F=this.svgFactory.create(s,c,!0),h=N(this,tV,this.svgFactory.createElement("svg:g"));F.append(h),h.setAttribute("stroke-width",n.width||1),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round"),h.setAttribute("stroke-miterlimit",10),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),h.setAttribute("transform",i);for(let o=0,V=d.length;o<V;o++){const W=this.svgFactory.createElement(this.svgElementName);U(this,Nc).push(W),W.setAttribute("points",d[o].join(",")),h.append(W)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(F),this._editOnDoubleClick(),this.container}updateEdited(l){super.updateEdited(l);const{thickness:t,points:d,rect:n}=l,a=U(this,tV);if(t>=0&&a.setAttribute("stroke-width",t||1),d)for(let i=0,s=U(this,Nc).length;i<s;i++)U(this,Nc)[i].setAttribute("points",d[i].join(","));if(n){const{transform:i,width:s,height:c}=p(this,eV,FN).call(this,this.data.rotation,n);a.parentElement.setAttribute("viewBox",`0 0 ${s} ${c}`),a.setAttribute("transform",i)}}getElementsToTriggerPopup(){return U(this,Nc)}addHighlightArea(){this.container.classList.add("highlightArea")}}tV=new WeakMap,Nc=new WeakMap,eV=new WeakSet,FN=function(e,l){switch(e){case 90:return{transform:`rotate(90) translate(${-l[0]},${l[1]}) scale(1,-1)`,width:l[3]-l[1],height:l[2]-l[0]};case 180:return{transform:`rotate(180) translate(${-l[2]},${l[1]}) scale(1,-1)`,width:l[2]-l[0],height:l[3]-l[1]};case 270:return{transform:`rotate(270) translate(${-l[2]},${l[3]}) scale(1,-1)`,width:l[3]-l[1],height:l[2]-l[0]};default:return{transform:`translate(${-l[0]},${l[3]}) scale(1,-1)`,width:l[2]-l[0],height:l[3]-l[1]}}};class PS extends Wt{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=ul.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class RD extends Wt{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class ND extends Wt{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class bD extends Wt{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class AS extends Wt{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=ul.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var dV,nV,oN;class uD extends Wt{constructor(l){var t;super(l,{isRenderable:!0}),M(this,nV),M(this,dV,null);const{file:d}=this.data;this.filename=d.filename,this.content=d.content,(t=this.linkService.eventBus)==null||t.dispatch("fileattachmentannotation",{source:this,...d})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:l,data:t}=this;let d;t.hasAppearance||t.fillAlpha===0?d=document.createElement("div"):(d=document.createElement("img"),d.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?"paperclip":"pushpin"}.svg`,t.fillAlpha&&t.fillAlpha<1&&(d.style=`filter: opacity(${Math.round(t.fillAlpha*100)}%);`)),d.addEventListener("dblclick",p(this,nV,oN).bind(this)),N(this,dV,d);const{isMac:n}=te.platform;return l.addEventListener("keydown",a=>{a.key==="Enter"&&(n?a.metaKey:a.ctrlKey)&&p(this,nV,oN).call(this)}),!t.popupRef&&this.hasPopupData?this._createPopup():d.classList.add("popupTriggerArea"),l.append(d),l}getElementsToTriggerPopup(){return U(this,dV)}addHighlightArea(){this.container.classList.add("highlightArea")}}dV=new WeakMap,nV=new WeakSet,oN=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var aV,bc,uc,iV,FF,_S,VN,qS;let rD=(qS=class{constructor({div:e,accessibilityManager:l,annotationCanvasMap:t,annotationEditorUIManager:d,page:n,viewport:a,structTreeLayer:i}){M(this,FF),M(this,aV,null),M(this,bc,null),M(this,uc,new Map),M(this,iV,null),this.div=e,N(this,aV,l),N(this,bc,t),N(this,iV,i||null),this.page=n,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=d}hasEditableAnnotations(){return U(this,uc).size>0}async render(e){var l;const{annotations:t}=e,d=this.div;Pa(d,this.viewport);const n=new Map,a={data:null,layer:d,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new nN,annotationStorage:e.annotationStorage||new ER,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const i of t){if(i.noHTML)continue;const s=i.annotationType===ht.POPUP;if(s){const h=n.get(i.id);if(!h)continue;a.elements=h}else{const{width:h,height:o}=ia(i.rect);if(h<=0||o<=0)continue}a.data=i;const c=nD.create(a);if(!c.isRenderable)continue;if(!s&&i.popupRef){const h=n.get(i.popupRef);h?h.push(c):n.set(i.popupRef,[c])}const F=c.render();i.hidden&&(F.style.visibility="hidden"),await p(this,FF,_S).call(this,F,i.id),c._isEditable&&(U(this,uc).set(c.data.id,c),(l=this._annotationEditorUIManager)==null||l.renderAnnotationElement(c))}p(this,FF,VN).call(this)}update({viewport:e}){const l=this.div;this.viewport=e,Pa(l,{rotation:e.rotation}),p(this,FF,VN).call(this),l.hidden=!1}getEditableAnnotations(){return Array.from(U(this,uc).values())}getEditableAnnotation(e){return U(this,uc).get(e)}},aV=new WeakMap,bc=new WeakMap,uc=new WeakMap,iV=new WeakMap,FF=new WeakSet,_S=async function(e,l){var t,d;const n=e.firstChild||e,a=n.id=`${ZR}${l}`,i=await((t=U(this,iV))==null?void 0:t.getAriaAttributes(a));if(i)for(const[s,c]of i)n.setAttribute(s,c);this.div.append(e),(d=U(this,aV))==null||d.moveElementInDOM(this.div,e,n,!1)},VN=function(){if(!U(this,bc))return;const e=this.div;for(const[l,t]of U(this,bc)){const d=e.querySelector(`[data-annotation-id="${l}"]`);if(!d)continue;t.className="annotationContent";const{firstChild:n}=d;n?n.nodeName==="CANVAS"?n.replaceWith(t):n.classList.contains("annotationContent")?n.after(t):n.before(t):d.append(t)}U(this,bc).clear()},qS);const sV=/\r\n?|\n/g;var Yd,we,cV,rc,Ee,Me,$S,lJ,tJ,UV,Mi,ZV,FV,eJ,WN,dJ;const Zn=class wt extends dt{constructor(l){super({...l,name:"freeTextEditor"}),M(this,Me),M(this,Yd),M(this,we,""),M(this,cV,`${this.id}-editor`),M(this,rc,null),M(this,Ee),N(this,Yd,l.color||wt._defaultColor||dt._defaultLineColor),N(this,Ee,l.fontSize||wt._defaultFontSize)}static get _keyboardManager(){const l=wt.prototype,t=a=>a.isEmpty(),d=MZ.TRANSLATE_SMALL,n=MZ.TRANSLATE_BIG;return rl(this,"_keyboardManager",new QZ([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],l.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],l.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],l._translateEmpty,{args:[-d,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],l._translateEmpty,{args:[-n,0],checker:t}],[["ArrowRight","mac+ArrowRight"],l._translateEmpty,{args:[d,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],l._translateEmpty,{args:[n,0],checker:t}],[["ArrowUp","mac+ArrowUp"],l._translateEmpty,{args:[0,-d],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],l._translateEmpty,{args:[0,-n],checker:t}],[["ArrowDown","mac+ArrowDown"],l._translateEmpty,{args:[0,d],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],l._translateEmpty,{args:[0,n],checker:t}]]))}static initialize(l,t){dt.initialize(l,t);const d=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(d.getPropertyValue("--freetext-padding"))}static updateDefaultParams(l,t){switch(l){case Jl.FREETEXT_SIZE:wt._defaultFontSize=t;break;case Jl.FREETEXT_COLOR:wt._defaultColor=t;break}}updateParams(l,t){switch(l){case Jl.FREETEXT_SIZE:p(this,Me,$S).call(this,t);break;case Jl.FREETEXT_COLOR:p(this,Me,lJ).call(this,t);break}}static get defaultPropertiesToUpdate(){return[[Jl.FREETEXT_SIZE,wt._defaultFontSize],[Jl.FREETEXT_COLOR,wt._defaultColor||dt._defaultLineColor]]}get propertiesToUpdate(){return[[Jl.FREETEXT_SIZE,U(this,Ee)],[Jl.FREETEXT_COLOR,U(this,Yd)]]}_translateEmpty(l,t){this._uiManager.translateSelectedEditors(l,t,!0)}getInitialTranslation(){const l=this.parentScale;return[-wt._internalPadding*l,-(wt._internalPadding+U(this,Ee))*l]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(ul.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),N(this,rc,new AbortController);const l=this._uiManager.combinedSignal(U(this,rc));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:l}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:l}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:l}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:l}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:l})}disableEditMode(){var l;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",U(this,cV)),this._isDraggable=!0,(l=U(this,rc))==null||l.abort(),N(this,rc,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(l){this._focusEventsAllowed&&(super.focusin(l),l.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(l){var t;this.width||(this.enableEditMode(),l&&this.editorDiv.focus(),(t=this._initialOptions)!=null&&t.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const l=U(this,we),t=N(this,we,p(this,Me,tJ).call(this).trimEnd());if(l===t)return;const d=n=>{if(N(this,we,n),!n){this.remove();return}p(this,Me,FV).call(this),this._uiManager.rebuild(this),p(this,Me,UV).call(this)};this.addCommands({cmd:()=>{d(t)},undo:()=>{d(l)},mustExec:!1}),p(this,Me,UV).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(l){this.enterInEditMode()}keydown(l){l.target===this.div&&l.key==="Enter"&&(this.enterInEditMode(),l.preventDefault())}editorDivKeydown(l){wt._keyboardManager.exec(this,l)}editorDivFocus(l){this.isEditing=!0}editorDivBlur(l){this.isEditing=!1}editorDivInput(l){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let l,t;this.width&&(l=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",U(this,cV)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:d}=this.editorDiv;if(d.fontSize=`calc(${U(this,Ee)}px * var(--scale-factor))`,d.color=U(this,Yd),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),Ih(this,this.div,["dblclick","keydown"]),this.width){const[n,a]=this.parentDimensions;if(this.annotationElementId){const{position:i}=this._initialData;let[s,c]=this.getInitialTranslation();[s,c]=this.pageTranslationToScreen(s,c);const[F,h]=this.pageDimensions,[o,V]=this.pageTranslation;let W,Q;switch(this.rotation){case 0:W=l+(i[0]-o)/F,Q=t+this.height-(i[1]-V)/h;break;case 90:W=l+(i[0]-o)/F,Q=t-(i[1]-V)/h,[s,c]=[c,-s];break;case 180:W=l-this.width+(i[0]-o)/F,Q=t-(i[1]-V)/h,[s,c]=[-s,-c];break;case 270:W=l+(i[0]-o-this.height*h)/F,Q=t+(i[1]-V-this.width*F)/h,[s,c]=[-c,s];break}this.setAt(W*n,Q*a,s,c)}else this.setAt(l*n,t*a,this.width*n,this.height*a);p(this,Me,FV).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(l){var t,d,n;const a=l.clipboardData||window.clipboardData,{types:i}=a;if(i.length===1&&i[0]==="text/plain")return;l.preventDefault();const s=p(t=wt,Mi,WN).call(t,a.getData("text")||"").replaceAll(sV,`
40
40
  `);if(!s)return;const c=window.getSelection();if(!c.rangeCount)return;this.editorDiv.normalize(),c.deleteFromDocument();const F=c.getRangeAt(0);if(!s.includes(`
@@ -58,10 +58,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
58
58
  page-break-before: avoid;
59
59
  page-break-inside: avoid;
60
60
  }
61
- `,e.contentWindow.document.head.appendChild(d),e.contentWindow.document.body.style.width="100%"}function gD(e){return new Promise(l=>{const t=document.createElement("iframe");t.width="0",t.height="0",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.border="none",t.style.overflow="hidden",t.onload=()=>l(t),e.appendChild(t)})}function jD(e,l){const t=URL.createObjectURL(new Blob([e],{type:"application/pdf"})),d=document.createElement("a");d.href=t,d.download=l,d.style.display="none",document.body.append(d),d.click(),setTimeout(()=>{URL.revokeObjectURL(t),document.body.removeChild(d)},1e3)}function wJ(e){for(;e!=null&&e.firstChild;)e.removeChild(e.firstChild)}function EJ(e){return e?Object.prototype.hasOwnProperty.call(e,"_pdfInfo"):!1}function EN(e){e==null||e.querySelectorAll("canvas").forEach(l=>{var t;l.width=1,l.height=1,(t=l.getContext("2d"))==null||t.clearRect(0,0,1,1)})}function CJ({onError:e,onPasswordRequest:l,onProgress:t,source:d}){const n=Z.shallowRef(null),a=Z.shallowRef(null);return Z.watchEffect(async()=>{const i=Z.toValue(d);if(i){if(EJ(i)){n.value=i;return}}else return;try{a.value=ED(i),l&&(a.value.onPassword=(s,c)=>{l({callback:s,isWrongPassword:c===DD.INCORRECT_PASSWORD})}),t&&(a.value.onProgress=t),n.value=await a.value.promise}catch(s){if(n.value=null,e)e(s);else throw s}}),Z.watch(n,(i,s)=>{s==null||s.destroy()}),Z.onBeforeUnmount(()=>{var i,s,c,F;(i=a.value)!=null&&i.onPassword&&(a.value.onPassword=null),(s=a.value)!=null&&s.onProgress&&(a.value.onProgress=null),(c=a.value)==null||c.destroy(),EJ(Z.toValue(d))||(F=n.value)==null||F.destroy()}),{doc:n}}var jF={};jF.d=(e,l)=>{for(var t in l)jF.o(l,t)&&!jF.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:l[t]})},jF.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l);var Al=globalThis.pdfjsViewer={};jF.d(Al,{AnnotationLayerBuilder:()=>hT,DownloadManager:()=>ww,EventBus:()=>QT,FindState:()=>ra,GenericL10n:()=>eW,LinkTarget:()=>wi,PDFFindController:()=>Mw,PDFHistory:()=>IE,PDFLinkService:()=>UT,PDFPageView:()=>dG,PDFScriptingManager:()=>AE,PDFSinglePageViewer:()=>lC,PDFViewer:()=>mG,ProgressBar:()=>tw,RenderingStates:()=>lt,ScrollMode:()=>Gl,SimpleLinkService:()=>lb,SpreadMode:()=>Pt,StructTreeLayerBuilder:()=>HT,TextLayerBuilder:()=>$T,XfaLayerBuilder:()=>lG,parseQueryString:()=>xV});const OD="auto",xJ=1,gJ=1.1,vD=.1,KD=10,CN=0,fD=1.25,jJ=40,OJ=5,lt={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},jc={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},xd={DISABLE:0,ENABLE:1,ENABLE_PERMISSIONS:2},Gl={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},Pt={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};function vJ(e,l,t=!1){let d=e.offsetParent;if(!d){console.error("offsetParent is not set -- cannot scroll");return}let n=e.offsetTop+e.clientTop,a=e.offsetLeft+e.clientLeft;for(;d.clientHeight===d.scrollHeight&&d.clientWidth===d.scrollWidth||t&&(d.classList.contains("markedContent")||getComputedStyle(d).overflow==="hidden");)if(n+=d.offsetTop,a+=d.offsetLeft,d=d.offsetParent,!d)return;l&&(l.top!==void 0&&(n+=l.top),l.left!==void 0&&(a+=l.left,d.scrollLeft=a)),d.scrollTop=n}function HD(e,l,t=void 0){const d=function(i){a||(a=window.requestAnimationFrame(function(){a=null;const s=e.scrollLeft,c=n.lastX;s!==c&&(n.right=s>c),n.lastX=s;const F=e.scrollTop,h=n.lastY;F!==h&&(n.down=F>h),n.lastY=F,l(n)}))},n={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:d};let a=null;return e.addEventListener("scroll",d,{useCapture:!0,signal:t}),t==null||t.addEventListener("abort",()=>window.cancelAnimationFrame(a),{once:!0}),n}function xV(e){const l=new Map;for(const[t,d]of new URLSearchParams(e))l.set(t.toLowerCase(),d);return l}const KJ=/[\x00-\x1F]/g;function OF(e,l=!1){return KJ.test(e)?l?e.replaceAll(KJ,t=>t==="\0"?"":" "):e.replaceAll("\0",""):e}function vF(e,l,t=0){let d=t,n=e.length-1;if(n<0||!l(e[n]))return e.length;if(l(e[d]))return d;for(;d<n;){const a=d+n>>1,i=e[a];l(i)?n=a:d=a+1}return d}function fJ(e){if(Math.floor(e)===e)return[e,1];const l=1/e,t=8;if(l>t)return[1,t];if(Math.floor(l)===l)return[1,l];const d=e>1?l:e;let n=0,a=1,i=1,s=1;for(;;){const F=n+i,h=a+s;if(h>t)break;d<=F/h?(i=F,s=h):(n=F,a=h)}let c;return d-n/a<i/s-d?c=d===e?[n,a]:[a,n]:c=d===e?[i,s]:[s,i],c}function gV(e,l){return e-e%l}function PD(e,l,t){if(e<2)return e;let d=l[e].div,n=d.offsetTop+d.clientTop;n>=t&&(d=l[e-1].div,n=d.offsetTop+d.clientTop);for(let a=e-2;a>=0&&(d=l[a].div,!(d.offsetTop+d.clientTop+d.clientHeight<=n));--a)e=a;return e}function AD({scrollEl:e,views:l,sortByVisibility:t=!1,horizontal:d=!1,rtl:n=!1}){const a=e.scrollTop,i=a+e.clientHeight,s=e.scrollLeft,c=s+e.clientWidth;function F(b){const u=b.div;return u.offsetTop+u.clientTop+u.clientHeight>a}function h(b){const u=b.div,J=u.offsetLeft+u.clientLeft,G=J+u.clientWidth;return n?J<c:G>s}const o=[],V=new Set,W=l.length;let Q=vF(l,d?h:F);Q>0&&Q<W&&!d&&(Q=PD(Q,l,a));let m=d?c:-1;for(let b=Q;b<W;b++){const u=l[b],J=u.div,G=J.offsetLeft+J.clientLeft,T=J.offsetTop+J.clientTop,y=J.clientWidth,k=J.clientHeight,X=G+y,L=T+k;if(m===-1)L>=i&&(m=L);else if((d?G:T)>m)break;if(L<=a||T>=i||X<=s||G>=c)continue;const D=Math.max(0,a-T)+Math.max(0,L-i),C=Math.max(0,s-G)+Math.max(0,X-c),I=(k-D)/k,P=(y-C)/y,H=I*P*100|0;o.push({id:u.id,x:G,y:T,view:u,percent:H,widthPercent:P*100|0}),V.add(u.id)}const R=o[0],r=o.at(-1);return t&&o.sort(function(b,u){const J=b.percent-u.percent;return Math.abs(J)>.001?-J:b.id-u.id}),{first:R,last:r,views:o,ids:V}}function HJ(e){return Number.isInteger(e)&&e%90===0}function _D(e){return Number.isInteger(e)&&Object.values(Gl).includes(e)&&e!==Gl.UNKNOWN}function qD(e){return Number.isInteger(e)&&Object.values(Pt).includes(e)&&e!==Pt.UNKNOWN}function PJ(e){return e.width<=e.height}new Promise(function(e){window.requestAnimationFrame(e)});const $D=document.documentElement.style;function lw(e,l,t){return Math.min(Math.max(e,l),t)}var Ii,Oc,Di,KF,vc;class tw{constructor(l){M(this,Ii,null),M(this,Oc,null),M(this,Di,0),M(this,KF,null),M(this,vc,!0),N(this,Ii,l.classList),N(this,KF,l.style)}get percent(){return U(this,Di)}set percent(l){if(N(this,Di,lw(l,0,100)),isNaN(l)){U(this,Ii).add("indeterminate");return}U(this,Ii).remove("indeterminate"),U(this,KF).setProperty("--progressBar-percent",`${U(this,Di)}%`)}setWidth(l){if(!l)return;const t=l.parentNode.offsetWidth-l.offsetWidth;t>0&&U(this,KF).setProperty("--progressBar-end-offset",`${t}px`)}setDisableAutoFetch(l=5e3){U(this,Di)===100||isNaN(U(this,Di))||(U(this,Oc)&&clearTimeout(U(this,Oc)),this.show(),N(this,Oc,setTimeout(()=>{N(this,Oc,null),this.hide()},l)))}hide(){U(this,vc)&&(N(this,vc,!1),U(this,Ii).add("hidden"))}show(){U(this,vc)||(N(this,vc,!0),U(this,Ii).remove("hidden"))}}Ii=new WeakMap,Oc=new WeakMap,Di=new WeakMap,KF=new WeakMap,vc=new WeakMap;function ew(e){let l=Gl.VERTICAL,t=Pt.NONE;switch(e){case"SinglePage":l=Gl.PAGE;break;case"OneColumn":break;case"TwoPageLeft":l=Gl.PAGE;case"TwoColumnLeft":t=Pt.ODD;break;case"TwoPageRight":l=Gl.PAGE;case"TwoColumnRight":t=Pt.EVEN;break}return{scrollMode:l,spreadMode:t}}const jV=function(){const e=document.createElement("div");return e.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)",e.style.width==="calc(1320px)"?Math.fround:l=>l}(),Ud={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};function dw(e){return e<11904}function nw(e){return(e&65408)===0}function aw(e){return e>=97&&e<=122||e>=65&&e<=90}function iw(e){return e>=48&&e<=57}function sw(e){return e===32||e===9||e===13||e===10}function cw(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}function Uw(e){return e>=12448&&e<=12543}function Zw(e){return e>=12352&&e<=12447}function Fw(e){return e>=65376&&e<=65439}function hw(e){return(e&65408)===3584}function OV(e){return dw(e)?nw(e)?sw(e)?Ud.SPACE:aw(e)||iw(e)||e===95?Ud.ALPHA_LETTER:Ud.PUNCT:hw(e)?Ud.THAI_LETTER:e===160?Ud.SPACE:Ud.ALPHA_LETTER:cw(e)?Ud.HAN_LETTER:Uw(e)?Ud.KATAKANA_LETTER:Zw(e)?Ud.HIRAGANA_LETTER:Fw(e)?Ud.HALFWIDTH_KATAKANA_LETTER:Ud.ALPHA_LETTER}let xN;function ow(){return xN||(xN=" ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩"),xN}const ra={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},Vw=250,Ww=-50,Qw=-400,AJ={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},_J=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let gN;const mw=new RegExp("\\p{M}+","gu"),Rw=new RegExp("([.*+?^${}()|[\\]\\\\])|(\\p{P})|(\\s+)|(\\p{M})|(\\p{L})","gu"),Nw=new RegExp("([^\\p{M}])\\p{M}*$","u"),bw=new RegExp("^\\p{M}*([^\\p{M}])","u"),uw=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,qJ=new Map,rw="[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]",$J=new Map;let jN=null,ON=null;function vN(e){const l=[];let t;for(;(t=uw.exec(e))!==null;){let{index:m}=t;for(const R of t[0]){let r=qJ.get(R);r||(r=R.normalize("NFD").length,qJ.set(R,r)),l.push([r,m++])}}let d;if(l.length===0&&jN)d=jN;else if(l.length>0&&ON)d=ON;else{const m=Object.keys(AJ).join(""),R=ow(),r=`([${m}])|([${R}])|((?:゙|゚)\\n)|(\\p{M}+(?:-\\n)?)|(\\p{Ll}-\\n\\p{Lu})|(\\S-\\n)|((?:\\p{Ideographic}|[぀-ヿ])\\n)|(\\n)`;l.length===0?d=jN=new RegExp(r+"|(\\u0000)","gum"):d=ON=new RegExp(r+`|(${rw})`,"gum")}const n=[];for(;(t=mw.exec(e))!==null;)n.push([t[0].length,t.index]);let a=e.normalize("NFD");const i=[0,0];let s=0,c=0,F=0,h=0,o=0,V=!1;a=a.replace(d,(m,R,r,b,u,J,G,T,y,k,X)=>{var L,D,C;if(X-=h,R){const I=AJ[R],P=I.length;for(let H=1;H<P;H++)i.push(X-F+H,F-H);return F-=P-1,I}if(r){let I=$J.get(r);I||(I=r.normalize("NFKC"),$J.set(r,I));const P=I.length;for(let H=1;H<P;H++)i.push(X-F+H,F-H);return F-=P-1,I}if(b)return V=!0,X+o===((L=n[s])==null?void 0:L[1])?++s:(i.push(X-1-F+1,F-1),F-=1,h+=1),i.push(X-F+1,F),h+=1,o+=1,b.charAt(0);if(u){const I=u.endsWith(`
62
- `),P=I?u.length-2:u.length;V=!0;let H=P;X+o===((D=n[s])==null?void 0:D[1])&&(H-=n[s][0],++s);for(let Y=1;Y<=H;Y++)i.push(X-1-F+Y,F-Y);return F-=H,h+=H,I?(X+=P-1,i.push(X-F+1,1+F),F+=1,h+=1,o+=1,u.slice(0,P)):u}if(J)return h+=1,o+=1,J.replace(`
63
- `,"");if(G){const I=G.length-2;return i.push(X-F+I,1+F),F+=1,h+=1,o+=1,G.slice(0,-2)}if(T){const I=T.length-1;return i.push(X-F+I,F),h+=1,o+=1,T.slice(0,-1)}if(y)return i.push(X-F+1,F-1),F-=1,h+=1,o+=1," ";if(X+o===((C=l[c])==null?void 0:C[1])){const I=l[c][0]-1;++c;for(let P=1;P<=I;P++)i.push(X-(F-P),F-P);F-=I,h+=I}return k}),i.push(a.length,F);const W=new Uint32Array(i.length>>1),Q=new Int32Array(i.length>>1);for(let m=0,R=i.length;m<R;m+=2)W[m>>1]=i[m],Q[m>>1]=i[m+1];return[a,[W,Q],V]}function pw(e,l,t){if(!e)return[l,t];const[d,n]=e,a=l,i=l+t-1;let s=vF(d,o=>o>=a);d[s]>a&&--s;let c=vF(d,o=>o>=i,s);d[c]>i&&--c;const F=a+n[s],h=i+n[c]+1-F;return[F,h]}var It,fF,Kc,bl,lT,KN,fN,tT,eT,HN,dT,nT,vV,HF,fc,aT,PN,AN,KV,iT,_N,qN,PF;class Mw{constructor({linkService:l,eventBus:t,updateMatchesCountOnProgress:d=!0}){M(this,bl),M(this,It,null),M(this,fF,!0),M(this,Kc,0),this._linkService=l,this._eventBus=t,N(this,fF,d),this.onIsPageVisible=null,p(this,bl,KN).call(this),t._on("find",p(this,bl,lT).bind(this)),t._on("findbarclose",p(this,bl,iT).bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return U(this,It)}setDocument(l){this._pdfDocument&&p(this,bl,KN).call(this),l&&(this._pdfDocument=l,this._firstPageCapability.resolve())}scrollMatchIntoView({element:l=null,selectedLeft:t=0,pageIndex:d=-1,matchIndex:n=-1}){if(!this._scrollMatches||!l||n===-1||n!==this._selected.matchIdx||d===-1||d!==this._selected.pageIdx)return;this._scrollMatches=!1;const a={top:Ww,left:t+Qw};vJ(l,a,!0)}match(l,t,d){const n=this._hasDiacritics[d];let a=!1;if(typeof l=="string"?[a,l]=p(this,bl,HN).call(this,l,n):l=l.sort().reverse().map(o=>{const[V,W]=p(this,bl,HN).call(this,o,n);return a||(a=V),`(${W})`}).join("|"),!l)return;const{caseSensitive:i,entireWord:s}=U(this,It),c=`g${a?"u":""}${i?"":"i"}`;l=new RegExp(l,c);const F=[];let h;for(;(h=l.exec(t))!==null;)s&&!p(this,bl,eT).call(this,t,h.index,h[0].length)||F.push({index:h.index,length:h[0].length});return F}}It=new WeakMap,fF=new WeakMap,Kc=new WeakMap,bl=new WeakSet,lT=function(e){if(!e)return;const l=this._pdfDocument,{type:t}=e;(U(this,It)===null||p(this,bl,tT).call(this,e))&&(this._dirtyMatch=!0),N(this,It,e),t!=="highlightallchange"&&p(this,bl,PF).call(this,ra.PENDING),this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||l&&this._pdfDocument!==l)return;p(this,bl,nT).call(this);const d=!this._highlightMatches,n=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),t?this._dirtyMatch?p(this,bl,fc).call(this):t==="again"?(p(this,bl,fc).call(this),d&&U(this,It).highlightAll&&p(this,bl,HF).call(this)):t==="highlightallchange"?(n?p(this,bl,fc).call(this):this._highlightMatches=!0,p(this,bl,HF).call(this)):p(this,bl,fc).call(this):this._findTimeout=setTimeout(()=>{p(this,bl,fc).call(this),this._findTimeout=null},Vw)})},KN=function(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],N(this,Kc,0),N(this,It,null),this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=Promise.withResolvers()},fN=function(){const{query:e}=U(this,It);return typeof e=="string"?(e!==this._rawQuery&&(this._rawQuery=e,[this._normalizedQuery]=vN(e)),this._normalizedQuery):(e||[]).filter(l=>!!l).map(l=>vN(l)[0])},tT=function(e){var l;const t=e.query,d=U(this,It).query,n=typeof t;if(n!==typeof d)return!0;if(n==="string"){if(t!==d)return!0}else if(JSON.stringify(t)!==JSON.stringify(d))return!0;switch(e.type){case"again":const a=this._selected.pageIdx+1,i=this._linkService;return a>=1&&a<=i.pagesCount&&a!==i.page&&!(((l=this.onIsPageVisible)==null?void 0:l.call(this,a))??!0);case"highlightallchange":return!1}return!0},eT=function(e,l,t){let d=e.slice(0,l).match(Nw);if(d){const n=e.charCodeAt(l),a=d[1].charCodeAt(0);if(OV(n)===OV(a))return!1}if(d=e.slice(l+t).match(bw),d){const n=e.charCodeAt(l+t-1),a=d[1].charCodeAt(0);if(OV(n)===OV(a))return!1}return!0},HN=function(e,l){const{matchDiacritics:t}=U(this,It);let d=!1;e=e.replaceAll(Rw,(a,i,s,c,F,h)=>i?`[ ]*\\${i}[ ]*`:s?`[ ]*${s}[ ]*`:c?"[ ]+":t?F||h:F?_J.has(F.charCodeAt(0))?F:"":l?(d=!0,`${h}\\p{M}*`):h);const n="[ ]*";return e.endsWith(n)&&(e=e.slice(0,e.length-n.length)),t&&l&&(gN||(gN=String.fromCharCode(..._J)),d=!0,e=`${e}(?=[${gN}]|[^\\p{M}]|$)`),[d,e]},dT=function(e){const l=U(this,bl,fN);if(l.length===0)return;const t=this._pageContents[e],d=this.match(l,t,e),n=this._pageMatches[e]=[],a=this._pageMatchesLength[e]=[],i=this._pageDiffs[e];d==null||d.forEach(({index:c,length:F})=>{const[h,o]=pw(i,c,F);o&&(n.push(h),a.push(o))}),U(this,It).highlightAll&&p(this,bl,vV).call(this,e),this._resumePageIdx===e&&(this._resumePageIdx=null,p(this,bl,PN).call(this));const s=n.length;this._matchesCountTotal+=s,U(this,fF)?s>0&&p(this,bl,qN).call(this):++le(this,Kc)._===this._linkService.pagesCount&&p(this,bl,qN).call(this)},nT=function(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();const l={disableNormalization:!0};for(let t=0,d=this._linkService.pagesCount;t<d;t++){const{promise:n,resolve:a}=Promise.withResolvers();this._extractTextPromises[t]=n,e=e.then(()=>this._pdfDocument.getPage(t+1).then(i=>i.getTextContent(l)).then(i=>{const s=[];for(const c of i.items)s.push(c.str),c.hasEOL&&s.push(`
64
- `);[this._pageContents[t],this._pageDiffs[t],this._hasDiacritics[t]]=vN(s.join("")),a()},i=>{console.error(`Unable to get text content for page ${t+1}`,i),this._pageContents[t]="",this._pageDiffs[t]=null,this._hasDiacritics[t]=!1,a()}))}},vV=function(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})},HF=function(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})},fc=function(){const e=U(this,It).findPrevious,l=this._linkService.page-1,t=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=l,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,N(this,Kc,0),this._matchesCountTotal=0,p(this,bl,HF).call(this);for(let n=0;n<t;n++)this._pendingFindMatches.has(n)||(this._pendingFindMatches.add(n),this._extractTextPromises[n].then(()=>{this._pendingFindMatches.delete(n),p(this,bl,dT).call(this,n)}))}if(U(this,bl,fN).length===0){p(this,bl,PF).call(this,ra.FOUND);return}if(this._resumePageIdx)return;const d=this._offset;if(this._pagesToSearch=t,d.matchIdx!==null){const n=this._pageMatches[d.pageIdx].length;if(!e&&d.matchIdx+1<n||e&&d.matchIdx>0){d.matchIdx=e?d.matchIdx-1:d.matchIdx+1,p(this,bl,KV).call(this,!0);return}p(this,bl,AN).call(this,e)}p(this,bl,PN).call(this)},aT=function(e){const l=this._offset,t=e.length,d=U(this,It).findPrevious;return t?(l.matchIdx=d?t-1:0,p(this,bl,KV).call(this,!0),!0):(p(this,bl,AN).call(this,d),l.wrapped&&(l.matchIdx=null,this._pagesToSearch<0)?(p(this,bl,KV).call(this,!1),!0):!1)},PN=function(){this._resumePageIdx!==null&&console.error("There can only be one pending page.");let e=null;do{const l=this._offset.pageIdx;if(e=this._pageMatches[l],!e){this._resumePageIdx=l;break}}while(!p(this,bl,aT).call(this,e))},AN=function(e){const l=this._offset,t=this._linkService.pagesCount;l.pageIdx=e?l.pageIdx-1:l.pageIdx+1,l.matchIdx=null,this._pagesToSearch--,(l.pageIdx>=t||l.pageIdx<0)&&(l.pageIdx=e?t-1:0,l.wrapped=!0)},KV=function(e=!1){let l=ra.NOT_FOUND;const t=this._offset.wrapped;if(this._offset.wrapped=!1,e){const d=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,l=t?ra.WRAPPED:ra.FOUND,d!==-1&&d!==this._selected.pageIdx&&p(this,bl,vV).call(this,d)}p(this,bl,PF).call(this,l,U(this,It).findPrevious),this._selected.pageIdx!==-1&&(this._scrollMatches=!0,p(this,bl,vV).call(this,this._selected.pageIdx))},iT=function(e){const l=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||l&&this._pdfDocument!==l||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),p(this,bl,PF).call(this,ra.FOUND),this._highlightMatches=!1,p(this,bl,HF).call(this))})},_N=function(){var e;const{pageIdx:l,matchIdx:t}=this._selected;let d=0,n=this._matchesCountTotal;if(t!==-1){for(let a=0;a<l;a++)d+=((e=this._pageMatches[a])==null?void 0:e.length)||0;d+=t+1}return(d<1||d>n)&&(d=n=0),{current:d,total:n}},qN=function(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:p(this,bl,_N).call(this)})},PF=function(e,l=!1){var t,d;!U(this,fF)&&(U(this,Kc)!==this._linkService.pagesCount||e===ra.PENDING)||this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:l,entireWord:((t=U(this,It))==null?void 0:t.entireWord)??null,matchesCount:p(this,bl,_N).call(this),rawQuery:((d=U(this,It))==null?void 0:d.query)??null})};const Sw="noopener noreferrer nofollow",wi={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};var $N,sT;const cT=class uy{constructor({eventBus:l,externalLinkTarget:t=null,externalLinkRel:d=null,ignoreDestinationZoom:n=!1}={}){hl(this,"externalLinkEnabled",!0),this.eventBus=l,this.externalLinkTarget=t,this.externalLinkRel=d,this._ignoreDestinationZoom=n,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(l,t=null){this.baseUrl=t,this.pdfDocument=l}setViewer(l){this.pdfViewer=l}setHistory(l){this.pdfHistory=l}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfDocument?this.pdfViewer.currentPageNumber:1}set page(l){this.pdfDocument&&(this.pdfViewer.currentPageNumber=l)}get rotation(){return this.pdfDocument?this.pdfViewer.pagesRotation:0}set rotation(l){this.pdfDocument&&(this.pdfViewer.pagesRotation=l)}get isInPresentationMode(){return this.pdfDocument?this.pdfViewer.isInPresentationMode:!1}async goToDestination(l){if(!this.pdfDocument)return;let t,d,n;if(typeof l=="string"?(t=l,d=await this.pdfDocument.getDestination(l)):(t=null,d=await l),!Array.isArray(d)){console.error(`goToDestination: "${d}" is not a valid destination array, for dest="${l}".`);return}const[a]=d;if(a&&typeof a=="object"){if(n=this.pdfDocument.cachedPageNumber(a),!n)try{n=await this.pdfDocument.getPageIndex(a)+1}catch{console.error(`goToDestination: "${a}" is not a valid page reference, for dest="${l}".`);return}}else Number.isInteger(a)&&(n=a+1);if(!n||n<1||n>this.pagesCount){console.error(`goToDestination: "${n}" is not a valid page number, for dest="${l}".`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:t,explicitDest:d,pageNumber:n})),this.pdfViewer.scrollPageIntoView({pageNumber:n,destArray:d,ignoreDestinationZoom:this._ignoreDestinationZoom})}goToPage(l){if(!this.pdfDocument)return;const t=typeof l=="string"&&this.pdfViewer.pageLabelToPageNumber(l)||l|0;if(!(Number.isInteger(t)&&t>0&&t<=this.pagesCount)){console.error(`PDFLinkService.goToPage: "${l}" is not a valid page.`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(t)),this.pdfViewer.scrollPageIntoView({pageNumber:t})}addLinkAttributes(l,t,d=!1){if(!t||typeof t!="string")throw new Error('A valid "url" parameter must provided.');const n=d?wi.BLANK:this.externalLinkTarget,a=this.externalLinkRel;this.externalLinkEnabled?l.href=l.title=t:(l.href="",l.title=`Disabled: ${t}`,l.onclick=()=>!1);let i="";switch(n){case wi.NONE:break;case wi.SELF:i="_self";break;case wi.BLANK:i="_blank";break;case wi.PARENT:i="_parent";break;case wi.TOP:i="_top";break}l.target=i,l.rel=typeof a=="string"?a:Sw}getDestinationHash(l){if(typeof l=="string"){if(l.length>0)return this.getAnchorUrl("#"+escape(l))}else if(Array.isArray(l)){const t=JSON.stringify(l);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(l){return this.baseUrl?this.baseUrl+l:l}setHash(l){var t;if(!this.pdfDocument)return;let d,n;if(l.includes("=")){const a=xV(l);if(a.has("search")){const i=a.get("search").replaceAll('"',""),s=a.get("phrase")==="true";this.eventBus.dispatch("findfromurlhash",{source:this,query:s?i:i.match(/\S+/g)})}if(a.has("page")&&(d=a.get("page")|0||1),a.has("zoom")){const i=a.get("zoom").split(","),s=i[0],c=parseFloat(s);s.includes("Fit")?s==="Fit"||s==="FitB"?n=[null,{name:s}]:s==="FitH"||s==="FitBH"||s==="FitV"||s==="FitBV"?n=[null,{name:s},i.length>1?i[1]|0:null]:s==="FitR"?i.length!==5?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):n=[null,{name:s},i[1]|0,i[2]|0,i[3]|0,i[4]|0]:console.error(`PDFLinkService.setHash: "${s}" is not a valid zoom value.`):n=[null,{name:"XYZ"},i.length>1?i[1]|0:null,i.length>2?i[2]|0:null,c?c/100:s]}n?this.pdfViewer.scrollPageIntoView({pageNumber:d||this.page,destArray:n,allowNegativeOffset:!0}):d&&(this.page=d),a.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:a.get("pagemode")}),a.has("nameddest")&&this.goToDestination(a.get("nameddest"));return}n=unescape(l);try{n=JSON.parse(n),Array.isArray(n)||(n=n.toString())}catch{}if(typeof n=="string"||p(t=uy,$N,sT).call(t,n)){this.goToDestination(n);return}console.error(`PDFLinkService.setHash: "${unescape(l)}" is not a valid destination.`)}executeNamedAction(l){var t,d;if(this.pdfDocument){switch(l){case"GoBack":(t=this.pdfHistory)==null||t.back();break;case"GoForward":(d=this.pdfHistory)==null||d.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1;break}this.eventBus.dispatch("namedaction",{source:this,action:l})}}async executeSetOCGState(l){if(!this.pdfDocument)return;const t=this.pdfDocument,d=await this.pdfViewer.optionalContentConfigPromise;t===this.pdfDocument&&(d.setOCGState(l),this.pdfViewer.optionalContentConfigPromise=Promise.resolve(d))}};$N=new WeakSet,sT=function(e){if(!Array.isArray(e)||e.length<2)return!1;const[l,t,...d]=e;if(!(typeof l=="object"&&Number.isInteger(l==null?void 0:l.num)&&Number.isInteger(l==null?void 0:l.gen))&&!Number.isInteger(l)||!(typeof t=="object"&&typeof(t==null?void 0:t.name)=="string"))return!1;const n=d.length;let a=!0;switch(t.name){case"XYZ":if(n<2||n>3)return!1;break;case"Fit":case"FitB":return n===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(n>1)return!1;break;case"FitR":if(n!==4)return!1;a=!1;break;default:return!1}for(const i of d)if(!(typeof i=="number"||a&&i===null))return!1;return!0},M(cT,$N);let UT=cT;class lb extends UT{setDocument(l,t=null){}}const{AbortException:Jw,AnnotationEditorLayer:Tw,AnnotationEditorParamsType:a3,AnnotationEditorType:Ge,AnnotationEditorUIManager:Gw,AnnotationLayer:Xw,AnnotationMode:bn,build:i3,ColorPicker:s3,createValidAbsoluteUrl:yw,DOMSVGFactory:c3,DrawLayer:Bw,FeatureTest:U3,fetchData:ZT,getDocument:Z3,getFilenameFromUrl:F3,getPdfFilenameFromUrl:Yw,getXfaPageViewport:h3,GlobalWorkerOptions:o3,ImageKind:V3,InvalidPDFException:W3,isDataScheme:Q3,isPdfFile:kw,MissingPDFException:m3,noContextMenu:R3,normalizeUnicode:zw,OPS:N3,OutputScale:Lw,PasswordResponses:b3,PDFDataRangeTransport:u3,PDFDateString:r3,PDFWorker:p3,PermissionFlag:fV,PixelsPerInch:un,RenderingCancelledException:tb,setLayerDimensions:Iw,shadow:HV,stopEvent:eb,TextLayer:Dw,TouchManager:M3,UnexpectedResponseException:S3,Util:J3,VerbosityLevel:T3,version:FT,XfaLayer:db}=globalThis.pdfjsLib;var PV,Ei,AV,nb;class hT{constructor({pdfPage:l,linkService:t,downloadManager:d,annotationStorage:n=null,imageResourcesPath:a="",renderForms:i=!0,enableScripting:s=!1,hasJSActionsPromise:c=null,fieldObjectsPromise:F=null,annotationCanvasMap:h=null,accessibilityManager:o=null,annotationEditorUIManager:V=null,onAppend:W=null}){M(this,AV),M(this,PV,null),M(this,Ei,null),this.pdfPage=l,this.linkService=t,this.downloadManager=d,this.imageResourcesPath=a,this.renderForms=i,this.annotationStorage=n,this.enableScripting=s,this._hasJSActionsPromise=c||Promise.resolve(!1),this._fieldObjectsPromise=F||Promise.resolve(null),this._annotationCanvasMap=h,this._accessibilityManager=o,this._annotationEditorUIManager=V,N(this,PV,W),this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=t.eventBus}async render(l,t,d="display"){var n,a;if(this.div){if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:l.clone({dontFlip:!0})});return}const[i,s,c]=await Promise.all([this.pdfPage.getAnnotations({intent:d}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;const F=this.div=document.createElement("div");if(F.className="annotationLayer",(n=U(this,PV))==null||n.call(this,F),i.length===0){this.hide();return}this.annotationLayer=new Xw({div:F,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,page:this.pdfPage,viewport:l.clone({dontFlip:!0}),structTreeLayer:(t==null?void 0:t.structTreeLayer)||null}),await this.annotationLayer.render({annotations:i,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:s,fieldObjects:c}),this.linkService.isInPresentationMode&&p(this,AV,nb).call(this,jc.FULLSCREEN),U(this,Ei)||(N(this,Ei,new AbortController),(a=this._eventBus)==null||a._on("presentationmodechanged",h=>{p(this,AV,nb).call(this,h.state)},{signal:U(this,Ei).signal}))}cancel(){var l;this._cancelled=!0,(l=U(this,Ei))==null||l.abort(),N(this,Ei,null)}hide(){this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){var l;return!!((l=this.annotationLayer)!=null&&l.hasEditableAnnotations())}}PV=new WeakMap,Ei=new WeakMap,AV=new WeakSet,nb=function(e){if(!this.div)return;let l=!1;switch(e){case jc.FULLSCREEN:l=!0;break;case jc.NORMAL:break;default:return}for(const t of this.div.childNodes)t.hasAttribute("data-internal-link")||(t.inert=l)};function oT(e,l){const t=document.createElement("a");if(!t.click)throw new Error('DownloadManager: "a.click()" is not supported.');t.href=e,t.target="_parent","download"in t&&(t.download=l),(document.body||document.documentElement).append(t),t.click(),t.remove()}var VT;class ww{constructor(){M(this,VT,new WeakMap)}downloadData(l,t,d){const n=URL.createObjectURL(new Blob([l],{type:d}));oT(n,t)}openOrDownloadData(l,t,d=null){const n=kw(t)?"application/pdf":"";return this.downloadData(l,t,n),!1}download(l,t,d){let n;if(l)n=URL.createObjectURL(new Blob([l],{type:"application/pdf"}));else{if(!yw(t,"http://example.com")){console.error(`download - not a valid URL: ${t}`);return}n=t+"#pdfjs.action=download"}oT(n,d)}}VT=new WeakMap;const WT={EVENT:"event",TIMEOUT:"timeout"};async function Ew({target:e,name:l,delay:t=0}){if(typeof e!="object"||!(Number.isInteger(t)&&t>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");const{promise:d,resolve:n}=Promise.withResolvers(),a=new AbortController;function i(F){a.abort(),clearTimeout(c),n(F)}const s=e instanceof QT?"_on":"addEventListener";e[s](l,i.bind(null,WT.EVENT),{signal:a.signal});const c=setTimeout(i.bind(null,WT.TIMEOUT),t);return d}var AF;class QT{constructor(){M(this,AF,Object.create(null))}on(l,t,d=null){this._on(l,t,{external:!0,once:d==null?void 0:d.once,signal:d==null?void 0:d.signal})}off(l,t,d=null){this._off(l,t)}dispatch(l,t){const d=U(this,AF)[l];if(!d||d.length===0)return;let n;for(const{listener:a,external:i,once:s}of d.slice(0)){if(s&&this._off(l,a),i){(n||(n=[])).push(a);continue}a(t)}if(n){for(const a of n)a(t);n=null}}_on(l,t,d=null){var n;let a=null;if((d==null?void 0:d.signal)instanceof AbortSignal){const{signal:i}=d;if(i.aborted){console.error("Cannot use an `aborted` signal.");return}const s=()=>this._off(l,t);a=()=>i.removeEventListener("abort",s),i.addEventListener("abort",s)}((n=U(this,AF))[l]||(n[l]=[])).push({listener:t,external:(d==null?void 0:d.external)===!0,once:(d==null?void 0:d.once)===!0,rmAbort:a})}_off(l,t,d=null){var n;const a=U(this,AF)[l];if(a)for(let i=0,s=a.length;i<s;i++){const c=a[i];if(c.listener===t){(n=c.rmAbort)==null||n.call(c),a.splice(i,1);return}}}}AF=new WeakMap;class _V{constructor(l){this.value=l}valueOf(){return this.value}}class Ft extends _V{constructor(l="???"){super(l)}toString(l){return`{${this.value}}`}}class rn extends _V{constructor(l,t={}){super(l),this.opts=t}toString(l){try{return l.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(t){return l.reportError(t),this.value.toString(10)}}}class _F extends _V{constructor(l,t={}){super(l),this.opts=t}toString(l){try{return l.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(t){return l.reportError(t),new Date(this.value).toISOString()}}}const mT=100,Cw="⁨",xw="⁩";function gw(e,l,t){if(t===l||t instanceof rn&&l instanceof rn&&t.value===l.value)return!0;if(l instanceof rn&&typeof t=="string"){let d=e.memoizeIntlObject(Intl.PluralRules,l.opts).select(l.value);if(t===d)return!0}return!1}function RT(e,l,t){return l[t]?Hc(e,l[t].value):(e.reportError(new RangeError("No default")),new Ft)}function ab(e,l){const t=[],d=Object.create(null);for(const n of l)n.type==="narg"?d[n.name]=qF(e,n.value):t.push(qF(e,n));return{positional:t,named:d}}function qF(e,l){switch(l.type){case"str":return l.value;case"num":return new rn(l.value,{minimumFractionDigits:l.precision});case"var":return jw(e,l);case"mesg":return Ow(e,l);case"term":return vw(e,l);case"func":return Kw(e,l);case"select":return fw(e,l);default:return new Ft}}function jw(e,{name:l}){let t;if(e.params)if(Object.prototype.hasOwnProperty.call(e.params,l))t=e.params[l];else return new Ft(`$${l}`);else if(e.args&&Object.prototype.hasOwnProperty.call(e.args,l))t=e.args[l];else return e.reportError(new ReferenceError(`Unknown variable: $${l}`)),new Ft(`$${l}`);if(t instanceof _V)return t;switch(typeof t){case"string":return t;case"number":return new rn(t);case"object":if(t instanceof Date)return new _F(t.getTime());default:return e.reportError(new TypeError(`Variable type not supported: $${l}, ${typeof t}`)),new Ft(`$${l}`)}}function Ow(e,{name:l,attr:t}){const d=e.bundle._messages.get(l);if(!d)return e.reportError(new ReferenceError(`Unknown message: ${l}`)),new Ft(l);if(t){const n=d.attributes[t];return n?Hc(e,n):(e.reportError(new ReferenceError(`Unknown attribute: ${t}`)),new Ft(`${l}.${t}`))}return d.value?Hc(e,d.value):(e.reportError(new ReferenceError(`No value: ${l}`)),new Ft(l))}function vw(e,{name:l,attr:t,args:d}){const n=`-${l}`,a=e.bundle._terms.get(n);if(!a)return e.reportError(new ReferenceError(`Unknown term: ${n}`)),new Ft(n);if(t){const s=a.attributes[t];if(s){e.params=ab(e,d).named;const c=Hc(e,s);return e.params=null,c}return e.reportError(new ReferenceError(`Unknown attribute: ${t}`)),new Ft(`${n}.${t}`)}e.params=ab(e,d).named;const i=Hc(e,a.value);return e.params=null,i}function Kw(e,{name:l,args:t}){let d=e.bundle._functions[l];if(!d)return e.reportError(new ReferenceError(`Unknown function: ${l}()`)),new Ft(`${l}()`);if(typeof d!="function")return e.reportError(new TypeError(`Function ${l}() is not callable`)),new Ft(`${l}()`);try{let n=ab(e,t);return d(n.positional,n.named)}catch(n){return e.reportError(n),new Ft(`${l}()`)}}function fw(e,{selector:l,variants:t,star:d}){let n=qF(e,l);if(n instanceof Ft)return RT(e,t,d);for(const a of t){const i=qF(e,a.key);if(gw(e,n,i))return Hc(e,a.value)}return RT(e,t,d)}function NT(e,l){if(e.dirty.has(l))return e.reportError(new RangeError("Cyclic reference")),new Ft;e.dirty.add(l);const t=[],d=e.bundle._useIsolating&&l.length>1;for(const n of l){if(typeof n=="string"){t.push(e.bundle._transform(n));continue}if(e.placeables++,e.placeables>mT)throw e.dirty.delete(l),new RangeError(`Too many placeables expanded: ${e.placeables}, max allowed is ${mT}`);d&&t.push(Cw),t.push(qF(e,n).toString(e)),d&&t.push(xw)}return e.dirty.delete(l),t.join("")}function Hc(e,l){return typeof l=="string"?e.bundle._transform(l):NT(e,l)}class Hw{constructor(l,t,d){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=l,this.errors=t,this.args=d}reportError(l){if(!this.errors||!(l instanceof Error))throw l;this.errors.push(l)}memoizeIntlObject(l,t){let d=this.bundle._intls.get(l);d||(d={},this.bundle._intls.set(l,d));let n=JSON.stringify(t);return d[n]||(d[n]=new l(this.bundle.locales,t)),d[n]}}function qV(e,l){const t=Object.create(null);for(const[d,n]of Object.entries(e))l.includes(d)&&(t[d]=n.valueOf());return t}const bT=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function Pw(e,l){let t=e[0];if(t instanceof Ft)return new Ft(`NUMBER(${t.valueOf()})`);if(t instanceof rn)return new rn(t.valueOf(),{...t.opts,...qV(l,bT)});if(t instanceof _F)return new rn(t.valueOf(),{...qV(l,bT)});throw new TypeError("Invalid argument to NUMBER")}const uT=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function Aw(e,l){let t=e[0];if(t instanceof Ft)return new Ft(`DATETIME(${t.valueOf()})`);if(t instanceof _F)return new _F(t.valueOf(),{...t.opts,...qV(l,uT)});if(t instanceof rn)return new _F(t.valueOf(),{...qV(l,uT)});throw new TypeError("Invalid argument to DATETIME")}const rT=new Map;function _w(e){const l=Array.isArray(e)?e.join(" "):e;let t=rT.get(l);return t===void 0&&(t=new Map,rT.set(l,t)),t}class qw{constructor(l,{functions:t,useIsolating:d=!0,transform:n=a=>a}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(l)?l:[l],this._functions={NUMBER:Pw,DATETIME:Aw,...t},this._useIsolating=d,this._transform=n,this._intls=_w(l)}hasMessage(l){return this._messages.has(l)}getMessage(l){return this._messages.get(l)}addResource(l,{allowOverrides:t=!1}={}){const d=[];for(let n=0;n<l.body.length;n++){let a=l.body[n];if(a.id.startsWith("-")){if(t===!1&&this._terms.has(a.id)){d.push(new Error(`Attempt to override an existing term: "${a.id}"`));continue}this._terms.set(a.id,a)}else{if(t===!1&&this._messages.has(a.id)){d.push(new Error(`Attempt to override an existing message: "${a.id}"`));continue}this._messages.set(a.id,a)}}return d}formatPattern(l,t=null,d=null){if(typeof l=="string")return this._transform(l);let n=new Hw(this,d,t);try{return NT(n,l).toString(n)}catch(a){if(n.errors&&a instanceof Error)return n.errors.push(a),new Ft().toString(n);throw a}}}const ib=/^(-?[a-zA-Z][\w-]*) *= */gm,pT=/\.([a-zA-Z][\w-]*) *= */y,$w=/\*?\[/y,sb=/(-?[0-9]+(?:\.([0-9]+))?)/y,lE=/([a-zA-Z][\w-]*)/y,MT=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,tE=/^[A-Z][A-Z0-9_-]*$/,$V=/([^{}\n\r]+)/y,eE=/([^\\"\n\r]*)/y,ST=/\\([\\"])/y,JT=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,dE=/^\n+/,TT=/ +$/,nE=/ *\r?\n/g,aE=/( *)$/,iE=/{\s*/y,GT=/\s*}/y,sE=/\[\s*/y,cE=/\s*] */y,UE=/\s*\(\s*/y,ZE=/\s*->\s*/y,FE=/\s*:\s*/y,hE=/\s*,?\s*/y,oE=/\s+/y;class VE{constructor(l){this.body=[],ib.lastIndex=0;let t=0;for(;;){let X=ib.exec(l);if(X===null)break;t=ib.lastIndex;try{this.body.push(c(X[1]))}catch(L){if(L instanceof SyntaxError)continue;throw L}}function d(X){return X.lastIndex=t,X.test(l)}function n(X,L){if(l[t]===X)return t++,!0;if(L)throw new L(`Expected ${X}`);return!1}function a(X,L){if(d(X))return t=X.lastIndex,!0;if(L)throw new L(`Expected ${X.toString()}`);return!1}function i(X){X.lastIndex=t;let L=X.exec(l);if(L===null)throw new SyntaxError(`Expected ${X.toString()}`);return t=X.lastIndex,L}function s(X){return i(X)[1]}function c(X){let L=h(),D=F();if(L===null&&Object.keys(D).length===0)throw new SyntaxError("Expected message value or attributes");return{id:X,value:L,attributes:D}}function F(){let X=Object.create(null);for(;d(pT);){let L=s(pT),D=h();if(D===null)throw new SyntaxError("Expected attribute value");X[L]=D}return X}function h(){let X;if(d($V)&&(X=s($V)),l[t]==="{"||l[t]==="}")return o(X?[X]:[],1/0);let L=T();return L?X?o([X,L],L.length):(L.value=y(L.value,dE),o([L],L.length)):X?y(X,TT):null}function o(X=[],L){for(;;){if(d($V)){X.push(s($V));continue}if(l[t]==="{"){X.push(V());continue}if(l[t]==="}")throw new SyntaxError("Unbalanced closing brace");let P=T();if(P){X.push(P),L=Math.min(L,P.length);continue}break}let D=X.length-1,C=X[D];typeof C=="string"&&(X[D]=y(C,TT));let I=[];for(let P of X)P instanceof XT&&(P=P.value.slice(0,P.value.length-L)),P&&I.push(P);return I}function V(){a(iE,SyntaxError);let X=W();if(a(GT))return X;if(a(ZE)){let L=R();return a(GT,SyntaxError),{type:"select",selector:X,...L}}throw new SyntaxError("Unclosed placeable")}function W(){if(l[t]==="{")return V();if(d(MT)){let[,X,L,D=null]=i(MT);if(X==="$")return{type:"var",name:L};if(a(UE)){let C=Q();if(X==="-")return{type:"term",name:L,attr:D,args:C};if(tE.test(L))return{type:"func",name:L,args:C};throw new SyntaxError("Function names must be all upper-case")}return X==="-"?{type:"term",name:L,attr:D,args:[]}:{type:"mesg",name:L,attr:D}}return b()}function Q(){let X=[];for(;;){switch(l[t]){case")":return t++,X;case void 0:throw new SyntaxError("Unclosed argument list")}X.push(m()),a(hE)}}function m(){let X=W();return X.type!=="mesg"?X:a(FE)?{type:"narg",name:X.name,value:b()}:X}function R(){let X=[],L=0,D;for(;d($w);){n("*")&&(D=L);let C=r(),I=h();if(I===null)throw new SyntaxError("Expected variant value");X[L++]={key:C,value:I}}if(L===0)return null;if(D===void 0)throw new SyntaxError("Expected default variant");return{variants:X,star:D}}function r(){a(sE,SyntaxError);let X;return d(sb)?X=u():X={type:"str",value:s(lE)},a(cE,SyntaxError),X}function b(){if(d(sb))return u();if(l[t]==='"')return J();throw new SyntaxError("Invalid expression")}function u(){let[,X,L=""]=i(sb),D=L.length;return{type:"num",value:parseFloat(X),precision:D}}function J(){n('"',SyntaxError);let X="";for(;;){if(X+=s(eE),l[t]==="\\"){X+=G();continue}if(n('"'))return{type:"str",value:X};throw new SyntaxError("Unclosed string literal")}}function G(){if(d(ST))return s(ST);if(d(JT)){let[,X,L]=i(JT),D=parseInt(X||L,16);return D<=55295||57344<=D?String.fromCodePoint(D):"�"}throw new SyntaxError("Unknown escape sequence")}function T(){let X=t;switch(a(oE),l[t]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return k(l.slice(X,t))}return l[t-1]===" "?k(l.slice(X,t)):!1}function y(X,L){return X.replace(L,"")}function k(X){let L=X.replace(nE,`
61
+ `,e.contentWindow.document.head.appendChild(d),e.contentWindow.document.body.style.width="100%"}function gD(e){return new Promise(l=>{const t=document.createElement("iframe");t.width="0",t.height="0",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.border="none",t.style.overflow="hidden",t.onload=()=>l(t),e.appendChild(t)})}function jD(e,l){const t=URL.createObjectURL(new Blob([e],{type:"application/pdf"})),d=document.createElement("a");d.href=t,d.download=l,d.style.display="none",document.body.append(d),d.click(),setTimeout(()=>{URL.revokeObjectURL(t),document.body.removeChild(d)},1e3)}function wJ(e){for(;e!=null&&e.firstChild;)e.removeChild(e.firstChild)}function EJ(e){return e?Object.prototype.hasOwnProperty.call(e,"_pdfInfo"):!1}function EN(e){e==null||e.querySelectorAll("canvas").forEach(l=>{var t;l.width=1,l.height=1,(t=l.getContext("2d"))==null||t.clearRect(0,0,1,1)})}function CJ({onError:e,onPasswordRequest:l,onProgress:t,source:d}){const n=Z.shallowRef(null),a=Z.shallowRef(null);return Z.watchEffect(async()=>{const i=Z.toValue(d);if(i){if(EJ(i)){n.value=i;return}}else return;try{a.value=ED(i),l&&(a.value.onPassword=(s,c)=>{l({callback:s,isWrongPassword:c===DD.INCORRECT_PASSWORD})}),t&&(a.value.onProgress=t),n.value=await a.value.promise}catch(s){if(n.value=null,e)e(s);else throw s}}),Z.watch(n,(i,s)=>{s==null||s.destroy()}),Z.onBeforeUnmount(()=>{var i,s,c,F;(i=a.value)!=null&&i.onPassword&&(a.value.onPassword=null),(s=a.value)!=null&&s.onProgress&&(a.value.onProgress=null),(c=a.value)==null||c.destroy(),EJ(Z.toValue(d))||(F=n.value)==null||F.destroy()}),{doc:n}}var jF={};jF.d=(e,l)=>{for(var t in l)jF.o(l,t)&&!jF.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:l[t]})},jF.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l);var Al=globalThis.pdfjsViewer={};jF.d(Al,{AnnotationLayerBuilder:()=>hT,DownloadManager:()=>ww,EventBus:()=>QT,FindState:()=>ra,GenericL10n:()=>eW,LinkTarget:()=>wi,PDFFindController:()=>Mw,PDFHistory:()=>IE,PDFLinkService:()=>UT,PDFPageView:()=>dG,PDFScriptingManager:()=>AE,PDFSinglePageViewer:()=>lC,PDFViewer:()=>mG,ProgressBar:()=>tw,RenderingStates:()=>lt,ScrollMode:()=>Gl,SimpleLinkService:()=>lb,SpreadMode:()=>Pt,StructTreeLayerBuilder:()=>HT,TextLayerBuilder:()=>$T,XfaLayerBuilder:()=>lG,parseQueryString:()=>xV});const OD="auto",xJ=1,gJ=1.1,vD=.1,KD=10,CN=0,fD=1.25,jJ=40,OJ=5,lt={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},jc={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},xd={DISABLE:0,ENABLE:1,ENABLE_PERMISSIONS:2},Gl={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},Pt={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};function vJ(e,l,t=!1){let d=e.offsetParent;if(!d){console.error("offsetParent is not set -- cannot scroll");return}let n=e.offsetTop+e.clientTop,a=e.offsetLeft+e.clientLeft;for(;d.clientHeight===d.scrollHeight&&d.clientWidth===d.scrollWidth||t&&(d.classList.contains("markedContent")||getComputedStyle(d).overflow==="hidden");)if(n+=d.offsetTop,a+=d.offsetLeft,d=d.offsetParent,!d)return;l&&(l.top!==void 0&&(n+=l.top),l.left!==void 0&&(a+=l.left,d.scrollLeft=a)),d.scrollTop=n}function HD(e,l,t=void 0){const d=function(i){a||(a=window.requestAnimationFrame(function(){a=null;const s=e.scrollLeft,c=n.lastX;s!==c&&(n.right=s>c),n.lastX=s;const F=e.scrollTop,h=n.lastY;F!==h&&(n.down=F>h),n.lastY=F,l(n)}))},n={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:d};let a=null;return e.addEventListener("scroll",d,{useCapture:!0,signal:t}),t==null||t.addEventListener("abort",()=>window.cancelAnimationFrame(a),{once:!0}),n}function xV(e){const l=new Map;for(const[t,d]of new URLSearchParams(e))l.set(t.toLowerCase(),d);return l}const KJ=/[\x00-\x1F]/g;function OF(e,l=!1){return KJ.test(e)?l?e.replaceAll(KJ,t=>t==="\0"?"":" "):e.replaceAll("\0",""):e}function vF(e,l,t=0){let d=t,n=e.length-1;if(n<0||!l(e[n]))return e.length;if(l(e[d]))return d;for(;d<n;){const a=d+n>>1,i=e[a];l(i)?n=a:d=a+1}return d}function fJ(e){if(Math.floor(e)===e)return[e,1];const l=1/e,t=8;if(l>t)return[1,t];if(Math.floor(l)===l)return[1,l];const d=e>1?l:e;let n=0,a=1,i=1,s=1;for(;;){const F=n+i,h=a+s;if(h>t)break;d<=F/h?(i=F,s=h):(n=F,a=h)}let c;return d-n/a<i/s-d?c=d===e?[n,a]:[a,n]:c=d===e?[i,s]:[s,i],c}function gV(e,l){return e-e%l}function PD(e,l,t){if(e<2)return e;let d=l[e].div,n=d.offsetTop+d.clientTop;n>=t&&(d=l[e-1].div,n=d.offsetTop+d.clientTop);for(let a=e-2;a>=0&&(d=l[a].div,!(d.offsetTop+d.clientTop+d.clientHeight<=n));--a)e=a;return e}function AD({scrollEl:e,views:l,sortByVisibility:t=!1,horizontal:d=!1,rtl:n=!1}){const a=e.scrollTop,i=a+e.clientHeight,s=e.scrollLeft,c=s+e.clientWidth;function F(b){const u=b.div;return u.offsetTop+u.clientTop+u.clientHeight>a}function h(b){const u=b.div,J=u.offsetLeft+u.clientLeft,G=J+u.clientWidth;return n?J<c:G>s}const o=[],V=new Set,W=l.length;let Q=vF(l,d?h:F);Q>0&&Q<W&&!d&&(Q=PD(Q,l,a));let m=d?c:-1;for(let b=Q;b<W;b++){const u=l[b],J=u.div,G=J.offsetLeft+J.clientLeft,T=J.offsetTop+J.clientTop,y=J.clientWidth,k=J.clientHeight,X=G+y,L=T+k;if(m===-1)L>=i&&(m=L);else if((d?G:T)>m)break;if(L<=a||T>=i||X<=s||G>=c)continue;const D=Math.max(0,a-T)+Math.max(0,L-i),C=Math.max(0,s-G)+Math.max(0,X-c),I=(k-D)/k,H=(y-C)/y,f=I*H*100|0;o.push({id:u.id,x:G,y:T,view:u,percent:f,widthPercent:H*100|0}),V.add(u.id)}const R=o[0],r=o.at(-1);return t&&o.sort(function(b,u){const J=b.percent-u.percent;return Math.abs(J)>.001?-J:b.id-u.id}),{first:R,last:r,views:o,ids:V}}function HJ(e){return Number.isInteger(e)&&e%90===0}function _D(e){return Number.isInteger(e)&&Object.values(Gl).includes(e)&&e!==Gl.UNKNOWN}function qD(e){return Number.isInteger(e)&&Object.values(Pt).includes(e)&&e!==Pt.UNKNOWN}function PJ(e){return e.width<=e.height}new Promise(function(e){window.requestAnimationFrame(e)});const $D=document.documentElement.style;function lw(e,l,t){return Math.min(Math.max(e,l),t)}var Ii,Oc,Di,KF,vc;class tw{constructor(l){M(this,Ii,null),M(this,Oc,null),M(this,Di,0),M(this,KF,null),M(this,vc,!0),N(this,Ii,l.classList),N(this,KF,l.style)}get percent(){return U(this,Di)}set percent(l){if(N(this,Di,lw(l,0,100)),isNaN(l)){U(this,Ii).add("indeterminate");return}U(this,Ii).remove("indeterminate"),U(this,KF).setProperty("--progressBar-percent",`${U(this,Di)}%`)}setWidth(l){if(!l)return;const t=l.parentNode.offsetWidth-l.offsetWidth;t>0&&U(this,KF).setProperty("--progressBar-end-offset",`${t}px`)}setDisableAutoFetch(l=5e3){U(this,Di)===100||isNaN(U(this,Di))||(U(this,Oc)&&clearTimeout(U(this,Oc)),this.show(),N(this,Oc,setTimeout(()=>{N(this,Oc,null),this.hide()},l)))}hide(){U(this,vc)&&(N(this,vc,!1),U(this,Ii).add("hidden"))}show(){U(this,vc)||(N(this,vc,!0),U(this,Ii).remove("hidden"))}}Ii=new WeakMap,Oc=new WeakMap,Di=new WeakMap,KF=new WeakMap,vc=new WeakMap;function ew(e){let l=Gl.VERTICAL,t=Pt.NONE;switch(e){case"SinglePage":l=Gl.PAGE;break;case"OneColumn":break;case"TwoPageLeft":l=Gl.PAGE;case"TwoColumnLeft":t=Pt.ODD;break;case"TwoPageRight":l=Gl.PAGE;case"TwoColumnRight":t=Pt.EVEN;break}return{scrollMode:l,spreadMode:t}}const jV=function(){const e=document.createElement("div");return e.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)",e.style.width==="calc(1320px)"?Math.fround:l=>l}(),Ud={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};function dw(e){return e<11904}function nw(e){return(e&65408)===0}function aw(e){return e>=97&&e<=122||e>=65&&e<=90}function iw(e){return e>=48&&e<=57}function sw(e){return e===32||e===9||e===13||e===10}function cw(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}function Uw(e){return e>=12448&&e<=12543}function Zw(e){return e>=12352&&e<=12447}function Fw(e){return e>=65376&&e<=65439}function hw(e){return(e&65408)===3584}function OV(e){return dw(e)?nw(e)?sw(e)?Ud.SPACE:aw(e)||iw(e)||e===95?Ud.ALPHA_LETTER:Ud.PUNCT:hw(e)?Ud.THAI_LETTER:e===160?Ud.SPACE:Ud.ALPHA_LETTER:cw(e)?Ud.HAN_LETTER:Uw(e)?Ud.KATAKANA_LETTER:Zw(e)?Ud.HIRAGANA_LETTER:Fw(e)?Ud.HALFWIDTH_KATAKANA_LETTER:Ud.ALPHA_LETTER}let xN;function ow(){return xN||(xN=" ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩"),xN}const ra={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},Vw=250,Ww=-50,Qw=-400,AJ={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},_J=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let gN;const mw=new RegExp("\\p{M}+","gu"),Rw=new RegExp("([.*+?^${}()|[\\]\\\\])|(\\p{P})|(\\s+)|(\\p{M})|(\\p{L})","gu"),Nw=new RegExp("([^\\p{M}])\\p{M}*$","u"),bw=new RegExp("^\\p{M}*([^\\p{M}])","u"),uw=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,qJ=new Map,rw="[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]",$J=new Map;let jN=null,ON=null;function vN(e){const l=[];let t;for(;(t=uw.exec(e))!==null;){let{index:m}=t;for(const R of t[0]){let r=qJ.get(R);r||(r=R.normalize("NFD").length,qJ.set(R,r)),l.push([r,m++])}}let d;if(l.length===0&&jN)d=jN;else if(l.length>0&&ON)d=ON;else{const m=Object.keys(AJ).join(""),R=ow(),r=`([${m}])|([${R}])|((?:゙|゚)\\n)|(\\p{M}+(?:-\\n)?)|(\\p{Ll}-\\n\\p{Lu})|(\\S-\\n)|((?:\\p{Ideographic}|[぀-ヿ])\\n)|(\\n)`;l.length===0?d=jN=new RegExp(r+"|(\\u0000)","gum"):d=ON=new RegExp(r+`|(${rw})`,"gum")}const n=[];for(;(t=mw.exec(e))!==null;)n.push([t[0].length,t.index]);let a=e.normalize("NFD");const i=[0,0];let s=0,c=0,F=0,h=0,o=0,V=!1;a=a.replace(d,(m,R,r,b,u,J,G,T,y,k,X)=>{var L,D,C;if(X-=h,R){const I=AJ[R],H=I.length;for(let f=1;f<H;f++)i.push(X-F+f,F-f);return F-=H-1,I}if(r){let I=$J.get(r);I||(I=r.normalize("NFKC"),$J.set(r,I));const H=I.length;for(let f=1;f<H;f++)i.push(X-F+f,F-f);return F-=H-1,I}if(b)return V=!0,X+o===((L=n[s])==null?void 0:L[1])?++s:(i.push(X-1-F+1,F-1),F-=1,h+=1),i.push(X-F+1,F),h+=1,o+=1,b.charAt(0);if(u){const I=u.endsWith(`
62
+ `),H=I?u.length-2:u.length;V=!0;let f=H;X+o===((D=n[s])==null?void 0:D[1])&&(f-=n[s][0],++s);for(let Y=1;Y<=f;Y++)i.push(X-1-F+Y,F-Y);return F-=f,h+=f,I?(X+=H-1,i.push(X-F+1,1+F),F+=1,h+=1,o+=1,u.slice(0,H)):u}if(J)return h+=1,o+=1,J.replace(`
63
+ `,"");if(G){const I=G.length-2;return i.push(X-F+I,1+F),F+=1,h+=1,o+=1,G.slice(0,-2)}if(T){const I=T.length-1;return i.push(X-F+I,F),h+=1,o+=1,T.slice(0,-1)}if(y)return i.push(X-F+1,F-1),F-=1,h+=1,o+=1," ";if(X+o===((C=l[c])==null?void 0:C[1])){const I=l[c][0]-1;++c;for(let H=1;H<=I;H++)i.push(X-(F-H),F-H);F-=I,h+=I}return k}),i.push(a.length,F);const W=new Uint32Array(i.length>>1),Q=new Int32Array(i.length>>1);for(let m=0,R=i.length;m<R;m+=2)W[m>>1]=i[m],Q[m>>1]=i[m+1];return[a,[W,Q],V]}function pw(e,l,t){if(!e)return[l,t];const[d,n]=e,a=l,i=l+t-1;let s=vF(d,o=>o>=a);d[s]>a&&--s;let c=vF(d,o=>o>=i,s);d[c]>i&&--c;const F=a+n[s],h=i+n[c]+1-F;return[F,h]}var It,fF,Kc,bl,lT,KN,fN,tT,eT,HN,dT,nT,vV,HF,fc,aT,PN,AN,KV,iT,_N,qN,PF;class Mw{constructor({linkService:l,eventBus:t,updateMatchesCountOnProgress:d=!0}){M(this,bl),M(this,It,null),M(this,fF,!0),M(this,Kc,0),this._linkService=l,this._eventBus=t,N(this,fF,d),this.onIsPageVisible=null,p(this,bl,KN).call(this),t._on("find",p(this,bl,lT).bind(this)),t._on("findbarclose",p(this,bl,iT).bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return U(this,It)}setDocument(l){this._pdfDocument&&p(this,bl,KN).call(this),l&&(this._pdfDocument=l,this._firstPageCapability.resolve())}scrollMatchIntoView({element:l=null,selectedLeft:t=0,pageIndex:d=-1,matchIndex:n=-1}){if(!this._scrollMatches||!l||n===-1||n!==this._selected.matchIdx||d===-1||d!==this._selected.pageIdx)return;this._scrollMatches=!1;const a={top:Ww,left:t+Qw};vJ(l,a,!0)}match(l,t,d){const n=this._hasDiacritics[d];let a=!1;if(typeof l=="string"?[a,l]=p(this,bl,HN).call(this,l,n):l=l.sort().reverse().map(o=>{const[V,W]=p(this,bl,HN).call(this,o,n);return a||(a=V),`(${W})`}).join("|"),!l)return;const{caseSensitive:i,entireWord:s}=U(this,It),c=`g${a?"u":""}${i?"":"i"}`;l=new RegExp(l,c);const F=[];let h;for(;(h=l.exec(t))!==null;)s&&!p(this,bl,eT).call(this,t,h.index,h[0].length)||F.push({index:h.index,length:h[0].length});return F}}It=new WeakMap,fF=new WeakMap,Kc=new WeakMap,bl=new WeakSet,lT=function(e){if(!e)return;const l=this._pdfDocument,{type:t}=e;(U(this,It)===null||p(this,bl,tT).call(this,e))&&(this._dirtyMatch=!0),N(this,It,e),t!=="highlightallchange"&&p(this,bl,PF).call(this,ra.PENDING),this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||l&&this._pdfDocument!==l)return;p(this,bl,nT).call(this);const d=!this._highlightMatches,n=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),t?this._dirtyMatch?p(this,bl,fc).call(this):t==="again"?(p(this,bl,fc).call(this),d&&U(this,It).highlightAll&&p(this,bl,HF).call(this)):t==="highlightallchange"?(n?p(this,bl,fc).call(this):this._highlightMatches=!0,p(this,bl,HF).call(this)):p(this,bl,fc).call(this):this._findTimeout=setTimeout(()=>{p(this,bl,fc).call(this),this._findTimeout=null},Vw)})},KN=function(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],N(this,Kc,0),N(this,It,null),this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=Promise.withResolvers()},fN=function(){const{query:e}=U(this,It);return typeof e=="string"?(e!==this._rawQuery&&(this._rawQuery=e,[this._normalizedQuery]=vN(e)),this._normalizedQuery):(e||[]).filter(l=>!!l).map(l=>vN(l)[0])},tT=function(e){var l;const t=e.query,d=U(this,It).query,n=typeof t;if(n!==typeof d)return!0;if(n==="string"){if(t!==d)return!0}else if(JSON.stringify(t)!==JSON.stringify(d))return!0;switch(e.type){case"again":const a=this._selected.pageIdx+1,i=this._linkService;return a>=1&&a<=i.pagesCount&&a!==i.page&&!(((l=this.onIsPageVisible)==null?void 0:l.call(this,a))??!0);case"highlightallchange":return!1}return!0},eT=function(e,l,t){let d=e.slice(0,l).match(Nw);if(d){const n=e.charCodeAt(l),a=d[1].charCodeAt(0);if(OV(n)===OV(a))return!1}if(d=e.slice(l+t).match(bw),d){const n=e.charCodeAt(l+t-1),a=d[1].charCodeAt(0);if(OV(n)===OV(a))return!1}return!0},HN=function(e,l){const{matchDiacritics:t}=U(this,It);let d=!1;e=e.replaceAll(Rw,(a,i,s,c,F,h)=>i?`[ ]*\\${i}[ ]*`:s?`[ ]*${s}[ ]*`:c?"[ ]+":t?F||h:F?_J.has(F.charCodeAt(0))?F:"":l?(d=!0,`${h}\\p{M}*`):h);const n="[ ]*";return e.endsWith(n)&&(e=e.slice(0,e.length-n.length)),t&&l&&(gN||(gN=String.fromCharCode(..._J)),d=!0,e=`${e}(?=[${gN}]|[^\\p{M}]|$)`),[d,e]},dT=function(e){const l=U(this,bl,fN);if(l.length===0)return;const t=this._pageContents[e],d=this.match(l,t,e),n=this._pageMatches[e]=[],a=this._pageMatchesLength[e]=[],i=this._pageDiffs[e];d==null||d.forEach(({index:c,length:F})=>{const[h,o]=pw(i,c,F);o&&(n.push(h),a.push(o))}),U(this,It).highlightAll&&p(this,bl,vV).call(this,e),this._resumePageIdx===e&&(this._resumePageIdx=null,p(this,bl,PN).call(this));const s=n.length;this._matchesCountTotal+=s,U(this,fF)?s>0&&p(this,bl,qN).call(this):++le(this,Kc)._===this._linkService.pagesCount&&p(this,bl,qN).call(this)},nT=function(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();const l={disableNormalization:!0};for(let t=0,d=this._linkService.pagesCount;t<d;t++){const{promise:n,resolve:a}=Promise.withResolvers();this._extractTextPromises[t]=n,e=e.then(()=>this._pdfDocument.getPage(t+1).then(i=>i.getTextContent(l)).then(i=>{const s=[];for(const c of i.items)s.push(c.str),c.hasEOL&&s.push(`
64
+ `);[this._pageContents[t],this._pageDiffs[t],this._hasDiacritics[t]]=vN(s.join("")),a()},i=>{console.error(`Unable to get text content for page ${t+1}`,i),this._pageContents[t]="",this._pageDiffs[t]=null,this._hasDiacritics[t]=!1,a()}))}},vV=function(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})},HF=function(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})},fc=function(){const e=U(this,It).findPrevious,l=this._linkService.page-1,t=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=l,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,N(this,Kc,0),this._matchesCountTotal=0,p(this,bl,HF).call(this);for(let n=0;n<t;n++)this._pendingFindMatches.has(n)||(this._pendingFindMatches.add(n),this._extractTextPromises[n].then(()=>{this._pendingFindMatches.delete(n),p(this,bl,dT).call(this,n)}))}if(U(this,bl,fN).length===0){p(this,bl,PF).call(this,ra.FOUND);return}if(this._resumePageIdx)return;const d=this._offset;if(this._pagesToSearch=t,d.matchIdx!==null){const n=this._pageMatches[d.pageIdx].length;if(!e&&d.matchIdx+1<n||e&&d.matchIdx>0){d.matchIdx=e?d.matchIdx-1:d.matchIdx+1,p(this,bl,KV).call(this,!0);return}p(this,bl,AN).call(this,e)}p(this,bl,PN).call(this)},aT=function(e){const l=this._offset,t=e.length,d=U(this,It).findPrevious;return t?(l.matchIdx=d?t-1:0,p(this,bl,KV).call(this,!0),!0):(p(this,bl,AN).call(this,d),l.wrapped&&(l.matchIdx=null,this._pagesToSearch<0)?(p(this,bl,KV).call(this,!1),!0):!1)},PN=function(){this._resumePageIdx!==null&&console.error("There can only be one pending page.");let e=null;do{const l=this._offset.pageIdx;if(e=this._pageMatches[l],!e){this._resumePageIdx=l;break}}while(!p(this,bl,aT).call(this,e))},AN=function(e){const l=this._offset,t=this._linkService.pagesCount;l.pageIdx=e?l.pageIdx-1:l.pageIdx+1,l.matchIdx=null,this._pagesToSearch--,(l.pageIdx>=t||l.pageIdx<0)&&(l.pageIdx=e?t-1:0,l.wrapped=!0)},KV=function(e=!1){let l=ra.NOT_FOUND;const t=this._offset.wrapped;if(this._offset.wrapped=!1,e){const d=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,l=t?ra.WRAPPED:ra.FOUND,d!==-1&&d!==this._selected.pageIdx&&p(this,bl,vV).call(this,d)}p(this,bl,PF).call(this,l,U(this,It).findPrevious),this._selected.pageIdx!==-1&&(this._scrollMatches=!0,p(this,bl,vV).call(this,this._selected.pageIdx))},iT=function(e){const l=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||l&&this._pdfDocument!==l||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),p(this,bl,PF).call(this,ra.FOUND),this._highlightMatches=!1,p(this,bl,HF).call(this))})},_N=function(){var e;const{pageIdx:l,matchIdx:t}=this._selected;let d=0,n=this._matchesCountTotal;if(t!==-1){for(let a=0;a<l;a++)d+=((e=this._pageMatches[a])==null?void 0:e.length)||0;d+=t+1}return(d<1||d>n)&&(d=n=0),{current:d,total:n}},qN=function(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:p(this,bl,_N).call(this)})},PF=function(e,l=!1){var t,d;!U(this,fF)&&(U(this,Kc)!==this._linkService.pagesCount||e===ra.PENDING)||this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:l,entireWord:((t=U(this,It))==null?void 0:t.entireWord)??null,matchesCount:p(this,bl,_N).call(this),rawQuery:((d=U(this,It))==null?void 0:d.query)??null})};const Sw="noopener noreferrer nofollow",wi={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};var $N,sT;const cT=class uy{constructor({eventBus:l,externalLinkTarget:t=null,externalLinkRel:d=null,ignoreDestinationZoom:n=!1}={}){hl(this,"externalLinkEnabled",!0),this.eventBus=l,this.externalLinkTarget=t,this.externalLinkRel=d,this._ignoreDestinationZoom=n,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(l,t=null){this.baseUrl=t,this.pdfDocument=l}setViewer(l){this.pdfViewer=l}setHistory(l){this.pdfHistory=l}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfDocument?this.pdfViewer.currentPageNumber:1}set page(l){this.pdfDocument&&(this.pdfViewer.currentPageNumber=l)}get rotation(){return this.pdfDocument?this.pdfViewer.pagesRotation:0}set rotation(l){this.pdfDocument&&(this.pdfViewer.pagesRotation=l)}get isInPresentationMode(){return this.pdfDocument?this.pdfViewer.isInPresentationMode:!1}async goToDestination(l){if(!this.pdfDocument)return;let t,d,n;if(typeof l=="string"?(t=l,d=await this.pdfDocument.getDestination(l)):(t=null,d=await l),!Array.isArray(d)){console.error(`goToDestination: "${d}" is not a valid destination array, for dest="${l}".`);return}const[a]=d;if(a&&typeof a=="object"){if(n=this.pdfDocument.cachedPageNumber(a),!n)try{n=await this.pdfDocument.getPageIndex(a)+1}catch{console.error(`goToDestination: "${a}" is not a valid page reference, for dest="${l}".`);return}}else Number.isInteger(a)&&(n=a+1);if(!n||n<1||n>this.pagesCount){console.error(`goToDestination: "${n}" is not a valid page number, for dest="${l}".`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:t,explicitDest:d,pageNumber:n})),this.pdfViewer.scrollPageIntoView({pageNumber:n,destArray:d,ignoreDestinationZoom:this._ignoreDestinationZoom})}goToPage(l){if(!this.pdfDocument)return;const t=typeof l=="string"&&this.pdfViewer.pageLabelToPageNumber(l)||l|0;if(!(Number.isInteger(t)&&t>0&&t<=this.pagesCount)){console.error(`PDFLinkService.goToPage: "${l}" is not a valid page.`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(t)),this.pdfViewer.scrollPageIntoView({pageNumber:t})}addLinkAttributes(l,t,d=!1){if(!t||typeof t!="string")throw new Error('A valid "url" parameter must provided.');const n=d?wi.BLANK:this.externalLinkTarget,a=this.externalLinkRel;this.externalLinkEnabled?l.href=l.title=t:(l.href="",l.title=`Disabled: ${t}`,l.onclick=()=>!1);let i="";switch(n){case wi.NONE:break;case wi.SELF:i="_self";break;case wi.BLANK:i="_blank";break;case wi.PARENT:i="_parent";break;case wi.TOP:i="_top";break}l.target=i,l.rel=typeof a=="string"?a:Sw}getDestinationHash(l){if(typeof l=="string"){if(l.length>0)return this.getAnchorUrl("#"+escape(l))}else if(Array.isArray(l)){const t=JSON.stringify(l);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(l){return this.baseUrl?this.baseUrl+l:l}setHash(l){var t;if(!this.pdfDocument)return;let d,n;if(l.includes("=")){const a=xV(l);if(a.has("search")){const i=a.get("search").replaceAll('"',""),s=a.get("phrase")==="true";this.eventBus.dispatch("findfromurlhash",{source:this,query:s?i:i.match(/\S+/g)})}if(a.has("page")&&(d=a.get("page")|0||1),a.has("zoom")){const i=a.get("zoom").split(","),s=i[0],c=parseFloat(s);s.includes("Fit")?s==="Fit"||s==="FitB"?n=[null,{name:s}]:s==="FitH"||s==="FitBH"||s==="FitV"||s==="FitBV"?n=[null,{name:s},i.length>1?i[1]|0:null]:s==="FitR"?i.length!==5?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):n=[null,{name:s},i[1]|0,i[2]|0,i[3]|0,i[4]|0]:console.error(`PDFLinkService.setHash: "${s}" is not a valid zoom value.`):n=[null,{name:"XYZ"},i.length>1?i[1]|0:null,i.length>2?i[2]|0:null,c?c/100:s]}n?this.pdfViewer.scrollPageIntoView({pageNumber:d||this.page,destArray:n,allowNegativeOffset:!0}):d&&(this.page=d),a.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:a.get("pagemode")}),a.has("nameddest")&&this.goToDestination(a.get("nameddest"));return}n=unescape(l);try{n=JSON.parse(n),Array.isArray(n)||(n=n.toString())}catch{}if(typeof n=="string"||p(t=uy,$N,sT).call(t,n)){this.goToDestination(n);return}console.error(`PDFLinkService.setHash: "${unescape(l)}" is not a valid destination.`)}executeNamedAction(l){var t,d;if(this.pdfDocument){switch(l){case"GoBack":(t=this.pdfHistory)==null||t.back();break;case"GoForward":(d=this.pdfHistory)==null||d.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1;break}this.eventBus.dispatch("namedaction",{source:this,action:l})}}async executeSetOCGState(l){if(!this.pdfDocument)return;const t=this.pdfDocument,d=await this.pdfViewer.optionalContentConfigPromise;t===this.pdfDocument&&(d.setOCGState(l),this.pdfViewer.optionalContentConfigPromise=Promise.resolve(d))}};$N=new WeakSet,sT=function(e){if(!Array.isArray(e)||e.length<2)return!1;const[l,t,...d]=e;if(!(typeof l=="object"&&Number.isInteger(l==null?void 0:l.num)&&Number.isInteger(l==null?void 0:l.gen))&&!Number.isInteger(l)||!(typeof t=="object"&&typeof(t==null?void 0:t.name)=="string"))return!1;const n=d.length;let a=!0;switch(t.name){case"XYZ":if(n<2||n>3)return!1;break;case"Fit":case"FitB":return n===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(n>1)return!1;break;case"FitR":if(n!==4)return!1;a=!1;break;default:return!1}for(const i of d)if(!(typeof i=="number"||a&&i===null))return!1;return!0},M(cT,$N);let UT=cT;class lb extends UT{setDocument(l,t=null){}}const{AbortException:Jw,AnnotationEditorLayer:Tw,AnnotationEditorParamsType:a3,AnnotationEditorType:Ge,AnnotationEditorUIManager:Gw,AnnotationLayer:Xw,AnnotationMode:bn,build:i3,ColorPicker:s3,createValidAbsoluteUrl:yw,DOMSVGFactory:c3,DrawLayer:Bw,FeatureTest:U3,fetchData:ZT,getDocument:Z3,getFilenameFromUrl:F3,getPdfFilenameFromUrl:Yw,getXfaPageViewport:h3,GlobalWorkerOptions:o3,ImageKind:V3,InvalidPDFException:W3,isDataScheme:Q3,isPdfFile:kw,MissingPDFException:m3,noContextMenu:R3,normalizeUnicode:zw,OPS:N3,OutputScale:Lw,PasswordResponses:b3,PDFDataRangeTransport:u3,PDFDateString:r3,PDFWorker:p3,PermissionFlag:fV,PixelsPerInch:un,RenderingCancelledException:tb,setLayerDimensions:Iw,shadow:HV,stopEvent:eb,TextLayer:Dw,TouchManager:M3,UnexpectedResponseException:S3,Util:J3,VerbosityLevel:T3,version:FT,XfaLayer:db}=globalThis.pdfjsLib;var PV,Ei,AV,nb;class hT{constructor({pdfPage:l,linkService:t,downloadManager:d,annotationStorage:n=null,imageResourcesPath:a="",renderForms:i=!0,enableScripting:s=!1,hasJSActionsPromise:c=null,fieldObjectsPromise:F=null,annotationCanvasMap:h=null,accessibilityManager:o=null,annotationEditorUIManager:V=null,onAppend:W=null}){M(this,AV),M(this,PV,null),M(this,Ei,null),this.pdfPage=l,this.linkService=t,this.downloadManager=d,this.imageResourcesPath=a,this.renderForms=i,this.annotationStorage=n,this.enableScripting=s,this._hasJSActionsPromise=c||Promise.resolve(!1),this._fieldObjectsPromise=F||Promise.resolve(null),this._annotationCanvasMap=h,this._accessibilityManager=o,this._annotationEditorUIManager=V,N(this,PV,W),this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=t.eventBus}async render(l,t,d="display"){var n,a;if(this.div){if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:l.clone({dontFlip:!0})});return}const[i,s,c]=await Promise.all([this.pdfPage.getAnnotations({intent:d}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;const F=this.div=document.createElement("div");if(F.className="annotationLayer",(n=U(this,PV))==null||n.call(this,F),i.length===0){this.hide();return}this.annotationLayer=new Xw({div:F,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,page:this.pdfPage,viewport:l.clone({dontFlip:!0}),structTreeLayer:(t==null?void 0:t.structTreeLayer)||null}),await this.annotationLayer.render({annotations:i,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:s,fieldObjects:c}),this.linkService.isInPresentationMode&&p(this,AV,nb).call(this,jc.FULLSCREEN),U(this,Ei)||(N(this,Ei,new AbortController),(a=this._eventBus)==null||a._on("presentationmodechanged",h=>{p(this,AV,nb).call(this,h.state)},{signal:U(this,Ei).signal}))}cancel(){var l;this._cancelled=!0,(l=U(this,Ei))==null||l.abort(),N(this,Ei,null)}hide(){this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){var l;return!!((l=this.annotationLayer)!=null&&l.hasEditableAnnotations())}}PV=new WeakMap,Ei=new WeakMap,AV=new WeakSet,nb=function(e){if(!this.div)return;let l=!1;switch(e){case jc.FULLSCREEN:l=!0;break;case jc.NORMAL:break;default:return}for(const t of this.div.childNodes)t.hasAttribute("data-internal-link")||(t.inert=l)};function oT(e,l){const t=document.createElement("a");if(!t.click)throw new Error('DownloadManager: "a.click()" is not supported.');t.href=e,t.target="_parent","download"in t&&(t.download=l),(document.body||document.documentElement).append(t),t.click(),t.remove()}var VT;class ww{constructor(){M(this,VT,new WeakMap)}downloadData(l,t,d){const n=URL.createObjectURL(new Blob([l],{type:d}));oT(n,t)}openOrDownloadData(l,t,d=null){const n=kw(t)?"application/pdf":"";return this.downloadData(l,t,n),!1}download(l,t,d){let n;if(l)n=URL.createObjectURL(new Blob([l],{type:"application/pdf"}));else{if(!yw(t,"http://example.com")){console.error(`download - not a valid URL: ${t}`);return}n=t+"#pdfjs.action=download"}oT(n,d)}}VT=new WeakMap;const WT={EVENT:"event",TIMEOUT:"timeout"};async function Ew({target:e,name:l,delay:t=0}){if(typeof e!="object"||!(Number.isInteger(t)&&t>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");const{promise:d,resolve:n}=Promise.withResolvers(),a=new AbortController;function i(F){a.abort(),clearTimeout(c),n(F)}const s=e instanceof QT?"_on":"addEventListener";e[s](l,i.bind(null,WT.EVENT),{signal:a.signal});const c=setTimeout(i.bind(null,WT.TIMEOUT),t);return d}var AF;class QT{constructor(){M(this,AF,Object.create(null))}on(l,t,d=null){this._on(l,t,{external:!0,once:d==null?void 0:d.once,signal:d==null?void 0:d.signal})}off(l,t,d=null){this._off(l,t)}dispatch(l,t){const d=U(this,AF)[l];if(!d||d.length===0)return;let n;for(const{listener:a,external:i,once:s}of d.slice(0)){if(s&&this._off(l,a),i){(n||(n=[])).push(a);continue}a(t)}if(n){for(const a of n)a(t);n=null}}_on(l,t,d=null){var n;let a=null;if((d==null?void 0:d.signal)instanceof AbortSignal){const{signal:i}=d;if(i.aborted){console.error("Cannot use an `aborted` signal.");return}const s=()=>this._off(l,t);a=()=>i.removeEventListener("abort",s),i.addEventListener("abort",s)}((n=U(this,AF))[l]||(n[l]=[])).push({listener:t,external:(d==null?void 0:d.external)===!0,once:(d==null?void 0:d.once)===!0,rmAbort:a})}_off(l,t,d=null){var n;const a=U(this,AF)[l];if(a)for(let i=0,s=a.length;i<s;i++){const c=a[i];if(c.listener===t){(n=c.rmAbort)==null||n.call(c),a.splice(i,1);return}}}}AF=new WeakMap;class _V{constructor(l){this.value=l}valueOf(){return this.value}}class Ft extends _V{constructor(l="???"){super(l)}toString(l){return`{${this.value}}`}}class rn extends _V{constructor(l,t={}){super(l),this.opts=t}toString(l){try{return l.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(t){return l.reportError(t),this.value.toString(10)}}}class _F extends _V{constructor(l,t={}){super(l),this.opts=t}toString(l){try{return l.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(t){return l.reportError(t),new Date(this.value).toISOString()}}}const mT=100,Cw="⁨",xw="⁩";function gw(e,l,t){if(t===l||t instanceof rn&&l instanceof rn&&t.value===l.value)return!0;if(l instanceof rn&&typeof t=="string"){let d=e.memoizeIntlObject(Intl.PluralRules,l.opts).select(l.value);if(t===d)return!0}return!1}function RT(e,l,t){return l[t]?Hc(e,l[t].value):(e.reportError(new RangeError("No default")),new Ft)}function ab(e,l){const t=[],d=Object.create(null);for(const n of l)n.type==="narg"?d[n.name]=qF(e,n.value):t.push(qF(e,n));return{positional:t,named:d}}function qF(e,l){switch(l.type){case"str":return l.value;case"num":return new rn(l.value,{minimumFractionDigits:l.precision});case"var":return jw(e,l);case"mesg":return Ow(e,l);case"term":return vw(e,l);case"func":return Kw(e,l);case"select":return fw(e,l);default:return new Ft}}function jw(e,{name:l}){let t;if(e.params)if(Object.prototype.hasOwnProperty.call(e.params,l))t=e.params[l];else return new Ft(`$${l}`);else if(e.args&&Object.prototype.hasOwnProperty.call(e.args,l))t=e.args[l];else return e.reportError(new ReferenceError(`Unknown variable: $${l}`)),new Ft(`$${l}`);if(t instanceof _V)return t;switch(typeof t){case"string":return t;case"number":return new rn(t);case"object":if(t instanceof Date)return new _F(t.getTime());default:return e.reportError(new TypeError(`Variable type not supported: $${l}, ${typeof t}`)),new Ft(`$${l}`)}}function Ow(e,{name:l,attr:t}){const d=e.bundle._messages.get(l);if(!d)return e.reportError(new ReferenceError(`Unknown message: ${l}`)),new Ft(l);if(t){const n=d.attributes[t];return n?Hc(e,n):(e.reportError(new ReferenceError(`Unknown attribute: ${t}`)),new Ft(`${l}.${t}`))}return d.value?Hc(e,d.value):(e.reportError(new ReferenceError(`No value: ${l}`)),new Ft(l))}function vw(e,{name:l,attr:t,args:d}){const n=`-${l}`,a=e.bundle._terms.get(n);if(!a)return e.reportError(new ReferenceError(`Unknown term: ${n}`)),new Ft(n);if(t){const s=a.attributes[t];if(s){e.params=ab(e,d).named;const c=Hc(e,s);return e.params=null,c}return e.reportError(new ReferenceError(`Unknown attribute: ${t}`)),new Ft(`${n}.${t}`)}e.params=ab(e,d).named;const i=Hc(e,a.value);return e.params=null,i}function Kw(e,{name:l,args:t}){let d=e.bundle._functions[l];if(!d)return e.reportError(new ReferenceError(`Unknown function: ${l}()`)),new Ft(`${l}()`);if(typeof d!="function")return e.reportError(new TypeError(`Function ${l}() is not callable`)),new Ft(`${l}()`);try{let n=ab(e,t);return d(n.positional,n.named)}catch(n){return e.reportError(n),new Ft(`${l}()`)}}function fw(e,{selector:l,variants:t,star:d}){let n=qF(e,l);if(n instanceof Ft)return RT(e,t,d);for(const a of t){const i=qF(e,a.key);if(gw(e,n,i))return Hc(e,a.value)}return RT(e,t,d)}function NT(e,l){if(e.dirty.has(l))return e.reportError(new RangeError("Cyclic reference")),new Ft;e.dirty.add(l);const t=[],d=e.bundle._useIsolating&&l.length>1;for(const n of l){if(typeof n=="string"){t.push(e.bundle._transform(n));continue}if(e.placeables++,e.placeables>mT)throw e.dirty.delete(l),new RangeError(`Too many placeables expanded: ${e.placeables}, max allowed is ${mT}`);d&&t.push(Cw),t.push(qF(e,n).toString(e)),d&&t.push(xw)}return e.dirty.delete(l),t.join("")}function Hc(e,l){return typeof l=="string"?e.bundle._transform(l):NT(e,l)}class Hw{constructor(l,t,d){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=l,this.errors=t,this.args=d}reportError(l){if(!this.errors||!(l instanceof Error))throw l;this.errors.push(l)}memoizeIntlObject(l,t){let d=this.bundle._intls.get(l);d||(d={},this.bundle._intls.set(l,d));let n=JSON.stringify(t);return d[n]||(d[n]=new l(this.bundle.locales,t)),d[n]}}function qV(e,l){const t=Object.create(null);for(const[d,n]of Object.entries(e))l.includes(d)&&(t[d]=n.valueOf());return t}const bT=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function Pw(e,l){let t=e[0];if(t instanceof Ft)return new Ft(`NUMBER(${t.valueOf()})`);if(t instanceof rn)return new rn(t.valueOf(),{...t.opts,...qV(l,bT)});if(t instanceof _F)return new rn(t.valueOf(),{...qV(l,bT)});throw new TypeError("Invalid argument to NUMBER")}const uT=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function Aw(e,l){let t=e[0];if(t instanceof Ft)return new Ft(`DATETIME(${t.valueOf()})`);if(t instanceof _F)return new _F(t.valueOf(),{...t.opts,...qV(l,uT)});if(t instanceof rn)return new _F(t.valueOf(),{...qV(l,uT)});throw new TypeError("Invalid argument to DATETIME")}const rT=new Map;function _w(e){const l=Array.isArray(e)?e.join(" "):e;let t=rT.get(l);return t===void 0&&(t=new Map,rT.set(l,t)),t}class qw{constructor(l,{functions:t,useIsolating:d=!0,transform:n=a=>a}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(l)?l:[l],this._functions={NUMBER:Pw,DATETIME:Aw,...t},this._useIsolating=d,this._transform=n,this._intls=_w(l)}hasMessage(l){return this._messages.has(l)}getMessage(l){return this._messages.get(l)}addResource(l,{allowOverrides:t=!1}={}){const d=[];for(let n=0;n<l.body.length;n++){let a=l.body[n];if(a.id.startsWith("-")){if(t===!1&&this._terms.has(a.id)){d.push(new Error(`Attempt to override an existing term: "${a.id}"`));continue}this._terms.set(a.id,a)}else{if(t===!1&&this._messages.has(a.id)){d.push(new Error(`Attempt to override an existing message: "${a.id}"`));continue}this._messages.set(a.id,a)}}return d}formatPattern(l,t=null,d=null){if(typeof l=="string")return this._transform(l);let n=new Hw(this,d,t);try{return NT(n,l).toString(n)}catch(a){if(n.errors&&a instanceof Error)return n.errors.push(a),new Ft().toString(n);throw a}}}const ib=/^(-?[a-zA-Z][\w-]*) *= */gm,pT=/\.([a-zA-Z][\w-]*) *= */y,$w=/\*?\[/y,sb=/(-?[0-9]+(?:\.([0-9]+))?)/y,lE=/([a-zA-Z][\w-]*)/y,MT=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,tE=/^[A-Z][A-Z0-9_-]*$/,$V=/([^{}\n\r]+)/y,eE=/([^\\"\n\r]*)/y,ST=/\\([\\"])/y,JT=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,dE=/^\n+/,TT=/ +$/,nE=/ *\r?\n/g,aE=/( *)$/,iE=/{\s*/y,GT=/\s*}/y,sE=/\[\s*/y,cE=/\s*] */y,UE=/\s*\(\s*/y,ZE=/\s*->\s*/y,FE=/\s*:\s*/y,hE=/\s*,?\s*/y,oE=/\s+/y;class VE{constructor(l){this.body=[],ib.lastIndex=0;let t=0;for(;;){let X=ib.exec(l);if(X===null)break;t=ib.lastIndex;try{this.body.push(c(X[1]))}catch(L){if(L instanceof SyntaxError)continue;throw L}}function d(X){return X.lastIndex=t,X.test(l)}function n(X,L){if(l[t]===X)return t++,!0;if(L)throw new L(`Expected ${X}`);return!1}function a(X,L){if(d(X))return t=X.lastIndex,!0;if(L)throw new L(`Expected ${X.toString()}`);return!1}function i(X){X.lastIndex=t;let L=X.exec(l);if(L===null)throw new SyntaxError(`Expected ${X.toString()}`);return t=X.lastIndex,L}function s(X){return i(X)[1]}function c(X){let L=h(),D=F();if(L===null&&Object.keys(D).length===0)throw new SyntaxError("Expected message value or attributes");return{id:X,value:L,attributes:D}}function F(){let X=Object.create(null);for(;d(pT);){let L=s(pT),D=h();if(D===null)throw new SyntaxError("Expected attribute value");X[L]=D}return X}function h(){let X;if(d($V)&&(X=s($V)),l[t]==="{"||l[t]==="}")return o(X?[X]:[],1/0);let L=T();return L?X?o([X,L],L.length):(L.value=y(L.value,dE),o([L],L.length)):X?y(X,TT):null}function o(X=[],L){for(;;){if(d($V)){X.push(s($V));continue}if(l[t]==="{"){X.push(V());continue}if(l[t]==="}")throw new SyntaxError("Unbalanced closing brace");let H=T();if(H){X.push(H),L=Math.min(L,H.length);continue}break}let D=X.length-1,C=X[D];typeof C=="string"&&(X[D]=y(C,TT));let I=[];for(let H of X)H instanceof XT&&(H=H.value.slice(0,H.value.length-L)),H&&I.push(H);return I}function V(){a(iE,SyntaxError);let X=W();if(a(GT))return X;if(a(ZE)){let L=R();return a(GT,SyntaxError),{type:"select",selector:X,...L}}throw new SyntaxError("Unclosed placeable")}function W(){if(l[t]==="{")return V();if(d(MT)){let[,X,L,D=null]=i(MT);if(X==="$")return{type:"var",name:L};if(a(UE)){let C=Q();if(X==="-")return{type:"term",name:L,attr:D,args:C};if(tE.test(L))return{type:"func",name:L,args:C};throw new SyntaxError("Function names must be all upper-case")}return X==="-"?{type:"term",name:L,attr:D,args:[]}:{type:"mesg",name:L,attr:D}}return b()}function Q(){let X=[];for(;;){switch(l[t]){case")":return t++,X;case void 0:throw new SyntaxError("Unclosed argument list")}X.push(m()),a(hE)}}function m(){let X=W();return X.type!=="mesg"?X:a(FE)?{type:"narg",name:X.name,value:b()}:X}function R(){let X=[],L=0,D;for(;d($w);){n("*")&&(D=L);let C=r(),I=h();if(I===null)throw new SyntaxError("Expected variant value");X[L++]={key:C,value:I}}if(L===0)return null;if(D===void 0)throw new SyntaxError("Expected default variant");return{variants:X,star:D}}function r(){a(sE,SyntaxError);let X;return d(sb)?X=u():X={type:"str",value:s(lE)},a(cE,SyntaxError),X}function b(){if(d(sb))return u();if(l[t]==='"')return J();throw new SyntaxError("Invalid expression")}function u(){let[,X,L=""]=i(sb),D=L.length;return{type:"num",value:parseFloat(X),precision:D}}function J(){n('"',SyntaxError);let X="";for(;;){if(X+=s(eE),l[t]==="\\"){X+=G();continue}if(n('"'))return{type:"str",value:X};throw new SyntaxError("Unclosed string literal")}}function G(){if(d(ST))return s(ST);if(d(JT)){let[,X,L]=i(JT),D=parseInt(X||L,16);return D<=55295||57344<=D?String.fromCodePoint(D):"�"}throw new SyntaxError("Unknown escape sequence")}function T(){let X=t;switch(a(oE),l[t]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return k(l.slice(X,t))}return l[t-1]===" "?k(l.slice(X,t)):!1}function y(X,L){return X.replace(L,"")}function k(X){let L=X.replace(nE,`
65
65
  `),D=aE.exec(X)[1].length;return new XT(L,D)}}}class XT{constructor(l,t){this.value=l,this.length=t}}const WE=/<|&#?\w+;/,QE={"http://www.w3.org/1999/xhtml":["em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","bdi","bdo","span","br","wbr"]},mE={"http://www.w3.org/1999/xhtml":{global:["title","aria-label","aria-valuetext"],a:["download"],area:["download","alt"],input:["alt","placeholder"],menuitem:["label"],menu:["label"],optgroup:["label"],option:["label"],track:["label"],img:["alt"],textarea:["placeholder"],th:["abbr"]},"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul":{global:["accesskey","aria-label","aria-valuetext","label","title","tooltiptext"],description:["value"],key:["key","keycode"],label:["value"],textbox:["placeholder","value"]}};function RE(e,l){const{value:t}=l;if(typeof t=="string")if(e.localName==="title"&&e.namespaceURI==="http://www.w3.org/1999/xhtml")e.textContent=t;else if(!WE.test(t))e.textContent=t;else{const d=e.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");d.innerHTML=t,NE(d.content,e)}yT(l,e)}function NE(e,l){for(const t of e.childNodes)if(t.nodeType!==t.TEXT_NODE){if(t.hasAttribute("data-l10n-name")){const d=uE(l,t);e.replaceChild(d,t);continue}if(pE(t)){const d=rE(t);e.replaceChild(d,t);continue}console.warn(`An element of forbidden type "${t.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`),e.replaceChild(cb(t),t)}l.textContent="",l.appendChild(e)}function bE(e,l){if(!e)return!1;for(let t of e)if(t.name===l)return!0;return!1}function yT(e,l){const t=l.hasAttribute("data-l10n-attrs")?l.getAttribute("data-l10n-attrs").split(",").map(d=>d.trim()):null;for(const d of Array.from(l.attributes))BT(d.name,l,t)&&!bE(e.attributes,d.name)&&l.removeAttribute(d.name);if(e.attributes)for(const d of Array.from(e.attributes))BT(d.name,l,t)&&l.getAttribute(d.name)!==d.value&&l.setAttribute(d.name,d.value)}function uE(e,l){const t=l.getAttribute("data-l10n-name"),d=e.querySelector(`[data-l10n-name="${t}"]`);if(!d)return console.warn(`An element named "${t}" wasn't found in the source.`),cb(l);if(d.localName!==l.localName)return console.warn(`An element named "${t}" was found in the translation but its type ${l.localName} didn't match the element found in the source (${d.localName}).`),cb(l);e.removeChild(d);const n=d.cloneNode(!1);return YT(l,n)}function rE(e){const l=e.ownerDocument.createElement(e.localName);return YT(e,l)}function cb(e){return e.ownerDocument.createTextNode(e.textContent)}function pE(e){const l=QE[e.namespaceURI];return l&&l.includes(e.localName)}function BT(e,l,t=null){if(t&&t.includes(e))return!0;const d=mE[l.namespaceURI];if(!d)return!1;const n=e.toLowerCase(),a=l.localName;if(d.global.includes(n))return!0;if(!d[a])return!1;if(d[a].includes(n))return!0;if(l.namespaceURI==="http://www.w3.org/1999/xhtml"&&a==="input"&&n==="value"){const i=l.type.toLowerCase();if(i==="submit"||i==="button"||i==="reset")return!0}return!1}function YT(e,l){return l.textContent=e.textContent,yT(e,l),l}class ME extends Array{static from(l){return l instanceof this?l:new this(l)}}class SE extends ME{constructor(l){if(super(),Symbol.asyncIterator in Object(l))this.iterator=l[Symbol.asyncIterator]();else if(Symbol.iterator in Object(l))this.iterator=l[Symbol.iterator]();else throw new TypeError("Argument must implement the iteration protocol.")}[Symbol.asyncIterator](){const l=this;let t=0;return{async next(){return l.length<=t&&l.push(l.iterator.next()),l[t++]}}}async touchNext(l=1){let t=0;for(;t++<l;){const d=this[this.length-1];if(d&&(await d).done)break;this.push(this.iterator.next())}return this[this.length-1]}}class JE{constructor(l=[],t){this.resourceIds=l,this.generateBundles=t,this.onChange(!0)}addResourceIds(l,t=!1){return this.resourceIds.push(...l),this.onChange(t),this.resourceIds.length}removeResourceIds(l){return this.resourceIds=this.resourceIds.filter(t=>!l.includes(t)),this.onChange(),this.resourceIds.length}async formatWithFallback(l,t){const d=[];let n=!1;for await(const a of this.bundles){n=!0;const i=XE(t,a,l,d);if(i.size===0)break;if(typeof console<"u"){const s=a.locales[0],c=Array.from(i).join(", ");console.warn(`[fluent] Missing translations in ${s}: ${c}`)}}return!n&&typeof console<"u"&&console.warn(`[fluent] Request for keys failed because no resource bundles got generated.
66
66
  keys: ${JSON.stringify(l)}.
67
67
  resourceIds: ${JSON.stringify(this.resourceIds)}.`),d}formatMessages(l){return this.formatWithFallback(l,GE)}formatValues(l){return this.formatWithFallback(l,TE)}async formatValue(l,t){const[d]=await this.formatValues([{id:l,args:t}]);return d}handleEvent(){this.onChange()}onChange(l=!1){this.bundles=SE.from(this.generateBundles(this.resourceIds)),l&&this.bundles.touchNext(2)}}function TE(e,l,t,d){return t.value?e.formatPattern(t.value,d,l):null}function GE(e,l,t,d){const n={value:null,attributes:null};t.value&&(n.value=e.formatPattern(t.value,d,l));let a=Object.keys(t.attributes);if(a.length>0){n.attributes=new Array(a.length);for(let[i,s]of a.entries()){let c=e.formatPattern(t.attributes[s],d,l);n.attributes[i]={name:s,value:c}}}return n}function XE(e,l,t,d){const n=[],a=new Set;return t.forEach(({id:i,args:s},c)=>{if(d[c]!==void 0)return;let F=l.getMessage(i);if(F){if(n.length=0,d[c]=e(l,n,F,s),n.length>0&&typeof console<"u"){const h=l.locales[0],o=n.join(", ");console.warn(`[fluent][resolver] errors in ${h}/${i}: ${o}.`)}}else a.add(i)}),a}const Ci="data-l10n-id",$F="data-l10n-args",yE=`[${Ci}]`;class BE extends JE{constructor(l,t){super(l,t),this.roots=new Set,this.pendingrAF=null,this.pendingElements=new Set,this.windowElement=null,this.mutationObserver=null,this.observerConfig={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:[Ci,$F]}}onChange(l=!1){super.onChange(l),this.roots&&this.translateRoots()}setAttributes(l,t,d){return l.setAttribute(Ci,t),d?l.setAttribute($F,JSON.stringify(d)):l.removeAttribute($F),l}getAttributes(l){return{id:l.getAttribute(Ci),args:JSON.parse(l.getAttribute($F)||null)}}connectRoot(l){for(const t of this.roots)if(t===l||t.contains(l)||l.contains(t))throw new Error("Cannot add a root that overlaps with existing root.");if(this.windowElement){if(this.windowElement!==l.ownerDocument.defaultView)throw new Error(`Cannot connect a root:
@@ -401,14 +401,14 @@ pdfjs-editor-undo-bar-undo-button =
401
401
  pdfjs-editor-undo-bar-undo-button-label = Undo
402
402
  pdfjs-editor-undo-bar-close-button =
403
403
  .title = Close
404
- pdfjs-editor-undo-bar-close-button-label = Close`)},M(xT,Ma);let eW=xT;const kE=1e3,zE=50,LE=1e3;function Zb(){return document.location.hash}var xi,Yl,pn,dW,nW,t0,aW,Fb,gT,jT,hb,OT,vT;class IE{constructor({linkService:l,eventBus:t}){M(this,Yl),M(this,xi,null),this.linkService=l,this.eventBus=t,this._initialized=!1,this._fingerprint="",this.reset(),this.eventBus._on("pagesinit",()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",d=>{this._isPagesLoaded=!!d.pagesCount},{once:!0})})}initialize({fingerprint:l,resetHistory:t=!1,updateUrl:d=!1}){if(!l||typeof l!="string"){console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const n=this._fingerprint!==""&&this._fingerprint!==l;this._fingerprint=l,this._updateUrl=d===!0,this._initialized=!0,p(this,Yl,OT).call(this);const a=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=Zb(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!p(this,Yl,t0).call(this,a,!0)||t){const{hash:s,page:c,rotation:F}=p(this,Yl,Fb).call(this,!0);if(!s||n||t){p(this,Yl,pn).call(this,null,!0);return}p(this,Yl,pn).call(this,{hash:s,page:c,rotation:F},!0);return}const i=a.destination;p(this,Yl,aW).call(this,i,a.uid,!0),i.rotation!==void 0&&(this._initialRotation=i.rotation),i.dest?(this._initialBookmark=JSON.stringify(i.dest),this._destination.page=null):i.hash?this._initialBookmark=i.hash:i.page&&(this._initialBookmark=`page=${i.page}`)}reset(){this._initialized&&(p(this,Yl,hb).call(this),this._initialized=!1,p(this,Yl,vT).call(this)),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:l=null,explicitDest:t,pageNumber:d}){if(!this._initialized)return;if(l&&typeof l!="string"){console.error(`PDFHistory.push: "${l}" is not a valid namedDest parameter.`);return}else if(Array.isArray(t)){if(!p(this,Yl,nW).call(this,d)&&(d!==null||this._destination)){console.error(`PDFHistory.push: "${d}" is not a valid pageNumber parameter.`);return}}else{console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);return}const n=l||JSON.stringify(t);if(!n)return;let a=!1;if(this._destination&&(DE(this._destination.hash,n)||wE(this._destination.dest,t))){if(this._destination.page)return;a=!0}this._popStateInProgress&&!a||(p(this,Yl,pn).call(this,{dest:t,hash:n,page:d,rotation:this.linkService.rotation},a),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(l){var t;if(this._initialized){if(!p(this,Yl,nW).call(this,l)){console.error(`PDFHistory.pushPage: "${l}" is not a valid page number.`);return}((t=this._destination)==null?void 0:t.page)!==l&&(this._popStateInProgress||(p(this,Yl,pn).call(this,{dest:null,hash:`page=${l}`,page:l,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1}))))}}pushCurrentPosition(){!this._initialized||this._popStateInProgress||p(this,Yl,dW).call(this)}back(){if(!this._initialized||this._popStateInProgress)return;const l=window.history.state;p(this,Yl,t0).call(this,l)&&l.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const l=window.history.state;p(this,Yl,t0).call(this,l)&&l.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}}xi=new WeakMap,Yl=new WeakSet,pn=function(e,l=!1){const t=l||!this._destination,d={fingerprint:this._fingerprint,uid:t?this._uid:this._uid+1,destination:e};p(this,Yl,aW).call(this,e,d.uid);let n;if(this._updateUrl&&e!=null&&e.hash){const a=document.location.href.split("#",1)[0];a.startsWith("file://")||(n=`${a}#${e.hash}`)}t?window.history.replaceState(d,"",n):window.history.pushState(d,"",n)},dW=function(e=!1){if(!this._position)return;let l=this._position;if(e&&(l=Object.assign(Object.create(null),this._position),l.temporary=!0),!this._destination){p(this,Yl,pn).call(this,l);return}if(this._destination.temporary){p(this,Yl,pn).call(this,l,!0);return}if(this._destination.hash===l.hash||!this._destination.page&&this._numPositionUpdates<=zE)return;let t=!1;if(this._destination.page>=l.first&&this._destination.page<=l.page){if(this._destination.dest!==void 0||!this._destination.first)return;t=!0}p(this,Yl,pn).call(this,l,t)},nW=function(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount},t0=function(e,l=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint)if(l){if(typeof e.fingerprint!="string"||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if((t==null?void 0:t.type)!=="reload")return!1}else return!1;return!(!Number.isInteger(e.uid)||e.uid<0||e.destination===null||typeof e.destination!="object")},aW=function(e,l,t=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),t&&e!=null&&e.temporary&&delete e.temporary,this._destination=e,this._uid=l,this._maxUid=Math.max(this._maxUid,l),this._numPositionUpdates=0},Fb=function(e=!1){const l=unescape(Zb()).substring(1),t=xV(l),d=t.get("nameddest")||"";let n=t.get("page")|0;return(!p(this,Yl,nW).call(this,n)||e&&d.length>0)&&(n=null),{hash:l,page:n,rotation:this.linkService.rotation}},gT=function({location:e}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation},!this._popStateInProgress&&(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||p(this,Yl,dW).call(this,!0),this._updateViewareaTimeout=null},LE))},jT=function({state:e}){const l=Zb(),t=this._currentHash!==l;if(this._currentHash=l,!e){this._uid++;const{hash:n,page:a,rotation:i}=p(this,Yl,Fb).call(this);p(this,Yl,pn).call(this,{hash:n,page:a,rotation:i},!0);return}if(!p(this,Yl,t0).call(this,e))return;this._popStateInProgress=!0,t&&(this._blockHashChange++,Ew({target:window,name:"hashchange",delay:kE}).then(()=>{this._blockHashChange--}));const d=e.destination;p(this,Yl,aW).call(this,d,e.uid,!0),HJ(d.rotation)&&(this.linkService.rotation=d.rotation),d.dest?this.linkService.goToDestination(d.dest):d.hash?this.linkService.setHash(d.hash):d.page&&(this.linkService.page=d.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})},hb=function(){(!this._destination||this._destination.temporary)&&p(this,Yl,dW).call(this)},OT=function(){if(U(this,xi))return;N(this,xi,new AbortController);const{signal:e}=U(this,xi);this.eventBus._on("updateviewarea",p(this,Yl,gT).bind(this),{signal:e}),window.addEventListener("popstate",p(this,Yl,jT).bind(this),{signal:e}),window.addEventListener("pagehide",p(this,Yl,hb).bind(this),{signal:e})},vT=function(){var e;(e=U(this,xi))==null||e.abort(),N(this,xi,null)};function DE(e,l){return typeof e!="string"||typeof l!="string"?!1:e===l||xV(e).get("nameddest")===l}function wE(e,l){function t(d,n){if(typeof d!=typeof n||Array.isArray(d)||Array.isArray(n))return!1;if(d!==null&&typeof d=="object"&&n!==null){if(Object.keys(d).length!==Object.keys(n).length)return!1;for(const a in d)if(!t(d[a],n[a]))return!1;return!0}return d===n||Number.isNaN(d)&&Number.isNaN(n)}if(!(Array.isArray(e)&&Array.isArray(l))||e.length!==l.length)return!1;for(let d=0,n=e.length;d<n;d++)if(!t(e[d],l[d]))return!1;return!0}var iW,sW,cW,UW,ZW,e0;class EE{constructor(l){M(this,iW,null),M(this,sW,null),M(this,cW,null),M(this,UW,null),M(this,ZW,null),M(this,e0),this.pdfPage=l.pdfPage,this.accessibilityManager=l.accessibilityManager,this.l10n=l.l10n,this.l10n||(this.l10n=new eW),this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,N(this,e0,l.uiManager),N(this,iW,l.annotationLayer||null),N(this,ZW,l.textLayer||null),N(this,sW,l.drawLayer||null),N(this,cW,l.onAppend||null),N(this,UW,l.structTreeLayer||null)}async render(l,t="display"){var d;if(t!=="display"||this._cancelled)return;const n=l.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:n}),this.show();return}const a=this.div=document.createElement("div");a.className="annotationEditorLayer",a.hidden=!0,a.dir=U(this,e0).direction,(d=U(this,cW))==null||d.call(this,a),this.annotationEditorLayer=new Tw({uiManager:U(this,e0),div:a,structTreeLayer:U(this,UW),accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:n,annotationLayer:U(this,iW),textLayer:U(this,ZW),drawLayer:U(this,sW)});const i={viewport:n,div:a,annotations:null,intent:t};this.annotationEditorLayer.render(i),this.show()}cancel(){this._cancelled=!0,this.div&&this.annotationEditorLayer.destroy()}hide(){this.div&&(this.annotationEditorLayer.pause(!0),this.div.hidden=!0)}show(){!this.div||this.annotationEditorLayer.isInvisible||(this.div.hidden=!1,this.annotationEditorLayer.pause(!1))}}iW=new WeakMap,sW=new WeakMap,cW=new WeakMap,UW=new WeakMap,ZW=new WeakMap,e0=new WeakMap;{var ob=new Map;const e=navigator.userAgent||"",l=navigator.platform||"",t=navigator.maxTouchPoints||1,d=/Android/.test(e),n=/\b(iPad|iPhone|iPod)(?=;)/.test(e)||l==="MacIntel"&&t>1;(function(){(n||d)&&ob.set("maxCanvasPixels",5242880)})(),function(){d&&ob.set("useSystemFonts",!1)}()}const q={BROWSER:1,VIEWER:2,API:4,WORKER:8,EVENT_DISPATCH:16,PREFERENCE:128},Vb={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},gd={allowedGlobalEvents:{value:null,kind:q.BROWSER},canvasMaxAreaInBytes:{value:-1,kind:q.BROWSER+q.API},isInAutomation:{value:!1,kind:q.BROWSER},localeProperties:{value:{lang:navigator.language||"en-US"},kind:q.BROWSER},nimbusDataStr:{value:"",kind:q.BROWSER},supportsCaretBrowsingMode:{value:!1,kind:q.BROWSER},supportsDocumentFonts:{value:!0,kind:q.BROWSER},supportsIntegratedFind:{value:!1,kind:q.BROWSER},supportsMouseWheelZoomCtrlKey:{value:!0,kind:q.BROWSER},supportsMouseWheelZoomMetaKey:{value:!0,kind:q.BROWSER},supportsPinchToZoom:{value:!0,kind:q.BROWSER},toolbarDensity:{value:0,kind:q.BROWSER+q.EVENT_DISPATCH},altTextLearnMoreUrl:{value:"",kind:q.VIEWER+q.PREFERENCE},annotationEditorMode:{value:0,kind:q.VIEWER+q.PREFERENCE},annotationMode:{value:2,kind:q.VIEWER+q.PREFERENCE},cursorToolOnLoad:{value:0,kind:q.VIEWER+q.PREFERENCE},debuggerSrc:{value:"./debugger.mjs",kind:q.VIEWER},defaultZoomDelay:{value:400,kind:q.VIEWER+q.PREFERENCE},defaultZoomValue:{value:"",kind:q.VIEWER+q.PREFERENCE},disableHistory:{value:!1,kind:q.VIEWER},disablePageLabels:{value:!1,kind:q.VIEWER+q.PREFERENCE},enableAltText:{value:!1,kind:q.VIEWER+q.PREFERENCE},enableAltTextModelDownload:{value:!0,kind:q.VIEWER+q.PREFERENCE+q.EVENT_DISPATCH},enableGuessAltText:{value:!0,kind:q.VIEWER+q.PREFERENCE+q.EVENT_DISPATCH},enableHighlightFloatingButton:{value:!1,kind:q.VIEWER+q.PREFERENCE},enableNewAltTextWhenAddingImage:{value:!0,kind:q.VIEWER+q.PREFERENCE},enablePermissions:{value:!1,kind:q.VIEWER+q.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:q.VIEWER+q.PREFERENCE},enableScripting:{value:!0,kind:q.VIEWER+q.PREFERENCE},enableUpdatedAddImage:{value:!1,kind:q.VIEWER+q.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:q.VIEWER},externalLinkTarget:{value:0,kind:q.VIEWER+q.PREFERENCE},highlightEditorColors:{value:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F",kind:q.VIEWER+q.PREFERENCE},historyUpdateUrl:{value:!1,kind:q.VIEWER+q.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:q.VIEWER+q.PREFERENCE},imageResourcesPath:{value:"./images/",kind:q.VIEWER},maxCanvasPixels:{value:2**25,kind:q.VIEWER},forcePageColors:{value:!1,kind:q.VIEWER+q.PREFERENCE},pageColorsBackground:{value:"Canvas",kind:q.VIEWER+q.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:q.VIEWER+q.PREFERENCE},pdfBugEnabled:{value:!1,kind:q.VIEWER+q.PREFERENCE},printResolution:{value:150,kind:q.VIEWER},sidebarViewOnLoad:{value:-1,kind:q.VIEWER+q.PREFERENCE},scrollModeOnLoad:{value:-1,kind:q.VIEWER+q.PREFERENCE},spreadModeOnLoad:{value:-1,kind:q.VIEWER+q.PREFERENCE},textLayerMode:{value:1,kind:q.VIEWER+q.PREFERENCE},viewOnLoad:{value:0,kind:q.VIEWER+q.PREFERENCE},cMapPacked:{value:!0,kind:q.API},cMapUrl:{value:"../web/cmaps/",kind:q.API},disableAutoFetch:{value:!1,kind:q.API+q.PREFERENCE},disableFontFace:{value:!1,kind:q.API+q.PREFERENCE},disableRange:{value:!1,kind:q.API+q.PREFERENCE},disableStream:{value:!1,kind:q.API+q.PREFERENCE},docBaseUrl:{value:"",kind:q.API},enableHWA:{value:!0,kind:q.API+q.VIEWER+q.PREFERENCE},enableXfa:{value:!0,kind:q.API+q.PREFERENCE},fontExtraProperties:{value:!1,kind:q.API},isEvalSupported:{value:!0,kind:q.API},isOffscreenCanvasSupported:{value:!0,kind:q.API},maxImageSize:{value:-1,kind:q.API},pdfBug:{value:!1,kind:q.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:q.API},useSystemFonts:{value:void 0,kind:q.API,type:Vb.BOOLEAN+Vb.UNDEFINED},verbosity:{value:1,kind:q.API},workerPort:{value:null,kind:q.WORKER},workerSrc:{value:"../build/pdf.worker.mjs",kind:q.WORKER}};gd.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:q.VIEWER},gd.sandboxBundleSrc={value:"../build/pdf.sandbox.mjs",kind:q.VIEWER},gd.viewerCssTheme={value:0,kind:q.VIEWER+q.PREFERENCE},gd.enableFakeMLManager={value:!0,kind:q.VIEWER},gd.disablePreferences={value:!1,kind:q.VIEWER};var gi;const Mn=class{static get(l){return U(this,gi).get(l)}static getAll(l=null,t=!1){const d=Object.create(null);for(const n in gd){const a=gd[n];l&&!(l&a.kind)||(d[n]=t?a.value:U(this,gi).get(n))}return d}static set(l,t){this.setAll({[l]:t})}static setAll(l,t=!1){this._hasInvokedSet||(this._hasInvokedSet=!0);let d;for(const n in l){const a=gd[n],i=l[n];if(!a||!(typeof i==typeof a.value||Vb[(typeof i).toUpperCase()]&a.type))continue;const{kind:s}=a;t&&!(s&q.BROWSER||s&q.PREFERENCE)||(this.eventBus&&s&q.EVENT_DISPATCH&&(d||(d=new Map)).set(n,i),U(this,gi).set(n,i))}if(d)for(const[n,a]of d)this.eventBus.dispatch(n.toLowerCase(),{source:this,value:a})}};gi=new WeakMap,hl(Mn,"eventBus"),M(Mn,gi,new Map),(()=>{for(const e in gd)U(Mn,gi).set(e,gd[e].value);for(const[e,l]of ob)U(Mn,gi).set(e,l);Mn._hasInvokedSet=!1,Mn._checkDisablePreferences=()=>Mn.get("disablePreferences")?!0:(Mn._hasInvokedSet&&console.warn('The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.'),!1)})();let CE=Mn;var Sn;class xE{constructor(l){M(this,Sn,null),this.pageIndex=l.pageIndex}async render(l="display"){l!=="display"||U(this,Sn)||this._cancelled||N(this,Sn,new Bw({pageIndex:this.pageIndex}))}cancel(){this._cancelled=!0,U(this,Sn)&&(U(this,Sn).destroy(),N(this,Sn,null))}setParent(l){var t;(t=U(this,Sn))==null||t.setParent(l)}getDrawLayer(){return U(this,Sn)}}Sn=new WeakMap;const KT={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},gE=/^H(\d+)$/;var d0,jd,n0,a0,i0,Sa,ji,Wb,fT,Qb;class HT{constructor(l,t){M(this,ji),M(this,d0),M(this,jd,null),M(this,n0),M(this,a0,new Map),M(this,i0),M(this,Sa,null),N(this,d0,l.getStructTree()),N(this,i0,t)}async render(){var l;if(U(this,n0))return U(this,n0);const{promise:t,resolve:d,reject:n}=Promise.withResolvers();N(this,n0,t);try{N(this,jd,p(this,ji,Qb).call(this,await U(this,d0)))}catch(a){n(a)}return N(this,d0,null),(l=U(this,jd))==null||l.classList.add("structTree"),d(U(this,jd)),t}async getAriaAttributes(l){try{return await this.render(),U(this,a0).get(l)}catch{}return null}hide(){U(this,jd)&&!U(this,jd).hidden&&(U(this,jd).hidden=!0)}show(){var l;(l=U(this,jd))!=null&&l.hidden&&(U(this,jd).hidden=!1)}addElementsToTextLayer(){var l;if(U(this,Sa)){for(const[t,d]of U(this,Sa))(l=document.getElementById(t))==null||l.append(d);U(this,Sa).clear(),N(this,Sa,null)}}}d0=new WeakMap,jd=new WeakMap,n0=new WeakMap,a0=new WeakMap,i0=new WeakMap,Sa=new WeakMap,ji=new WeakSet,Wb=function(e,l){const{alt:t,id:d,lang:n}=e;if(t!==void 0){let a=!1;const i=OF(t);for(const s of e.children)if(s.type==="annotation"){let c=U(this,a0).get(s.id);c||(c=new Map,U(this,a0).set(s.id,c)),c.set("aria-label",i),a=!0}a||l.setAttribute("aria-label",i)}d!==void 0&&l.setAttribute("aria-owns",d),n!==void 0&&l.setAttribute("lang",OF(n,!0))},fT=function(e,l){const{alt:t,bbox:d,children:n}=e,a=n==null?void 0:n[0];if(!U(this,i0)||!t||!d||(a==null?void 0:a.type)!=="content")return!1;const{id:i}=a;if(!i)return!1;l.setAttribute("aria-owns",i);const s=document.createElement("span");(U(this,Sa)||N(this,Sa,new Map)).set(i,s),s.setAttribute("role","img"),s.setAttribute("aria-label",OF(t));const{pageHeight:c,pageX:F,pageY:h}=U(this,i0),o="calc(var(--scale-factor)*",{style:V}=s;return V.width=`${o}${d[2]-d[0]}px)`,V.height=`${o}${d[3]-d[1]}px)`,V.left=`${o}${d[0]-F}px)`,V.top=`${o}${c-d[3]+h}px)`,!0},Qb=function(e){if(!e)return null;const l=document.createElement("span");if("role"in e){const{role:t}=e,d=t.match(gE);if(d?(l.setAttribute("role","heading"),l.setAttribute("aria-level",d[1])):KT[t]&&l.setAttribute("role",KT[t]),t==="Figure"&&p(this,ji,fT).call(this,e,l))return l}if(p(this,ji,Wb).call(this,e,l),e.children)if(e.children.length===1&&"id"in e.children[0])p(this,ji,Wb).call(this,e.children[0],l);else for(const t of e.children)l.append(p(this,ji,Qb).call(this,t));return l};var Ja,Zd,Ta,Oi,s0,FW,hW,mb;const PT=class hQ{constructor(){M(this,hW),M(this,Ja,!1),M(this,Zd,null),M(this,Ta,new Map),M(this,Oi,new Map)}setTextMapping(l){N(this,Zd,l)}enable(){if(U(this,Ja))throw new Error("TextAccessibilityManager is already enabled.");if(!U(this,Zd))throw new Error("Text divs and strings have not been set.");if(N(this,Ja,!0),N(this,Zd,U(this,Zd).slice()),U(this,Zd).sort(p(hQ,s0,FW)),U(this,Ta).size>0){const l=U(this,Zd);for(const[t,d]of U(this,Ta)){if(!document.getElementById(t)){U(this,Ta).delete(t);continue}p(this,hW,mb).call(this,t,l[d])}}for(const[l,t]of U(this,Oi))this.addPointerInTextLayer(l,t);U(this,Oi).clear()}disable(){U(this,Ja)&&(U(this,Oi).clear(),N(this,Zd,null),N(this,Ja,!1))}removePointerInTextLayer(l){if(!U(this,Ja)){U(this,Oi).delete(l);return}const t=U(this,Zd);if(!t||t.length===0)return;const{id:d}=l,n=U(this,Ta).get(d);if(n===void 0)return;const a=t[n];U(this,Ta).delete(d);let i=a.getAttribute("aria-owns");i!=null&&i.includes(d)&&(i=i.split(" ").filter(s=>s!==d).join(" "),i?a.setAttribute("aria-owns",i):(a.removeAttribute("aria-owns"),a.setAttribute("role","presentation")))}addPointerInTextLayer(l,t){const{id:d}=l;if(!d)return null;if(!U(this,Ja))return U(this,Oi).set(l,t),null;t&&this.removePointerInTextLayer(l);const n=U(this,Zd);if(!n||n.length===0)return null;const a=vF(n,F=>{var h;return p(h=hQ,s0,FW).call(h,l,F)<0}),i=Math.max(0,a-1),s=n[i];p(this,hW,mb).call(this,d,s),U(this,Ta).set(d,i);const c=s.parentNode;return c!=null&&c.classList.contains("markedContent")?c.id:null}moveElementInDOM(l,t,d,n){const a=this.addPointerInTextLayer(d,n);if(!l.hasChildNodes())return l.append(t),a;const i=Array.from(l.childNodes).filter(F=>F!==t);if(i.length===0)return a;const s=d||t,c=vF(i,F=>{var h;return p(h=hQ,s0,FW).call(h,s,F)<0});return c===0?i[0].before(t):i[c-1].after(t),a}};Ja=new WeakMap,Zd=new WeakMap,Ta=new WeakMap,Oi=new WeakMap,s0=new WeakSet,FW=function(e,l){const t=e.getBoundingClientRect(),d=l.getBoundingClientRect();if(t.width===0&&t.height===0)return 1;if(d.width===0&&d.height===0)return-1;const n=t.y,a=t.y+t.height,i=t.y+t.height/2,s=d.y,c=d.y+d.height,F=d.y+d.height/2;if(i<=s&&F>=a)return-1;if(F<=n&&i>=c)return 1;const h=t.x+t.width/2,o=d.x+d.width/2;return h-o},hW=new WeakSet,mb=function(e,l){const t=l.getAttribute("aria-owns");t!=null&&t.includes(e)||l.setAttribute("aria-owns",t?`${t} ${e}`:e),l.removeAttribute("role")},M(PT,s0);let jE=PT;var vi;class OE{constructor({findController:l,eventBus:t,pageIndex:d}){M(this,vi,null),this.findController=l,this.matches=[],this.eventBus=t,this.pageIdx=d,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(l,t){this.textDivs=l,this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,U(this,vi)||(N(this,vi,new AbortController),this.eventBus._on("updatetextlayermatches",l=>{(l.pageIndex===this.pageIdx||l.pageIndex===-1)&&this._updateMatches()},{signal:U(this,vi).signal})),this._updateMatches()}disable(){var l;this.enabled&&(this.enabled=!1,(l=U(this,vi))==null||l.abort(),N(this,vi,null),this._updateMatches(!0))}_convertMatches(l,t){if(!l)return[];const{textContentItemsStr:d}=this;let n=0,a=0;const i=d.length-1,s=[];for(let c=0,F=l.length;c<F;c++){let h=l[c];for(;n!==i&&h>=a+d[n].length;)a+=d[n].length,n++;n===d.length&&console.error("Could not find a matching mapping");const o={begin:{divIdx:n,offset:h-a}};for(h+=t[c];n!==i&&h>a+d[n].length;)a+=d[n].length,n++;o.end={divIdx:n,offset:h-a},s.push(o)}return s}_renderMatches(l){if(l.length===0)return;const{findController:t,pageIdx:d}=this,{textContentItemsStr:n,textDivs:a}=this,i=d===t.selected.pageIdx,s=t.selected.matchIdx,c=t.state.highlightAll;let F=null;const h={offset:void 0};function o(r,b){const u=r.divIdx;return a[u].textContent="",V(u,0,r.offset,b)}function V(r,b,u,J){let G=a[r];if(G.nodeType===Node.TEXT_NODE){const k=document.createElement("span");G.before(k),k.append(G),a[r]=k,G=k}const T=n[r].substring(b,u),y=document.createTextNode(T);if(J){const k=document.createElement("span");if(k.className=`${J} appended`,k.append(y),G.append(k),J.includes("selected")){const{left:X}=k.getClientRects()[0],L=G.getBoundingClientRect().left;return X-L}return 0}return G.append(y),0}let W=s,Q=W+1;if(c)W=0,Q=l.length;else if(!i)return;let m=-1,R=-1;for(let r=W;r<Q;r++){const b=l[r],u=b.begin;if(u.divIdx===m&&u.offset===R)continue;m=u.divIdx,R=u.offset;const J=b.end,G=i&&r===s,T=G?" selected":"";let y=0;if(!F||u.divIdx!==F.divIdx?(F!==null&&V(F.divIdx,F.offset,h.offset),o(u)):V(F.divIdx,F.offset,u.offset),u.divIdx===J.divIdx)y=V(u.divIdx,u.offset,J.offset,"highlight"+T);else{y=V(u.divIdx,u.offset,h.offset,"highlight begin"+T);for(let k=u.divIdx+1,X=J.divIdx;k<X;k++)a[k].className="highlight middle"+T;o(J,"highlight end"+T)}F=J,G&&t.scrollMatchIntoView({element:a[u.divIdx],selectedLeft:y,pageIndex:d,matchIndex:s})}F&&V(F.divIdx,F.offset,h.offset)}_updateMatches(l=!1){if(!this.enabled&&!l)return;const{findController:t,matches:d,pageIdx:n}=this,{textContentItemsStr:a,textDivs:i}=this;let s=-1;for(const h of d){const o=Math.max(s,h.begin.divIdx);for(let V=o,W=h.end.divIdx;V<=W;V++){const Q=i[V];Q.textContent=a[V],Q.className=""}s=h.end.divIdx+1}if(!(t!=null&&t.highlightMatches)||l)return;const c=t.pageMatches[n]||null,F=t.pageMatchesLength[n]||null;this.matches=this._convertMatches(c,F),this._renderMatches(this.matches)}}vi=new WeakMap;var oW,VW,Pc,Jn,ye,Ki,Rb,AT,WW,_T,qT;const Ac=class ry{constructor({pdfPage:l,highlighter:t=null,accessibilityManager:d=null,enablePermissions:n=!1,onAppend:a=null}){M(this,Rb),M(this,oW,!1),M(this,VW,null),M(this,Pc,!1),M(this,Jn,null),this.pdfPage=l,this.highlighter=t,this.accessibilityManager=d,N(this,oW,n===!0),N(this,VW,a),this.div=document.createElement("div"),this.div.tabIndex=0,this.div.className="textLayer"}async render(l,t=null){var d,n,a,i,s;if(U(this,Pc)&&U(this,Jn)){U(this,Jn).update({viewport:l,onBefore:this.hide.bind(this)}),this.show();return}this.cancel(),N(this,Jn,new Dw({textContentSource:this.pdfPage.streamTextContent(t||{includeMarkedContent:!0,disableNormalization:!0}),container:this.div,viewport:l}));const{textDivs:c,textContentItemsStr:F}=U(this,Jn);(d=this.highlighter)==null||d.setTextMapping(c,F),(n=this.accessibilityManager)==null||n.setTextMapping(c),await U(this,Jn).render(),N(this,Pc,!0);const h=document.createElement("div");h.className="endOfContent",this.div.append(h),p(this,Rb,AT).call(this,h),(a=U(this,VW))==null||a.call(this,this.div),(i=this.highlighter)==null||i.enable(),(s=this.accessibilityManager)==null||s.enable()}hide(){var l;!this.div.hidden&&U(this,Pc)&&((l=this.highlighter)==null||l.disable(),this.div.hidden=!0)}show(){var l;this.div.hidden&&U(this,Pc)&&(this.div.hidden=!1,(l=this.highlighter)==null||l.enable())}cancel(){var l,t,d,n;(l=U(this,Jn))==null||l.cancel(),N(this,Jn,null),(t=this.highlighter)==null||t.disable(),(d=this.accessibilityManager)==null||d.disable(),p(n=ry,WW,_T).call(n,this.div)}};oW=new WeakMap,VW=new WeakMap,Pc=new WeakMap,Jn=new WeakMap,ye=new WeakMap,Ki=new WeakMap,Rb=new WeakSet,AT=function(e){var l;const{div:t}=this;t.addEventListener("mousedown",()=>{t.classList.add("selecting")}),t.addEventListener("copy",d=>{if(!U(this,oW)){const n=document.getSelection();d.clipboardData.setData("text/plain",OF(zw(n.toString())))}eb(d)}),U(Ac,ye).set(t,e),p(l=Ac,WW,qT).call(l)},WW=new WeakSet,_T=function(e){var l;U(this,ye).delete(e),U(this,ye).size===0&&((l=U(this,Ki))==null||l.abort(),N(this,Ki,null))},qT=function(){if(U(this,Ki))return;N(this,Ki,new AbortController);const{signal:e}=U(this,Ki),l=(a,i)=>{i.append(a),a.style.width="",a.style.height="",i.classList.remove("selecting")};let t=!1;document.addEventListener("pointerdown",()=>{t=!0},{signal:e}),document.addEventListener("pointerup",()=>{t=!1,U(this,ye).forEach(l)},{signal:e}),window.addEventListener("blur",()=>{t=!1,U(this,ye).forEach(l)},{signal:e}),document.addEventListener("keyup",()=>{t||U(this,ye).forEach(l)},{signal:e});var d,n;document.addEventListener("selectionchange",()=>{var a;const i=document.getSelection();if(i.rangeCount===0){U(this,ye).forEach(l);return}const s=new Set;for(let W=0;W<i.rangeCount;W++){const Q=i.getRangeAt(W);for(const m of U(this,ye).keys())!s.has(m)&&Q.intersectsNode(m)&&s.add(m)}for(const[W,Q]of U(this,ye))s.has(W)?W.classList.add("selecting"):l(Q,W);if(d??(d=getComputedStyle(U(this,ye).values().next().value).getPropertyValue("-moz-user-select")==="none"),d)return;const c=i.getRangeAt(0),F=n&&(c.compareBoundaryPoints(Range.END_TO_END,n)===0||c.compareBoundaryPoints(Range.START_TO_END,n)===0);let h=F?c.startContainer:c.endContainer;h.nodeType===Node.TEXT_NODE&&(h=h.parentNode);const o=(a=h.parentElement)==null?void 0:a.closest(".textLayer"),V=U(this,ye).get(o);V&&(V.style.width=o.style.width,V.style.height=o.style.height,h.parentElement.insertBefore(V,F?h:h.nextSibling)),n=c.cloneRange()},{signal:e})},M(Ac,WW),M(Ac,ye,new Map),M(Ac,Ki,null);let $T=Ac;class lG{constructor({pdfPage:l,annotationStorage:t=null,linkService:d,xfaHtml:n=null}){this.pdfPage=l,this.annotationStorage=t,this.linkService=d,this.xfaHtml=n,this.div=null,this._cancelled=!1}async render(l,t="display"){if(t==="print"){const a={viewport:l.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};return this.div=document.createElement("div"),a.div=this.div,db.render(a)}const d=await this.pdfPage.getXfa();if(this._cancelled||!d)return{textDivs:[]};const n={viewport:l.clone({dontFlip:!0}),div:this.div,xfaHtml:d,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};return this.div?db.update(n):(this.div=document.createElement("div"),n.div=this.div,db.render(n))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}const vE={annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsPromise:null,get linkService(){return new lb}},KE=new Map([["canvasWrapper",0],["textLayer",1],["annotationLayer",2],["annotationEditorLayer",3],["xfaLayer",3]]);var _c,fi,QW,qc,mW,Hi,Pi,c0,RW,NW,bW,$c,U0,Z0,Ga,Ai,zl,lU,uW,F0,Nb,bb,ub,rb,pb,tG,eG,Mb,Sb;class dG{constructor(l){M(this,zl),M(this,_c,bn.ENABLE_FORMS),M(this,fi,null),M(this,QW,!1),M(this,qc,!1),M(this,mW,!1),M(this,Hi,null),M(this,Pi,null),M(this,c0,null),M(this,RW,null),M(this,NW,1),M(this,bW,1),M(this,$c,null),M(this,U0,lt.INITIAL),M(this,Z0,xd.ENABLE),M(this,Ga,{directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0}),M(this,Ai,[null,null,null,null]);var t,d;const n=l.container,a=l.defaultViewport;this.id=l.id,this.renderingId="page"+this.id,N(this,Hi,l.layerProperties||vE),this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=l.scale||xJ,this.viewport=a,this.pdfPageRotate=a.rotation,this._optionalContentConfigPromise=l.optionalContentConfigPromise||null,N(this,Z0,l.textLayerMode??xd.ENABLE),N(this,_c,l.annotationMode??bn.ENABLE_FORMS),this.imageResourcesPath=l.imageResourcesPath||"",this.maxCanvasPixels=l.maxCanvasPixels??CE.get("maxCanvasPixels"),this.pageColors=l.pageColors||null,N(this,QW,l.enableHWA||!1),this.eventBus=l.eventBus,this.renderingQueue=l.renderingQueue,this.l10n=l.l10n,this.l10n||(this.l10n=new eW),this.renderTask=null,this.resume=null,this._isStandalone=!((t=this.renderingQueue)!=null&&t.hasViewer()),this._container=n,this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.xfaLayer=null,this.structTreeLayer=null,this.drawLayer=null;const i=document.createElement("div");if(i.className="page",i.setAttribute("data-page-number",this.id),i.setAttribute("role","region"),i.setAttribute("data-l10n-id","pdfjs-page-landmark"),i.setAttribute("data-l10n-args",JSON.stringify({page:this.id})),this.div=i,p(this,zl,uW).call(this),n==null||n.append(i),this._isStandalone){n==null||n.style.setProperty("--scale-factor",this.scale*un.PDF_TO_CSS_UNITS),(d=this.pageColors)!=null&&d.background&&(n==null||n.style.setProperty("--page-bg-color",this.pageColors.background));const{optionalContentConfigPromise:s}=l;s&&s.then(c=>{s===this._optionalContentConfigPromise&&(U(this,Ga).initialOptionalContent=c.hasInitialVisibility)}),l.l10n||this.l10n.translate(this.div)}}get renderingState(){return U(this,U0)}set renderingState(l){if(l!==U(this,U0))switch(N(this,U0,l),U(this,Pi)&&(clearTimeout(U(this,Pi)),N(this,Pi,null)),l){case lt.PAUSED:this.div.classList.remove("loading");break;case lt.RUNNING:this.div.classList.add("loadingIcon"),N(this,Pi,setTimeout(()=>{this.div.classList.add("loading"),N(this,Pi,null)},0));break;case lt.INITIAL:case lt.FINISHED:this.div.classList.remove("loadingIcon","loading");break}}setPdfPage(l){var t,d,n,a;this._isStandalone&&(((t=this.pageColors)==null?void 0:t.foreground)==="CanvasText"||((d=this.pageColors)==null?void 0:d.background)==="Canvas")&&((n=this._container)==null||n.style.setProperty("--hcm-highlight-filter",l.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),(a=this._container)==null||a.style.setProperty("--hcm-highlight-selected-filter",l.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","Highlight"))),this.pdfPage=l,this.pdfPageRotate=l.rotate;const i=(this.rotation+this.pdfPageRotate)%360;this.viewport=l.getViewport({scale:this.scale*un.PDF_TO_CSS_UNITS,rotation:i}),p(this,zl,uW).call(this),this.reset()}destroy(){var l;this.reset(),(l=this.pdfPage)==null||l.cleanup()}hasEditableAnnotations(){var l;return!!((l=this.annotationLayer)!=null&&l.hasEditableAnnotations())}get _textHighlighter(){return HV(this,"_textHighlighter",new OE({pageIndex:this.id-1,eventBus:this.eventBus,findController:U(this,Hi).findController}))}reset({keepAnnotationLayer:l=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:d=!1,keepTextLayer:n=!1,keepCanvasWrapper:a=!1}={}){var i,s,c,F,h;this.cancelRendering({keepAnnotationLayer:l,keepAnnotationEditorLayer:t,keepXfaLayer:d,keepTextLayer:n}),this.renderingState=lt.INITIAL;const o=this.div,V=o.childNodes,W=l&&((i=this.annotationLayer)==null?void 0:i.div)||null,Q=t&&((s=this.annotationEditorLayer)==null?void 0:s.div)||null,m=d&&((c=this.xfaLayer)==null?void 0:c.div)||null,R=n&&((F=this.textLayer)==null?void 0:F.div)||null,r=a&&U(this,fi)||null;for(let b=V.length-1;b>=0;b--){const u=V[b];switch(u){case W:case Q:case m:case R:case r:continue}u.remove();const J=U(this,Ai).indexOf(u);J>=0&&(U(this,Ai)[J]=null)}o.removeAttribute("data-loaded"),W&&this.annotationLayer.hide(),Q&&this.annotationEditorLayer.hide(),m&&this.xfaLayer.hide(),R&&this.textLayer.hide(),(h=this.structTreeLayer)==null||h.hide(),!a&&U(this,fi)&&(N(this,fi,null),p(this,zl,Mb).call(this))}toggleEditingMode(l){this.hasEditableAnnotations()&&(N(this,mW,l),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0}))}update({scale:l=0,rotation:t=null,optionalContentConfigPromise:d=null,drawingDelay:n=-1}){var a;this.scale=l||this.scale,typeof t=="number"&&(this.rotation=t),d instanceof Promise&&(this._optionalContentConfigPromise=d,d.then(s=>{d===this._optionalContentConfigPromise&&(U(this,Ga).initialOptionalContent=s.hasInitialVisibility)})),U(this,Ga).directDrawing=!0;const i=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*un.PDF_TO_CSS_UNITS,rotation:i}),p(this,zl,uW).call(this),this._isStandalone&&((a=this._container)==null||a.style.setProperty("--scale-factor",this.viewport.scale)),this.canvas){let s=!1;if(U(this,qc)){if(this.maxCanvasPixels===0)s=!0;else if(this.maxCanvasPixels>0){const{width:F,height:h}=this.viewport,{sx:o,sy:V}=this.outputScale;s=(Math.floor(F)*o|0)*(Math.floor(h)*V|0)>this.maxCanvasPixels}}const c=n>=0&&n<1e3;if(c||s){if(c&&!s&&this.renderingState!==lt.FINISHED&&(this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:n}),this.renderingState=lt.FINISHED,U(this,Ga).directDrawing=!1),this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!c,hideTextLayer:c}),c)return;this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:U(this,$c)});return}}this.cssTransform({}),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}cancelRendering({keepAnnotationLayer:l=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:d=!1,keepTextLayer:n=!1,cancelExtraDelay:a=0}={}){var i;this.renderTask&&(this.renderTask.cancel(a),this.renderTask=null),this.resume=null,this.textLayer&&(!n||!this.textLayer.div)&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!l||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),this.annotationEditorLayer&&(!t||!this.annotationEditorLayer.div)&&(this.drawLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),this.xfaLayer&&(!d||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,(i=this._textHighlighter)==null||i.disable())}cssTransform({redrawAnnotationLayer:l=!1,redrawAnnotationEditorLayer:t=!1,redrawXfaLayer:d=!1,redrawTextLayer:n=!1,hideTextLayer:a=!1}){var i;const{canvas:s}=this;if(!s)return;const c=U(this,c0);if(this.viewport!==c){const F=(360+this.viewport.rotation-c.rotation)%360;if(F===90||F===270){const{width:h,height:o}=this.viewport,V=o/h,W=h/o;s.style.transform=`rotate(${F}deg) scale(${V},${W})`}else s.style.transform=F===0?"":`rotate(${F}deg)`}l&&this.annotationLayer&&p(this,zl,Nb).call(this),t&&this.annotationEditorLayer&&(this.drawLayer&&p(this,zl,ub).call(this),p(this,zl,bb).call(this)),d&&this.xfaLayer&&p(this,zl,rb).call(this),this.textLayer&&(a?(this.textLayer.hide(),(i=this.structTreeLayer)==null||i.hide()):n&&p(this,zl,pb).call(this))}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(l,t){return this.viewport.convertToPdfPoint(l,t)}async draw(){this.renderingState!==lt.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:l,l10n:t,pageColors:d,pdfPage:n,viewport:a}=this;if(!n)throw this.renderingState=lt.FINISHED,new Error("pdfPage is not loaded");this.renderingState=lt.RUNNING;let i=U(this,fi);if(i||(i=N(this,fi,document.createElement("div")),i.classList.add("canvasWrapper"),p(this,zl,lU).call(this,i,"canvasWrapper")),!this.textLayer&&U(this,Z0)!==xd.DISABLE&&!n.isPureXfa&&(this._accessibilityManager||(this._accessibilityManager=new jE),this.textLayer=new $T({pdfPage:n,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:U(this,Z0)===xd.ENABLE_PERMISSIONS,onAppend:D=>{this.l10n.pause(),p(this,zl,lU).call(this,D,"textLayer"),this.l10n.resume()}})),!this.annotationLayer&&U(this,_c)!==bn.DISABLE){const{annotationStorage:D,annotationEditorUIManager:C,downloadManager:I,enableScripting:P,fieldObjectsPromise:H,hasJSActionsPromise:Y,linkService:B}=U(this,Hi);this._annotationCanvasMap||(this._annotationCanvasMap=new Map),this.annotationLayer=new hT({pdfPage:n,annotationStorage:D,imageResourcesPath:this.imageResourcesPath,renderForms:U(this,_c)===bn.ENABLE_FORMS,linkService:B,downloadManager:I,enableScripting:P,hasJSActionsPromise:Y,fieldObjectsPromise:H,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:C,onAppend:z=>{p(this,zl,lU).call(this,z,"annotationLayer")}})}const s=D=>{if(Q==null||Q(!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this)){this.renderingState=lt.PAUSED,this.resume=()=>{this.renderingState=lt.RUNNING,D()};return}D()},{width:c,height:F}=a,h=document.createElement("canvas");h.setAttribute("role","presentation");const o=!!(d!=null&&d.background&&d!=null&&d.foreground),V=this.canvas,W=!V&&!o;this.canvas=h,N(this,c0,a);let Q=D=>{if(W){i.prepend(h),Q=null;return}D&&(V?(V.replaceWith(h),V.width=V.height=0):i.prepend(h),Q=null)};const m=h.getContext("2d",{alpha:!1,willReadFrequently:!U(this,QW)}),R=this.outputScale=new Lw;if(this.maxCanvasPixels===0){const D=1/this.scale;R.sx*=D,R.sy*=D,N(this,qc,!0)}else if(this.maxCanvasPixels>0){const D=c*F,C=Math.sqrt(this.maxCanvasPixels/D);R.sx>C||R.sy>C?(R.sx=C,R.sy=C,N(this,qc,!0)):N(this,qc,!1)}const r=fJ(R.sx),b=fJ(R.sy),u=h.width=gV(jV(c*R.sx),r[0]),J=h.height=gV(jV(F*R.sy),b[0]),G=gV(jV(c),r[1]),T=gV(jV(F),b[1]);R.sx=u/G,R.sy=J/T,U(this,NW)!==r[1]&&(l.style.setProperty("--scale-round-x",`${r[1]}px`),N(this,NW,r[1])),U(this,bW)!==b[1]&&(l.style.setProperty("--scale-round-y",`${b[1]}px`),N(this,bW,b[1]));const y=R.scaled?[R.sx,0,0,R.sy,0,0]:null,k={canvasContext:m,transform:y,viewport:a,annotationMode:U(this,_c),optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:d,isEditing:U(this,mW)},X=this.renderTask=n.render(k);X.onContinue=s;const L=X.promise.then(async()=>{var D;Q==null||Q(!0),await p(this,zl,Sb).call(this,X),this.structTreeLayer||(this.structTreeLayer=new HT(n,a.rawDims)),p(this,zl,pb).call(this),this.annotationLayer&&await p(this,zl,Nb).call(this);const{annotationEditorUIManager:C}=U(this,Hi);C&&(this.drawLayer||(this.drawLayer=new xE({pageIndex:this.id})),await p(this,zl,ub).call(this),this.drawLayer.setParent(i),this.annotationEditorLayer||(this.annotationEditorLayer=new EE({uiManager:C,pdfPage:n,l10n:t,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:(D=this.annotationLayer)==null?void 0:D.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:I=>{p(this,zl,lU).call(this,I,"annotationEditorLayer")}})),p(this,zl,bb).call(this))},D=>(D instanceof tb?(V==null||V.remove(),p(this,zl,Mb).call(this)):Q==null||Q(!0),p(this,zl,Sb).call(this,X,D)));if(n.isPureXfa){if(!this.xfaLayer){const{annotationStorage:D,linkService:C}=U(this,Hi);this.xfaLayer=new lG({pdfPage:n,annotationStorage:D,linkService:C})}p(this,zl,rb).call(this)}return l.setAttribute("data-loaded",!0),this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id}),L}setPageLabel(l){this.pageLabel=typeof l=="string"?l:null,this.div.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id})),this.pageLabel!==null?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:l,initialOptionalContent:t,regularAnnotations:d}=U(this,Ga);return l&&t&&d?this.canvas:null}}_c=new WeakMap,fi=new WeakMap,QW=new WeakMap,qc=new WeakMap,mW=new WeakMap,Hi=new WeakMap,Pi=new WeakMap,c0=new WeakMap,RW=new WeakMap,NW=new WeakMap,bW=new WeakMap,$c=new WeakMap,U0=new WeakMap,Z0=new WeakMap,Ga=new WeakMap,Ai=new WeakMap,zl=new WeakSet,lU=function(e,l){const t=KE.get(l),d=U(this,Ai)[t];if(U(this,Ai)[t]=e,d){d.replaceWith(e);return}for(let n=t-1;n>=0;n--){const a=U(this,Ai)[n];if(a){a.after(e);return}}this.div.prepend(e)},uW=function(){const{viewport:e}=this;if(this.pdfPage){if(U(this,RW)===e.rotation)return;N(this,RW,e.rotation)}Iw(this.div,e,!0,!1)},F0=function(e,l){this.eventBus.dispatch(e,{source:this,pageNumber:this.id,error:l})},Nb=async function(){let e=null;try{await this.annotationLayer.render(this.viewport,{structTreeLayer:this.structTreeLayer},"display")}catch(l){console.error("#renderAnnotationLayer:",l),e=l}finally{p(this,zl,F0).call(this,"annotationlayerrendered",e)}},bb=async function(){let e=null;try{await this.annotationEditorLayer.render(this.viewport,"display")}catch(l){console.error("#renderAnnotationEditorLayer:",l),e=l}finally{p(this,zl,F0).call(this,"annotationeditorlayerrendered",e)}},ub=async function(){try{await this.drawLayer.render("display")}catch(e){console.error("#renderDrawLayer:",e)}},rb=async function(){var e;let l=null;try{const t=await this.xfaLayer.render(this.viewport,"display");t!=null&&t.textDivs&&this._textHighlighter&&p(this,zl,eG).call(this,t.textDivs)}catch(t){console.error("#renderXfaLayer:",t),l=t}finally{(e=this.xfaLayer)!=null&&e.div&&(this.l10n.pause(),p(this,zl,lU).call(this,this.xfaLayer.div,"xfaLayer"),this.l10n.resume()),p(this,zl,F0).call(this,"xfalayerrendered",l)}},pb=async function(){if(!this.textLayer)return;let e=null;try{await this.textLayer.render(this.viewport)}catch(l){if(l instanceof Jw)return;console.error("#renderTextLayer:",l),e=l}p(this,zl,F0).call(this,"textlayerrendered",e),p(this,zl,tG).call(this)},tG=async function(){var e,l,t;if(!this.textLayer)return;const d=await((e=this.structTreeLayer)==null?void 0:e.render());d&&(this.l10n.pause(),(l=this.structTreeLayer)==null||l.addElementsToTextLayer(),this.canvas&&d.parentNode!==this.canvas&&this.canvas.append(d),this.l10n.resume()),(t=this.structTreeLayer)==null||t.show()},eG=async function(e){const l=await this.pdfPage.getTextContent(),t=[];for(const d of l.items)t.push(d.str);this._textHighlighter.setTextMapping(e,t),this._textHighlighter.enable()},Mb=function(){const{canvas:e}=this;e&&(e.remove(),e.width=e.height=0,this.canvas=null,N(this,c0,null))},Sb=async function(e,l=null){if(e===this.renderTask&&(this.renderTask=null),l instanceof tb){N(this,$c,null);return}if(N(this,$c,l),this.renderingState=lt.FINISHED,U(this,Ga).regularAnnotations=!e.separateAnnots,this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:U(this,$c)}),l)throw l};async function fE(e){const t="".split("#",1)[0];let{info:d,metadata:n,contentDispositionFilename:a,contentLength:i}=await e.getMetadata();if(!i){const{length:s}=await e.getDownloadInfo();i=s}return{...d,baseURL:t,filesize:i,filename:a||Yw(""),metadata:n==null?void 0:n.getRaw(),authors:n==null?void 0:n.get("dc:creator"),numPages:e.numPages,URL:""}}class HE{constructor(l){this._ready=new Promise((t,d)=>{import(l).then(n=>{t(n.QuickJSSandbox())}).catch(d)})}async createSandbox(l){(await this._ready).create(l)}async dispatchEventInSandbox(l){const t=await this._ready;setTimeout(()=>t.dispatchEvent(l),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}var Tn,tU,rW,eU,dU,pW,me,Xa,h0,St,Fd,Be,nG,MW,Jb,aG,o0;class PE{constructor({eventBus:l,externalServices:t=null,docProperties:d=null}){M(this,Be),M(this,Tn,null),M(this,tU,null),M(this,rW,null),M(this,eU,null),M(this,dU,null),M(this,pW,null),M(this,me,null),M(this,Xa,null),M(this,h0,!1),M(this,St,null),M(this,Fd,null),N(this,dU,l),N(this,pW,t),N(this,rW,d)}setViewer(l){N(this,Xa,l)}async setDocument(l){var t;if(U(this,me)&&await p(this,Be,o0).call(this),N(this,me,l),!l)return;const[d,n,a]=await Promise.all([l.getFieldObjects(),l.getCalculationOrderIds(),l.getJSActions()]);if(!d&&!a){await p(this,Be,o0).call(this);return}if(l!==U(this,me))return;try{N(this,St,p(this,Be,aG).call(this))}catch(c){console.error("setDocument:",c),await p(this,Be,o0).call(this);return}const i=U(this,dU);N(this,eU,new AbortController);const{signal:s}=U(this,eU);i._on("updatefromsandbox",c=>{(c==null?void 0:c.source)===window&&p(this,Be,nG).call(this,c.detail)},{signal:s}),i._on("dispatcheventinsandbox",c=>{var F;(F=U(this,St))==null||F.dispatchEventInSandbox(c.detail)},{signal:s}),i._on("pagechanging",({pageNumber:c,previous:F})=>{c!==F&&(p(this,Be,Jb).call(this,F),p(this,Be,MW).call(this,c))},{signal:s}),i._on("pagerendered",({pageNumber:c})=>{this._pageOpenPending.has(c)&&c===U(this,Xa).currentPageNumber&&p(this,Be,MW).call(this,c)},{signal:s}),i._on("pagesdestroy",async()=>{var c,F;await p(this,Be,Jb).call(this,U(this,Xa).currentPageNumber),await((c=U(this,St))==null?void 0:c.dispatchEventInSandbox({id:"doc",name:"WillClose"})),(F=U(this,Tn))==null||F.resolve()},{signal:s});try{const c=await U(this,rW).call(this,l);if(l!==U(this,me))return;await U(this,St).createSandbox({objects:d,calculationOrder:n,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...c,actions:a}}),i.dispatch("sandboxcreated",{source:this})}catch(c){console.error("setDocument:",c),await p(this,Be,o0).call(this);return}await((t=U(this,St))==null?void 0:t.dispatchEventInSandbox({id:"doc",name:"Open"})),await p(this,Be,MW).call(this,U(this,Xa).currentPageNumber,!0),Promise.resolve().then(()=>{l===U(this,me)&&N(this,h0,!0)})}async dispatchWillSave(){var l;return(l=U(this,St))==null?void 0:l.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){var l;return(l=U(this,St))==null?void 0:l.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){var l;if(U(this,St)){await((l=U(this,Fd))==null?void 0:l.promise),N(this,Fd,Promise.withResolvers());try{await U(this,St).dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(t){throw U(this,Fd).resolve(),N(this,Fd,null),t}await U(this,Fd).promise}}async dispatchDidPrint(){var l;return(l=U(this,St))==null?void 0:l.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){var l;return((l=U(this,tU))==null?void 0:l.promise)||null}get ready(){return U(this,h0)}get _pageOpenPending(){return HV(this,"_pageOpenPending",new Set)}get _visitedPages(){return HV(this,"_visitedPages",new Map)}}Tn=new WeakMap,tU=new WeakMap,rW=new WeakMap,eU=new WeakMap,dU=new WeakMap,pW=new WeakMap,me=new WeakMap,Xa=new WeakMap,h0=new WeakMap,St=new WeakMap,Fd=new WeakMap,Be=new WeakSet,nG=async function(e){var l,t;const d=U(this,Xa),n=d.isInPresentationMode||d.isChangingPresentationMode,{id:a,siblings:i,command:s,value:c}=e;if(!a){switch(s){case"clear":console.clear();break;case"error":console.error(c);break;case"layout":if(!n){const h=ew(c);d.spreadMode=h.spreadMode}break;case"page-num":d.currentPageNumber=c+1;break;case"print":await d.pagesPromise,U(this,dU).dispatch("print",{source:this});break;case"println":console.log(c);break;case"zoom":n||(d.currentScaleValue=c);break;case"SaveAs":U(this,dU).dispatch("download",{source:this});break;case"FirstPage":d.currentPageNumber=1;break;case"LastPage":d.currentPageNumber=d.pagesCount;break;case"NextPage":d.nextPage();break;case"PrevPage":d.previousPage();break;case"ZoomViewIn":n||d.increaseScale();break;case"ZoomViewOut":n||d.decreaseScale();break;case"WillPrintFinished":(l=U(this,Fd))==null||l.resolve(),N(this,Fd,null);break}return}if(n&&e.focus)return;delete e.id,delete e.siblings;const F=i?[a,...i]:[a];for(const h of F){const o=document.querySelector(`[data-element-id="${h}"]`);o?o.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):(t=U(this,me))==null||t.annotationStorage.setValue(h,e)}},MW=async function(e,l=!1){const t=U(this,me),d=this._visitedPages;if(l&&N(this,Tn,Promise.withResolvers()),!U(this,Tn))return;const n=U(this,Xa).getPageView(e-1);if((n==null?void 0:n.renderingState)!==lt.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);const a=(async()=>{var i,s;const c=await(d.has(e)?null:(i=n.pdfPage)==null?void 0:i.getJSActions());t===U(this,me)&&await((s=U(this,St))==null?void 0:s.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:c}))})();d.set(e,a)},Jb=async function(e){var l;const t=U(this,me),d=this._visitedPages;if(!U(this,Tn)||this._pageOpenPending.has(e))return;const n=d.get(e);n&&(d.set(e,null),await n,t===U(this,me)&&await((l=U(this,St))==null?void 0:l.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e})))},aG=function(){if(N(this,tU,Promise.withResolvers()),U(this,St))throw new Error("#initScripting: Scripting already exists.");return U(this,pW).createScripting()},o0=async function(){var e,l,t,d;if(!U(this,St)){N(this,me,null),(e=U(this,tU))==null||e.resolve();return}U(this,Tn)&&(await Promise.race([U(this,Tn).promise,new Promise(n=>{setTimeout(n,1e3)})]).catch(()=>{}),N(this,Tn,null)),N(this,me,null);try{await U(this,St).destroySandbox()}catch{}(l=U(this,Fd))==null||l.reject(new Error("Scripting destroyed.")),N(this,Fd,null),(t=U(this,eU))==null||t.abort(),N(this,eU,null),this._pageOpenPending.clear(),this._visitedPages.clear(),N(this,St,null),N(this,h0,!1),(d=U(this,tU))==null||d.resolve()};class AE extends PE{constructor(l){l.externalServices||window.addEventListener("updatefromsandbox",t=>{l.eventBus.dispatch("updatefromsandbox",{source:window,detail:t.detail})}),l.externalServices||(l.externalServices={createScripting:()=>new HE(l.sandboxBundleSrc)}),l.docProperties||(l.docProperties=t=>fE(t)),super(l)}}const _E=3e4;class qE{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1,Object.defineProperty(this,"hasViewer",{value:()=>!!this.pdfViewer})}setViewer(l){this.pdfViewer=l}setThumbnailViewer(l){this.pdfThumbnailViewer=l}isHighestPriority(l){return this.highestPriorityPage===l.renderingId}renderHighestPriority(l){var t;this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),!this.pdfViewer.forceRendering(l)&&(this.isThumbnailViewEnabled&&(t=this.pdfThumbnailViewer)!=null&&t.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),_E)))}getHighestPriority(l,t,d,n=!1){const a=l.views,i=a.length;if(i===0)return null;for(let o=0;o<i;o++){const V=a[o].view;if(!this.isViewFinished(V))return V}const s=l.first.id,c=l.last.id;if(c-s+1>i){const o=l.ids;for(let V=1,W=c-s;V<W;V++){const Q=d?s+V:c-V;if(o.has(Q))continue;const m=t[Q-1];if(!this.isViewFinished(m))return m}}let F=d?c:s-2,h=t[F];return h&&!this.isViewFinished(h)||n&&(F+=d?1:-1,h=t[F],h&&!this.isViewFinished(h))?h:null}isViewFinished(l){return l.renderingState===lt.FINISHED}renderView(l){switch(l.renderingState){case lt.FINISHED:return!1;case lt.PAUSED:this.highestPriorityPage=l.renderingId,l.resume();break;case lt.RUNNING:this.highestPriorityPage=l.renderingId;break;case lt.INITIAL:this.highestPriorityPage=l.renderingId,l.draw().finally(()=>{this.renderHighestPriority()}).catch(t=>{t instanceof tb||console.error("renderView:",t)});break}return!0}}const iG=10,SW={FORCE_SCROLL_MODE_PAGE:1e4,FORCE_LAZY_PAGE_INIT:5e3,PAUSE_EAGER_PAGE_INIT:250};function sG(e){return Object.values(Ge).includes(e)&&e!==Ge.DISABLE}var ya,nU,JW,Tb;class $E{constructor(l){M(this,JW),M(this,ya,new Set),M(this,nU,0),N(this,nU,l)}push(l){const t=U(this,ya);t.has(l)&&t.delete(l),t.add(l),t.size>U(this,nU)&&p(this,JW,Tb).call(this)}resize(l,t=null){N(this,nU,l);const d=U(this,ya);if(t){const n=d.size;let a=1;for(const i of d)if(t.has(i.id)&&(d.delete(i),d.add(i)),++a>n)break}for(;d.size>U(this,nU);)p(this,JW,Tb).call(this)}has(l){return U(this,ya).has(l)}[Symbol.iterator](){return U(this,ya).keys()}}ya=new WeakMap,nU=new WeakMap,JW=new WeakSet,Tb=function(){const e=U(this,ya).keys().next().value;e==null||e.destroy(),U(this,ya).delete(e)};var _i,TW,GW,Gn,He,aU,V0,XW,yW,BW,YW,kW,zW,qi,iU,sU,cU,W0,$i,Q0,LW,m0,UU,ls,IW,R0,Xl,cG,UG,ZG,N0,DW,FG,Gb,hG,Ba,Xb,oG,VG,WG,yb,QG,wW;class mG{constructor(l){M(this,Xl),M(this,_i,null),M(this,TW,null),M(this,GW,null),M(this,Gn,Ge.NONE),M(this,He,null),M(this,aU,bn.ENABLE_FORMS),M(this,V0,null),M(this,XW,null),M(this,yW,!1),M(this,BW,!1),M(this,YW,!1),M(this,kW,!1),M(this,zW,!1),M(this,qi,null),M(this,iU,null),M(this,sU,null),M(this,cU,null),M(this,W0,!1),M(this,$i,null),M(this,Q0,!1),M(this,LW,0),M(this,m0,new ResizeObserver(p(this,Xl,QG).bind(this))),M(this,UU,null),M(this,ls,null),M(this,IW,!0),M(this,R0,xd.ENABLE);var t,d;const n="4.10.38";if(FT!==n)throw new Error(`The API version "${FT}" does not match the Viewer version "${n}".`);if(this.container=l.container,this.viewer=l.viewer||l.container.firstElementChild,((t=this.container)==null?void 0:t.tagName)!=="DIV"||((d=this.viewer)==null?void 0:d.tagName)!=="DIV")throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&getComputedStyle(this.container).position!=="absolute")throw new Error("The `container` must be absolutely positioned.");U(this,m0).observe(this.container),this.eventBus=l.eventBus,this.linkService=l.linkService||new lb,this.downloadManager=l.downloadManager||null,this.findController=l.findController||null,N(this,TW,l.altTextManager||null),N(this,XW,l.editorUndoBar||null),this.findController&&(this.findController.onIsPageVisible=i=>this._getVisiblePages().ids.has(i)),this._scriptingManager=l.scriptingManager||null,N(this,R0,l.textLayerMode??xd.ENABLE),N(this,aU,l.annotationMode??bn.ENABLE_FORMS),N(this,Gn,l.annotationEditorMode??Ge.NONE),N(this,GW,l.annotationEditorHighlightColors||null),N(this,BW,l.enableHighlightFloatingButton===!0),N(this,kW,l.enableUpdatedAddImage===!0),N(this,zW,l.enableNewAltTextWhenAddingImage===!0),this.imageResourcesPath=l.imageResourcesPath||"",this.enablePrintAutoRotate=l.enablePrintAutoRotate||!1,this.removePageBorders=l.removePageBorders||!1,this.maxCanvasPixels=l.maxCanvasPixels,this.l10n=l.l10n,this.l10n||(this.l10n=new eW),N(this,YW,l.enablePermissions||!1),this.pageColors=l.pageColors||null,N(this,iU,l.mlManager||null),N(this,yW,l.enableHWA||!1),N(this,IW,l.supportsPinchToZoom!==!1),this.defaultRenderingQueue=!l.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new qE,this.renderingQueue.setViewer(this)):this.renderingQueue=l.renderingQueue;const{abortSignal:a}=l;a==null||a.addEventListener("abort",()=>{U(this,m0).disconnect(),N(this,m0,null)},{once:!0}),this.scroll=HD(this.container,this._scrollUpdate.bind(this),a),this.presentationModeState=jc.UNKNOWN,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),p(this,Xl,yb).call(this),this.eventBus._on("thumbnailrendered",({pageNumber:i,pdfPage:s})=>{const c=this._pages[i-1];U(this,_i).has(c)||s==null||s.cleanup()}),l.l10n||this.l10n.translate(this.container)}get pagesCount(){return this._pages.length}getPageView(l){return this._pages[l]}getCachedPageViews(){return new Set(U(this,_i))}get pageViewsReady(){return this._pages.every(l=>l==null?void 0:l.pdfPage)}get renderForms(){return U(this,aU)===bn.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(l){if(!Number.isInteger(l))throw new Error("Invalid page number.");this.pdfDocument&&(this._setCurrentPageNumber(l,!0)||console.error(`currentPageNumber: "${l}" is not a valid page.`))}_setCurrentPageNumber(l,t=!1){var d;if(this._currentPageNumber===l)return t&&p(this,Xl,Xb).call(this),!0;if(!(0<l&&l<=this.pagesCount))return!1;const n=this._currentPageNumber;return this._currentPageNumber=l,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:l,pageLabel:((d=this._pageLabels)==null?void 0:d[l-1])??null,previous:n}),t&&p(this,Xl,Xb).call(this),!0}get currentPageLabel(){var l;return((l=this._pageLabels)==null?void 0:l[this._currentPageNumber-1])??null}set currentPageLabel(l){if(!this.pdfDocument)return;let t=l|0;if(this._pageLabels){const d=this._pageLabels.indexOf(l);d>=0&&(t=d+1)}this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${l}" is not a valid page.`)}get currentScale(){return this._currentScale!==CN?this._currentScale:xJ}set currentScale(l){if(isNaN(l))throw new Error("Invalid numeric scale.");this.pdfDocument&&p(this,Xl,Ba).call(this,l,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(l){this.pdfDocument&&p(this,Xl,Ba).call(this,l,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(l){if(!HJ(l))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument||(l%=360,l<0&&(l+=360),this._pagesRotation===l))return;this._pagesRotation=l;const t=this._currentPageNumber;this.refresh(!0,{rotation:l}),this._currentScaleValue&&p(this,Xl,Ba).call(this,this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:l,pageNumber:t}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){const l=this;return HV(this,"_layerProperties",{get annotationEditorUIManager(){return U(l,He)},get annotationStorage(){var t;return(t=l.pdfDocument)==null?void 0:t.annotationStorage},get downloadManager(){return l.downloadManager},get enableScripting(){return!!l._scriptingManager},get fieldObjectsPromise(){var t;return(t=l.pdfDocument)==null?void 0:t.getFieldObjects()},get findController(){return l.findController},get hasJSActionsPromise(){var t;return(t=l.pdfDocument)==null?void 0:t.hasJSActions()},get linkService(){return l.linkService}})}async getAllText(){const l=[],t=[];for(let d=1,n=this.pdfDocument.numPages;d<=n;++d){if(U(this,Q0))return null;t.length=0;const a=await this.pdfDocument.getPage(d),{items:i}=await a.getTextContent();for(const s of i)s.str&&t.push(s.str),s.hasEOL&&t.push(`
404
+ pdfjs-editor-undo-bar-close-button-label = Close`)},M(xT,Ma);let eW=xT;const kE=1e3,zE=50,LE=1e3;function Zb(){return document.location.hash}var xi,Yl,pn,dW,nW,t0,aW,Fb,gT,jT,hb,OT,vT;class IE{constructor({linkService:l,eventBus:t}){M(this,Yl),M(this,xi,null),this.linkService=l,this.eventBus=t,this._initialized=!1,this._fingerprint="",this.reset(),this.eventBus._on("pagesinit",()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",d=>{this._isPagesLoaded=!!d.pagesCount},{once:!0})})}initialize({fingerprint:l,resetHistory:t=!1,updateUrl:d=!1}){if(!l||typeof l!="string"){console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const n=this._fingerprint!==""&&this._fingerprint!==l;this._fingerprint=l,this._updateUrl=d===!0,this._initialized=!0,p(this,Yl,OT).call(this);const a=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=Zb(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!p(this,Yl,t0).call(this,a,!0)||t){const{hash:s,page:c,rotation:F}=p(this,Yl,Fb).call(this,!0);if(!s||n||t){p(this,Yl,pn).call(this,null,!0);return}p(this,Yl,pn).call(this,{hash:s,page:c,rotation:F},!0);return}const i=a.destination;p(this,Yl,aW).call(this,i,a.uid,!0),i.rotation!==void 0&&(this._initialRotation=i.rotation),i.dest?(this._initialBookmark=JSON.stringify(i.dest),this._destination.page=null):i.hash?this._initialBookmark=i.hash:i.page&&(this._initialBookmark=`page=${i.page}`)}reset(){this._initialized&&(p(this,Yl,hb).call(this),this._initialized=!1,p(this,Yl,vT).call(this)),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:l=null,explicitDest:t,pageNumber:d}){if(!this._initialized)return;if(l&&typeof l!="string"){console.error(`PDFHistory.push: "${l}" is not a valid namedDest parameter.`);return}else if(Array.isArray(t)){if(!p(this,Yl,nW).call(this,d)&&(d!==null||this._destination)){console.error(`PDFHistory.push: "${d}" is not a valid pageNumber parameter.`);return}}else{console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);return}const n=l||JSON.stringify(t);if(!n)return;let a=!1;if(this._destination&&(DE(this._destination.hash,n)||wE(this._destination.dest,t))){if(this._destination.page)return;a=!0}this._popStateInProgress&&!a||(p(this,Yl,pn).call(this,{dest:t,hash:n,page:d,rotation:this.linkService.rotation},a),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(l){var t;if(this._initialized){if(!p(this,Yl,nW).call(this,l)){console.error(`PDFHistory.pushPage: "${l}" is not a valid page number.`);return}((t=this._destination)==null?void 0:t.page)!==l&&(this._popStateInProgress||(p(this,Yl,pn).call(this,{dest:null,hash:`page=${l}`,page:l,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1}))))}}pushCurrentPosition(){!this._initialized||this._popStateInProgress||p(this,Yl,dW).call(this)}back(){if(!this._initialized||this._popStateInProgress)return;const l=window.history.state;p(this,Yl,t0).call(this,l)&&l.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const l=window.history.state;p(this,Yl,t0).call(this,l)&&l.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}}xi=new WeakMap,Yl=new WeakSet,pn=function(e,l=!1){const t=l||!this._destination,d={fingerprint:this._fingerprint,uid:t?this._uid:this._uid+1,destination:e};p(this,Yl,aW).call(this,e,d.uid);let n;if(this._updateUrl&&e!=null&&e.hash){const a=document.location.href.split("#",1)[0];a.startsWith("file://")||(n=`${a}#${e.hash}`)}t?window.history.replaceState(d,"",n):window.history.pushState(d,"",n)},dW=function(e=!1){if(!this._position)return;let l=this._position;if(e&&(l=Object.assign(Object.create(null),this._position),l.temporary=!0),!this._destination){p(this,Yl,pn).call(this,l);return}if(this._destination.temporary){p(this,Yl,pn).call(this,l,!0);return}if(this._destination.hash===l.hash||!this._destination.page&&this._numPositionUpdates<=zE)return;let t=!1;if(this._destination.page>=l.first&&this._destination.page<=l.page){if(this._destination.dest!==void 0||!this._destination.first)return;t=!0}p(this,Yl,pn).call(this,l,t)},nW=function(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount},t0=function(e,l=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint)if(l){if(typeof e.fingerprint!="string"||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if((t==null?void 0:t.type)!=="reload")return!1}else return!1;return!(!Number.isInteger(e.uid)||e.uid<0||e.destination===null||typeof e.destination!="object")},aW=function(e,l,t=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),t&&e!=null&&e.temporary&&delete e.temporary,this._destination=e,this._uid=l,this._maxUid=Math.max(this._maxUid,l),this._numPositionUpdates=0},Fb=function(e=!1){const l=unescape(Zb()).substring(1),t=xV(l),d=t.get("nameddest")||"";let n=t.get("page")|0;return(!p(this,Yl,nW).call(this,n)||e&&d.length>0)&&(n=null),{hash:l,page:n,rotation:this.linkService.rotation}},gT=function({location:e}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation},!this._popStateInProgress&&(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||p(this,Yl,dW).call(this,!0),this._updateViewareaTimeout=null},LE))},jT=function({state:e}){const l=Zb(),t=this._currentHash!==l;if(this._currentHash=l,!e){this._uid++;const{hash:n,page:a,rotation:i}=p(this,Yl,Fb).call(this);p(this,Yl,pn).call(this,{hash:n,page:a,rotation:i},!0);return}if(!p(this,Yl,t0).call(this,e))return;this._popStateInProgress=!0,t&&(this._blockHashChange++,Ew({target:window,name:"hashchange",delay:kE}).then(()=>{this._blockHashChange--}));const d=e.destination;p(this,Yl,aW).call(this,d,e.uid,!0),HJ(d.rotation)&&(this.linkService.rotation=d.rotation),d.dest?this.linkService.goToDestination(d.dest):d.hash?this.linkService.setHash(d.hash):d.page&&(this.linkService.page=d.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})},hb=function(){(!this._destination||this._destination.temporary)&&p(this,Yl,dW).call(this)},OT=function(){if(U(this,xi))return;N(this,xi,new AbortController);const{signal:e}=U(this,xi);this.eventBus._on("updateviewarea",p(this,Yl,gT).bind(this),{signal:e}),window.addEventListener("popstate",p(this,Yl,jT).bind(this),{signal:e}),window.addEventListener("pagehide",p(this,Yl,hb).bind(this),{signal:e})},vT=function(){var e;(e=U(this,xi))==null||e.abort(),N(this,xi,null)};function DE(e,l){return typeof e!="string"||typeof l!="string"?!1:e===l||xV(e).get("nameddest")===l}function wE(e,l){function t(d,n){if(typeof d!=typeof n||Array.isArray(d)||Array.isArray(n))return!1;if(d!==null&&typeof d=="object"&&n!==null){if(Object.keys(d).length!==Object.keys(n).length)return!1;for(const a in d)if(!t(d[a],n[a]))return!1;return!0}return d===n||Number.isNaN(d)&&Number.isNaN(n)}if(!(Array.isArray(e)&&Array.isArray(l))||e.length!==l.length)return!1;for(let d=0,n=e.length;d<n;d++)if(!t(e[d],l[d]))return!1;return!0}var iW,sW,cW,UW,ZW,e0;class EE{constructor(l){M(this,iW,null),M(this,sW,null),M(this,cW,null),M(this,UW,null),M(this,ZW,null),M(this,e0),this.pdfPage=l.pdfPage,this.accessibilityManager=l.accessibilityManager,this.l10n=l.l10n,this.l10n||(this.l10n=new eW),this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,N(this,e0,l.uiManager),N(this,iW,l.annotationLayer||null),N(this,ZW,l.textLayer||null),N(this,sW,l.drawLayer||null),N(this,cW,l.onAppend||null),N(this,UW,l.structTreeLayer||null)}async render(l,t="display"){var d;if(t!=="display"||this._cancelled)return;const n=l.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:n}),this.show();return}const a=this.div=document.createElement("div");a.className="annotationEditorLayer",a.hidden=!0,a.dir=U(this,e0).direction,(d=U(this,cW))==null||d.call(this,a),this.annotationEditorLayer=new Tw({uiManager:U(this,e0),div:a,structTreeLayer:U(this,UW),accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:n,annotationLayer:U(this,iW),textLayer:U(this,ZW),drawLayer:U(this,sW)});const i={viewport:n,div:a,annotations:null,intent:t};this.annotationEditorLayer.render(i),this.show()}cancel(){this._cancelled=!0,this.div&&this.annotationEditorLayer.destroy()}hide(){this.div&&(this.annotationEditorLayer.pause(!0),this.div.hidden=!0)}show(){!this.div||this.annotationEditorLayer.isInvisible||(this.div.hidden=!1,this.annotationEditorLayer.pause(!1))}}iW=new WeakMap,sW=new WeakMap,cW=new WeakMap,UW=new WeakMap,ZW=new WeakMap,e0=new WeakMap;{var ob=new Map;const e=navigator.userAgent||"",l=navigator.platform||"",t=navigator.maxTouchPoints||1,d=/Android/.test(e),n=/\b(iPad|iPhone|iPod)(?=;)/.test(e)||l==="MacIntel"&&t>1;(function(){(n||d)&&ob.set("maxCanvasPixels",5242880)})(),function(){d&&ob.set("useSystemFonts",!1)}()}const q={BROWSER:1,VIEWER:2,API:4,WORKER:8,EVENT_DISPATCH:16,PREFERENCE:128},Vb={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},gd={allowedGlobalEvents:{value:null,kind:q.BROWSER},canvasMaxAreaInBytes:{value:-1,kind:q.BROWSER+q.API},isInAutomation:{value:!1,kind:q.BROWSER},localeProperties:{value:{lang:navigator.language||"en-US"},kind:q.BROWSER},nimbusDataStr:{value:"",kind:q.BROWSER},supportsCaretBrowsingMode:{value:!1,kind:q.BROWSER},supportsDocumentFonts:{value:!0,kind:q.BROWSER},supportsIntegratedFind:{value:!1,kind:q.BROWSER},supportsMouseWheelZoomCtrlKey:{value:!0,kind:q.BROWSER},supportsMouseWheelZoomMetaKey:{value:!0,kind:q.BROWSER},supportsPinchToZoom:{value:!0,kind:q.BROWSER},toolbarDensity:{value:0,kind:q.BROWSER+q.EVENT_DISPATCH},altTextLearnMoreUrl:{value:"",kind:q.VIEWER+q.PREFERENCE},annotationEditorMode:{value:0,kind:q.VIEWER+q.PREFERENCE},annotationMode:{value:2,kind:q.VIEWER+q.PREFERENCE},cursorToolOnLoad:{value:0,kind:q.VIEWER+q.PREFERENCE},debuggerSrc:{value:"./debugger.mjs",kind:q.VIEWER},defaultZoomDelay:{value:400,kind:q.VIEWER+q.PREFERENCE},defaultZoomValue:{value:"",kind:q.VIEWER+q.PREFERENCE},disableHistory:{value:!1,kind:q.VIEWER},disablePageLabels:{value:!1,kind:q.VIEWER+q.PREFERENCE},enableAltText:{value:!1,kind:q.VIEWER+q.PREFERENCE},enableAltTextModelDownload:{value:!0,kind:q.VIEWER+q.PREFERENCE+q.EVENT_DISPATCH},enableGuessAltText:{value:!0,kind:q.VIEWER+q.PREFERENCE+q.EVENT_DISPATCH},enableHighlightFloatingButton:{value:!1,kind:q.VIEWER+q.PREFERENCE},enableNewAltTextWhenAddingImage:{value:!0,kind:q.VIEWER+q.PREFERENCE},enablePermissions:{value:!1,kind:q.VIEWER+q.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:q.VIEWER+q.PREFERENCE},enableScripting:{value:!0,kind:q.VIEWER+q.PREFERENCE},enableUpdatedAddImage:{value:!1,kind:q.VIEWER+q.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:q.VIEWER},externalLinkTarget:{value:0,kind:q.VIEWER+q.PREFERENCE},highlightEditorColors:{value:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F",kind:q.VIEWER+q.PREFERENCE},historyUpdateUrl:{value:!1,kind:q.VIEWER+q.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:q.VIEWER+q.PREFERENCE},imageResourcesPath:{value:"./images/",kind:q.VIEWER},maxCanvasPixels:{value:2**25,kind:q.VIEWER},forcePageColors:{value:!1,kind:q.VIEWER+q.PREFERENCE},pageColorsBackground:{value:"Canvas",kind:q.VIEWER+q.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:q.VIEWER+q.PREFERENCE},pdfBugEnabled:{value:!1,kind:q.VIEWER+q.PREFERENCE},printResolution:{value:150,kind:q.VIEWER},sidebarViewOnLoad:{value:-1,kind:q.VIEWER+q.PREFERENCE},scrollModeOnLoad:{value:-1,kind:q.VIEWER+q.PREFERENCE},spreadModeOnLoad:{value:-1,kind:q.VIEWER+q.PREFERENCE},textLayerMode:{value:1,kind:q.VIEWER+q.PREFERENCE},viewOnLoad:{value:0,kind:q.VIEWER+q.PREFERENCE},cMapPacked:{value:!0,kind:q.API},cMapUrl:{value:"../web/cmaps/",kind:q.API},disableAutoFetch:{value:!1,kind:q.API+q.PREFERENCE},disableFontFace:{value:!1,kind:q.API+q.PREFERENCE},disableRange:{value:!1,kind:q.API+q.PREFERENCE},disableStream:{value:!1,kind:q.API+q.PREFERENCE},docBaseUrl:{value:"",kind:q.API},enableHWA:{value:!0,kind:q.API+q.VIEWER+q.PREFERENCE},enableXfa:{value:!0,kind:q.API+q.PREFERENCE},fontExtraProperties:{value:!1,kind:q.API},isEvalSupported:{value:!0,kind:q.API},isOffscreenCanvasSupported:{value:!0,kind:q.API},maxImageSize:{value:-1,kind:q.API},pdfBug:{value:!1,kind:q.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:q.API},useSystemFonts:{value:void 0,kind:q.API,type:Vb.BOOLEAN+Vb.UNDEFINED},verbosity:{value:1,kind:q.API},workerPort:{value:null,kind:q.WORKER},workerSrc:{value:"../build/pdf.worker.mjs",kind:q.WORKER}};gd.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:q.VIEWER},gd.sandboxBundleSrc={value:"../build/pdf.sandbox.mjs",kind:q.VIEWER},gd.viewerCssTheme={value:0,kind:q.VIEWER+q.PREFERENCE},gd.enableFakeMLManager={value:!0,kind:q.VIEWER},gd.disablePreferences={value:!1,kind:q.VIEWER};var gi;const Mn=class{static get(l){return U(this,gi).get(l)}static getAll(l=null,t=!1){const d=Object.create(null);for(const n in gd){const a=gd[n];l&&!(l&a.kind)||(d[n]=t?a.value:U(this,gi).get(n))}return d}static set(l,t){this.setAll({[l]:t})}static setAll(l,t=!1){this._hasInvokedSet||(this._hasInvokedSet=!0);let d;for(const n in l){const a=gd[n],i=l[n];if(!a||!(typeof i==typeof a.value||Vb[(typeof i).toUpperCase()]&a.type))continue;const{kind:s}=a;t&&!(s&q.BROWSER||s&q.PREFERENCE)||(this.eventBus&&s&q.EVENT_DISPATCH&&(d||(d=new Map)).set(n,i),U(this,gi).set(n,i))}if(d)for(const[n,a]of d)this.eventBus.dispatch(n.toLowerCase(),{source:this,value:a})}};gi=new WeakMap,hl(Mn,"eventBus"),M(Mn,gi,new Map),(()=>{for(const e in gd)U(Mn,gi).set(e,gd[e].value);for(const[e,l]of ob)U(Mn,gi).set(e,l);Mn._hasInvokedSet=!1,Mn._checkDisablePreferences=()=>Mn.get("disablePreferences")?!0:(Mn._hasInvokedSet&&console.warn('The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.'),!1)})();let CE=Mn;var Sn;class xE{constructor(l){M(this,Sn,null),this.pageIndex=l.pageIndex}async render(l="display"){l!=="display"||U(this,Sn)||this._cancelled||N(this,Sn,new Bw({pageIndex:this.pageIndex}))}cancel(){this._cancelled=!0,U(this,Sn)&&(U(this,Sn).destroy(),N(this,Sn,null))}setParent(l){var t;(t=U(this,Sn))==null||t.setParent(l)}getDrawLayer(){return U(this,Sn)}}Sn=new WeakMap;const KT={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},gE=/^H(\d+)$/;var d0,jd,n0,a0,i0,Sa,ji,Wb,fT,Qb;class HT{constructor(l,t){M(this,ji),M(this,d0),M(this,jd,null),M(this,n0),M(this,a0,new Map),M(this,i0),M(this,Sa,null),N(this,d0,l.getStructTree()),N(this,i0,t)}async render(){var l;if(U(this,n0))return U(this,n0);const{promise:t,resolve:d,reject:n}=Promise.withResolvers();N(this,n0,t);try{N(this,jd,p(this,ji,Qb).call(this,await U(this,d0)))}catch(a){n(a)}return N(this,d0,null),(l=U(this,jd))==null||l.classList.add("structTree"),d(U(this,jd)),t}async getAriaAttributes(l){try{return await this.render(),U(this,a0).get(l)}catch{}return null}hide(){U(this,jd)&&!U(this,jd).hidden&&(U(this,jd).hidden=!0)}show(){var l;(l=U(this,jd))!=null&&l.hidden&&(U(this,jd).hidden=!1)}addElementsToTextLayer(){var l;if(U(this,Sa)){for(const[t,d]of U(this,Sa))(l=document.getElementById(t))==null||l.append(d);U(this,Sa).clear(),N(this,Sa,null)}}}d0=new WeakMap,jd=new WeakMap,n0=new WeakMap,a0=new WeakMap,i0=new WeakMap,Sa=new WeakMap,ji=new WeakSet,Wb=function(e,l){const{alt:t,id:d,lang:n}=e;if(t!==void 0){let a=!1;const i=OF(t);for(const s of e.children)if(s.type==="annotation"){let c=U(this,a0).get(s.id);c||(c=new Map,U(this,a0).set(s.id,c)),c.set("aria-label",i),a=!0}a||l.setAttribute("aria-label",i)}d!==void 0&&l.setAttribute("aria-owns",d),n!==void 0&&l.setAttribute("lang",OF(n,!0))},fT=function(e,l){const{alt:t,bbox:d,children:n}=e,a=n==null?void 0:n[0];if(!U(this,i0)||!t||!d||(a==null?void 0:a.type)!=="content")return!1;const{id:i}=a;if(!i)return!1;l.setAttribute("aria-owns",i);const s=document.createElement("span");(U(this,Sa)||N(this,Sa,new Map)).set(i,s),s.setAttribute("role","img"),s.setAttribute("aria-label",OF(t));const{pageHeight:c,pageX:F,pageY:h}=U(this,i0),o="calc(var(--scale-factor)*",{style:V}=s;return V.width=`${o}${d[2]-d[0]}px)`,V.height=`${o}${d[3]-d[1]}px)`,V.left=`${o}${d[0]-F}px)`,V.top=`${o}${c-d[3]+h}px)`,!0},Qb=function(e){if(!e)return null;const l=document.createElement("span");if("role"in e){const{role:t}=e,d=t.match(gE);if(d?(l.setAttribute("role","heading"),l.setAttribute("aria-level",d[1])):KT[t]&&l.setAttribute("role",KT[t]),t==="Figure"&&p(this,ji,fT).call(this,e,l))return l}if(p(this,ji,Wb).call(this,e,l),e.children)if(e.children.length===1&&"id"in e.children[0])p(this,ji,Wb).call(this,e.children[0],l);else for(const t of e.children)l.append(p(this,ji,Qb).call(this,t));return l};var Ja,Zd,Ta,Oi,s0,FW,hW,mb;const PT=class hQ{constructor(){M(this,hW),M(this,Ja,!1),M(this,Zd,null),M(this,Ta,new Map),M(this,Oi,new Map)}setTextMapping(l){N(this,Zd,l)}enable(){if(U(this,Ja))throw new Error("TextAccessibilityManager is already enabled.");if(!U(this,Zd))throw new Error("Text divs and strings have not been set.");if(N(this,Ja,!0),N(this,Zd,U(this,Zd).slice()),U(this,Zd).sort(p(hQ,s0,FW)),U(this,Ta).size>0){const l=U(this,Zd);for(const[t,d]of U(this,Ta)){if(!document.getElementById(t)){U(this,Ta).delete(t);continue}p(this,hW,mb).call(this,t,l[d])}}for(const[l,t]of U(this,Oi))this.addPointerInTextLayer(l,t);U(this,Oi).clear()}disable(){U(this,Ja)&&(U(this,Oi).clear(),N(this,Zd,null),N(this,Ja,!1))}removePointerInTextLayer(l){if(!U(this,Ja)){U(this,Oi).delete(l);return}const t=U(this,Zd);if(!t||t.length===0)return;const{id:d}=l,n=U(this,Ta).get(d);if(n===void 0)return;const a=t[n];U(this,Ta).delete(d);let i=a.getAttribute("aria-owns");i!=null&&i.includes(d)&&(i=i.split(" ").filter(s=>s!==d).join(" "),i?a.setAttribute("aria-owns",i):(a.removeAttribute("aria-owns"),a.setAttribute("role","presentation")))}addPointerInTextLayer(l,t){const{id:d}=l;if(!d)return null;if(!U(this,Ja))return U(this,Oi).set(l,t),null;t&&this.removePointerInTextLayer(l);const n=U(this,Zd);if(!n||n.length===0)return null;const a=vF(n,F=>{var h;return p(h=hQ,s0,FW).call(h,l,F)<0}),i=Math.max(0,a-1),s=n[i];p(this,hW,mb).call(this,d,s),U(this,Ta).set(d,i);const c=s.parentNode;return c!=null&&c.classList.contains("markedContent")?c.id:null}moveElementInDOM(l,t,d,n){const a=this.addPointerInTextLayer(d,n);if(!l.hasChildNodes())return l.append(t),a;const i=Array.from(l.childNodes).filter(F=>F!==t);if(i.length===0)return a;const s=d||t,c=vF(i,F=>{var h;return p(h=hQ,s0,FW).call(h,s,F)<0});return c===0?i[0].before(t):i[c-1].after(t),a}};Ja=new WeakMap,Zd=new WeakMap,Ta=new WeakMap,Oi=new WeakMap,s0=new WeakSet,FW=function(e,l){const t=e.getBoundingClientRect(),d=l.getBoundingClientRect();if(t.width===0&&t.height===0)return 1;if(d.width===0&&d.height===0)return-1;const n=t.y,a=t.y+t.height,i=t.y+t.height/2,s=d.y,c=d.y+d.height,F=d.y+d.height/2;if(i<=s&&F>=a)return-1;if(F<=n&&i>=c)return 1;const h=t.x+t.width/2,o=d.x+d.width/2;return h-o},hW=new WeakSet,mb=function(e,l){const t=l.getAttribute("aria-owns");t!=null&&t.includes(e)||l.setAttribute("aria-owns",t?`${t} ${e}`:e),l.removeAttribute("role")},M(PT,s0);let jE=PT;var vi;class OE{constructor({findController:l,eventBus:t,pageIndex:d}){M(this,vi,null),this.findController=l,this.matches=[],this.eventBus=t,this.pageIdx=d,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(l,t){this.textDivs=l,this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,U(this,vi)||(N(this,vi,new AbortController),this.eventBus._on("updatetextlayermatches",l=>{(l.pageIndex===this.pageIdx||l.pageIndex===-1)&&this._updateMatches()},{signal:U(this,vi).signal})),this._updateMatches()}disable(){var l;this.enabled&&(this.enabled=!1,(l=U(this,vi))==null||l.abort(),N(this,vi,null),this._updateMatches(!0))}_convertMatches(l,t){if(!l)return[];const{textContentItemsStr:d}=this;let n=0,a=0;const i=d.length-1,s=[];for(let c=0,F=l.length;c<F;c++){let h=l[c];for(;n!==i&&h>=a+d[n].length;)a+=d[n].length,n++;n===d.length&&console.error("Could not find a matching mapping");const o={begin:{divIdx:n,offset:h-a}};for(h+=t[c];n!==i&&h>a+d[n].length;)a+=d[n].length,n++;o.end={divIdx:n,offset:h-a},s.push(o)}return s}_renderMatches(l){if(l.length===0)return;const{findController:t,pageIdx:d}=this,{textContentItemsStr:n,textDivs:a}=this,i=d===t.selected.pageIdx,s=t.selected.matchIdx,c=t.state.highlightAll;let F=null;const h={offset:void 0};function o(r,b){const u=r.divIdx;return a[u].textContent="",V(u,0,r.offset,b)}function V(r,b,u,J){let G=a[r];if(G.nodeType===Node.TEXT_NODE){const k=document.createElement("span");G.before(k),k.append(G),a[r]=k,G=k}const T=n[r].substring(b,u),y=document.createTextNode(T);if(J){const k=document.createElement("span");if(k.className=`${J} appended`,k.append(y),G.append(k),J.includes("selected")){const{left:X}=k.getClientRects()[0],L=G.getBoundingClientRect().left;return X-L}return 0}return G.append(y),0}let W=s,Q=W+1;if(c)W=0,Q=l.length;else if(!i)return;let m=-1,R=-1;for(let r=W;r<Q;r++){const b=l[r],u=b.begin;if(u.divIdx===m&&u.offset===R)continue;m=u.divIdx,R=u.offset;const J=b.end,G=i&&r===s,T=G?" selected":"";let y=0;if(!F||u.divIdx!==F.divIdx?(F!==null&&V(F.divIdx,F.offset,h.offset),o(u)):V(F.divIdx,F.offset,u.offset),u.divIdx===J.divIdx)y=V(u.divIdx,u.offset,J.offset,"highlight"+T);else{y=V(u.divIdx,u.offset,h.offset,"highlight begin"+T);for(let k=u.divIdx+1,X=J.divIdx;k<X;k++)a[k].className="highlight middle"+T;o(J,"highlight end"+T)}F=J,G&&t.scrollMatchIntoView({element:a[u.divIdx],selectedLeft:y,pageIndex:d,matchIndex:s})}F&&V(F.divIdx,F.offset,h.offset)}_updateMatches(l=!1){if(!this.enabled&&!l)return;const{findController:t,matches:d,pageIdx:n}=this,{textContentItemsStr:a,textDivs:i}=this;let s=-1;for(const h of d){const o=Math.max(s,h.begin.divIdx);for(let V=o,W=h.end.divIdx;V<=W;V++){const Q=i[V];Q.textContent=a[V],Q.className=""}s=h.end.divIdx+1}if(!(t!=null&&t.highlightMatches)||l)return;const c=t.pageMatches[n]||null,F=t.pageMatchesLength[n]||null;this.matches=this._convertMatches(c,F),this._renderMatches(this.matches)}}vi=new WeakMap;var oW,VW,Pc,Jn,ye,Ki,Rb,AT,WW,_T,qT;const Ac=class ry{constructor({pdfPage:l,highlighter:t=null,accessibilityManager:d=null,enablePermissions:n=!1,onAppend:a=null}){M(this,Rb),M(this,oW,!1),M(this,VW,null),M(this,Pc,!1),M(this,Jn,null),this.pdfPage=l,this.highlighter=t,this.accessibilityManager=d,N(this,oW,n===!0),N(this,VW,a),this.div=document.createElement("div"),this.div.tabIndex=0,this.div.className="textLayer"}async render(l,t=null){var d,n,a,i,s;if(U(this,Pc)&&U(this,Jn)){U(this,Jn).update({viewport:l,onBefore:this.hide.bind(this)}),this.show();return}this.cancel(),N(this,Jn,new Dw({textContentSource:this.pdfPage.streamTextContent(t||{includeMarkedContent:!0,disableNormalization:!0}),container:this.div,viewport:l}));const{textDivs:c,textContentItemsStr:F}=U(this,Jn);(d=this.highlighter)==null||d.setTextMapping(c,F),(n=this.accessibilityManager)==null||n.setTextMapping(c),await U(this,Jn).render(),N(this,Pc,!0);const h=document.createElement("div");h.className="endOfContent",this.div.append(h),p(this,Rb,AT).call(this,h),(a=U(this,VW))==null||a.call(this,this.div),(i=this.highlighter)==null||i.enable(),(s=this.accessibilityManager)==null||s.enable()}hide(){var l;!this.div.hidden&&U(this,Pc)&&((l=this.highlighter)==null||l.disable(),this.div.hidden=!0)}show(){var l;this.div.hidden&&U(this,Pc)&&(this.div.hidden=!1,(l=this.highlighter)==null||l.enable())}cancel(){var l,t,d,n;(l=U(this,Jn))==null||l.cancel(),N(this,Jn,null),(t=this.highlighter)==null||t.disable(),(d=this.accessibilityManager)==null||d.disable(),p(n=ry,WW,_T).call(n,this.div)}};oW=new WeakMap,VW=new WeakMap,Pc=new WeakMap,Jn=new WeakMap,ye=new WeakMap,Ki=new WeakMap,Rb=new WeakSet,AT=function(e){var l;const{div:t}=this;t.addEventListener("mousedown",()=>{t.classList.add("selecting")}),t.addEventListener("copy",d=>{if(!U(this,oW)){const n=document.getSelection();d.clipboardData.setData("text/plain",OF(zw(n.toString())))}eb(d)}),U(Ac,ye).set(t,e),p(l=Ac,WW,qT).call(l)},WW=new WeakSet,_T=function(e){var l;U(this,ye).delete(e),U(this,ye).size===0&&((l=U(this,Ki))==null||l.abort(),N(this,Ki,null))},qT=function(){if(U(this,Ki))return;N(this,Ki,new AbortController);const{signal:e}=U(this,Ki),l=(a,i)=>{i.append(a),a.style.width="",a.style.height="",i.classList.remove("selecting")};let t=!1;document.addEventListener("pointerdown",()=>{t=!0},{signal:e}),document.addEventListener("pointerup",()=>{t=!1,U(this,ye).forEach(l)},{signal:e}),window.addEventListener("blur",()=>{t=!1,U(this,ye).forEach(l)},{signal:e}),document.addEventListener("keyup",()=>{t||U(this,ye).forEach(l)},{signal:e});var d,n;document.addEventListener("selectionchange",()=>{var a;const i=document.getSelection();if(i.rangeCount===0){U(this,ye).forEach(l);return}const s=new Set;for(let W=0;W<i.rangeCount;W++){const Q=i.getRangeAt(W);for(const m of U(this,ye).keys())!s.has(m)&&Q.intersectsNode(m)&&s.add(m)}for(const[W,Q]of U(this,ye))s.has(W)?W.classList.add("selecting"):l(Q,W);if(d??(d=getComputedStyle(U(this,ye).values().next().value).getPropertyValue("-moz-user-select")==="none"),d)return;const c=i.getRangeAt(0),F=n&&(c.compareBoundaryPoints(Range.END_TO_END,n)===0||c.compareBoundaryPoints(Range.START_TO_END,n)===0);let h=F?c.startContainer:c.endContainer;h.nodeType===Node.TEXT_NODE&&(h=h.parentNode);const o=(a=h.parentElement)==null?void 0:a.closest(".textLayer"),V=U(this,ye).get(o);V&&(V.style.width=o.style.width,V.style.height=o.style.height,h.parentElement.insertBefore(V,F?h:h.nextSibling)),n=c.cloneRange()},{signal:e})},M(Ac,WW),M(Ac,ye,new Map),M(Ac,Ki,null);let $T=Ac;class lG{constructor({pdfPage:l,annotationStorage:t=null,linkService:d,xfaHtml:n=null}){this.pdfPage=l,this.annotationStorage=t,this.linkService=d,this.xfaHtml=n,this.div=null,this._cancelled=!1}async render(l,t="display"){if(t==="print"){const a={viewport:l.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};return this.div=document.createElement("div"),a.div=this.div,db.render(a)}const d=await this.pdfPage.getXfa();if(this._cancelled||!d)return{textDivs:[]};const n={viewport:l.clone({dontFlip:!0}),div:this.div,xfaHtml:d,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};return this.div?db.update(n):(this.div=document.createElement("div"),n.div=this.div,db.render(n))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}const vE={annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsPromise:null,get linkService(){return new lb}},KE=new Map([["canvasWrapper",0],["textLayer",1],["annotationLayer",2],["annotationEditorLayer",3],["xfaLayer",3]]);var _c,fi,QW,qc,mW,Hi,Pi,c0,RW,NW,bW,$c,U0,Z0,Ga,Ai,zl,lU,uW,F0,Nb,bb,ub,rb,pb,tG,eG,Mb,Sb;class dG{constructor(l){M(this,zl),M(this,_c,bn.ENABLE_FORMS),M(this,fi,null),M(this,QW,!1),M(this,qc,!1),M(this,mW,!1),M(this,Hi,null),M(this,Pi,null),M(this,c0,null),M(this,RW,null),M(this,NW,1),M(this,bW,1),M(this,$c,null),M(this,U0,lt.INITIAL),M(this,Z0,xd.ENABLE),M(this,Ga,{directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0}),M(this,Ai,[null,null,null,null]);var t,d;const n=l.container,a=l.defaultViewport;this.id=l.id,this.renderingId="page"+this.id,N(this,Hi,l.layerProperties||vE),this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=l.scale||xJ,this.viewport=a,this.pdfPageRotate=a.rotation,this._optionalContentConfigPromise=l.optionalContentConfigPromise||null,N(this,Z0,l.textLayerMode??xd.ENABLE),N(this,_c,l.annotationMode??bn.ENABLE_FORMS),this.imageResourcesPath=l.imageResourcesPath||"",this.maxCanvasPixels=l.maxCanvasPixels??CE.get("maxCanvasPixels"),this.pageColors=l.pageColors||null,N(this,QW,l.enableHWA||!1),this.eventBus=l.eventBus,this.renderingQueue=l.renderingQueue,this.l10n=l.l10n,this.l10n||(this.l10n=new eW),this.renderTask=null,this.resume=null,this._isStandalone=!((t=this.renderingQueue)!=null&&t.hasViewer()),this._container=n,this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.xfaLayer=null,this.structTreeLayer=null,this.drawLayer=null;const i=document.createElement("div");if(i.className="page",i.setAttribute("data-page-number",this.id),i.setAttribute("role","region"),i.setAttribute("data-l10n-id","pdfjs-page-landmark"),i.setAttribute("data-l10n-args",JSON.stringify({page:this.id})),this.div=i,p(this,zl,uW).call(this),n==null||n.append(i),this._isStandalone){n==null||n.style.setProperty("--scale-factor",this.scale*un.PDF_TO_CSS_UNITS),(d=this.pageColors)!=null&&d.background&&(n==null||n.style.setProperty("--page-bg-color",this.pageColors.background));const{optionalContentConfigPromise:s}=l;s&&s.then(c=>{s===this._optionalContentConfigPromise&&(U(this,Ga).initialOptionalContent=c.hasInitialVisibility)}),l.l10n||this.l10n.translate(this.div)}}get renderingState(){return U(this,U0)}set renderingState(l){if(l!==U(this,U0))switch(N(this,U0,l),U(this,Pi)&&(clearTimeout(U(this,Pi)),N(this,Pi,null)),l){case lt.PAUSED:this.div.classList.remove("loading");break;case lt.RUNNING:this.div.classList.add("loadingIcon"),N(this,Pi,setTimeout(()=>{this.div.classList.add("loading"),N(this,Pi,null)},0));break;case lt.INITIAL:case lt.FINISHED:this.div.classList.remove("loadingIcon","loading");break}}setPdfPage(l){var t,d,n,a;this._isStandalone&&(((t=this.pageColors)==null?void 0:t.foreground)==="CanvasText"||((d=this.pageColors)==null?void 0:d.background)==="Canvas")&&((n=this._container)==null||n.style.setProperty("--hcm-highlight-filter",l.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),(a=this._container)==null||a.style.setProperty("--hcm-highlight-selected-filter",l.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","Highlight"))),this.pdfPage=l,this.pdfPageRotate=l.rotate;const i=(this.rotation+this.pdfPageRotate)%360;this.viewport=l.getViewport({scale:this.scale*un.PDF_TO_CSS_UNITS,rotation:i}),p(this,zl,uW).call(this),this.reset()}destroy(){var l;this.reset(),(l=this.pdfPage)==null||l.cleanup()}hasEditableAnnotations(){var l;return!!((l=this.annotationLayer)!=null&&l.hasEditableAnnotations())}get _textHighlighter(){return HV(this,"_textHighlighter",new OE({pageIndex:this.id-1,eventBus:this.eventBus,findController:U(this,Hi).findController}))}reset({keepAnnotationLayer:l=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:d=!1,keepTextLayer:n=!1,keepCanvasWrapper:a=!1}={}){var i,s,c,F,h;this.cancelRendering({keepAnnotationLayer:l,keepAnnotationEditorLayer:t,keepXfaLayer:d,keepTextLayer:n}),this.renderingState=lt.INITIAL;const o=this.div,V=o.childNodes,W=l&&((i=this.annotationLayer)==null?void 0:i.div)||null,Q=t&&((s=this.annotationEditorLayer)==null?void 0:s.div)||null,m=d&&((c=this.xfaLayer)==null?void 0:c.div)||null,R=n&&((F=this.textLayer)==null?void 0:F.div)||null,r=a&&U(this,fi)||null;for(let b=V.length-1;b>=0;b--){const u=V[b];switch(u){case W:case Q:case m:case R:case r:continue}u.remove();const J=U(this,Ai).indexOf(u);J>=0&&(U(this,Ai)[J]=null)}o.removeAttribute("data-loaded"),W&&this.annotationLayer.hide(),Q&&this.annotationEditorLayer.hide(),m&&this.xfaLayer.hide(),R&&this.textLayer.hide(),(h=this.structTreeLayer)==null||h.hide(),!a&&U(this,fi)&&(N(this,fi,null),p(this,zl,Mb).call(this))}toggleEditingMode(l){this.hasEditableAnnotations()&&(N(this,mW,l),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0}))}update({scale:l=0,rotation:t=null,optionalContentConfigPromise:d=null,drawingDelay:n=-1}){var a;this.scale=l||this.scale,typeof t=="number"&&(this.rotation=t),d instanceof Promise&&(this._optionalContentConfigPromise=d,d.then(s=>{d===this._optionalContentConfigPromise&&(U(this,Ga).initialOptionalContent=s.hasInitialVisibility)})),U(this,Ga).directDrawing=!0;const i=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*un.PDF_TO_CSS_UNITS,rotation:i}),p(this,zl,uW).call(this),this._isStandalone&&((a=this._container)==null||a.style.setProperty("--scale-factor",this.viewport.scale)),this.canvas){let s=!1;if(U(this,qc)){if(this.maxCanvasPixels===0)s=!0;else if(this.maxCanvasPixels>0){const{width:F,height:h}=this.viewport,{sx:o,sy:V}=this.outputScale;s=(Math.floor(F)*o|0)*(Math.floor(h)*V|0)>this.maxCanvasPixels}}const c=n>=0&&n<1e3;if(c||s){if(c&&!s&&this.renderingState!==lt.FINISHED&&(this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:n}),this.renderingState=lt.FINISHED,U(this,Ga).directDrawing=!1),this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!c,hideTextLayer:c}),c)return;this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:U(this,$c)});return}}this.cssTransform({}),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}cancelRendering({keepAnnotationLayer:l=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:d=!1,keepTextLayer:n=!1,cancelExtraDelay:a=0}={}){var i;this.renderTask&&(this.renderTask.cancel(a),this.renderTask=null),this.resume=null,this.textLayer&&(!n||!this.textLayer.div)&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!l||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),this.annotationEditorLayer&&(!t||!this.annotationEditorLayer.div)&&(this.drawLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),this.xfaLayer&&(!d||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,(i=this._textHighlighter)==null||i.disable())}cssTransform({redrawAnnotationLayer:l=!1,redrawAnnotationEditorLayer:t=!1,redrawXfaLayer:d=!1,redrawTextLayer:n=!1,hideTextLayer:a=!1}){var i;const{canvas:s}=this;if(!s)return;const c=U(this,c0);if(this.viewport!==c){const F=(360+this.viewport.rotation-c.rotation)%360;if(F===90||F===270){const{width:h,height:o}=this.viewport,V=o/h,W=h/o;s.style.transform=`rotate(${F}deg) scale(${V},${W})`}else s.style.transform=F===0?"":`rotate(${F}deg)`}l&&this.annotationLayer&&p(this,zl,Nb).call(this),t&&this.annotationEditorLayer&&(this.drawLayer&&p(this,zl,ub).call(this),p(this,zl,bb).call(this)),d&&this.xfaLayer&&p(this,zl,rb).call(this),this.textLayer&&(a?(this.textLayer.hide(),(i=this.structTreeLayer)==null||i.hide()):n&&p(this,zl,pb).call(this))}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(l,t){return this.viewport.convertToPdfPoint(l,t)}async draw(){this.renderingState!==lt.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:l,l10n:t,pageColors:d,pdfPage:n,viewport:a}=this;if(!n)throw this.renderingState=lt.FINISHED,new Error("pdfPage is not loaded");this.renderingState=lt.RUNNING;let i=U(this,fi);if(i||(i=N(this,fi,document.createElement("div")),i.classList.add("canvasWrapper"),p(this,zl,lU).call(this,i,"canvasWrapper")),!this.textLayer&&U(this,Z0)!==xd.DISABLE&&!n.isPureXfa&&(this._accessibilityManager||(this._accessibilityManager=new jE),this.textLayer=new $T({pdfPage:n,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:U(this,Z0)===xd.ENABLE_PERMISSIONS,onAppend:D=>{this.l10n.pause(),p(this,zl,lU).call(this,D,"textLayer"),this.l10n.resume()}})),!this.annotationLayer&&U(this,_c)!==bn.DISABLE){const{annotationStorage:D,annotationEditorUIManager:C,downloadManager:I,enableScripting:H,fieldObjectsPromise:f,hasJSActionsPromise:Y,linkService:B}=U(this,Hi);this._annotationCanvasMap||(this._annotationCanvasMap=new Map),this.annotationLayer=new hT({pdfPage:n,annotationStorage:D,imageResourcesPath:this.imageResourcesPath,renderForms:U(this,_c)===bn.ENABLE_FORMS,linkService:B,downloadManager:I,enableScripting:H,hasJSActionsPromise:Y,fieldObjectsPromise:f,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:C,onAppend:z=>{p(this,zl,lU).call(this,z,"annotationLayer")}})}const s=D=>{if(Q==null||Q(!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this)){this.renderingState=lt.PAUSED,this.resume=()=>{this.renderingState=lt.RUNNING,D()};return}D()},{width:c,height:F}=a,h=document.createElement("canvas");h.setAttribute("role","presentation");const o=!!(d!=null&&d.background&&d!=null&&d.foreground),V=this.canvas,W=!V&&!o;this.canvas=h,N(this,c0,a);let Q=D=>{if(W){i.prepend(h),Q=null;return}D&&(V?(V.replaceWith(h),V.width=V.height=0):i.prepend(h),Q=null)};const m=h.getContext("2d",{alpha:!1,willReadFrequently:!U(this,QW)}),R=this.outputScale=new Lw;if(this.maxCanvasPixels===0){const D=1/this.scale;R.sx*=D,R.sy*=D,N(this,qc,!0)}else if(this.maxCanvasPixels>0){const D=c*F,C=Math.sqrt(this.maxCanvasPixels/D);R.sx>C||R.sy>C?(R.sx=C,R.sy=C,N(this,qc,!0)):N(this,qc,!1)}const r=fJ(R.sx),b=fJ(R.sy),u=h.width=gV(jV(c*R.sx),r[0]),J=h.height=gV(jV(F*R.sy),b[0]),G=gV(jV(c),r[1]),T=gV(jV(F),b[1]);R.sx=u/G,R.sy=J/T,U(this,NW)!==r[1]&&(l.style.setProperty("--scale-round-x",`${r[1]}px`),N(this,NW,r[1])),U(this,bW)!==b[1]&&(l.style.setProperty("--scale-round-y",`${b[1]}px`),N(this,bW,b[1]));const y=R.scaled?[R.sx,0,0,R.sy,0,0]:null,k={canvasContext:m,transform:y,viewport:a,annotationMode:U(this,_c),optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:d,isEditing:U(this,mW)},X=this.renderTask=n.render(k);X.onContinue=s;const L=X.promise.then(async()=>{var D;Q==null||Q(!0),await p(this,zl,Sb).call(this,X),this.structTreeLayer||(this.structTreeLayer=new HT(n,a.rawDims)),p(this,zl,pb).call(this),this.annotationLayer&&await p(this,zl,Nb).call(this);const{annotationEditorUIManager:C}=U(this,Hi);C&&(this.drawLayer||(this.drawLayer=new xE({pageIndex:this.id})),await p(this,zl,ub).call(this),this.drawLayer.setParent(i),this.annotationEditorLayer||(this.annotationEditorLayer=new EE({uiManager:C,pdfPage:n,l10n:t,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:(D=this.annotationLayer)==null?void 0:D.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:I=>{p(this,zl,lU).call(this,I,"annotationEditorLayer")}})),p(this,zl,bb).call(this))},D=>(D instanceof tb?(V==null||V.remove(),p(this,zl,Mb).call(this)):Q==null||Q(!0),p(this,zl,Sb).call(this,X,D)));if(n.isPureXfa){if(!this.xfaLayer){const{annotationStorage:D,linkService:C}=U(this,Hi);this.xfaLayer=new lG({pdfPage:n,annotationStorage:D,linkService:C})}p(this,zl,rb).call(this)}return l.setAttribute("data-loaded",!0),this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id}),L}setPageLabel(l){this.pageLabel=typeof l=="string"?l:null,this.div.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id})),this.pageLabel!==null?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:l,initialOptionalContent:t,regularAnnotations:d}=U(this,Ga);return l&&t&&d?this.canvas:null}}_c=new WeakMap,fi=new WeakMap,QW=new WeakMap,qc=new WeakMap,mW=new WeakMap,Hi=new WeakMap,Pi=new WeakMap,c0=new WeakMap,RW=new WeakMap,NW=new WeakMap,bW=new WeakMap,$c=new WeakMap,U0=new WeakMap,Z0=new WeakMap,Ga=new WeakMap,Ai=new WeakMap,zl=new WeakSet,lU=function(e,l){const t=KE.get(l),d=U(this,Ai)[t];if(U(this,Ai)[t]=e,d){d.replaceWith(e);return}for(let n=t-1;n>=0;n--){const a=U(this,Ai)[n];if(a){a.after(e);return}}this.div.prepend(e)},uW=function(){const{viewport:e}=this;if(this.pdfPage){if(U(this,RW)===e.rotation)return;N(this,RW,e.rotation)}Iw(this.div,e,!0,!1)},F0=function(e,l){this.eventBus.dispatch(e,{source:this,pageNumber:this.id,error:l})},Nb=async function(){let e=null;try{await this.annotationLayer.render(this.viewport,{structTreeLayer:this.structTreeLayer},"display")}catch(l){console.error("#renderAnnotationLayer:",l),e=l}finally{p(this,zl,F0).call(this,"annotationlayerrendered",e)}},bb=async function(){let e=null;try{await this.annotationEditorLayer.render(this.viewport,"display")}catch(l){console.error("#renderAnnotationEditorLayer:",l),e=l}finally{p(this,zl,F0).call(this,"annotationeditorlayerrendered",e)}},ub=async function(){try{await this.drawLayer.render("display")}catch(e){console.error("#renderDrawLayer:",e)}},rb=async function(){var e;let l=null;try{const t=await this.xfaLayer.render(this.viewport,"display");t!=null&&t.textDivs&&this._textHighlighter&&p(this,zl,eG).call(this,t.textDivs)}catch(t){console.error("#renderXfaLayer:",t),l=t}finally{(e=this.xfaLayer)!=null&&e.div&&(this.l10n.pause(),p(this,zl,lU).call(this,this.xfaLayer.div,"xfaLayer"),this.l10n.resume()),p(this,zl,F0).call(this,"xfalayerrendered",l)}},pb=async function(){if(!this.textLayer)return;let e=null;try{await this.textLayer.render(this.viewport)}catch(l){if(l instanceof Jw)return;console.error("#renderTextLayer:",l),e=l}p(this,zl,F0).call(this,"textlayerrendered",e),p(this,zl,tG).call(this)},tG=async function(){var e,l,t;if(!this.textLayer)return;const d=await((e=this.structTreeLayer)==null?void 0:e.render());d&&(this.l10n.pause(),(l=this.structTreeLayer)==null||l.addElementsToTextLayer(),this.canvas&&d.parentNode!==this.canvas&&this.canvas.append(d),this.l10n.resume()),(t=this.structTreeLayer)==null||t.show()},eG=async function(e){const l=await this.pdfPage.getTextContent(),t=[];for(const d of l.items)t.push(d.str);this._textHighlighter.setTextMapping(e,t),this._textHighlighter.enable()},Mb=function(){const{canvas:e}=this;e&&(e.remove(),e.width=e.height=0,this.canvas=null,N(this,c0,null))},Sb=async function(e,l=null){if(e===this.renderTask&&(this.renderTask=null),l instanceof tb){N(this,$c,null);return}if(N(this,$c,l),this.renderingState=lt.FINISHED,U(this,Ga).regularAnnotations=!e.separateAnnots,this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:U(this,$c)}),l)throw l};async function fE(e){const t="".split("#",1)[0];let{info:d,metadata:n,contentDispositionFilename:a,contentLength:i}=await e.getMetadata();if(!i){const{length:s}=await e.getDownloadInfo();i=s}return{...d,baseURL:t,filesize:i,filename:a||Yw(""),metadata:n==null?void 0:n.getRaw(),authors:n==null?void 0:n.get("dc:creator"),numPages:e.numPages,URL:""}}class HE{constructor(l){this._ready=new Promise((t,d)=>{import(l).then(n=>{t(n.QuickJSSandbox())}).catch(d)})}async createSandbox(l){(await this._ready).create(l)}async dispatchEventInSandbox(l){const t=await this._ready;setTimeout(()=>t.dispatchEvent(l),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}var Tn,tU,rW,eU,dU,pW,me,Xa,h0,St,Fd,Be,nG,MW,Jb,aG,o0;class PE{constructor({eventBus:l,externalServices:t=null,docProperties:d=null}){M(this,Be),M(this,Tn,null),M(this,tU,null),M(this,rW,null),M(this,eU,null),M(this,dU,null),M(this,pW,null),M(this,me,null),M(this,Xa,null),M(this,h0,!1),M(this,St,null),M(this,Fd,null),N(this,dU,l),N(this,pW,t),N(this,rW,d)}setViewer(l){N(this,Xa,l)}async setDocument(l){var t;if(U(this,me)&&await p(this,Be,o0).call(this),N(this,me,l),!l)return;const[d,n,a]=await Promise.all([l.getFieldObjects(),l.getCalculationOrderIds(),l.getJSActions()]);if(!d&&!a){await p(this,Be,o0).call(this);return}if(l!==U(this,me))return;try{N(this,St,p(this,Be,aG).call(this))}catch(c){console.error("setDocument:",c),await p(this,Be,o0).call(this);return}const i=U(this,dU);N(this,eU,new AbortController);const{signal:s}=U(this,eU);i._on("updatefromsandbox",c=>{(c==null?void 0:c.source)===window&&p(this,Be,nG).call(this,c.detail)},{signal:s}),i._on("dispatcheventinsandbox",c=>{var F;(F=U(this,St))==null||F.dispatchEventInSandbox(c.detail)},{signal:s}),i._on("pagechanging",({pageNumber:c,previous:F})=>{c!==F&&(p(this,Be,Jb).call(this,F),p(this,Be,MW).call(this,c))},{signal:s}),i._on("pagerendered",({pageNumber:c})=>{this._pageOpenPending.has(c)&&c===U(this,Xa).currentPageNumber&&p(this,Be,MW).call(this,c)},{signal:s}),i._on("pagesdestroy",async()=>{var c,F;await p(this,Be,Jb).call(this,U(this,Xa).currentPageNumber),await((c=U(this,St))==null?void 0:c.dispatchEventInSandbox({id:"doc",name:"WillClose"})),(F=U(this,Tn))==null||F.resolve()},{signal:s});try{const c=await U(this,rW).call(this,l);if(l!==U(this,me))return;await U(this,St).createSandbox({objects:d,calculationOrder:n,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...c,actions:a}}),i.dispatch("sandboxcreated",{source:this})}catch(c){console.error("setDocument:",c),await p(this,Be,o0).call(this);return}await((t=U(this,St))==null?void 0:t.dispatchEventInSandbox({id:"doc",name:"Open"})),await p(this,Be,MW).call(this,U(this,Xa).currentPageNumber,!0),Promise.resolve().then(()=>{l===U(this,me)&&N(this,h0,!0)})}async dispatchWillSave(){var l;return(l=U(this,St))==null?void 0:l.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){var l;return(l=U(this,St))==null?void 0:l.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){var l;if(U(this,St)){await((l=U(this,Fd))==null?void 0:l.promise),N(this,Fd,Promise.withResolvers());try{await U(this,St).dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(t){throw U(this,Fd).resolve(),N(this,Fd,null),t}await U(this,Fd).promise}}async dispatchDidPrint(){var l;return(l=U(this,St))==null?void 0:l.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){var l;return((l=U(this,tU))==null?void 0:l.promise)||null}get ready(){return U(this,h0)}get _pageOpenPending(){return HV(this,"_pageOpenPending",new Set)}get _visitedPages(){return HV(this,"_visitedPages",new Map)}}Tn=new WeakMap,tU=new WeakMap,rW=new WeakMap,eU=new WeakMap,dU=new WeakMap,pW=new WeakMap,me=new WeakMap,Xa=new WeakMap,h0=new WeakMap,St=new WeakMap,Fd=new WeakMap,Be=new WeakSet,nG=async function(e){var l,t;const d=U(this,Xa),n=d.isInPresentationMode||d.isChangingPresentationMode,{id:a,siblings:i,command:s,value:c}=e;if(!a){switch(s){case"clear":console.clear();break;case"error":console.error(c);break;case"layout":if(!n){const h=ew(c);d.spreadMode=h.spreadMode}break;case"page-num":d.currentPageNumber=c+1;break;case"print":await d.pagesPromise,U(this,dU).dispatch("print",{source:this});break;case"println":console.log(c);break;case"zoom":n||(d.currentScaleValue=c);break;case"SaveAs":U(this,dU).dispatch("download",{source:this});break;case"FirstPage":d.currentPageNumber=1;break;case"LastPage":d.currentPageNumber=d.pagesCount;break;case"NextPage":d.nextPage();break;case"PrevPage":d.previousPage();break;case"ZoomViewIn":n||d.increaseScale();break;case"ZoomViewOut":n||d.decreaseScale();break;case"WillPrintFinished":(l=U(this,Fd))==null||l.resolve(),N(this,Fd,null);break}return}if(n&&e.focus)return;delete e.id,delete e.siblings;const F=i?[a,...i]:[a];for(const h of F){const o=document.querySelector(`[data-element-id="${h}"]`);o?o.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):(t=U(this,me))==null||t.annotationStorage.setValue(h,e)}},MW=async function(e,l=!1){const t=U(this,me),d=this._visitedPages;if(l&&N(this,Tn,Promise.withResolvers()),!U(this,Tn))return;const n=U(this,Xa).getPageView(e-1);if((n==null?void 0:n.renderingState)!==lt.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);const a=(async()=>{var i,s;const c=await(d.has(e)?null:(i=n.pdfPage)==null?void 0:i.getJSActions());t===U(this,me)&&await((s=U(this,St))==null?void 0:s.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:c}))})();d.set(e,a)},Jb=async function(e){var l;const t=U(this,me),d=this._visitedPages;if(!U(this,Tn)||this._pageOpenPending.has(e))return;const n=d.get(e);n&&(d.set(e,null),await n,t===U(this,me)&&await((l=U(this,St))==null?void 0:l.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e})))},aG=function(){if(N(this,tU,Promise.withResolvers()),U(this,St))throw new Error("#initScripting: Scripting already exists.");return U(this,pW).createScripting()},o0=async function(){var e,l,t,d;if(!U(this,St)){N(this,me,null),(e=U(this,tU))==null||e.resolve();return}U(this,Tn)&&(await Promise.race([U(this,Tn).promise,new Promise(n=>{setTimeout(n,1e3)})]).catch(()=>{}),N(this,Tn,null)),N(this,me,null);try{await U(this,St).destroySandbox()}catch{}(l=U(this,Fd))==null||l.reject(new Error("Scripting destroyed.")),N(this,Fd,null),(t=U(this,eU))==null||t.abort(),N(this,eU,null),this._pageOpenPending.clear(),this._visitedPages.clear(),N(this,St,null),N(this,h0,!1),(d=U(this,tU))==null||d.resolve()};class AE extends PE{constructor(l){l.externalServices||window.addEventListener("updatefromsandbox",t=>{l.eventBus.dispatch("updatefromsandbox",{source:window,detail:t.detail})}),l.externalServices||(l.externalServices={createScripting:()=>new HE(l.sandboxBundleSrc)}),l.docProperties||(l.docProperties=t=>fE(t)),super(l)}}const _E=3e4;class qE{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1,Object.defineProperty(this,"hasViewer",{value:()=>!!this.pdfViewer})}setViewer(l){this.pdfViewer=l}setThumbnailViewer(l){this.pdfThumbnailViewer=l}isHighestPriority(l){return this.highestPriorityPage===l.renderingId}renderHighestPriority(l){var t;this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),!this.pdfViewer.forceRendering(l)&&(this.isThumbnailViewEnabled&&(t=this.pdfThumbnailViewer)!=null&&t.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),_E)))}getHighestPriority(l,t,d,n=!1){const a=l.views,i=a.length;if(i===0)return null;for(let o=0;o<i;o++){const V=a[o].view;if(!this.isViewFinished(V))return V}const s=l.first.id,c=l.last.id;if(c-s+1>i){const o=l.ids;for(let V=1,W=c-s;V<W;V++){const Q=d?s+V:c-V;if(o.has(Q))continue;const m=t[Q-1];if(!this.isViewFinished(m))return m}}let F=d?c:s-2,h=t[F];return h&&!this.isViewFinished(h)||n&&(F+=d?1:-1,h=t[F],h&&!this.isViewFinished(h))?h:null}isViewFinished(l){return l.renderingState===lt.FINISHED}renderView(l){switch(l.renderingState){case lt.FINISHED:return!1;case lt.PAUSED:this.highestPriorityPage=l.renderingId,l.resume();break;case lt.RUNNING:this.highestPriorityPage=l.renderingId;break;case lt.INITIAL:this.highestPriorityPage=l.renderingId,l.draw().finally(()=>{this.renderHighestPriority()}).catch(t=>{t instanceof tb||console.error("renderView:",t)});break}return!0}}const iG=10,SW={FORCE_SCROLL_MODE_PAGE:1e4,FORCE_LAZY_PAGE_INIT:5e3,PAUSE_EAGER_PAGE_INIT:250};function sG(e){return Object.values(Ge).includes(e)&&e!==Ge.DISABLE}var ya,nU,JW,Tb;class $E{constructor(l){M(this,JW),M(this,ya,new Set),M(this,nU,0),N(this,nU,l)}push(l){const t=U(this,ya);t.has(l)&&t.delete(l),t.add(l),t.size>U(this,nU)&&p(this,JW,Tb).call(this)}resize(l,t=null){N(this,nU,l);const d=U(this,ya);if(t){const n=d.size;let a=1;for(const i of d)if(t.has(i.id)&&(d.delete(i),d.add(i)),++a>n)break}for(;d.size>U(this,nU);)p(this,JW,Tb).call(this)}has(l){return U(this,ya).has(l)}[Symbol.iterator](){return U(this,ya).keys()}}ya=new WeakMap,nU=new WeakMap,JW=new WeakSet,Tb=function(){const e=U(this,ya).keys().next().value;e==null||e.destroy(),U(this,ya).delete(e)};var _i,TW,GW,Gn,He,aU,V0,XW,yW,BW,YW,kW,zW,qi,iU,sU,cU,W0,$i,Q0,LW,m0,UU,ls,IW,R0,Xl,cG,UG,ZG,N0,DW,FG,Gb,hG,Ba,Xb,oG,VG,WG,yb,QG,wW;class mG{constructor(l){M(this,Xl),M(this,_i,null),M(this,TW,null),M(this,GW,null),M(this,Gn,Ge.NONE),M(this,He,null),M(this,aU,bn.ENABLE_FORMS),M(this,V0,null),M(this,XW,null),M(this,yW,!1),M(this,BW,!1),M(this,YW,!1),M(this,kW,!1),M(this,zW,!1),M(this,qi,null),M(this,iU,null),M(this,sU,null),M(this,cU,null),M(this,W0,!1),M(this,$i,null),M(this,Q0,!1),M(this,LW,0),M(this,m0,new ResizeObserver(p(this,Xl,QG).bind(this))),M(this,UU,null),M(this,ls,null),M(this,IW,!0),M(this,R0,xd.ENABLE);var t,d;const n="4.10.38";if(FT!==n)throw new Error(`The API version "${FT}" does not match the Viewer version "${n}".`);if(this.container=l.container,this.viewer=l.viewer||l.container.firstElementChild,((t=this.container)==null?void 0:t.tagName)!=="DIV"||((d=this.viewer)==null?void 0:d.tagName)!=="DIV")throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&getComputedStyle(this.container).position!=="absolute")throw new Error("The `container` must be absolutely positioned.");U(this,m0).observe(this.container),this.eventBus=l.eventBus,this.linkService=l.linkService||new lb,this.downloadManager=l.downloadManager||null,this.findController=l.findController||null,N(this,TW,l.altTextManager||null),N(this,XW,l.editorUndoBar||null),this.findController&&(this.findController.onIsPageVisible=i=>this._getVisiblePages().ids.has(i)),this._scriptingManager=l.scriptingManager||null,N(this,R0,l.textLayerMode??xd.ENABLE),N(this,aU,l.annotationMode??bn.ENABLE_FORMS),N(this,Gn,l.annotationEditorMode??Ge.NONE),N(this,GW,l.annotationEditorHighlightColors||null),N(this,BW,l.enableHighlightFloatingButton===!0),N(this,kW,l.enableUpdatedAddImage===!0),N(this,zW,l.enableNewAltTextWhenAddingImage===!0),this.imageResourcesPath=l.imageResourcesPath||"",this.enablePrintAutoRotate=l.enablePrintAutoRotate||!1,this.removePageBorders=l.removePageBorders||!1,this.maxCanvasPixels=l.maxCanvasPixels,this.l10n=l.l10n,this.l10n||(this.l10n=new eW),N(this,YW,l.enablePermissions||!1),this.pageColors=l.pageColors||null,N(this,iU,l.mlManager||null),N(this,yW,l.enableHWA||!1),N(this,IW,l.supportsPinchToZoom!==!1),this.defaultRenderingQueue=!l.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new qE,this.renderingQueue.setViewer(this)):this.renderingQueue=l.renderingQueue;const{abortSignal:a}=l;a==null||a.addEventListener("abort",()=>{U(this,m0).disconnect(),N(this,m0,null)},{once:!0}),this.scroll=HD(this.container,this._scrollUpdate.bind(this),a),this.presentationModeState=jc.UNKNOWN,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),p(this,Xl,yb).call(this),this.eventBus._on("thumbnailrendered",({pageNumber:i,pdfPage:s})=>{const c=this._pages[i-1];U(this,_i).has(c)||s==null||s.cleanup()}),l.l10n||this.l10n.translate(this.container)}get pagesCount(){return this._pages.length}getPageView(l){return this._pages[l]}getCachedPageViews(){return new Set(U(this,_i))}get pageViewsReady(){return this._pages.every(l=>l==null?void 0:l.pdfPage)}get renderForms(){return U(this,aU)===bn.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(l){if(!Number.isInteger(l))throw new Error("Invalid page number.");this.pdfDocument&&(this._setCurrentPageNumber(l,!0)||console.error(`currentPageNumber: "${l}" is not a valid page.`))}_setCurrentPageNumber(l,t=!1){var d;if(this._currentPageNumber===l)return t&&p(this,Xl,Xb).call(this),!0;if(!(0<l&&l<=this.pagesCount))return!1;const n=this._currentPageNumber;return this._currentPageNumber=l,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:l,pageLabel:((d=this._pageLabels)==null?void 0:d[l-1])??null,previous:n}),t&&p(this,Xl,Xb).call(this),!0}get currentPageLabel(){var l;return((l=this._pageLabels)==null?void 0:l[this._currentPageNumber-1])??null}set currentPageLabel(l){if(!this.pdfDocument)return;let t=l|0;if(this._pageLabels){const d=this._pageLabels.indexOf(l);d>=0&&(t=d+1)}this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${l}" is not a valid page.`)}get currentScale(){return this._currentScale!==CN?this._currentScale:xJ}set currentScale(l){if(isNaN(l))throw new Error("Invalid numeric scale.");this.pdfDocument&&p(this,Xl,Ba).call(this,l,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(l){this.pdfDocument&&p(this,Xl,Ba).call(this,l,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(l){if(!HJ(l))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument||(l%=360,l<0&&(l+=360),this._pagesRotation===l))return;this._pagesRotation=l;const t=this._currentPageNumber;this.refresh(!0,{rotation:l}),this._currentScaleValue&&p(this,Xl,Ba).call(this,this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:l,pageNumber:t}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){const l=this;return HV(this,"_layerProperties",{get annotationEditorUIManager(){return U(l,He)},get annotationStorage(){var t;return(t=l.pdfDocument)==null?void 0:t.annotationStorage},get downloadManager(){return l.downloadManager},get enableScripting(){return!!l._scriptingManager},get fieldObjectsPromise(){var t;return(t=l.pdfDocument)==null?void 0:t.getFieldObjects()},get findController(){return l.findController},get hasJSActionsPromise(){var t;return(t=l.pdfDocument)==null?void 0:t.hasJSActions()},get linkService(){return l.linkService}})}async getAllText(){const l=[],t=[];for(let d=1,n=this.pdfDocument.numPages;d<=n;++d){if(U(this,Q0))return null;t.length=0;const a=await this.pdfDocument.getPage(d),{items:i}=await a.getTextContent();for(const s of i)s.str&&t.push(s.str),s.hasEOL&&t.push(`
405
405
  `);l.push(OF(t.join("")))}return l.join(`
406
- `)}setDocument(l){var t,d,n;if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),(t=this.findController)==null||t.setDocument(null),(d=this._scriptingManager)==null||d.setDocument(null),(n=U(this,He))==null||n.destroy(),N(this,He,null)),this.pdfDocument=l,!l)return;const a=l.numPages,i=l.getPage(1),s=l.getOptionalContentConfig({intent:"display"}),c=U(this,YW)?l.getPermissions():Promise.resolve(),{eventBus:F,pageColors:h,viewer:o}=this;N(this,qi,new AbortController);const{signal:V}=U(this,qi);if(a>SW.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const m=this._scrollMode=Gl.PAGE;F.dispatch("scrollmodechanged",{source:this,mode:m})}this._pagesCapability.promise.then(()=>{F.dispatch("pagesloaded",{source:this,pagesCount:a})},()=>{});const W=m=>{const R=this._pages[m.pageNumber-1];R&&U(this,_i).push(R)};F._on("pagerender",W,{signal:V});const Q=m=>{m.cssTransform||(this._onePageRenderedCapability.resolve({timestamp:m.timestamp}),F._off("pagerendered",Q))};F._on("pagerendered",Q,{signal:V}),Promise.all([i,c]).then(([m,R])=>{var r,b;if(l!==this.pdfDocument)return;this._firstPageCapability.resolve(m),this._optionalContentConfigPromise=s;const{annotationEditorMode:u,annotationMode:J,textLayerMode:G}=p(this,Xl,cG).call(this,R);if(G!==xd.DISABLE){const X=N(this,$i,document.createElement("div"));X.id="hiddenCopyElement",o.before(X)}if(typeof AbortSignal.any=="function"&&u!==Ge.DISABLE){const X=u;l.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):sG(X)?(N(this,He,new Gw(this.container,o,U(this,TW),F,l,h,U(this,GW),U(this,BW),U(this,kW),U(this,zW),U(this,iU),U(this,XW),U(this,IW))),F.dispatch("annotationeditoruimanager",{source:this,uiManager:U(this,He)}),X!==Ge.NONE&&(X===Ge.STAMP&&((r=U(this,iU))==null||r.loadModel("altText")),U(this,He).updateMode(X))):console.error(`Invalid AnnotationEditor mode: ${X}`)}const T=this._scrollMode===Gl.PAGE?null:o,y=this.currentScale,k=m.getViewport({scale:y*un.PDF_TO_CSS_UNITS});o.style.setProperty("--scale-factor",k.scale),h!=null&&h.background&&o.style.setProperty("--page-bg-color",h.background),((h==null?void 0:h.foreground)==="CanvasText"||(h==null?void 0:h.background)==="Canvas")&&(o.style.setProperty("--hcm-highlight-filter",l.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),o.style.setProperty("--hcm-highlight-selected-filter",l.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText")));for(let X=1;X<=a;++X){const L=new dG({container:T,eventBus:F,id:X,scale:y,defaultViewport:k.clone(),optionalContentConfigPromise:s,renderingQueue:this.renderingQueue,textLayerMode:G,annotationMode:J,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,pageColors:h,l10n:this.l10n,layerProperties:this._layerProperties,enableHWA:U(this,yW)});this._pages.push(L)}(b=this._pages[0])==null||b.setPdfPage(m),this._scrollMode===Gl.PAGE?p(this,Xl,N0).call(this):this._spreadMode!==Pt.NONE&&this._updateSpreadMode(),p(this,Xl,UG).call(this,V).then(async()=>{var X,L;if(l!==this.pdfDocument)return;if((X=this.findController)==null||X.setDocument(l),(L=this._scriptingManager)==null||L.setDocument(l),U(this,$i)&&document.addEventListener("copy",p(this,Xl,ZG).bind(this,G),{signal:V}),U(this,He)&&F.dispatch("annotationeditormodechanged",{source:this,mode:U(this,Gn)}),l.loadingParams.disableAutoFetch||a>SW.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let D=a-1;if(D<=0){this._pagesCapability.resolve();return}for(let C=2;C<=a;++C){const I=l.getPage(C).then(P=>{const H=this._pages[C-1];H.pdfPage||H.setPdfPage(P),--D===0&&this._pagesCapability.resolve()},P=>{console.error(`Unable to get page ${C} to initialize viewer`,P),--D===0&&this._pagesCapability.resolve()});C%SW.PAUSE_EAGER_PAGE_INIT===0&&await I}}),F.dispatch("pagesinit",{source:this}),l.getMetadata().then(({info:X})=>{l===this.pdfDocument&&X.Language&&(o.lang=X.Language)}),this.defaultRenderingQueue&&this.update()}).catch(m=>{console.error("Unable to initialize viewer",m),this._pagesCapability.reject(m)})}setPageLabels(l){var t;if(this.pdfDocument){l?Array.isArray(l)&&this.pdfDocument.numPages===l.length?this._pageLabels=l:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let d=0,n=this._pages.length;d<n;d++)this._pages[d].setPageLabel(((t=this._pageLabels)==null?void 0:t[d])??null)}}_resetView(){var l,t;this._pages=[],this._currentPageNumber=1,this._currentScale=CN,this._currentScaleValue=null,this._pageLabels=null,N(this,_i,new $E(iG)),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=Promise.withResolvers(),this._onePageRenderedCapability=Promise.withResolvers(),this._pagesCapability=Promise.withResolvers(),this._scrollMode=Gl.VERTICAL,this._previousScrollMode=Gl.UNKNOWN,this._spreadMode=Pt.NONE,N(this,UU,{previousPageNumber:1,scrollDown:!0,pages:[]}),(l=U(this,qi))==null||l.abort(),N(this,qi,null),this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),(t=U(this,$i))==null||t.remove(),N(this,$i,null),p(this,Xl,wW).call(this)}_scrollUpdate(){this.pagesCount!==0&&this.update()}pageLabelToPageNumber(l){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(l);return t<0?null:t+1}scrollPageIntoView({pageNumber:l,destArray:t=null,allowNegativeOffset:d=!1,ignoreDestinationZoom:n=!1}){if(!this.pdfDocument)return;const a=Number.isInteger(l)&&this._pages[l-1];if(!a){console.error(`scrollPageIntoView: "${l}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!t){this._setCurrentPageNumber(l,!0);return}let i=0,s=0,c=0,F=0,h,o;const V=a.rotation%180!==0,W=(V?a.height:a.width)/a.scale/un.PDF_TO_CSS_UNITS,Q=(V?a.width:a.height)/a.scale/un.PDF_TO_CSS_UNITS;let m=0;switch(t[1].name){case"XYZ":i=t[2],s=t[3],m=t[4],i=i!==null?i:0,s=s!==null?s:Q;break;case"Fit":case"FitB":m="page-fit";break;case"FitH":case"FitBH":s=t[2],m="page-width",s===null&&this._location?(i=this._location.left,s=this._location.top):(typeof s!="number"||s<0)&&(s=Q);break;case"FitV":case"FitBV":i=t[2],c=W,F=Q,m="page-height";break;case"FitR":i=t[2],s=t[3],c=t[4]-i,F=t[5]-s;let u=jJ,J=OJ;this.removePageBorders&&(u=J=0),h=(this.container.clientWidth-u)/c/un.PDF_TO_CSS_UNITS,o=(this.container.clientHeight-J)/F/un.PDF_TO_CSS_UNITS,m=Math.min(Math.abs(h),Math.abs(o));break;default:console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`);return}if(n||(m&&m!==this._currentScale?this.currentScaleValue=m:this._currentScale===CN&&(this.currentScaleValue=OD)),m==="page-fit"&&!t[4]){p(this,Xl,DW).call(this,a);return}const R=[a.viewport.convertToViewportPoint(i,s),a.viewport.convertToViewportPoint(i+c,s+F)];let r=Math.min(R[0][0],R[1][0]),b=Math.min(R[0][1],R[1][1]);d||(r=Math.max(r,0),b=Math.max(b,0)),p(this,Xl,DW).call(this,a,{left:r,top:b})}_updateLocation(l){const t=this._currentScale,d=this._currentScaleValue,n=parseFloat(d)===t?Math.round(t*1e4)/100:d,a=l.id,i=this._pages[a-1],s=this.container,c=i.getPagePoint(s.scrollLeft-l.x,s.scrollTop-l.y),F=Math.round(c[0]),h=Math.round(c[1]);let o=`#page=${a}`;this.isInPresentationMode||(o+=`&zoom=${n},${F},${h}`),this._location={pageNumber:a,scale:n,top:h,left:F,rotation:this._pagesRotation,pdfOpenParams:o}}update(){const l=this._getVisiblePages(),t=l.views,d=t.length;if(d===0)return;const n=Math.max(iG,2*d+1);U(this,_i).resize(n,l.ids),this.renderingQueue.renderHighestPriority(l);const a=this._spreadMode===Pt.NONE&&(this._scrollMode===Gl.PAGE||this._scrollMode===Gl.VERTICAL),i=this._currentPageNumber;let s=!1;for(const c of t){if(c.percent<100)break;if(c.id===i&&a){s=!0;break}}this._setCurrentPageNumber(s?i:t[0].id),this._updateLocation(l.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}containsElement(l){return this.container.contains(l)}focus(){this.container.focus()}get _isContainerRtl(){return getComputedStyle(this.container).direction==="rtl"}get isInPresentationMode(){return this.presentationModeState===jc.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===jc.CHANGING}get isHorizontalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const l=this._scrollMode===Gl.PAGE?U(this,UU).pages:this._pages,t=this._scrollMode===Gl.HORIZONTAL,d=t&&this._isContainerRtl;return AD({scrollEl:this.container,views:l,sortByVisibility:!0,horizontal:t,rtl:d})}cleanup(){for(const l of this._pages)l.renderingState!==lt.FINISHED&&l.reset()}_cancelRendering(){for(const l of this._pages)l.cancelRendering()}forceRendering(l){const t=l||this._getVisiblePages(),d=p(this,Xl,WG).call(this,t),n=this._spreadMode!==Pt.NONE&&this._scrollMode!==Gl.HORIZONTAL,a=this.renderingQueue.getHighestPriority(t,this._pages,d,n);return a?(p(this,Xl,VG).call(this,a).then(()=>{this.renderingQueue.renderView(a)}),!0):!1}get hasEqualPageSizes(){const l=this._pages[0];for(let t=1,d=this._pages.length;t<d;++t){const n=this._pages[t];if(n.width!==l.width||n.height!==l.height)return!1}return!0}getPagesOverview(){let l;return this._pages.map(t=>{const d=t.pdfPage.getViewport({scale:1}),n=PJ(d);if(l===void 0)l=n;else if(this.enablePrintAutoRotate&&n!==l)return{width:d.height,height:d.width,rotation:(d.rotation-90)%360};return{width:d.width,height:d.height,rotation:d.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig({intent:"display"})):Promise.resolve(null)}set optionalContentConfigPromise(l){if(!(l instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${l}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=l,this.refresh(!1,{optionalContentConfigPromise:l}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:l}))}get scrollMode(){return this._scrollMode}set scrollMode(l){if(this._scrollMode!==l){if(!_D(l))throw new Error(`Invalid scroll mode: ${l}`);this.pagesCount>SW.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=l,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:l}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(l=null){const t=this._scrollMode,d=this.viewer;d.classList.toggle("scrollHorizontal",t===Gl.HORIZONTAL),d.classList.toggle("scrollWrapped",t===Gl.WRAPPED),!(!this.pdfDocument||!l)&&(t===Gl.PAGE?p(this,Xl,N0).call(this):this._previousScrollMode===Gl.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&p(this,Xl,Ba).call(this,this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(l,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(l){if(this._spreadMode!==l){if(!qD(l))throw new Error(`Invalid spread mode: ${l}`);this._spreadMode=l,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:l}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(l=null){if(!this.pdfDocument)return;const t=this.viewer,d=this._pages;if(this._scrollMode===Gl.PAGE)p(this,Xl,N0).call(this);else if(t.textContent="",this._spreadMode===Pt.NONE)for(const n of this._pages)t.append(n.div);else{const n=this._spreadMode-1;let a=null;for(let i=0,s=d.length;i<s;++i)a===null?(a=document.createElement("div"),a.className="spread",t.append(a)):i%2===n&&(a=a.cloneNode(!1),t.append(a)),a.append(d[i].div)}l&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&p(this,Xl,Ba).call(this,this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(l,!0),this.update())}_getPageAdvance(l,t=!1){switch(this._scrollMode){case Gl.WRAPPED:{const{views:d}=this._getVisiblePages(),n=new Map;for(const{id:a,y:i,percent:s,widthPercent:c}of d){if(s===0||c<100)continue;let F=n.get(i);F||n.set(i,F||(F=[])),F.push(a)}for(const a of n.values()){const i=a.indexOf(l);if(i===-1)continue;const s=a.length;if(s===1)break;if(t)for(let c=i-1,F=0;c>=F;c--){const h=a[c],o=a[c+1]-1;if(h<o)return l-o}else for(let c=i+1,F=s;c<F;c++){const h=a[c],o=a[c-1]+1;if(h>o)return o-l}if(t){const c=a[0];if(c<l)return l-c+1}else{const c=a[s-1];if(c>l)return c-l+1}break}break}case Gl.HORIZONTAL:break;case Gl.PAGE:case Gl.VERTICAL:{if(this._spreadMode===Pt.NONE)break;const d=this._spreadMode-1;if(t&&l%2!==d||!t&&l%2===d)break;const{views:n}=this._getVisiblePages(),a=t?l-1:l+1;for(const{id:i,percent:s,widthPercent:c}of n)if(i===a){if(s>0&&c===100)return 2;break}break}}return 1}nextPage(){const l=this._currentPageNumber,t=this.pagesCount;if(l>=t)return!1;const d=this._getPageAdvance(l,!1)||1;return this.currentPageNumber=Math.min(l+d,t),!0}previousPage(){const l=this._currentPageNumber;if(l<=1)return!1;const t=this._getPageAdvance(l,!0)||1;return this.currentPageNumber=Math.max(l-t,1),!0}updateScale({drawingDelay:l,scaleFactor:t=null,steps:d=null,origin:n}){if(d===null&&t===null)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let a=this._currentScale;if(t>0&&t!==1)a=Math.round(a*t*100)/100;else if(d){const i=d>0?gJ:1/gJ,s=d>0?Math.ceil:Math.floor;d=Math.abs(d);do a=s((a*i).toFixed(2)*10)/10;while(--d>0)}a=Math.max(vD,Math.min(KD,a)),p(this,Xl,Ba).call(this,a,{noScroll:!1,drawingDelay:l,origin:n})}increaseScale(l={}){this.updateScale({...l,steps:l.steps??1})}decreaseScale(l={}){this.updateScale({...l,steps:-(l.steps??1)})}get containerTopLeft(){return U(this,V0)||N(this,V0,[this.container.offsetTop,this.container.offsetLeft])}get annotationEditorMode(){return U(this,He)?U(this,Gn):Ge.DISABLE}set annotationEditorMode({mode:l,editId:t=null,isFromKeyboard:d=!1}){var n;if(!U(this,He))throw new Error("The AnnotationEditor is not enabled.");if(U(this,Gn)===l)return;if(!sG(l))throw new Error(`Invalid AnnotationEditor mode: ${l}`);if(!this.pdfDocument)return;l===Ge.STAMP&&((n=U(this,iU))==null||n.loadModel("altText"));const{eventBus:a}=this,i=()=>{p(this,Xl,wW).call(this),N(this,Gn,l),U(this,He).updateMode(l,t,d),a.dispatch("annotationeditormodechanged",{source:this,mode:l})};if(l===Ge.NONE||U(this,Gn)===Ge.NONE){const s=l!==Ge.NONE;s||this.pdfDocument.annotationStorage.resetModifiedIds();for(const F of this._pages)F.toggleEditingMode(s);const c=p(this,Xl,oG).call(this);if(s&&c){p(this,Xl,wW).call(this),N(this,sU,new AbortController);const F=AbortSignal.any([U(this,qi).signal,U(this,sU).signal]);a._on("pagerendered",({pageNumber:h})=>{c.delete(h),c.size===0&&N(this,cU,setTimeout(i,0))},{signal:F});return}}i()}refresh(l=!1,t=Object.create(null)){if(this.pdfDocument){for(const d of this._pages)d.update(t);U(this,ls)!==null&&(clearTimeout(U(this,ls)),N(this,ls,null)),l||this.update()}}}_i=new WeakMap,TW=new WeakMap,GW=new WeakMap,Gn=new WeakMap,He=new WeakMap,aU=new WeakMap,V0=new WeakMap,XW=new WeakMap,yW=new WeakMap,BW=new WeakMap,YW=new WeakMap,kW=new WeakMap,zW=new WeakMap,qi=new WeakMap,iU=new WeakMap,sU=new WeakMap,cU=new WeakMap,W0=new WeakMap,$i=new WeakMap,Q0=new WeakMap,LW=new WeakMap,m0=new WeakMap,UU=new WeakMap,ls=new WeakMap,IW=new WeakMap,R0=new WeakMap,Xl=new WeakSet,cG=function(e){const l={annotationEditorMode:U(this,Gn),annotationMode:U(this,aU),textLayerMode:U(this,R0)};return e&&(!e.includes(fV.COPY)&&U(this,R0)===xd.ENABLE&&(l.textLayerMode=xd.ENABLE_PERMISSIONS),e.includes(fV.MODIFY_CONTENTS)||(l.annotationEditorMode=Ge.DISABLE),!e.includes(fV.MODIFY_ANNOTATIONS)&&!e.includes(fV.FILL_INTERACTIVE_FORMS)&&U(this,aU)===bn.ENABLE_FORMS&&(l.annotationMode=bn.ENABLE)),l},UG=async function(e){if(document.visibilityState==="hidden"||!this.container.offsetParent||this._getVisiblePages().views.length===0)return;const l=Promise.withResolvers(),t=new AbortController;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&l.resolve()},{signal:typeof AbortSignal.any=="function"?AbortSignal.any([e,t.signal]):e}),await Promise.race([this._onePageRenderedCapability.promise,l.promise]),t.abort()},ZG=function(e,l){const t=document.getSelection(),{focusNode:d,anchorNode:n}=t;if(n&&d&&t.containsNode(U(this,$i))){if(U(this,W0)||e===xd.ENABLE_PERMISSIONS){eb(l);return}N(this,W0,!0);const{classList:a}=this.viewer;a.add("copyAll");const i=new AbortController;window.addEventListener("keydown",s=>N(this,Q0,s.key==="Escape"),{signal:i.signal}),this.getAllText().then(async s=>{s!==null&&await navigator.clipboard.writeText(s)}).catch(s=>{console.warn(`Something goes wrong when extracting the text: ${s.message}`)}).finally(()=>{N(this,W0,!1),N(this,Q0,!1),i.abort(),a.remove("copyAll")}),eb(l)}},N0=function(){if(this._scrollMode!==Gl.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,l=U(this,UU),t=this.viewer;if(t.textContent="",l.pages.length=0,this._spreadMode===Pt.NONE&&!this.isInPresentationMode){const d=this._pages[e-1];t.append(d.div),l.pages.push(d)}else{const d=new Set,n=this._spreadMode-1;n===-1?d.add(e-1):e%2!==n?(d.add(e-1),d.add(e)):(d.add(e-2),d.add(e-1));const a=document.createElement("div");if(a.className="spread",this.isInPresentationMode){const i=document.createElement("div");i.className="dummyPage",a.append(i)}for(const i of d){const s=this._pages[i];s&&(a.append(s.div),l.pages.push(s))}t.append(a)}l.scrollDown=e>=l.previousPageNumber,l.previousPageNumber=e},DW=function(e,l=null){const{div:t,id:d}=e;if(this._currentPageNumber!==d&&this._setCurrentPageNumber(d),this._scrollMode===Gl.PAGE&&(p(this,Xl,N0).call(this),this.update()),!l&&!this.isInPresentationMode){const n=t.offsetLeft+t.clientLeft,a=n+t.clientWidth,{scrollLeft:i,clientWidth:s}=this.container;(this._scrollMode===Gl.HORIZONTAL||n<i||a>i+s)&&(l={left:0,top:0})}vJ(t,l),!this._currentScaleValue&&this._location&&(this._location=null)},FG=function(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15},Gb=function(e,l,{noScroll:t=!1,preset:d=!1,drawingDelay:n=-1,origin:a=null}){if(this._currentScaleValue=l.toString(),p(this,Xl,FG).call(this,e)){d&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:l});return}this.viewer.style.setProperty("--scale-factor",e*un.PDF_TO_CSS_UNITS);const i=n>=0&&n<1e3;this.refresh(!0,{scale:e,drawingDelay:i?n:-1}),i&&N(this,ls,setTimeout(()=>{N(this,ls,null),this.refresh()},n));const s=this._currentScale;if(this._currentScale=e,!t){let c=this._currentPageNumber,F;if(this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(c=this._location.pageNumber,F=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:c,destArray:F,allowNegativeOffset:!0}),Array.isArray(a)){const h=e/s-1,[o,V]=this.containerTopLeft;this.container.scrollLeft+=(a[0]-V)*h,this.container.scrollTop+=(a[1]-o)*h}}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:d?l:void 0}),this.defaultRenderingQueue&&this.update()},hG=function(){return this._spreadMode!==Pt.NONE&&this._scrollMode!==Gl.HORIZONTAL?2:1},Ba=function(e,l){let t=parseFloat(e);if(t>0)l.preset=!1,p(this,Xl,Gb).call(this,t,e,l);else{const d=this._pages[this._currentPageNumber-1];if(!d)return;let n=jJ,a=OJ;this.isInPresentationMode?(n=a=4,this._spreadMode!==Pt.NONE&&(n*=2)):this.removePageBorders?n=a=0:this._scrollMode===Gl.HORIZONTAL&&([n,a]=[a,n]);const i=(this.container.clientWidth-n)/d.width*d.scale/U(this,Xl,hG),s=(this.container.clientHeight-a)/d.height*d.scale;switch(e){case"page-actual":t=1;break;case"page-width":t=i;break;case"page-height":t=s;break;case"page-fit":t=Math.min(i,s);break;case"auto":const c=PJ(d)?i:Math.min(s,i);t=Math.min(fD,c);break;default:console.error(`#setScale: "${e}" is an unknown zoom value.`);return}l.preset=!0,p(this,Xl,Gb).call(this,t,e,l)}},Xb=function(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&p(this,Xl,Ba).call(this,this._currentScaleValue,{noScroll:!0}),p(this,Xl,DW).call(this,e)},oG=function(){const e=this._getVisiblePages(),l=[],{ids:t,views:d}=e;for(const n of d){const{view:a}=n;if(!a.hasEditableAnnotations()){t.delete(a.id);continue}l.push(n)}return l.length===0?null:(this.renderingQueue.renderHighestPriority({first:l[0],last:l.at(-1),views:l,ids:t}),t)},VG=async function(e){if(e.pdfPage)return e.pdfPage;try{const l=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(l),l}catch(l){return console.error("Unable to get page for page view",l),null}},WG=function(e){var l,t;if(((l=e.first)==null?void 0:l.id)===1)return!0;if(((t=e.last)==null?void 0:t.id)===this.pagesCount)return!1;switch(this._scrollMode){case Gl.PAGE:return U(this,UU).scrollDown;case Gl.HORIZONTAL:return this.scroll.right}return this.scroll.down},yb=function(e=this.container.clientHeight){e!==U(this,LW)&&(N(this,LW,e),$D.setProperty("--viewer-container-height",`${e}px`))},QG=function(e){for(const l of e)if(l.target===this.container){p(this,Xl,yb).call(this,Math.floor(l.borderBoxSize[0].blockSize)),N(this,V0,null);break}},wW=function(){var e;(e=U(this,sU))==null||e.abort(),N(this,sU,null),U(this,cU)!==null&&(clearTimeout(U(this,cU)),N(this,cU,null))};class lC extends mG{_resetView(){super._resetView(),this._scrollMode=Gl.PAGE,this._spreadMode=Pt.NONE}set scrollMode(l){}_updateScrollMode(){}set spreadMode(l){}_updateSpreadMode(){}}Al.AnnotationLayerBuilder,Al.DownloadManager,Al.EventBus,Al.FindState,Al.GenericL10n,Al.LinkTarget,Al.PDFFindController,Al.PDFHistory;var tC=Al.PDFLinkService;Al.PDFPageView,Al.PDFScriptingManager,Al.PDFSinglePageViewer,Al.PDFViewer,Al.ProgressBar,Al.RenderingStates,Al.ScrollMode,Al.SimpleLinkService,Al.SpreadMode,Al.StructTreeLayerBuilder,Al.TextLayerBuilder,Al.XfaLayerBuilder,Al.parseQueryString;const eC=["id"],dC=["id"],nC={key:0,class:"textLayer"},aC={key:1,class:"annotationLayer"},RG=Z.defineComponent({__name:"VuePdfEmbed",props:{annotationLayer:{type:Boolean},height:{},id:{},imageResourcesPath:{},linkService:{},page:{},rotation:{default:0},scale:{default:1},source:{},textLayer:{type:Boolean},width:{}},emits:["internal-link-clicked","loaded","loading-failed","password-requested","progress","rendered","rendering-failed"],setup(e,{expose:l,emit:t}){const d=e,n=t,a=Z.shallowRef([]),i=Z.ref([]),s=Z.shallowRef(null);let c=null;const{doc:F}=CJ({onError:b=>{a.value=[],n("loading-failed",b)},onPasswordRequest({callback:b,isWrongPassword:u}){n("password-requested",{callback:b,isWrongPassword:u})},onProgress:b=>{n("progress",b)},source:Z.toRef(d,"source")}),h=Z.computed(()=>{if(!F.value||!d.annotationLayer)return null;if(d.linkService)return d.linkService;const b=new tC;return b.setDocument(F.value),b.setViewer({scrollPageIntoView:({pageNumber:u})=>{n("internal-link-clicked",u)}}),b}),o=async b=>{if(!F.value)return;const u=await F.value.getData(),J=await F.value.getMetadata(),G=b??J.contentDispositionFilename??"";jD(u,G)},V=b=>{let u,J;return d.height&&!d.width?(J=d.height,u=J/b):(u=d.width??s.value.clientWidth,J=u*b),[u,J]},W=async(b=300,u="",J=!1)=>{var G,T,y;if(!F.value)return;const k=b/72,X=96/72;let L,D,C;try{L=window.document.createElement("div"),L.style.display="none",window.document.body.appendChild(L),D=await gD(L);const I=d.page&&!J?Array.isArray(d.page)?d.page:[d.page]:[...Array(F.value.numPages+1).keys()].slice(1);await Promise.all(I.map(async(P,H)=>{const Y=await F.value.getPage(P),B=Y.getViewport({scale:1,rotation:0});if(H===0){const w=B.width*k/X,O=B.height*k/X;xD(D,w,O)}const z=window.document.createElement("canvas");z.width=B.width*k,z.height=B.height*k,L.appendChild(z);const g=z.cloneNode();D.contentWindow.document.body.appendChild(g),await Y.render({canvasContext:z.getContext("2d"),intent:"print",transform:[k,0,0,k,0,0],viewport:B}).promise,g.getContext("2d").drawImage(z,0,0)})),u&&(C=window.document.title,window.document.title=u),(G=D.contentWindow)==null||G.focus(),(T=D.contentWindow)==null||T.print()}finally{C&&(window.document.title=C),EN(L),(y=L.parentNode)==null||y.removeChild(L)}},Q=async()=>{if(!(!F.value||c!=null&&c.isAborted))try{a.value=d.page?Array.isArray(d.page)?d.page:[d.page]:[...Array(F.value.numPages+1).keys()].slice(1),i.value=Array(a.value.length).fill(1),await Promise.all(a.value.map(async(b,u)=>{const J=await F.value.getPage(b);if(c!=null&&c.isAborted)return;const G=((d.rotation%90===0?d.rotation:0)+J.rotate)%360,[T,y,k]=Array.from(s.value.getElementsByClassName("vue-pdf-embed__page")[u].children),X=!!(G/90%2),L=J.view[2]-J.view[0],D=J.view[3]-J.view[1],[C,I]=V(X?L/D:D/L),P=`${Math.floor(C)}px`,H=`${Math.floor(I)}px`,Y=C/(X?D:L),B=J.getViewport({scale:Y,rotation:G});i.value[u]=Y,T.style.display="block",T.style.width=P,T.style.height=H;const z=[m(J,B.clone({scale:B.scale*window.devicePixelRatio*d.scale}),T)];return d.textLayer&&z.push(r(J,B.clone({dontFlip:!0}),y)),d.annotationLayer&&z.push(R(J,B.clone({dontFlip:!0}),k||y)),Promise.all(z)})),c!=null&&c.isAborted||n("rendered")}catch(b){a.value=[],i.value=[],c!=null&&c.isAborted||n("rendering-failed",b)}},m=async(b,u,J)=>{J.width=u.width,J.height=u.height,await b.render({canvasContext:J.getContext("2d"),viewport:u}).promise},R=async(b,u,J)=>{wJ(J),new ID({accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:J,page:b,structTreeLayer:null,viewport:u}).render({annotations:await b.getAnnotations(),div:J,imageResourcesPath:d.imageResourcesPath,linkService:h.value,page:b,renderForms:!1,viewport:u})},r=async(b,u,J)=>{wJ(J),new wD({container:J,textContentSource:await b.getTextContent(),viewport:u}).render()};return Z.watch(F,b=>{b&&n("loaded",b)},{immediate:!0}),Z.watch(()=>[F.value,d.annotationLayer,d.height,d.imageResourcesPath,d.page,d.rotation,d.scale,d.textLayer,d.width],async([b])=>{b&&(c&&(c.isAborted=!0,await c.promise),EN(s.value),c={isAborted:!1,promise:Q()},await c.promise,c=null)},{immediate:!0}),Z.onBeforeUnmount(()=>{EN(s.value)}),l({doc:F,download:o,print:W}),(b,u)=>(Z.openBlock(),Z.createElementBlock("div",{id:b.id,ref_key:"root",ref:s,class:"vue-pdf-embed"},[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(a.value,(J,G)=>(Z.openBlock(),Z.createElementBlock("div",{key:J},[Z.renderSlot(b.$slots,"before-page",{page:J}),Z.createElementVNode("div",{id:b.id&&`${b.id}-${J}`,class:"vue-pdf-embed__page",style:Z.normalizeStyle({"--scale-factor":i.value[G],position:"relative"})},[u[0]||(u[0]=Z.createElementVNode("canvas",null,null,-1)),b.textLayer?(Z.openBlock(),Z.createElementBlock("div",nC)):Z.createCommentVNode("",!0),b.annotationLayer?(Z.openBlock(),Z.createElementBlock("div",aC)):Z.createCommentVNode("",!0)],12,dC),Z.renderSlot(b.$slots,"after-page",{page:J})]))),128))],8,eC))}});window!=null&&window.Vue&&(window.VuePdfEmbed=RG,window.useVuePdfEmbed=CJ),wN!=null&&wN.workerSrc||(wN.workerSrc=CD);const iC=Z.defineComponent({__name:"PdfViewerModal",props:Z.mergeModels({src:{type:String,required:!0}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e,t=Z.useModel(e,"modelValue");return(d,n)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElDialog),{fullscreen:"",modelValue:t.value,"onUpdate:modelValue":n[0]||(n[0]=a=>t.value=a),"append-to-body":"",modal:"",class:"preview-dialog"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(RG),{"annotation-layer":"","text-layer":"",source:l.src},null,8,["source"])]),_:1},8,["modelValue"]))}}),Rt=(e,l)=>{const t=e.__vccOpts||e;for(const[d,n]of l)t[d]=n;return t},NG=Rt(iC,[["__scopeId","data-v-bfb5e065"]]),sC={class:"ja-uploader"},cC={class:"ja-uploader-tools"},UC={class:"loader-shimmer"},bG=Rt(Z.defineComponent({__name:"uploader",props:Z.mergeModels({serviceName:{},configKey:{},attachToken:{},classificationLevel:{},height:{},maxHeight:{},allowUpload:{type:Boolean},allowDownload:{type:Boolean},allowDelete:{type:Boolean},allowPreview:{type:Boolean}},{modelValue:{required:!1},modelModifiers:{}}),emits:Z.mergeModels(["change","fileAdded","filesAdded","fileRemoved","upload","progress","uploadProgress","uploadPause","uploadSuccess","complete","error","uploadError","downloaded","zipDownloaded"],["update:modelValue"]),setup(e,{emit:l}){const t=e,d=Z.useModel(e,"modelValue"),n=$.createAxiosWithoutCache(),a=$.useLoading(n),i=$.useFilesApi(n),s=Z.ref([]),c=Z.ref([]),F=Z.ref([]),h=Z.ref(),o=Z.ref(),V=Z.ref(),W=Z.ref(50),Q=Z.ref(),m=Z.ref(),R=Z.ref(!1),r=Z.ref(100),b=Z.ref(!1),u=Z.ref(""),J=[".doc",".docx",".xls",".xlsx",".wps",".et",".csv",".txt",".rtf",".odt",".ods",".mht",".ppt",".pptx",".odp",".pdf",".xps","."],G=l;let T;Q.value=t.attachToken,Z.onMounted(async()=>{await y(),t.attachToken?await C():await I()}),Z.onUnmounted(()=>{T&&T.destroy(),T=void 0});async function y(){var A,al;V.value=$.useLoginUser();const x=Math.max(t.classificationLevel??50,((A=V.value)==null?void 0:A.classifiedLevel)??50);c.value=await uu(),h.value=await ru(),F.value=c.value.filter(_=>_.value>=x),o.value=Math.min(...F.value.map(_=>_.value)),console.log(`附件控件密级调试:
406
+ `)}setDocument(l){var t,d,n;if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),(t=this.findController)==null||t.setDocument(null),(d=this._scriptingManager)==null||d.setDocument(null),(n=U(this,He))==null||n.destroy(),N(this,He,null)),this.pdfDocument=l,!l)return;const a=l.numPages,i=l.getPage(1),s=l.getOptionalContentConfig({intent:"display"}),c=U(this,YW)?l.getPermissions():Promise.resolve(),{eventBus:F,pageColors:h,viewer:o}=this;N(this,qi,new AbortController);const{signal:V}=U(this,qi);if(a>SW.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const m=this._scrollMode=Gl.PAGE;F.dispatch("scrollmodechanged",{source:this,mode:m})}this._pagesCapability.promise.then(()=>{F.dispatch("pagesloaded",{source:this,pagesCount:a})},()=>{});const W=m=>{const R=this._pages[m.pageNumber-1];R&&U(this,_i).push(R)};F._on("pagerender",W,{signal:V});const Q=m=>{m.cssTransform||(this._onePageRenderedCapability.resolve({timestamp:m.timestamp}),F._off("pagerendered",Q))};F._on("pagerendered",Q,{signal:V}),Promise.all([i,c]).then(([m,R])=>{var r,b;if(l!==this.pdfDocument)return;this._firstPageCapability.resolve(m),this._optionalContentConfigPromise=s;const{annotationEditorMode:u,annotationMode:J,textLayerMode:G}=p(this,Xl,cG).call(this,R);if(G!==xd.DISABLE){const X=N(this,$i,document.createElement("div"));X.id="hiddenCopyElement",o.before(X)}if(typeof AbortSignal.any=="function"&&u!==Ge.DISABLE){const X=u;l.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):sG(X)?(N(this,He,new Gw(this.container,o,U(this,TW),F,l,h,U(this,GW),U(this,BW),U(this,kW),U(this,zW),U(this,iU),U(this,XW),U(this,IW))),F.dispatch("annotationeditoruimanager",{source:this,uiManager:U(this,He)}),X!==Ge.NONE&&(X===Ge.STAMP&&((r=U(this,iU))==null||r.loadModel("altText")),U(this,He).updateMode(X))):console.error(`Invalid AnnotationEditor mode: ${X}`)}const T=this._scrollMode===Gl.PAGE?null:o,y=this.currentScale,k=m.getViewport({scale:y*un.PDF_TO_CSS_UNITS});o.style.setProperty("--scale-factor",k.scale),h!=null&&h.background&&o.style.setProperty("--page-bg-color",h.background),((h==null?void 0:h.foreground)==="CanvasText"||(h==null?void 0:h.background)==="Canvas")&&(o.style.setProperty("--hcm-highlight-filter",l.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),o.style.setProperty("--hcm-highlight-selected-filter",l.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText")));for(let X=1;X<=a;++X){const L=new dG({container:T,eventBus:F,id:X,scale:y,defaultViewport:k.clone(),optionalContentConfigPromise:s,renderingQueue:this.renderingQueue,textLayerMode:G,annotationMode:J,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,pageColors:h,l10n:this.l10n,layerProperties:this._layerProperties,enableHWA:U(this,yW)});this._pages.push(L)}(b=this._pages[0])==null||b.setPdfPage(m),this._scrollMode===Gl.PAGE?p(this,Xl,N0).call(this):this._spreadMode!==Pt.NONE&&this._updateSpreadMode(),p(this,Xl,UG).call(this,V).then(async()=>{var X,L;if(l!==this.pdfDocument)return;if((X=this.findController)==null||X.setDocument(l),(L=this._scriptingManager)==null||L.setDocument(l),U(this,$i)&&document.addEventListener("copy",p(this,Xl,ZG).bind(this,G),{signal:V}),U(this,He)&&F.dispatch("annotationeditormodechanged",{source:this,mode:U(this,Gn)}),l.loadingParams.disableAutoFetch||a>SW.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let D=a-1;if(D<=0){this._pagesCapability.resolve();return}for(let C=2;C<=a;++C){const I=l.getPage(C).then(H=>{const f=this._pages[C-1];f.pdfPage||f.setPdfPage(H),--D===0&&this._pagesCapability.resolve()},H=>{console.error(`Unable to get page ${C} to initialize viewer`,H),--D===0&&this._pagesCapability.resolve()});C%SW.PAUSE_EAGER_PAGE_INIT===0&&await I}}),F.dispatch("pagesinit",{source:this}),l.getMetadata().then(({info:X})=>{l===this.pdfDocument&&X.Language&&(o.lang=X.Language)}),this.defaultRenderingQueue&&this.update()}).catch(m=>{console.error("Unable to initialize viewer",m),this._pagesCapability.reject(m)})}setPageLabels(l){var t;if(this.pdfDocument){l?Array.isArray(l)&&this.pdfDocument.numPages===l.length?this._pageLabels=l:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let d=0,n=this._pages.length;d<n;d++)this._pages[d].setPageLabel(((t=this._pageLabels)==null?void 0:t[d])??null)}}_resetView(){var l,t;this._pages=[],this._currentPageNumber=1,this._currentScale=CN,this._currentScaleValue=null,this._pageLabels=null,N(this,_i,new $E(iG)),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=Promise.withResolvers(),this._onePageRenderedCapability=Promise.withResolvers(),this._pagesCapability=Promise.withResolvers(),this._scrollMode=Gl.VERTICAL,this._previousScrollMode=Gl.UNKNOWN,this._spreadMode=Pt.NONE,N(this,UU,{previousPageNumber:1,scrollDown:!0,pages:[]}),(l=U(this,qi))==null||l.abort(),N(this,qi,null),this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),(t=U(this,$i))==null||t.remove(),N(this,$i,null),p(this,Xl,wW).call(this)}_scrollUpdate(){this.pagesCount!==0&&this.update()}pageLabelToPageNumber(l){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(l);return t<0?null:t+1}scrollPageIntoView({pageNumber:l,destArray:t=null,allowNegativeOffset:d=!1,ignoreDestinationZoom:n=!1}){if(!this.pdfDocument)return;const a=Number.isInteger(l)&&this._pages[l-1];if(!a){console.error(`scrollPageIntoView: "${l}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!t){this._setCurrentPageNumber(l,!0);return}let i=0,s=0,c=0,F=0,h,o;const V=a.rotation%180!==0,W=(V?a.height:a.width)/a.scale/un.PDF_TO_CSS_UNITS,Q=(V?a.width:a.height)/a.scale/un.PDF_TO_CSS_UNITS;let m=0;switch(t[1].name){case"XYZ":i=t[2],s=t[3],m=t[4],i=i!==null?i:0,s=s!==null?s:Q;break;case"Fit":case"FitB":m="page-fit";break;case"FitH":case"FitBH":s=t[2],m="page-width",s===null&&this._location?(i=this._location.left,s=this._location.top):(typeof s!="number"||s<0)&&(s=Q);break;case"FitV":case"FitBV":i=t[2],c=W,F=Q,m="page-height";break;case"FitR":i=t[2],s=t[3],c=t[4]-i,F=t[5]-s;let u=jJ,J=OJ;this.removePageBorders&&(u=J=0),h=(this.container.clientWidth-u)/c/un.PDF_TO_CSS_UNITS,o=(this.container.clientHeight-J)/F/un.PDF_TO_CSS_UNITS,m=Math.min(Math.abs(h),Math.abs(o));break;default:console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`);return}if(n||(m&&m!==this._currentScale?this.currentScaleValue=m:this._currentScale===CN&&(this.currentScaleValue=OD)),m==="page-fit"&&!t[4]){p(this,Xl,DW).call(this,a);return}const R=[a.viewport.convertToViewportPoint(i,s),a.viewport.convertToViewportPoint(i+c,s+F)];let r=Math.min(R[0][0],R[1][0]),b=Math.min(R[0][1],R[1][1]);d||(r=Math.max(r,0),b=Math.max(b,0)),p(this,Xl,DW).call(this,a,{left:r,top:b})}_updateLocation(l){const t=this._currentScale,d=this._currentScaleValue,n=parseFloat(d)===t?Math.round(t*1e4)/100:d,a=l.id,i=this._pages[a-1],s=this.container,c=i.getPagePoint(s.scrollLeft-l.x,s.scrollTop-l.y),F=Math.round(c[0]),h=Math.round(c[1]);let o=`#page=${a}`;this.isInPresentationMode||(o+=`&zoom=${n},${F},${h}`),this._location={pageNumber:a,scale:n,top:h,left:F,rotation:this._pagesRotation,pdfOpenParams:o}}update(){const l=this._getVisiblePages(),t=l.views,d=t.length;if(d===0)return;const n=Math.max(iG,2*d+1);U(this,_i).resize(n,l.ids),this.renderingQueue.renderHighestPriority(l);const a=this._spreadMode===Pt.NONE&&(this._scrollMode===Gl.PAGE||this._scrollMode===Gl.VERTICAL),i=this._currentPageNumber;let s=!1;for(const c of t){if(c.percent<100)break;if(c.id===i&&a){s=!0;break}}this._setCurrentPageNumber(s?i:t[0].id),this._updateLocation(l.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}containsElement(l){return this.container.contains(l)}focus(){this.container.focus()}get _isContainerRtl(){return getComputedStyle(this.container).direction==="rtl"}get isInPresentationMode(){return this.presentationModeState===jc.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===jc.CHANGING}get isHorizontalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const l=this._scrollMode===Gl.PAGE?U(this,UU).pages:this._pages,t=this._scrollMode===Gl.HORIZONTAL,d=t&&this._isContainerRtl;return AD({scrollEl:this.container,views:l,sortByVisibility:!0,horizontal:t,rtl:d})}cleanup(){for(const l of this._pages)l.renderingState!==lt.FINISHED&&l.reset()}_cancelRendering(){for(const l of this._pages)l.cancelRendering()}forceRendering(l){const t=l||this._getVisiblePages(),d=p(this,Xl,WG).call(this,t),n=this._spreadMode!==Pt.NONE&&this._scrollMode!==Gl.HORIZONTAL,a=this.renderingQueue.getHighestPriority(t,this._pages,d,n);return a?(p(this,Xl,VG).call(this,a).then(()=>{this.renderingQueue.renderView(a)}),!0):!1}get hasEqualPageSizes(){const l=this._pages[0];for(let t=1,d=this._pages.length;t<d;++t){const n=this._pages[t];if(n.width!==l.width||n.height!==l.height)return!1}return!0}getPagesOverview(){let l;return this._pages.map(t=>{const d=t.pdfPage.getViewport({scale:1}),n=PJ(d);if(l===void 0)l=n;else if(this.enablePrintAutoRotate&&n!==l)return{width:d.height,height:d.width,rotation:(d.rotation-90)%360};return{width:d.width,height:d.height,rotation:d.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig({intent:"display"})):Promise.resolve(null)}set optionalContentConfigPromise(l){if(!(l instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${l}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=l,this.refresh(!1,{optionalContentConfigPromise:l}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:l}))}get scrollMode(){return this._scrollMode}set scrollMode(l){if(this._scrollMode!==l){if(!_D(l))throw new Error(`Invalid scroll mode: ${l}`);this.pagesCount>SW.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=l,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:l}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(l=null){const t=this._scrollMode,d=this.viewer;d.classList.toggle("scrollHorizontal",t===Gl.HORIZONTAL),d.classList.toggle("scrollWrapped",t===Gl.WRAPPED),!(!this.pdfDocument||!l)&&(t===Gl.PAGE?p(this,Xl,N0).call(this):this._previousScrollMode===Gl.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&p(this,Xl,Ba).call(this,this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(l,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(l){if(this._spreadMode!==l){if(!qD(l))throw new Error(`Invalid spread mode: ${l}`);this._spreadMode=l,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:l}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(l=null){if(!this.pdfDocument)return;const t=this.viewer,d=this._pages;if(this._scrollMode===Gl.PAGE)p(this,Xl,N0).call(this);else if(t.textContent="",this._spreadMode===Pt.NONE)for(const n of this._pages)t.append(n.div);else{const n=this._spreadMode-1;let a=null;for(let i=0,s=d.length;i<s;++i)a===null?(a=document.createElement("div"),a.className="spread",t.append(a)):i%2===n&&(a=a.cloneNode(!1),t.append(a)),a.append(d[i].div)}l&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&p(this,Xl,Ba).call(this,this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(l,!0),this.update())}_getPageAdvance(l,t=!1){switch(this._scrollMode){case Gl.WRAPPED:{const{views:d}=this._getVisiblePages(),n=new Map;for(const{id:a,y:i,percent:s,widthPercent:c}of d){if(s===0||c<100)continue;let F=n.get(i);F||n.set(i,F||(F=[])),F.push(a)}for(const a of n.values()){const i=a.indexOf(l);if(i===-1)continue;const s=a.length;if(s===1)break;if(t)for(let c=i-1,F=0;c>=F;c--){const h=a[c],o=a[c+1]-1;if(h<o)return l-o}else for(let c=i+1,F=s;c<F;c++){const h=a[c],o=a[c-1]+1;if(h>o)return o-l}if(t){const c=a[0];if(c<l)return l-c+1}else{const c=a[s-1];if(c>l)return c-l+1}break}break}case Gl.HORIZONTAL:break;case Gl.PAGE:case Gl.VERTICAL:{if(this._spreadMode===Pt.NONE)break;const d=this._spreadMode-1;if(t&&l%2!==d||!t&&l%2===d)break;const{views:n}=this._getVisiblePages(),a=t?l-1:l+1;for(const{id:i,percent:s,widthPercent:c}of n)if(i===a){if(s>0&&c===100)return 2;break}break}}return 1}nextPage(){const l=this._currentPageNumber,t=this.pagesCount;if(l>=t)return!1;const d=this._getPageAdvance(l,!1)||1;return this.currentPageNumber=Math.min(l+d,t),!0}previousPage(){const l=this._currentPageNumber;if(l<=1)return!1;const t=this._getPageAdvance(l,!0)||1;return this.currentPageNumber=Math.max(l-t,1),!0}updateScale({drawingDelay:l,scaleFactor:t=null,steps:d=null,origin:n}){if(d===null&&t===null)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let a=this._currentScale;if(t>0&&t!==1)a=Math.round(a*t*100)/100;else if(d){const i=d>0?gJ:1/gJ,s=d>0?Math.ceil:Math.floor;d=Math.abs(d);do a=s((a*i).toFixed(2)*10)/10;while(--d>0)}a=Math.max(vD,Math.min(KD,a)),p(this,Xl,Ba).call(this,a,{noScroll:!1,drawingDelay:l,origin:n})}increaseScale(l={}){this.updateScale({...l,steps:l.steps??1})}decreaseScale(l={}){this.updateScale({...l,steps:-(l.steps??1)})}get containerTopLeft(){return U(this,V0)||N(this,V0,[this.container.offsetTop,this.container.offsetLeft])}get annotationEditorMode(){return U(this,He)?U(this,Gn):Ge.DISABLE}set annotationEditorMode({mode:l,editId:t=null,isFromKeyboard:d=!1}){var n;if(!U(this,He))throw new Error("The AnnotationEditor is not enabled.");if(U(this,Gn)===l)return;if(!sG(l))throw new Error(`Invalid AnnotationEditor mode: ${l}`);if(!this.pdfDocument)return;l===Ge.STAMP&&((n=U(this,iU))==null||n.loadModel("altText"));const{eventBus:a}=this,i=()=>{p(this,Xl,wW).call(this),N(this,Gn,l),U(this,He).updateMode(l,t,d),a.dispatch("annotationeditormodechanged",{source:this,mode:l})};if(l===Ge.NONE||U(this,Gn)===Ge.NONE){const s=l!==Ge.NONE;s||this.pdfDocument.annotationStorage.resetModifiedIds();for(const F of this._pages)F.toggleEditingMode(s);const c=p(this,Xl,oG).call(this);if(s&&c){p(this,Xl,wW).call(this),N(this,sU,new AbortController);const F=AbortSignal.any([U(this,qi).signal,U(this,sU).signal]);a._on("pagerendered",({pageNumber:h})=>{c.delete(h),c.size===0&&N(this,cU,setTimeout(i,0))},{signal:F});return}}i()}refresh(l=!1,t=Object.create(null)){if(this.pdfDocument){for(const d of this._pages)d.update(t);U(this,ls)!==null&&(clearTimeout(U(this,ls)),N(this,ls,null)),l||this.update()}}}_i=new WeakMap,TW=new WeakMap,GW=new WeakMap,Gn=new WeakMap,He=new WeakMap,aU=new WeakMap,V0=new WeakMap,XW=new WeakMap,yW=new WeakMap,BW=new WeakMap,YW=new WeakMap,kW=new WeakMap,zW=new WeakMap,qi=new WeakMap,iU=new WeakMap,sU=new WeakMap,cU=new WeakMap,W0=new WeakMap,$i=new WeakMap,Q0=new WeakMap,LW=new WeakMap,m0=new WeakMap,UU=new WeakMap,ls=new WeakMap,IW=new WeakMap,R0=new WeakMap,Xl=new WeakSet,cG=function(e){const l={annotationEditorMode:U(this,Gn),annotationMode:U(this,aU),textLayerMode:U(this,R0)};return e&&(!e.includes(fV.COPY)&&U(this,R0)===xd.ENABLE&&(l.textLayerMode=xd.ENABLE_PERMISSIONS),e.includes(fV.MODIFY_CONTENTS)||(l.annotationEditorMode=Ge.DISABLE),!e.includes(fV.MODIFY_ANNOTATIONS)&&!e.includes(fV.FILL_INTERACTIVE_FORMS)&&U(this,aU)===bn.ENABLE_FORMS&&(l.annotationMode=bn.ENABLE)),l},UG=async function(e){if(document.visibilityState==="hidden"||!this.container.offsetParent||this._getVisiblePages().views.length===0)return;const l=Promise.withResolvers(),t=new AbortController;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&l.resolve()},{signal:typeof AbortSignal.any=="function"?AbortSignal.any([e,t.signal]):e}),await Promise.race([this._onePageRenderedCapability.promise,l.promise]),t.abort()},ZG=function(e,l){const t=document.getSelection(),{focusNode:d,anchorNode:n}=t;if(n&&d&&t.containsNode(U(this,$i))){if(U(this,W0)||e===xd.ENABLE_PERMISSIONS){eb(l);return}N(this,W0,!0);const{classList:a}=this.viewer;a.add("copyAll");const i=new AbortController;window.addEventListener("keydown",s=>N(this,Q0,s.key==="Escape"),{signal:i.signal}),this.getAllText().then(async s=>{s!==null&&await navigator.clipboard.writeText(s)}).catch(s=>{console.warn(`Something goes wrong when extracting the text: ${s.message}`)}).finally(()=>{N(this,W0,!1),N(this,Q0,!1),i.abort(),a.remove("copyAll")}),eb(l)}},N0=function(){if(this._scrollMode!==Gl.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,l=U(this,UU),t=this.viewer;if(t.textContent="",l.pages.length=0,this._spreadMode===Pt.NONE&&!this.isInPresentationMode){const d=this._pages[e-1];t.append(d.div),l.pages.push(d)}else{const d=new Set,n=this._spreadMode-1;n===-1?d.add(e-1):e%2!==n?(d.add(e-1),d.add(e)):(d.add(e-2),d.add(e-1));const a=document.createElement("div");if(a.className="spread",this.isInPresentationMode){const i=document.createElement("div");i.className="dummyPage",a.append(i)}for(const i of d){const s=this._pages[i];s&&(a.append(s.div),l.pages.push(s))}t.append(a)}l.scrollDown=e>=l.previousPageNumber,l.previousPageNumber=e},DW=function(e,l=null){const{div:t,id:d}=e;if(this._currentPageNumber!==d&&this._setCurrentPageNumber(d),this._scrollMode===Gl.PAGE&&(p(this,Xl,N0).call(this),this.update()),!l&&!this.isInPresentationMode){const n=t.offsetLeft+t.clientLeft,a=n+t.clientWidth,{scrollLeft:i,clientWidth:s}=this.container;(this._scrollMode===Gl.HORIZONTAL||n<i||a>i+s)&&(l={left:0,top:0})}vJ(t,l),!this._currentScaleValue&&this._location&&(this._location=null)},FG=function(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15},Gb=function(e,l,{noScroll:t=!1,preset:d=!1,drawingDelay:n=-1,origin:a=null}){if(this._currentScaleValue=l.toString(),p(this,Xl,FG).call(this,e)){d&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:l});return}this.viewer.style.setProperty("--scale-factor",e*un.PDF_TO_CSS_UNITS);const i=n>=0&&n<1e3;this.refresh(!0,{scale:e,drawingDelay:i?n:-1}),i&&N(this,ls,setTimeout(()=>{N(this,ls,null),this.refresh()},n));const s=this._currentScale;if(this._currentScale=e,!t){let c=this._currentPageNumber,F;if(this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(c=this._location.pageNumber,F=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:c,destArray:F,allowNegativeOffset:!0}),Array.isArray(a)){const h=e/s-1,[o,V]=this.containerTopLeft;this.container.scrollLeft+=(a[0]-V)*h,this.container.scrollTop+=(a[1]-o)*h}}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:d?l:void 0}),this.defaultRenderingQueue&&this.update()},hG=function(){return this._spreadMode!==Pt.NONE&&this._scrollMode!==Gl.HORIZONTAL?2:1},Ba=function(e,l){let t=parseFloat(e);if(t>0)l.preset=!1,p(this,Xl,Gb).call(this,t,e,l);else{const d=this._pages[this._currentPageNumber-1];if(!d)return;let n=jJ,a=OJ;this.isInPresentationMode?(n=a=4,this._spreadMode!==Pt.NONE&&(n*=2)):this.removePageBorders?n=a=0:this._scrollMode===Gl.HORIZONTAL&&([n,a]=[a,n]);const i=(this.container.clientWidth-n)/d.width*d.scale/U(this,Xl,hG),s=(this.container.clientHeight-a)/d.height*d.scale;switch(e){case"page-actual":t=1;break;case"page-width":t=i;break;case"page-height":t=s;break;case"page-fit":t=Math.min(i,s);break;case"auto":const c=PJ(d)?i:Math.min(s,i);t=Math.min(fD,c);break;default:console.error(`#setScale: "${e}" is an unknown zoom value.`);return}l.preset=!0,p(this,Xl,Gb).call(this,t,e,l)}},Xb=function(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&p(this,Xl,Ba).call(this,this._currentScaleValue,{noScroll:!0}),p(this,Xl,DW).call(this,e)},oG=function(){const e=this._getVisiblePages(),l=[],{ids:t,views:d}=e;for(const n of d){const{view:a}=n;if(!a.hasEditableAnnotations()){t.delete(a.id);continue}l.push(n)}return l.length===0?null:(this.renderingQueue.renderHighestPriority({first:l[0],last:l.at(-1),views:l,ids:t}),t)},VG=async function(e){if(e.pdfPage)return e.pdfPage;try{const l=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(l),l}catch(l){return console.error("Unable to get page for page view",l),null}},WG=function(e){var l,t;if(((l=e.first)==null?void 0:l.id)===1)return!0;if(((t=e.last)==null?void 0:t.id)===this.pagesCount)return!1;switch(this._scrollMode){case Gl.PAGE:return U(this,UU).scrollDown;case Gl.HORIZONTAL:return this.scroll.right}return this.scroll.down},yb=function(e=this.container.clientHeight){e!==U(this,LW)&&(N(this,LW,e),$D.setProperty("--viewer-container-height",`${e}px`))},QG=function(e){for(const l of e)if(l.target===this.container){p(this,Xl,yb).call(this,Math.floor(l.borderBoxSize[0].blockSize)),N(this,V0,null);break}},wW=function(){var e;(e=U(this,sU))==null||e.abort(),N(this,sU,null),U(this,cU)!==null&&(clearTimeout(U(this,cU)),N(this,cU,null))};class lC extends mG{_resetView(){super._resetView(),this._scrollMode=Gl.PAGE,this._spreadMode=Pt.NONE}set scrollMode(l){}_updateScrollMode(){}set spreadMode(l){}_updateSpreadMode(){}}Al.AnnotationLayerBuilder,Al.DownloadManager,Al.EventBus,Al.FindState,Al.GenericL10n,Al.LinkTarget,Al.PDFFindController,Al.PDFHistory;var tC=Al.PDFLinkService;Al.PDFPageView,Al.PDFScriptingManager,Al.PDFSinglePageViewer,Al.PDFViewer,Al.ProgressBar,Al.RenderingStates,Al.ScrollMode,Al.SimpleLinkService,Al.SpreadMode,Al.StructTreeLayerBuilder,Al.TextLayerBuilder,Al.XfaLayerBuilder,Al.parseQueryString;const eC=["id"],dC=["id"],nC={key:0,class:"textLayer"},aC={key:1,class:"annotationLayer"},RG=Z.defineComponent({__name:"VuePdfEmbed",props:{annotationLayer:{type:Boolean},height:{},id:{},imageResourcesPath:{},linkService:{},page:{},rotation:{default:0},scale:{default:1},source:{},textLayer:{type:Boolean},width:{}},emits:["internal-link-clicked","loaded","loading-failed","password-requested","progress","rendered","rendering-failed"],setup(e,{expose:l,emit:t}){const d=e,n=t,a=Z.shallowRef([]),i=Z.ref([]),s=Z.shallowRef(null);let c=null;const{doc:F}=CJ({onError:b=>{a.value=[],n("loading-failed",b)},onPasswordRequest({callback:b,isWrongPassword:u}){n("password-requested",{callback:b,isWrongPassword:u})},onProgress:b=>{n("progress",b)},source:Z.toRef(d,"source")}),h=Z.computed(()=>{if(!F.value||!d.annotationLayer)return null;if(d.linkService)return d.linkService;const b=new tC;return b.setDocument(F.value),b.setViewer({scrollPageIntoView:({pageNumber:u})=>{n("internal-link-clicked",u)}}),b}),o=async b=>{if(!F.value)return;const u=await F.value.getData(),J=await F.value.getMetadata(),G=b??J.contentDispositionFilename??"";jD(u,G)},V=b=>{let u,J;return d.height&&!d.width?(J=d.height,u=J/b):(u=d.width??s.value.clientWidth,J=u*b),[u,J]},W=async(b=300,u="",J=!1)=>{var G,T,y;if(!F.value)return;const k=b/72,X=96/72;let L,D,C;try{L=window.document.createElement("div"),L.style.display="none",window.document.body.appendChild(L),D=await gD(L);const I=d.page&&!J?Array.isArray(d.page)?d.page:[d.page]:[...Array(F.value.numPages+1).keys()].slice(1);await Promise.all(I.map(async(H,f)=>{const Y=await F.value.getPage(H),B=Y.getViewport({scale:1,rotation:0});if(f===0){const w=B.width*k/X,O=B.height*k/X;xD(D,w,O)}const z=window.document.createElement("canvas");z.width=B.width*k,z.height=B.height*k,L.appendChild(z);const g=z.cloneNode();D.contentWindow.document.body.appendChild(g),await Y.render({canvasContext:z.getContext("2d"),intent:"print",transform:[k,0,0,k,0,0],viewport:B}).promise,g.getContext("2d").drawImage(z,0,0)})),u&&(C=window.document.title,window.document.title=u),(G=D.contentWindow)==null||G.focus(),(T=D.contentWindow)==null||T.print()}finally{C&&(window.document.title=C),EN(L),(y=L.parentNode)==null||y.removeChild(L)}},Q=async()=>{if(!(!F.value||c!=null&&c.isAborted))try{a.value=d.page?Array.isArray(d.page)?d.page:[d.page]:[...Array(F.value.numPages+1).keys()].slice(1),i.value=Array(a.value.length).fill(1),await Promise.all(a.value.map(async(b,u)=>{const J=await F.value.getPage(b);if(c!=null&&c.isAborted)return;const G=((d.rotation%90===0?d.rotation:0)+J.rotate)%360,[T,y,k]=Array.from(s.value.getElementsByClassName("vue-pdf-embed__page")[u].children),X=!!(G/90%2),L=J.view[2]-J.view[0],D=J.view[3]-J.view[1],[C,I]=V(X?L/D:D/L),H=`${Math.floor(C)}px`,f=`${Math.floor(I)}px`,Y=C/(X?D:L),B=J.getViewport({scale:Y,rotation:G});i.value[u]=Y,T.style.display="block",T.style.width=H,T.style.height=f;const z=[m(J,B.clone({scale:B.scale*window.devicePixelRatio*d.scale}),T)];return d.textLayer&&z.push(r(J,B.clone({dontFlip:!0}),y)),d.annotationLayer&&z.push(R(J,B.clone({dontFlip:!0}),k||y)),Promise.all(z)})),c!=null&&c.isAborted||n("rendered")}catch(b){a.value=[],i.value=[],c!=null&&c.isAborted||n("rendering-failed",b)}},m=async(b,u,J)=>{J.width=u.width,J.height=u.height,await b.render({canvasContext:J.getContext("2d"),viewport:u}).promise},R=async(b,u,J)=>{wJ(J),new ID({accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:J,page:b,structTreeLayer:null,viewport:u}).render({annotations:await b.getAnnotations(),div:J,imageResourcesPath:d.imageResourcesPath,linkService:h.value,page:b,renderForms:!1,viewport:u})},r=async(b,u,J)=>{wJ(J),new wD({container:J,textContentSource:await b.getTextContent(),viewport:u}).render()};return Z.watch(F,b=>{b&&n("loaded",b)},{immediate:!0}),Z.watch(()=>[F.value,d.annotationLayer,d.height,d.imageResourcesPath,d.page,d.rotation,d.scale,d.textLayer,d.width],async([b])=>{b&&(c&&(c.isAborted=!0,await c.promise),EN(s.value),c={isAborted:!1,promise:Q()},await c.promise,c=null)},{immediate:!0}),Z.onBeforeUnmount(()=>{EN(s.value)}),l({doc:F,download:o,print:W}),(b,u)=>(Z.openBlock(),Z.createElementBlock("div",{id:b.id,ref_key:"root",ref:s,class:"vue-pdf-embed"},[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(a.value,(J,G)=>(Z.openBlock(),Z.createElementBlock("div",{key:J},[Z.renderSlot(b.$slots,"before-page",{page:J}),Z.createElementVNode("div",{id:b.id&&`${b.id}-${J}`,class:"vue-pdf-embed__page",style:Z.normalizeStyle({"--scale-factor":i.value[G],position:"relative"})},[u[0]||(u[0]=Z.createElementVNode("canvas",null,null,-1)),b.textLayer?(Z.openBlock(),Z.createElementBlock("div",nC)):Z.createCommentVNode("",!0),b.annotationLayer?(Z.openBlock(),Z.createElementBlock("div",aC)):Z.createCommentVNode("",!0)],12,dC),Z.renderSlot(b.$slots,"after-page",{page:J})]))),128))],8,eC))}});window!=null&&window.Vue&&(window.VuePdfEmbed=RG,window.useVuePdfEmbed=CJ),wN!=null&&wN.workerSrc||(wN.workerSrc=CD);const iC=Z.defineComponent({__name:"PdfViewerModal",props:Z.mergeModels({src:{type:String,required:!0}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e,t=Z.useModel(e,"modelValue");return(d,n)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElDialog),{fullscreen:"",modelValue:t.value,"onUpdate:modelValue":n[0]||(n[0]=a=>t.value=a),"append-to-body":"",modal:"",class:"preview-dialog"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(RG),{"annotation-layer":"","text-layer":"",source:l.src},null,8,["source"])]),_:1},8,["modelValue"]))}}),Rt=(e,l)=>{const t=e.__vccOpts||e;for(const[d,n]of l)t[d]=n;return t},NG=Rt(iC,[["__scopeId","data-v-bfb5e065"]]),sC={class:"ja-uploader"},cC={class:"ja-uploader-tools"},UC={class:"loader-shimmer"},bG=Rt(Z.defineComponent({__name:"uploader",props:Z.mergeModels({serviceName:{},configKey:{},attachToken:{},classificationLevel:{},height:{},maxHeight:{},allowUpload:{type:Boolean},allowDownload:{type:Boolean},allowDelete:{type:Boolean},allowPreview:{type:Boolean}},{modelValue:{required:!1},modelModifiers:{}}),emits:Z.mergeModels(["change","fileAdded","filesAdded","fileRemoved","upload","progress","uploadProgress","uploadPause","uploadSuccess","complete","error","uploadError","downloaded","zipDownloaded"],["update:modelValue"]),setup(e,{emit:l}){const t=e,d=Z.useModel(e,"modelValue"),n=$.createAxiosWithoutCache(),a=$.useLoading(n),i=$.useFilesApi(n),s=Z.ref([]),c=Z.ref([]),F=Z.ref([]),h=Z.ref(),o=Z.ref(),V=Z.ref(),W=Z.ref(50),Q=Z.ref(),m=Z.ref(),R=Z.ref(!1),r=Z.ref(100),b=Z.ref(!1),u=Z.ref(""),J=[".doc",".docx",".xls",".xlsx",".wps",".et",".csv",".txt",".rtf",".odt",".ods",".mht",".ppt",".pptx",".odp",".pdf",".xps","."],G=l;let T;Q.value=t.attachToken,Z.onMounted(async()=>{await y(),t.attachToken?await C():await I()}),Z.onUnmounted(()=>{T&&T.destroy(),T=void 0});async function y(){var _,al;V.value=$.useLoginUser();const x=Math.max(t.classificationLevel??50,((_=V.value)==null?void 0:_.classifiedLevel)??50);c.value=await uu(),h.value=await ru(),F.value=c.value.filter(P=>P.value>=x),o.value=Math.min(...F.value.map(P=>P.value)),console.log(`附件控件密级调试:
407
407
  表单密级:`,t.classificationLevel,`
408
408
  用户密级:`,(al=V.value)==null?void 0:al.classifiedLevel,`
409
409
  表单/用户密级比较后取最低密级:`,x,`
410
410
  系统密级:`,c.value,`
411
- 最终可选密级:`,F.value)}async function k(){Q.value||(s.value=[]),s.value=await i.getFileList(Q.value)}function X(){var al,_,K,tl;T&&T.destroy();const x=m.value.fileConfig;T=new AQ({autoProceed:!0,locale:rk}).on("progress",el=>{el==100&&k(),r.value=el}),T.use(Jp,{endpoint:new URL("/ace-file-service/uploads",location.origin).toString(),withCredentials:!0,retryDelays:void 0,chunkSize:!((al=m.value)!=null&&al.chunkSize)||((_=m.value)==null?void 0:_.chunkSize)==0?1/0:(K=m.value)==null?void 0:K.chunkSize,parallelUploads:1,headers:{aceAttachId:d.value,aceNewForm:R.value?"yes":"no"},metadata:{attachId:d.value,configKey:t.configKey,appServiceName:t.serviceName,classifiedLevel:W.value.toString()},metadataForPartialUploads:{attachId:d.value,configKey:t.configKey,appServiceName:t.serviceName,classifiedLevel:W.value.toString()}}),x.enableWebcam&&T.use(yp,{modes:(tl=x.allowedWebcamModes)==null?void 0:tl.map(el=>{switch(el){case"VIDEO_AUDIO":return"video-audio";case"VIDEO_ONLY":return"video-only";case"PICTURE":return"picture"}}),mirror:!1}),x.enableAudio&&T.use(kp),x.enableScreenCapture&&T.use(Bp);let A;x.disableFileUpload?x.disableDirUpload?A=void 0:A="folders":x.disableDirUpload?A="files":A="both",T.use(b2,{inline:!1,note:x.uploadNote,proudlyDisplayPoweredByUppy:!1,fileManagerSelectionType:A,singleFileFullScreen:!1,disableLocalFiles:x.disableFileUpload??!1,closeAfterFinish:!0,closeModalOnClickOutside:!0}).use(tM),T.on("file-added",el=>{G("fileAdded",el)}).on("files-added",el=>{G("filesAdded",el)}).on("file-removed",el=>{G("fileRemoved",el)}).on("upload",(el,Bl)=>{G("upload",el,Bl)}).on("progress",el=>{G("progress",el)}).on("upload-progress",el=>{G("uploadProgress",el)}).on("upload-pause",(el,Bl)=>{G("uploadPause",el,Bl)}).on("upload-success",el=>{G("uploadSuccess",el)}).on("complete",el=>{G("complete",el.successful,el.failed)}).on("error",el=>{G("error",el)}).on("upload-error",(el,Bl)=>{G("uploadError",el,Bl)})}async function L(){var A,al;const x=(A=m.value)==null?void 0:A.fileConfig;if(x){T==null||T.setMeta({attachId:d.value,configKey:t.configKey,appServiceName:t.serviceName,classifiedLevel:W.value.toString()});const _=T==null?void 0:T.getPlugin("Dashboard");_&&_.setOptions({note:(x.uploadNote?x.uploadNote:"")+`(正在上传${(al=h.value)==null?void 0:al.get(W.value)}文件)`}),_==null||_.openModal()}else v.ElMessageBox.alert("无法找到附件配置"+t.configKey,"错误")}function D(x){var al,_;W.value=x,T==null||T.setMeta({attachId:d.value,configKey:t.configKey,appServiceName:t.serviceName,classifiedLevel:W.value.toString()});const A=T==null?void 0:T.getPlugin("Dashboard");if(A){const K=(al=m.value)==null?void 0:al.fileConfig;K&&A.setOptions({note:(K.uploadNote?K.uploadNote:"")+`(正在上传${(_=h.value)==null?void 0:_.get(W.value)}文件)`}),A==null||A.openModal()}}async function C(){var x,A;m.value=await i.initLoad(t.serviceName,t.configKey,t.attachToken),s.value=m.value.files,d.value=(x=m.value)==null?void 0:x.attachId,Q.value=(A=m.value)==null?void 0:A.attachId,R.value=!1,await Z.nextTick(),X()}async function I(){var x,A;m.value=await i.initNew(t.serviceName,t.configKey),s.value=m.value.files,d.value=(x=m.value)==null?void 0:x.attachId,Q.value=(A=m.value)==null?void 0:A.attachToken,R.value=!0,G("change",d.value),await Z.nextTick(),X()}async function P(x){await i.deleteFile(x.token||x.id),s.value=s.value.filter(A=>A.id!==x.id)}function H(x){u.value=new URL("uploads/preview/"+x,location.origin).toString(),b.value=!0}async function Y(x){await i.downloadFile(x);var A=s.value.filter(al=>x===al.token);A&&A.length>0&&G("downloaded",A[0])}function B(){const x=T==null?void 0:T.getPlugin("Dashboard");x&&x.openModal()}async function z(){Q.value&&(await i.downloadZipFile(Q.value),G("zipDownloaded",s.value))}function g(){var x;if(t.allowUpload==null){const A=(x=m.value)==null?void 0:x.fileConfig;if(A){let al=!0;if(A.uploadAuthCode){const _=$.useLoginUser();return _&&(al=_.hasRole(A.uploadAuthCode)),!A.disallowUpload&&al}return!A.disallowUpload}console.log("file cfg is null")}return t.allowUpload}function w(){var x;if(t.allowDownload==null){const A=(x=m.value)==null?void 0:x.fileConfig;if(A){let al=!0;if(A.downloadAuthCode){const _=$.useLoginUser();return _&&(al=_.hasRole(A.downloadAuthCode)),!A.disallowDownload&&al}return!A.disallowDownload}}return t.allowDownload}function O(){var x;if(t.allowDelete==null){const A=(x=m.value)==null?void 0:x.fileConfig;if(A){let al=!0;if(A.deleteAuthCode){const _=$.useLoginUser();return _&&(al=_.hasRole(A.deleteAuthCode)),!A.disallowDelete&&al}return!A.disallowDelete}}return t.allowDelete}function f(x){var A;if(t.allowPreview==null){const al=(A=m.value)==null?void 0:A.fileConfig;if(al)return al.disablePreview?!1:J.some(_=>x.fileName.endsWith(_))}return t.allowPreview}return Z.watch(()=>t.attachToken,()=>{t.attachToken?C():I()}),Z.watch(()=>t.classificationLevel,y),(x,A)=>{var _;const al=Z.resolveComponent("el-tooltip");return Z.openBlock(),Z.createElementBlock(Z.Fragment,null,[Z.createElementVNode("div",sC,[Z.createElementVNode("div",cC,[F.value.length<=1&&g()?(Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{key:0,plain:"",type:"success",icon:Z.unref(Nl.Upload),onClick:L,loading:Z.unref(a),disabled:Z.unref(a),size:"small"},{default:Z.withCtx(()=>{var K;return[Z.createTextVNode(" 上传"+Z.toDisplayString((K=m.value)!=null&&K.fileConfig.enableClassifiedLevel?"(非密)":""),1)]}),_:1},8,["icon","loading","disabled"])):Z.createCommentVNode("",!0),w()?(Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{key:1,plain:"",icon:Z.unref(Nl.Download),onClick:z,loading:Z.unref(a),disabled:Z.unref(a)||((_=s.value)==null?void 0:_.length)===0,size:"small"},{default:Z.withCtx(()=>[...A[1]||(A[1]=[Z.createTextVNode(" 全部下载 ",-1)])]),_:1},8,["icon","loading","disabled"])):Z.createCommentVNode("",!0),F.value.length>1&&g()?(Z.openBlock(),Z.createBlock(Z.unref(v.ElDropdown),{key:2,onCommand:D,size:"small"},{dropdown:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElDropdownMenu),null,{default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(F.value,K=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElDropdownItem),{key:K.value,command:K.value},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(K.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElButton),{type:"success",size:"small"},{default:Z.withCtx(()=>[A[2]||(A[2]=Z.createTextVNode(" 上传 ",-1)),Z.createVNode(Z.unref(v.ElIcon),{class:"el-icon--right"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.ArrowDown))]),_:1})]),_:1})]),_:1})):Z.createCommentVNode("",!0),r.value<100&&r.value>0?(Z.openBlock(),Z.createElementBlock("div",{key:3,class:"container",onClick:B},[Z.createElementVNode("p",null,[Z.createElementVNode("span",UC,"正在上传,已完成"+Z.toDisplayString(r.value)+"%...",1)])])):Z.createCommentVNode("",!0)]),Z.createVNode(Z.unref(v.ElTable),{data:s.value,"show-header":!0,style:{width:"100%"},"empty-text":"暂无文件",height:t.height,"max-height":t.maxHeight},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElTableColumn),{prop:"fileName"}),Z.createVNode(Z.unref(v.ElTableColumn),{prop:"fileSize",width:"100"},{default:Z.withCtx(K=>[Z.createTextVNode(Z.toDisplayString(Z.unref(QL)(K.row.fileSize)),1)]),_:1}),Z.createVNode(Z.unref(v.ElTableColumn),{prop:"classifiedLevel",width:"80"},{default:Z.withCtx(K=>[Z.createVNode(Z.unref(v.ElTag),{type:K.row.classifiedLevel<50?K.row.classifiedLevel<30?"danger":"warning":"info"},{default:Z.withCtx(()=>{var tl;return[Z.createTextVNode(Z.toDisplayString((tl=h.value)==null?void 0:tl.get(K.row.classifiedLevel)),1)]}),_:2},1032,["type"]),K.row.classifiedLevel<o.value?(Z.openBlock(),Z.createBlock(al,{key:0,content:"文件密级已高于当前许可范围,请立即删除"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElIcon),{color:"#F56C6C"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.WarningFilled))]),_:1})]),_:1})):Z.createCommentVNode("",!0)]),_:1}),Z.createVNode(Z.unref(v.ElTableColumn),{align:"right",width:"150",fixed:"right"},{default:Z.withCtx(K=>[f(K.row)?(Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{key:0,link:"",type:"warning",onClick:tl=>H(K.row.token)},{default:Z.withCtx(()=>[...A[3]||(A[3]=[Z.createTextVNode("预览 ",-1)])]),_:1},8,["onClick"])):Z.createCommentVNode("",!0),w()?(Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{key:1,link:"",type:"primary",onClick:tl=>Y(K.row.token)},{default:Z.withCtx(()=>[...A[4]||(A[4]=[Z.createTextVNode("下载 ",-1)])]),_:1},8,["onClick"])):Z.createCommentVNode("",!0),O()?(Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{key:2,link:"",type:"danger",onClick:tl=>P(K.row)},{default:Z.withCtx(()=>[...A[5]||(A[5]=[Z.createTextVNode("删除 ",-1)])]),_:1},8,["onClick"])):Z.createCommentVNode("",!0)]),_:1})]),_:1},8,["data","height","max-height"])]),Z.createVNode(NG,{src:u.value,modelValue:b.value,"onUpdate:modelValue":A[0]||(A[0]=K=>b.value=K)},null,8,["src","modelValue"])],64)}}}),[["__scopeId","data-v-53f1dd8b"]]);function pl(e,l){if(!l||l.length==0)throw new Error("prop不能为空,请检查所有的ja-form-item的prop属性是否都已设置");const t=l.split(".");let d=e;for(let n=0;n<t.length&&(d=d[t[n]],!!d);n++);return d}function Nt(e,l,t){if(!l||l.length==0)throw new Error("prop不能为空,请检查所有的ja-form-item的prop属性是否都已设置");const d=l.split(".");let n=e;for(let a=0;a<d.length-1&&(n=n[d[a]],!!n);a++);n&&(n[d[d.length-1]]=t)}const ZC=Z.defineComponent({__name:"JaUploader",props:{serviceName:{},configKey:{},attachToken:{},classificationLevel:{},height:{},maxHeight:{}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t;function c(h){i.removeFieldError(a),Nt(n.formData,a,F.value),s("change",h)}const F=Z.ref(pl(n.formData,a));return Z.watch(()=>n.formData,()=>{F.value=pl(n.formData,a)},{deep:!0}),l({uploader:d}),(h,o)=>(Z.openBlock(),Z.createBlock(bG,{"service-name":e.serviceName,"max-height":e.maxHeight,height:e.height,"config-key":e.configKey,"attach-token":e.attachToken,"classification-level":e.classificationLevel,modelValue:F.value,"onUpdate:modelValue":o[0]||(o[0]=V=>F.value=V),onChange:c},null,8,["service-name","max-height","height","config-key","attach-token","classification-level","modelValue"]))}}),FC={class:"file-previewer"},hC=Rt(Z.defineComponent({__name:"FilePreviewer",props:{attachToken:{},buttonType:{},buttonSize:{},buttonPlain:{type:Boolean},buttonRound:{type:Boolean},buttonCircle:{type:Boolean},buttonDisabled:{type:Boolean},buttonIcon:{},buttonText:{},buttonClass:{}},setup(e){const l=e,t=$.createAxiosWithoutCache(),d=$.useFilesApi(t),n=Z.ref([]),a=Z.ref(!1),i=Z.ref(""),s=Z.ref(!1),c=Z.computed(()=>({type:l.buttonType||"warning",size:l.buttonSize||"small"})),F=[".doc",".docx",".xls",".xlsx",".wps",".et",".csv",".txt",".rtf",".odt","ods",".mht",".ppt",".pptx",".odp",".pdf","xps","."],h=Z.computed(()=>n.value.some(Q=>F.some(m=>Q.fileName.endsWith(m)))),o=Z.computed(()=>n.value.find(Q=>F.some(m=>Q.fileName.endsWith(m))));async function V(){if(!l.attachToken){n.value=[];return}try{s.value=!0,n.value=await d.getFileList(l.attachToken)}catch(Q){console.error("Failed to load file list:",Q),n.value=[]}finally{s.value=!1}}function W(){const Q=o.value;if(!Q){console.warn("No previewable files found");return}i.value=new URL("uploads/preview/"+(Q.token||Q.id),location.origin).toString(),a.value=!0}return V(),(Q,m)=>(Z.openBlock(),Z.createElementBlock("div",FC,[Z.createVNode(Z.unref(v.ElButton),{type:c.value.type,size:c.value.size,plain:e.buttonPlain!==void 0?e.buttonPlain:!0,round:e.buttonRound,circle:e.buttonCircle,loading:s.value,disabled:e.buttonDisabled||!h.value,icon:e.buttonIcon,class:Z.normalizeClass(e.buttonClass),onClick:W,link:""},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(e.buttonText||"预览"),1)]),_:1},8,["type","size","plain","round","circle","loading","disabled","icon","class"]),Z.createVNode(NG,{src:i.value,modelValue:a.value,"onUpdate:modelValue":m[0]||(m[0]=R=>a.value=R)},null,8,["src","modelValue"])]))}}),[["__scopeId","data-v-815ea2b4"]]),uG=Wl(ZC),rG=Wl(bG),pG=Wl(hC),oC={class:"text-box"},MG=Wl(Rt(Z.defineComponent({__name:"AceTip",props:{type:{default:"primary"},text:{default:""}},setup(e){const l=e;return(t,d)=>(Z.openBlock(),Z.createElementBlock("div",{class:"ace-tip-sfc",style:Z.normalizeStyle({backgroundColor:`var(--el-color-${l.type}-light-9)`,border:` var(--el-color-${l.type})`})},[Z.renderSlot(t.$slots,"icon",{},void 0,!0),Z.createElementVNode("p",oC,Z.toDisplayString(l.text),1)],4))}}),[["__scopeId","data-v-c5804df8"]]));function SG(e,l,t){const d=Z.reactive({});let n=[];l||(l=$.createAxiosWithoutCache()),l.setDefaultRequestConfig({validationErrorProcessor:s=>{n=s}});for(const s of e){const c={trigger:"blur",validator:(F,h,o)=>{if(!n)return;let V=!1;for(const W of n){let Q=W.fieldName;Q!=null&&Q.endsWith("[]")&&(Q=Q.substring(0,Q.length-2)),Q===s&&(V=!0,o(new Error(W.message)))}V||o()}};t&&t[s]?Array.isArray(t[s])?d[s]=[c,...t[s]]:d[s]=[c,t[s]]:d[s]=c}return{removeFieldError:s=>{n=n.filter(c=>c.fieldName!==s)},clearFiledErrors:()=>{n=[]},axios:l,rules:d}}function Bb(e,l){let t={};e={...e},l={...l};const d=Object.keys(e),n=Object.keys(l);return d.length>0&&n.length===0?e:d.length===0&&n.length>0?l:d.length===0&&n.length===0?{}:(n.forEach(a=>{d.includes(a)?Array.isArray(e[a])&&Array.isArray(l[a])?t[a]=[...e[a],...l[a]]:!Array.isArray(e[a])&&Array.isArray(l[a])?t[a]=[e[a],...l[a]]:Array.isArray(e[a])&&!Array.isArray(l[a])?t[a]=[...e[a],l[a]]:!Array.isArray(e[a])&&!Array.isArray(l[a])&&(t[a]=[e[a],l[a]]):t[a]=l[a],delete e[a],delete l[a]}),t={...t,...e},t)}const JG=Wl(Z.defineComponent({__name:"JaForm",props:{model:{},inline:{type:Boolean,default:!1},labelPosition:{default:"top"},labelWidth:{},labelSuffix:{},hideRequiredAsterisk:{type:Boolean,default:!0},showMessage:{type:Boolean,default:!0},inlineMessage:{type:Boolean,default:!0},statusIcon:{type:Boolean,default:!1},validateOnRuleChange:{type:Boolean,default:!0},rules:{},size:{default:"small"},disabled:{type:Boolean},scrollToError:{type:Boolean,default:!0},validator:{},requiredPosition:{default:"right"},requireAsteriskPosition:{},scrollIntoViewOptions:{}},emits:["validate","click"],setup(e,{expose:l}){const t=Z.ref(void 0),d=e;Z.provide("aceFormValidator",d.validator),Z.provide("aceFormModel",d.model),Z.provide("aceFormSize",d.size),Z.provide("aceFormRequiredPosition",d.requiredPosition);const n=Z.ref({}),a=Z.computed(()=>d.model.formData?d.model.formData:d.model);return l({elForm:t,getElForm:()=>t.value,validate:async(i,s)=>{t.value&&(t.value.clearValidate(),d.rules&&Object.keys(d.rules).length>0?await t.value.validate((c,F)=>{c?i().then(()=>{var h;(h=d.validator)==null||h.clearFiledErrors()}).catch(()=>{n.value=Bb(d.rules,d.validator.rules),t.value.validate(),s&&s()}):console.log("error submit!",F)}):i().then(()=>{var c;(c=d.validator)==null||c.clearFiledErrors()}).catch(async()=>{n.value=Bb(d.rules,d.validator.rules),await t.value.validate(),s&&s()}))},getRules:()=>n.value}),Z.watch(()=>d.model.formData,()=>{var i;(i=d.validator)==null||i.clearFiledErrors()}),Z.watch(()=>d.rules,()=>{d.rules&&(n.value=Bb(d.rules,d.validator.rules))},{immediate:!0}),(i,s)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElForm),{ref_key:"formRef",ref:t,model:a.value,rules:n.value,inline:e.inline,"label-position":e.labelPosition,"label-width":e.labelWidth,"label-suffix":e.labelSuffix,"hide-required-asterisk":e.hideRequiredAsterisk,"show-message":e.showMessage,"inline-message":e.inlineMessage,"status-icon":e.statusIcon,"validate-on-rule-change":e.validateOnRuleChange,size:e.size,disabled:e.disabled,"scroll-to-error":e.scrollToError,onValidate:s[0]||(s[0]=(c,F,h)=>i.$emit("validate",c,F,h)),onClick:s[1]||(s[1]=()=>i.$emit("click"))},{default:Z.withCtx(()=>[Z.renderSlot(i.$slots,"default")]),_:3},8,["model","rules","inline","label-position","label-width","label-suffix","hide-required-asterisk","show-message","inline-message","status-icon","validate-on-rule-change","size","disabled","scroll-to-error"]))}})),VC={key:0,style:{color:"red"}},WC=["innerHTML"],QC={key:1,style:{color:"red"}},ts=Wl(Z.defineComponent({__name:"JaFormItem",props:{prop:{},rules:{},label:{},labelWidth:{},labelRemark:{},required:{type:Boolean,default:!1},error:{},showMessage:{type:Boolean,default:!0},inlineMessage:{type:Boolean,default:!0},size:{default:"small"},requiredPosition:{},labelGap:{default:"4px"},labelPosition:{},validateStatus:{},for:{}},setup(e,{expose:l}){const t=Z.inject("aceFormRequiredPosition"),d=e;Z.provide("aceFormItemProp",d.prop);const n=Z.computed(()=>d.requiredPosition||t),a=Z.ref(null);return l({resetField:()=>{a.value.resetField()},clearValidate:()=>{a.value.clearValidate()},elFormItem:a}),(i,s)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElFormItem),{ref_key:"formItem",ref:a,prop:e.prop,rules:e.rules,"label-width":e.labelWidth,error:e.error,"show-message":e.showMessage,"inline-message":e.inlineMessage,size:e.size},{label:Z.withCtx(()=>[Z.createElementVNode("div",{style:Z.normalizeStyle([{display:"flex"},{gap:e.labelGap}])},[d.required&&n.value==="left"?(Z.openBlock(),Z.createElementBlock("span",VC,"*")):Z.createCommentVNode("",!0),Z.createVNode(Z.unref(v.ElText),{class:"el-form-item__label"},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(d.label)+" ",1),e.labelRemark?(Z.openBlock(),Z.createBlock(Z.unref(v.ElTooltip),{key:0,placement:"top"},{content:Z.withCtx(()=>[Z.createElementVNode("div",{innerHTML:e.labelRemark},null,8,WC)]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElIcon),null,{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.QuestionFilled))]),_:1})]),_:1})):Z.createCommentVNode("",!0)]),_:1}),d.required&&n.value==="right"?(Z.openBlock(),Z.createElementBlock("span",QC,"*")):Z.createCommentVNode("",!0)],4)]),default:Z.withCtx(()=>[Z.renderSlot(i.$slots,"default"),Z.renderSlot(i.$slots,"error")]),_:3},8,["prop","rules","label-width","error","show-message","inline-message","size"]))}})),EW=Wl(Z.defineComponent({__name:"JaInput",props:{maxLength:{},minLength:{},inputmode:{},name:{},ariaLabel:{},id:{},size:{},disabled:{type:Boolean,default:!1},modelValue:{},modelModifiers:{},maxlength:{},minlength:{},type:{default:"text"},resize:{},autosize:{default:!1},autocomplete:{default:"off"},formatter:{},parser:{},placeholder:{},form:{},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},clearIcon:{},showPassword:{type:Boolean,default:!1},showWordLimit:{type:Boolean,default:!1},wordLimitPosition:{},suffixIcon:{},prefixIcon:{},containerRole:{},tabindex:{},validateEvent:{type:Boolean,default:!0},inputStyle:{},autofocus:{type:Boolean,default:!1},rows:{default:2}},emits:["blur","focus","change","input","clear"],setup(e,{expose:l,emit:t}){const d=e,n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=Z.ref(),c=t;function F(V){i.removeFieldError(a),Nt(n.formData,a,h.value),c("change",V)}const h=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{h.value=pl(n.formData,a)},{deep:!0});const o=Z.computed(()=>{const{modelValue:V,maxLength:W,minLength:Q,...m}=d;return{...m,maxlength:d.maxlength??d.maxLength,minlength:d.minlength??d.minLength}});return l({focus(){var V;(V=s.value)==null||V.focus()},blur(){var V;(V=s.value)==null||V.blur()},select(){var V;(V=s.value)==null||V.select()},clear(){var V;(V=s.value)==null||V.clear()},elInput:s}),(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElInput),Z.mergeProps({ref_key:"input",ref:s,modelValue:h.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>h.value=Q)},{...o.value,...V.$attrs},{onBlur:W[1]||(W[1]=Q=>V.$emit("blur",Q)),onFocus:W[2]||(W[2]=Q=>V.$emit("focus",Q)),onChange:F,onInput:W[3]||(W[3]=Q=>V.$emit("input",Q)),onClear:W[4]||(W[4]=()=>V.$emit("clear"))}),Z.createSlots({_:2},[Z.renderList(V.$slots,(Q,m)=>({name:m,fn:Z.withCtx(()=>[Z.renderSlot(V.$slots,m)])}))]),1040,["modelValue"]))}})),TG=Wl(Z.defineComponent({__name:"JaCheckbox",props:{ariaControls:{},modelValue:{},label:{},value:{},indeterminate:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},checked:{type:Boolean,default:!1},name:{},trueValue:{},falseValue:{},trueLabel:{},falseLabel:{},id:{},border:{type:Boolean},size:{},tabindex:{},validateEvent:{type:Boolean,default:!0}},emits:["change"],setup(e,{expose:l,emit:t}){const d=e,n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=Z.ref(),c=t;function F(V){i.removeFieldError(a),Nt(n.formData,a,h.value),c("change",V)}const h=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{h.value=pl(n.formData,a)});const o=Z.computed(()=>{const{modelValue:V,...W}=d;return W});return l({elCheckbox:s}),(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElCheckbox),Z.mergeProps({ref_key:"checkbox",ref:s,modelValue:h.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>h.value=Q),onChange:F},{...o.value,...V.$attrs}),{default:Z.withCtx(()=>[Z.renderSlot(V.$slots,"default")]),_:3},16,["modelValue"]))}})),GG=Wl(Z.defineComponent({__name:"JaInputNumber",props:{inputmode:{},align:{},disabledScientific:{type:Boolean},ariaLabel:{},id:{},step:{default:1},stepStrictly:{type:Boolean,default:!1},max:{default:1/0},min:{default:-1/0},modelValue:{},readonly:{type:Boolean,default:!1},disabled:{type:Boolean},size:{default:"small"},controls:{type:Boolean,default:!0},controlsPosition:{},valueOnClear:{},name:{},placeholder:{},precision:{},validateEvent:{type:Boolean,default:!0}},emits:["blur","focus","change"],setup(e,{expose:l,emit:t}){const d=e,n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=Z.computed(()=>d.size?d.size:Z.inject("aceFormSize")),c=Z.ref(),F=t;function h(W){i.removeFieldError(a),Nt(n.formData,a,o.value),F("change",W)}const o=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{const W=pl(n.formData,a);o.value=W},{deep:!0});const V=Z.computed(()=>{const{modelValue:W,...Q}=d;return Q});return l({focus(){var W,Q;(Q=(W=c==null?void 0:c.value)==null?void 0:W.focus)==null||Q.call(W)},blur(){var W,Q;(Q=(W=c==null?void 0:c.value)==null?void 0:W.blur)==null||Q.call(W)},elInputNumber:c}),(W,Q)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElInputNumber),Z.mergeProps({ref_key:"input",ref:c,modelValue:o.value,"onUpdate:modelValue":Q[0]||(Q[0]=m=>o.value=m),modelModifiers:{number:!0}},{...V.value,...W.$attrs},{size:s.value,onChange:h,onBlur:Q[1]||(Q[1]=m=>W.$emit("blur",m)),onFocus:Q[2]||(Q[2]=m=>W.$emit("focus",m))}),{default:Z.withCtx(()=>[Z.renderSlot(W.$slots,"decrease-icon"),Z.renderSlot(W.$slots,"increase-icon")]),_:3},16,["modelValue","size"]))}})),XG=Wl(Z.defineComponent({__name:"JaSelect",props:{ariaLabel:{},emptyValues:{},valueOnClear:{},name:{},id:{},modelValue:{},autocomplete:{},automaticDropdown:{type:Boolean},size:{},effect:{},disabled:{type:Boolean},clearable:{type:Boolean},filterable:{type:Boolean},allowCreate:{type:Boolean},loading:{type:Boolean},popperClass:{},popperStyle:{},popperOptions:{},remote:{type:Boolean},debounce:{},loadingText:{},noMatchText:{},noDataText:{},remoteMethod:{},filterMethod:{},multiple:{type:Boolean},multipleLimit:{},placeholder:{},defaultFirstOption:{type:Boolean},reserveKeyword:{type:Boolean},valueKey:{},collapseTags:{type:Boolean},collapseTagsTooltip:{type:Boolean},maxCollapseTags:{},teleported:{type:Boolean},persistent:{type:Boolean},clearIcon:{},fitInputWidth:{type:Boolean},suffixIcon:{},tagType:{},tagEffect:{},validateEvent:{type:Boolean},remoteShowSuffix:{type:Boolean},showArrow:{type:Boolean},offset:{},placement:{},fallbackPlacements:{},tabindex:{},appendTo:{},options:{},props:{}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t,c=e;function F(V){i.removeFieldError(a),Nt(n.formData,a,h.value),s("change",V)}const h=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{h.value=pl(n.formData,a)},{deep:!0});const o=Z.computed(()=>{const{modelValue:V,...W}=c;return W});return l({focus:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.focus)==null?void 0:W.call(V)},blur:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.blur)==null?void 0:W.call(V)},elSelect:d}),(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElSelect),Z.mergeProps({ref_key:"input",ref:d,modelValue:h.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>h.value=Q),onChange:F},{...o.value,...V.$attrs}),Z.createSlots({_:2},[Z.renderList(V.$slots,(Q,m)=>({name:m,fn:Z.withCtx(()=>[Z.renderSlot(V.$slots,m)])}))]),1040,["modelValue"]))}})),yG=Wl(Z.defineComponent({__name:"JaDatePicker",props:{type:{},showNow:{type:Boolean},showConfirm:{type:Boolean},showFooter:{type:Boolean},showWeekNumber:{type:Boolean},ariaLabel:{},emptyValues:{},valueOnClear:{},disabledDate:{},cellClassName:{},shortcuts:{},arrowControl:{type:Boolean},tabindex:{},validateEvent:{type:Boolean},unlinkPanels:{type:Boolean},placement:{},fallbackPlacements:{},disabledHours:{},disabledMinutes:{},disabledSeconds:{},automaticDropdown:{type:Boolean},id:{},name:{},popperClass:{},popperStyle:{},format:{},valueFormat:{},dateFormat:{},timeFormat:{},clearable:{type:Boolean},clearIcon:{},editable:{type:Boolean},prefixIcon:{},size:{},readonly:{type:Boolean},disabled:{type:Boolean},placeholder:{},popperOptions:{},modelValue:{},rangeSeparator:{},startPlaceholder:{},endPlaceholder:{},defaultValue:{},defaultTime:{},isRange:{type:Boolean}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t,c=e,F=Z.ref({});function h(W){i.removeFieldError(a),Nt(n.formData,a,o.value),s("change",W)}const o=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{o.value=pl(n.formData,a)},{deep:!0});const V=Z.computed(()=>{const{modelValue:W,...Q}=c;return Q});return Z.onMounted(()=>{d.value&&Object.entries(d.value).filter(([Q,m])=>m instanceof Function).forEach(([Q,m])=>{F.value[Q]=m})}),l(F.value),(W,Q)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElDatePicker),Z.mergeProps({ref_key:"input",ref:d,modelValue:Z.unref(n).formData[Z.unref(a)],"onUpdate:modelValue":Q[0]||(Q[0]=m=>Z.unref(n).formData[Z.unref(a)]=m),onChange:h},{...V.value,...W.$attrs}),Z.createSlots({_:2},[Z.renderList(W.$slots,(m,R)=>({name:R,fn:Z.withCtx(()=>[Z.renderSlot(W.$slots,R)])}))]),1040,["modelValue"]))}}));function mC(e){const l=["Ctrl","Alt","Shift","Meta"],t=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0","Tab","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter","Escape","Space"];if(e.length<2)return!1;for(let n=0;n<e.length-1;n++)if(!l.includes(e[n]))return!1;const d=e[e.length-1];return t.includes(d)}let b0={};function BG(e,l,t){var n;const d=((n=e.arg)==null?void 0:n.split("+"))??[];if(!(!d||d.length===0))if(mC(d)){if(l.__vueShortcutHandler__)return;const a=i=>{var h;let s=!0;for(const o of d)o==="Ctrl"&&!i.ctrlKey&&(s=!1),o==="Alt"&&!i.altKey&&(s=!1),o==="Shift"&&!i.shiftKey&&(s=!1),o==="Meta"&&!i.metaKey&&(s=!1);const c=d.length>0?d[d.length-1]:null;i.key&&c&&i.key.toUpperCase()!==c.toUpperCase()&&(s=!1);let F=!1;t.component?F=(h=t.component.props)==null?void 0:h.disabled:t.props?F=t.props.disabled:F=l.hasAttribute("disabled"),s&&!F&&(i.preventDefault(),e.value?e.value(l,e,t):(l.focus(),l.click()))};RC({keys:e.arg,handler:a,el:l,prev:b0[e.arg]})}else console.warn(`Invalid shortcut key combination: ${d.join("+")}`)}function YG(e){e.__vueShortcutHandler__&&NC(e.__vueShortcutHandler__)}function RC(e){const l=e.prev,t=(window.rawWindow??window).document;l&&t.removeEventListener("keydown",l.handler),t.addEventListener("keydown",e.handler),b0[e.keys]=e,e.el.__vueShortcutHandler__=e}function NC(e){const l=b0[e.keys];if(l&&l==e){const t=(window.rawWindow??window).document;t.removeEventListener("keydown",e.handler),e.prev?(t.addEventListener("keydown",e.prev.handler),b0[e.keys]=e.prev):b0[e.keys]=void 0}else if(l){let t=l;for(;t&&t.prev!=e;)t=t.prev;t&&(t.prev=e.prev)}e.prev&&delete e.prev,delete e.el.__vueShortcutHandler__}const bC=e=>{if(e.offsetParent===null)return!1;const l=e.getBoundingClientRect(),t=window.rawWindow??window;return l.top<=t.innerHeight&&l.bottom>=0&&l.left<=t.innerWidth&&l.right>=0},uC={root:null,rootMargin:"0px",threshold:.1},CW={mounted(e,l,t){bC(e)&&BG(l,e,t);const d=a=>{a.forEach(i=>{i.isIntersecting?BG(l,e,t):YG(e)})},n=new IntersectionObserver(d,uC);e.__visibilityObserver__=n,n.observe(e)},unmounted(e){e.__visibilityObserver__.disconnect(),delete e.__visibilityObserver__,YG(e)}};function kG(e,l){e.disable?(l.disabled=!0,l.classList.add("disabled")):l.style.display="none"}const zG={mounted(e,l){const t=$.useLoginUser(),{value:d,modifiers:n}=l,a=typeof d=="string"?d.split(/,/):d??[];!a||a.length===0||(n.any?a.some(i=>t.hasRole(i))||kG(n,e):a.every(i=>t.hasRole(i))||kG(n,e))}},u0=Z.defineComponent({__name:"JaButton",props:{tooltip:{},shortcut:{},auth:{},authModifiers:{default:()=>({disable:!0,any:!1})},tooltipPlacement:{default:"bottom"},size:{},disabled:{type:Boolean},type:{},icon:{},nativeType:{},loading:{type:Boolean},loadingIcon:{},plain:{type:Boolean},text:{type:Boolean},link:{type:Boolean},bg:{type:Boolean},autofocus:{type:Boolean},round:{type:Boolean},circle:{type:Boolean},color:{},dark:{type:Boolean},autoInsertSpace:{type:Boolean},tag:{}},setup(e,{expose:l}){const t=Z.ref(),d=e,n=CW,a=Z.computed(()=>{const{tooltip:i,shortcut:s,auth:c,authModifiers:F,tooltipPlacement:h,...o}=d;return o});return l({elButton:t}),(i,s)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTooltip),{placement:e.tooltipPlacement,"append-to":"body",disabled:!e.tooltip&&!e.shortcut},{content:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(`${d.tooltip??""} ${d.shortcut?"(":""}${d.shortcut??""}${d.shortcut?")":""}`),1)]),default:Z.withCtx(()=>[Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),Z.mergeProps({ref_key:"input",ref:t},{...a.value,...i.$attrs}),Z.createSlots({_:2},[Z.renderList(i.$slots,(c,F)=>({name:F,fn:Z.withCtx(()=>[Z.renderSlot(i.$slots,F)])}))]),1040)),[[Z.unref(zG),e.auth,e.authModifiers],[Z.unref(n),void 0,e.shortcut]])]),_:3},8,["placement","disabled"]))}}),Jt=Wl(u0),LG=Wl(Z.defineComponent({__name:"JaDropdownButton",props:{tooltip:{},shortcut:{},buttonText:{},tooltipPlacement:{default:"top"},type:{default:"default"}},setup(e,{expose:l}){const t=Z.ref(),d=Z.ref(),n=e,a=CW;l({elButton:t,elDropdown:d});function i(s){s.focus()}return(s,c)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTooltip),{placement:e.tooltipPlacement,disabled:!e.tooltip&&!e.shortcut},{content:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(`${n.tooltip??""} ${n.tooltip?"(":""}${n.shortcut??""}${n.tooltip?")":""}`),1)]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElDropdown),Z.mergeProps({size:"default",ref_key:"dropdown",ref:d,trigger:"click"},s.$attrs),Z.createSlots({default:Z.withCtx(()=>[Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{ref_key:"input",ref:t,type:e.type,size:"default"},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(n.buttonText)+" ",1),Z.createVNode(Z.unref(v.ElIcon),{class:"el-icon--right"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.ArrowDown))]),_:1})]),_:1},8,["type"])),[[Z.unref(a),i,e.shortcut]])]),_:2},[Z.renderList(s.$slots,(F,h)=>({name:h,fn:Z.withCtx(()=>[Z.renderSlot(s.$slots,h)])}))]),1040)]),_:3},8,["placement","disabled"]))}})),IG=Wl(Z.defineComponent({__name:"JaSwitch",props:{ariaLabel:{},modelValue:{},disabled:{type:Boolean},loading:{type:Boolean},size:{},width:{},inlinePrompt:{type:Boolean},inactiveActionIcon:{},activeActionIcon:{},activeIcon:{},inactiveIcon:{},activeText:{},inactiveText:{},activeValue:{},inactiveValue:{},name:{},validateEvent:{type:Boolean},beforeChange:{type:Function},id:{},tabindex:{}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t,c=e;function F(V){i.removeFieldError(a),Nt(n.formData,a,h.value),s("change",V)}const h=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{h.value=pl(n.formData,a)},{deep:!0});const o=Z.computed(()=>{const{modelValue:V,...W}=c;return W});return l({focus:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.focus)==null?void 0:W.call(V)},blur:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.blur)==null?void 0:W.call(V)},elSwitch:d}),(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElSwitch),Z.mergeProps({ref_key:"input",ref:d,modelValue:h.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>h.value=Q),onChange:F},{...o.value,...V.$attrs}),Z.createSlots({_:2},[Z.renderList(V.$slots,(Q,m)=>({name:m,fn:Z.withCtx(()=>[Z.renderSlot(V.$slots,m)])}))]),1040,["modelValue"]))}})),rC={style:{width:"100%"}},pC=["onClick"],DG=Z.defineComponent({__name:"StringListInput",props:{modelValue:{},size:{}},emits:["update:modelValue","change"],setup(e,{emit:l}){var h;const t=e,d=l;function n(o){i.value.splice(o,1)}function a(){i.value.push({v:""})}const i=Z.ref(((h=t.modelValue)==null?void 0:h.map(o=>({v:o})))??[{v:""}]);let s=!1,c=!1;Z.onBeforeMount(()=>F(t.modelValue));function F(o){if(c){c=!1;return}s=!0,o?(i.value=o.map(V=>({v:V})),i.value.length==0&&i.value.push({v:""})):i.value=[{v:""}]}return Z.watch(()=>t.modelValue,o=>{F(o)}),Z.watch(()=>i.value,()=>{if(s){s=!1;return}c=!0;const o=i.value.map(V=>V.v).filter(V=>V&&V.length>0);d("update:modelValue",o),d("change",o)},{deep:!0}),(o,V)=>(Z.openBlock(),Z.createElementBlock("div",rC,[Z.createVNode(Z.unref(v.ElSpace),{direction:"vertical",style:{"align-items":"stretch",width:"100%"}},{default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(i.value,(W,Q)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElInput),{key:Q,modelValue:W.v,"onUpdate:modelValue":m=>W.v=m,size:e.size},{append:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElTooltip),{content:"删除",placement:"right"},{default:Z.withCtx(()=>{var m;return[Z.withDirectives(Z.createElementVNode("div",{onClick:R=>n(Q),style:{margin:"0 -20px",padding:"0 20px"}},[Z.createVNode(Z.unref(v.ElIcon),null,{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.Minus))]),_:1})],8,pC),[[Z.vShow,Q<(((m=i.value)==null?void 0:m.length)??0)-1]])]}),_:2},1024),Z.createVNode(Z.unref(v.ElTooltip),{content:"添加",placement:"right"},{default:Z.withCtx(()=>{var m;return[Z.withDirectives(Z.createElementVNode("div",{onClick:V[0]||(V[0]=R=>a()),style:{margin:"0 -20px",padding:"0 20px"}},[Z.createVNode(Z.unref(v.ElIcon),null,{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.Plus))]),_:1})],512),[[Z.vShow,Q===(((m=i.value)==null?void 0:m.length)??0)-1]])]}),_:2},1024)]),_:2},1032,["modelValue","onUpdate:modelValue","size"]))),128))]),_:1})]))}}),wG=Wl(Z.defineComponent({__name:"JaStringList",emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d)??[""]);return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)??[""]},{deep:!0}),(c,F)=>(Z.openBlock(),Z.createBlock(DG,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),onChange:i},c.$attrs),null,16,["modelValue"]))}})),EG=Wl(DG),MC={style:{width:"100%"},class:"ja-number-list"},SC={class:"el-input-group__append"},JC={class:"el-input-group__append"},CG=Rt(Z.defineComponent({__name:"NumberListInput",props:{modelValue:{},precision:{},step:{},size:{}},emits:["update:modelValue","change"],setup(e,{emit:l}){var h;const t=e,d=l;function n(o){i.value.splice(o,1)}function a(){i.value.push({v:0})}const i=Z.ref(((h=t.modelValue)==null?void 0:h.map(o=>({v:o})))??[{v:0}]);let s=!1,c=!1;Z.onBeforeMount(()=>F(t.modelValue));function F(o){if(o){if(c){c=!1;return}s=!0,o?(i.value=o.map(V=>({v:V})),i.value.length==0&&i.value.push({v:0})):i.value=[{v:0}]}}return Z.watch(()=>t.modelValue,o=>{F(o)}),Z.watch(()=>i.value,()=>{if(s){s=!1;return}c=!0;const o=i.value.map(V=>V.v);d("update:modelValue",o),d("change",o)},{deep:!0}),(o,V)=>{const W=Z.resolveComponent("el-tooltip");return Z.openBlock(),Z.createElementBlock("div",MC,[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(i.value,(Q,m)=>(Z.openBlock(),Z.createElementBlock("div",{class:"ja-input-box",key:m},[Z.createVNode(Z.unref(v.ElInputNumber),{modelValue:Q.v,"onUpdate:modelValue":R=>Q.v=R,precision:e.precision,size:e.size,step:e.step},null,8,["modelValue","onUpdate:modelValue","precision","size","step"]),Z.createVNode(W,{content:"删除",placement:"right"},{default:Z.withCtx(()=>{var R;return[Z.withDirectives(Z.createElementVNode("div",SC,[Z.createVNode(Z.unref(v.ElButton),{link:"",icon:Z.unref(Nl.Minus),onClick:r=>n(m),size:e.size},null,8,["icon","onClick","size"])],512),[[Z.vShow,m<(((R=i.value)==null?void 0:R.length)??0)-1]])]}),_:2},1024),Z.createVNode(W,{content:"添加",placement:"right"},{default:Z.withCtx(()=>{var R;return[Z.withDirectives(Z.createElementVNode("div",JC,[Z.createVNode(Z.unref(v.ElButton),{onClick:V[0]||(V[0]=r=>a()),size:e.size,link:"",icon:Z.unref(Nl.Plus)},null,8,["size","icon"])],512),[[Z.vShow,m===(((R=i.value)==null?void 0:R.length)??0)-1]])]}),_:2},1024)]))),128))])}}}),[["__scopeId","data-v-a3fae0c2"]]),xG=Wl(Z.defineComponent({__name:"JaNumberList",emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d)??[0]);return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)??[0]},{deep:!0}),(c,F)=>(Z.openBlock(),Z.createBlock(CG,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),onChange:i},c.$attrs),null,16,["modelValue"]))}})),gG=Wl(CG),TC={style:{width:"100%"},class:"ja-enum-list"},GC={class:"el-input-group__append"},XC={class:"el-input-group__append"},jG=Rt(Z.defineComponent({__name:"EnumListInput",props:{modelValue:{},enumValues:{},size:{}},emits:["update:modelValue","change"],setup(e,{emit:l}){var h;const t=e,d=l;function n(o){i.value.splice(o,1)}function a(){i.value.push({v:""})}const i=Z.ref(((h=t.modelValue)==null?void 0:h.map(o=>({v:o})))??[{v:""}]);let s=!1,c=!1;Z.onBeforeMount(()=>F(t.modelValue));function F(o){if(c){c=!1;return}s=!0,i.value=o.map(V=>({v:V})),i.value.length==0&&i.value.push({v:""})}return Z.watch(()=>t.modelValue,o=>{F(o)}),Z.watch(()=>i.value,()=>{if(s){s=!1;return}c=!0;const o=i.value.map(V=>V.v).filter(V=>V&&V.length>0);d("update:modelValue",o),d("change",o)},{deep:!0}),(o,V)=>{const W=Z.resolveComponent("el-option"),Q=Z.resolveComponent("el-tooltip");return Z.openBlock(),Z.createElementBlock("div",TC,[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(i.value,(m,R)=>(Z.openBlock(),Z.createElementBlock("div",{class:"ja-input-box",key:R},[Z.createVNode(Z.unref(v.ElSelect),{modelValue:m.v,"onUpdate:modelValue":r=>m.v=r,size:e.size},{default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(Object.keys(t.enumValues),r=>(Z.openBlock(),Z.createBlock(W,{key:r,label:r,value:t.enumValues[r]},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue","size"]),Z.createVNode(Q,{content:"删除",placement:"right"},{default:Z.withCtx(()=>{var r;return[Z.withDirectives(Z.createElementVNode("div",GC,[Z.createVNode(Z.unref(v.ElButton),{link:"",icon:Z.unref(Nl.Minus),onClick:b=>n(R),size:e.size},null,8,["icon","onClick","size"])],512),[[Z.vShow,R<(((r=i.value)==null?void 0:r.length)??0)-1]])]}),_:2},1024),Z.createVNode(Q,{content:"添加",placement:"right"},{default:Z.withCtx(()=>{var r;return[Z.withDirectives(Z.createElementVNode("div",XC,[Z.createVNode(Z.unref(v.ElButton),{onClick:V[0]||(V[0]=b=>a()),size:e.size,link:"",icon:Z.unref(Nl.Plus)},null,8,["size","icon"])],512),[[Z.vShow,R===(((r=i.value)==null?void 0:r.length)??0)-1]])]}),_:2},1024)]))),128))])}}}),[["__scopeId","data-v-49923459"]]),OG=Wl(Z.defineComponent({__name:"JaEnumList",props:{enumValues:{}},emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d)??[""]);return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)??[""]},{deep:!0}),(c,F)=>(Z.openBlock(),Z.createBlock(jG,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),"enum-values":e.enumValues,onChange:i},c.$attrs),null,16,["modelValue","enum-values"]))}})),vG=Wl(jG),yC={style:{width:"100%"},class:"ja-enum-list"},BC={class:"splitter"},YC={class:"el-input-group__append"},kC={class:"el-input-group__append"},KG=Rt(Z.defineComponent({__name:"MapItemListInput",props:{modelValue:{},enumValues:{},valueType:{default:"String"},size:{}},emits:["update:modelValue","change"],setup(e,{emit:l}){const t=e,d=l;function n(W){var Q;(Q=i.value)==null||Q.splice(W,1)}function a(){var W;(W=i.value)==null||W.push({k:""})}const i=Z.ref([]);let s=!1,c=!1,F=Z.ref(),h=Z.ref({});function o(){switch(console.log("map item value comp type:",t.valueType),t.valueType){case"String":F.value=v.ElInput,h.value={};break;case"Integer":case"Long":F.value=v.ElInputNumber;break;case"Decimal":F.value=v.ElInputNumber,h.value={precision:2,step:.1};break;case"Enum":F.value=v.ElSelect;break;case"Boolean":F.value=v.ElSwitch;break;case"DATE":F.value=v.ElDatePicker,h.value={type:"date"};break;case"TIMESTAMP":F.value=v.ElDatePicker,h.value={type:"datetime"};break}}Z.onBeforeMount(()=>{V(t.modelValue),o()});function V(W){if(c){c=!1;return}if(W){s=!0;const Q=Object.keys(W);i.value=Q.map(m=>({k:m,v:W[m]})),i.value.length==0&&i.value.push({k:""})}else i.value=[{k:""}]}return Z.watch(()=>t.modelValue,W=>{V(W)},{deep:!0}),Z.watch(()=>i.value,()=>{var Q;if(s){s=!1;return}c=!0;const W=(Q=i.value)==null?void 0:Q.filter(m=>m.k&&m.v).reduce((m,R)=>(m[R.k]=R.v,m),{});d("update:modelValue",W),d("change",W)},{deep:!0}),Z.watch(()=>t.valueType,()=>{o()}),(W,Q)=>{const m=Z.resolveComponent("el-text"),R=Z.resolveComponent("el-option"),r=Z.resolveComponent("el-tooltip");return Z.openBlock(),Z.createElementBlock("div",yC,[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(i.value,(b,u)=>(Z.openBlock(),Z.createElementBlock("div",{class:"ja-input-box",key:u},[Z.createVNode(Z.unref(v.ElInput),{modelValue:b.k,"onUpdate:modelValue":J=>b.k=J,size:e.size,placeholder:"键"},null,8,["modelValue","onUpdate:modelValue","size"]),Z.createElementVNode("div",BC,[Z.createVNode(m,null,{default:Z.withCtx(()=>[...Q[1]||(Q[1]=[Z.createTextVNode(":",-1)])]),_:1})]),(Z.openBlock(),Z.createBlock(Z.resolveDynamicComponent(Z.unref(F)),Z.mergeProps({modelValue:b.v,"onUpdate:modelValue":J=>b.v=J,size:e.size,placeholder:"值"},{ref_for:!0},Z.unref(h)),{default:Z.withCtx(()=>[t.valueType=="Enum"?(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,{key:0},Z.renderList(Object.keys(t.enumValues??{}),J=>(Z.openBlock(),Z.createBlock(R,{key:J,label:J,value:t.enumValues?t.enumValues[J]:""},null,8,["label","value"]))),128)):Z.createCommentVNode("",!0)]),_:1},16,["modelValue","onUpdate:modelValue","size"])),Z.createVNode(r,{content:"删除",placement:"right"},{default:Z.withCtx(()=>{var J;return[Z.withDirectives(Z.createElementVNode("div",YC,[Z.createVNode(Z.unref(v.ElButton),{link:"",icon:Z.unref(Nl.Minus),onClick:G=>n(u),size:e.size},null,8,["icon","onClick","size"])],512),[[Z.vShow,u<(((J=i.value)==null?void 0:J.length)??0)-1]])]}),_:2},1024),Z.createVNode(r,{content:"添加",placement:"right"},{default:Z.withCtx(()=>{var J;return[Z.withDirectives(Z.createElementVNode("div",kC,[Z.createVNode(Z.unref(v.ElButton),{onClick:Q[0]||(Q[0]=G=>a()),size:e.size,link:"",icon:Z.unref(Nl.Plus)},null,8,["size","icon"])],512),[[Z.vShow,u===(((J=i.value)==null?void 0:J.length)??0)-1]])]}),_:2},1024)]))),128))])}}}),[["__scopeId","data-v-bebb510c"]]),fG=Wl(Z.defineComponent({__name:"JaMapItemList",emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d)??{"":""});return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)??{"":""}}),(c,F)=>(Z.openBlock(),Z.createBlock(KG,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),onChange:i},c.$attrs),null,16,["modelValue"]))}})),HG=Wl(KG);function zC(e,l){return{...e,label:typeof l=="string"&&typeof e[l]=="string"?e[l]:"",children:[]}}function es(e,l){const t={},d=[];for(let n=0;n<e.length;n++){const a=e[n],i=zC(a,l);t[a.id]=i,a.parentId?t[a.parentId].children.push(i):d.push(i)}return d}const Yb="-1",PG="-100",AG=Wl(Z.defineComponent({__name:"DepartmentPicker",props:Z.mergeModels({realmId:{},modelValue:{},size:{default:"default"},showNodeAll:{type:Boolean,default:!1},allId:{default:Yb},multiple:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:Z.mergeModels(["change"],["update:modelValue"]),setup(e,{emit:l}){const t=$.createAxiosWithoutCache(),d=$.useDepartmentApi(t),n=e,a=l,i=Z.useModel(e,"modelValue");if(n.multiple&&!Array.isArray(i.value))throw new Error("部门选择器设置multiple为true,但是绑定的v-model值是单值");if(!n.multiple&&Array.isArray(i.value))throw new Error("部门选择器未设置multiple为true,但是绑定的v-model值是数组");const s=Z.reactive({department:[]}),c=()=>{n.realmId&&d.getNormal(n.realmId??"0",$.FromDeptSelect.BAT).then(h=>{s.department=[...es(h,"name")],n.showNodeAll&&s.department.unshift({label:"所有部门",id:n.allId,children:[],hasChildren:!1,sortIndex:0,sortPath:"",dataVersion:0,disabled:!0})})},F=h=>{a("change",Array.isArray(h)?s.department.filter(o=>h.findIndex(V=>o.id===V)>=0):s.department.find(o=>o.id===h))};return c(),Z.watch(()=>n.realmId,()=>{c()}),(h,o)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTreeSelect),Z.mergeProps({style:{width:"100%"},data:s.department,size:n.size,"node-key":"id","check-strictly":"","current-node-key":i.value,"highlight-current":"",modelValue:i.value,"onUpdate:modelValue":o[0]||(o[0]=V=>i.value=V),multiple:e.multiple,onChange:F},h.$attrs,{"collapse-tags":"","collapse-tags-tooltip":"","tag-type":"info",teleported:""}),null,16,["data","size","current-node-key","modelValue","multiple"]))}})),_G=Z.ref(Date.now());function qG(){_G.value=Date.now()}function kb(){return _G}const zb=`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1280.000000pt' height='1248.000000pt' viewBox='-384 -374 2048 2048' preserveAspectRatio='xMidYMid meet'%3E%3Cg transform='translate(0.000000,1248.000000) scale(0.100000,-0.100000)'
411
+ 最终可选密级:`,F.value)}async function k(){Q.value||(s.value=[]),s.value=await i.getFileList(Q.value)}function X(){var al,P,A,tl;T&&T.destroy();const x=m.value.fileConfig;T=new AQ({autoProceed:!0,locale:rk}).on("progress",el=>{el==100&&k(),r.value=el}),T.use(Jp,{endpoint:new URL("/ace-file-service/uploads",location.origin).toString(),withCredentials:!0,retryDelays:void 0,chunkSize:!((al=m.value)!=null&&al.chunkSize)||((P=m.value)==null?void 0:P.chunkSize)==0?1/0:(A=m.value)==null?void 0:A.chunkSize,parallelUploads:1,headers:{aceAttachId:d.value,aceNewForm:R.value?"yes":"no"},metadata:{attachId:d.value,configKey:t.configKey,appServiceName:t.serviceName,classifiedLevel:W.value.toString()},metadataForPartialUploads:{attachId:d.value,configKey:t.configKey,appServiceName:t.serviceName,classifiedLevel:W.value.toString()}}),x.enableWebcam&&T.use(yp,{modes:(tl=x.allowedWebcamModes)==null?void 0:tl.map(el=>{switch(el){case"VIDEO_AUDIO":return"video-audio";case"VIDEO_ONLY":return"video-only";case"PICTURE":return"picture"}}),mirror:!1}),x.enableAudio&&T.use(kp),x.enableScreenCapture&&T.use(Bp);let _;x.disableFileUpload?x.disableDirUpload?_=void 0:_="folders":x.disableDirUpload?_="files":_="both",T.use(b2,{inline:!1,note:x.uploadNote,proudlyDisplayPoweredByUppy:!1,fileManagerSelectionType:_,singleFileFullScreen:!1,disableLocalFiles:x.disableFileUpload??!1,closeAfterFinish:!0,closeModalOnClickOutside:!0}).use(tM),T.on("file-added",el=>{G("fileAdded",el)}).on("files-added",el=>{G("filesAdded",el)}).on("file-removed",el=>{G("fileRemoved",el)}).on("upload",(el,Bl)=>{G("upload",el,Bl)}).on("progress",el=>{G("progress",el)}).on("upload-progress",el=>{G("uploadProgress",el)}).on("upload-pause",(el,Bl)=>{G("uploadPause",el,Bl)}).on("upload-success",el=>{G("uploadSuccess",el)}).on("complete",el=>{G("complete",el.successful,el.failed)}).on("error",el=>{G("error",el)}).on("upload-error",(el,Bl)=>{G("uploadError",el,Bl)})}async function L(){var _,al;const x=(_=m.value)==null?void 0:_.fileConfig;if(x){T==null||T.setMeta({attachId:d.value,configKey:t.configKey,appServiceName:t.serviceName,classifiedLevel:W.value.toString()});const P=T==null?void 0:T.getPlugin("Dashboard");P&&P.setOptions({note:(x.uploadNote?x.uploadNote:"")+`(正在上传${(al=h.value)==null?void 0:al.get(W.value)}文件)`}),P==null||P.openModal()}else v.ElMessageBox.alert("无法找到附件配置"+t.configKey,"错误")}function D(x){var al,P;W.value=x,T==null||T.setMeta({attachId:d.value,configKey:t.configKey,appServiceName:t.serviceName,classifiedLevel:W.value.toString()});const _=T==null?void 0:T.getPlugin("Dashboard");if(_){const A=(al=m.value)==null?void 0:al.fileConfig;A&&_.setOptions({note:(A.uploadNote?A.uploadNote:"")+`(正在上传${(P=h.value)==null?void 0:P.get(W.value)}文件)`}),_==null||_.openModal()}}async function C(){var x,_;m.value=await i.initLoad(t.serviceName,t.configKey,t.attachToken),s.value=m.value.files,d.value=(x=m.value)==null?void 0:x.attachId,Q.value=(_=m.value)==null?void 0:_.attachId,R.value=!1,await Z.nextTick(),X()}async function I(){var x,_;m.value=await i.initNew(t.serviceName,t.configKey),s.value=m.value.files,d.value=(x=m.value)==null?void 0:x.attachId,Q.value=(_=m.value)==null?void 0:_.attachToken,R.value=!0,G("change",d.value),await Z.nextTick(),X()}async function H(x){await i.deleteFile(x.token||x.id),s.value=s.value.filter(_=>_.id!==x.id)}function f(x){u.value=new URL("uploads/preview/"+x,location.origin).toString(),b.value=!0}async function Y(x){await i.downloadFile(x);var _=s.value.filter(al=>x===al.token);_&&_.length>0&&G("downloaded",_[0])}function B(){const x=T==null?void 0:T.getPlugin("Dashboard");x&&x.openModal()}async function z(){Q.value&&(await i.downloadZipFile(Q.value),G("zipDownloaded",s.value))}function g(){var x;if(t.allowUpload==null){const _=(x=m.value)==null?void 0:x.fileConfig;if(_){let al=!0;if(_.uploadAuthCode){const P=$.useLoginUser();return P&&(al=P.hasRole(_.uploadAuthCode)),!_.disallowUpload&&al}return!_.disallowUpload}console.log("file cfg is null")}return t.allowUpload}function w(){var x;if(t.allowDownload==null){const _=(x=m.value)==null?void 0:x.fileConfig;if(_){let al=!0;if(_.downloadAuthCode){const P=$.useLoginUser();return P&&(al=P.hasRole(_.downloadAuthCode)),!_.disallowDownload&&al}return!_.disallowDownload}}return t.allowDownload}function O(){var x;if(t.allowDelete==null){const _=(x=m.value)==null?void 0:x.fileConfig;if(_){let al=!0;if(_.deleteAuthCode){const P=$.useLoginUser();return P&&(al=P.hasRole(_.deleteAuthCode)),!_.disallowDelete&&al}return!_.disallowDelete}}return t.allowDelete}function K(x){var _;if(t.allowPreview==null){const al=(_=m.value)==null?void 0:_.fileConfig;if(al)return al.disablePreview?!1:J.some(P=>x.fileName.endsWith(P))}return t.allowPreview}return Z.watch(()=>t.attachToken,()=>{t.attachToken?C():I()}),Z.watch(()=>t.classificationLevel,y),(x,_)=>{var al;return Z.openBlock(),Z.createElementBlock(Z.Fragment,null,[Z.createElementVNode("div",sC,[Z.createElementVNode("div",cC,[F.value.length<=1&&g()?(Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{key:0,plain:"",type:"success",icon:Z.unref(Nl.Upload),onClick:L,loading:Z.unref(a),disabled:Z.unref(a),size:"small"},{default:Z.withCtx(()=>{var P;return[Z.createTextVNode(" 上传"+Z.toDisplayString((P=m.value)!=null&&P.fileConfig.enableClassifiedLevel?"(非密)":""),1)]}),_:1},8,["icon","loading","disabled"])):Z.createCommentVNode("",!0),w()?(Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{key:1,plain:"",icon:Z.unref(Nl.Download),onClick:z,loading:Z.unref(a),disabled:Z.unref(a)||((al=s.value)==null?void 0:al.length)===0,size:"small"},{default:Z.withCtx(()=>[..._[1]||(_[1]=[Z.createTextVNode(" 全部下载 ",-1)])]),_:1},8,["icon","loading","disabled"])):Z.createCommentVNode("",!0),F.value.length>1&&g()?(Z.openBlock(),Z.createBlock(Z.unref(v.ElDropdown),{key:2,onCommand:D,size:"small"},{dropdown:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElDropdownMenu),null,{default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(F.value,P=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElDropdownItem),{key:P.value,command:P.value},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(P.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElButton),{type:"success",size:"small"},{default:Z.withCtx(()=>[_[2]||(_[2]=Z.createTextVNode(" 上传 ",-1)),Z.createVNode(Z.unref(v.ElIcon),{class:"el-icon--right"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.ArrowDown))]),_:1})]),_:1})]),_:1})):Z.createCommentVNode("",!0),r.value<100&&r.value>0?(Z.openBlock(),Z.createElementBlock("div",{key:3,class:"container",onClick:B},[Z.createElementVNode("p",null,[Z.createElementVNode("span",UC,"正在上传,已完成"+Z.toDisplayString(r.value)+"%...",1)])])):Z.createCommentVNode("",!0)]),Z.createVNode(Z.unref(v.ElTable),{data:s.value,"show-header":!0,style:{width:"100%"},"empty-text":"暂无文件",height:t.height,"max-height":t.maxHeight},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElTableColumn),{prop:"fileName"}),Z.createVNode(Z.unref(v.ElTableColumn),{prop:"fileSize",width:"100"},{default:Z.withCtx(P=>[Z.createTextVNode(Z.toDisplayString(Z.unref(QL)(P.row.fileSize)),1)]),_:1}),Z.createVNode(Z.unref(v.ElTableColumn),{prop:"classifiedLevel",width:"80"},{default:Z.withCtx(P=>[Z.createVNode(Z.unref(v.ElTag),{type:P.row.classifiedLevel<50?P.row.classifiedLevel<30?"danger":"warning":"info"},{default:Z.withCtx(()=>{var A;return[Z.createTextVNode(Z.toDisplayString((A=h.value)==null?void 0:A.get(P.row.classifiedLevel)),1)]}),_:2},1032,["type"]),P.row.classifiedLevel<o.value?(Z.openBlock(),Z.createBlock(Z.unref(v.ElTooltip),{key:0,content:"文件密级已高于当前许可范围,请立即删除"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElIcon),{color:"#F56C6C"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.WarningFilled))]),_:1})]),_:1})):Z.createCommentVNode("",!0)]),_:1}),Z.createVNode(Z.unref(v.ElTableColumn),{align:"right",width:"150",fixed:"right"},{default:Z.withCtx(P=>[K(P.row)?(Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{key:0,link:"",type:"warning",onClick:A=>f(P.row.token)},{default:Z.withCtx(()=>[..._[3]||(_[3]=[Z.createTextVNode("预览 ",-1)])]),_:1},8,["onClick"])):Z.createCommentVNode("",!0),w()?(Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{key:1,link:"",type:"primary",onClick:A=>Y(P.row.token)},{default:Z.withCtx(()=>[..._[4]||(_[4]=[Z.createTextVNode("下载 ",-1)])]),_:1},8,["onClick"])):Z.createCommentVNode("",!0),O()?(Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{key:2,link:"",type:"danger",onClick:A=>H(P.row)},{default:Z.withCtx(()=>[..._[5]||(_[5]=[Z.createTextVNode("删除 ",-1)])]),_:1},8,["onClick"])):Z.createCommentVNode("",!0)]),_:1})]),_:1},8,["data","height","max-height"])]),Z.createVNode(NG,{src:u.value,modelValue:b.value,"onUpdate:modelValue":_[0]||(_[0]=P=>b.value=P)},null,8,["src","modelValue"])],64)}}}),[["__scopeId","data-v-5a82be7f"]]);function pl(e,l){if(!l||l.length==0)throw new Error("prop不能为空,请检查所有的ja-form-item的prop属性是否都已设置");const t=l.split(".");let d=e;for(let n=0;n<t.length&&(d=d[t[n]],!!d);n++);return d}function Nt(e,l,t){if(!l||l.length==0)throw new Error("prop不能为空,请检查所有的ja-form-item的prop属性是否都已设置");const d=l.split(".");let n=e;for(let a=0;a<d.length-1&&(n=n[d[a]],!!n);a++);n&&(n[d[d.length-1]]=t)}const ZC=Z.defineComponent({__name:"JaUploader",props:{serviceName:{},configKey:{},attachToken:{},classificationLevel:{},height:{},maxHeight:{}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t;function c(h){i.removeFieldError(a),Nt(n.formData,a,F.value),s("change",h)}const F=Z.ref(pl(n.formData,a));return Z.watch(()=>n.formData,()=>{F.value=pl(n.formData,a)},{deep:!0}),l({uploader:d}),(h,o)=>(Z.openBlock(),Z.createBlock(bG,{"service-name":e.serviceName,"max-height":e.maxHeight,height:e.height,"config-key":e.configKey,"attach-token":e.attachToken,"classification-level":e.classificationLevel,modelValue:F.value,"onUpdate:modelValue":o[0]||(o[0]=V=>F.value=V),onChange:c},null,8,["service-name","max-height","height","config-key","attach-token","classification-level","modelValue"]))}}),FC={class:"file-previewer"},hC=Rt(Z.defineComponent({__name:"FilePreviewer",props:{attachToken:{},buttonType:{},buttonSize:{},buttonPlain:{type:Boolean},buttonRound:{type:Boolean},buttonCircle:{type:Boolean},buttonDisabled:{type:Boolean},buttonIcon:{},buttonText:{},buttonClass:{}},setup(e){const l=e,t=$.createAxiosWithoutCache(),d=$.useFilesApi(t),n=Z.ref([]),a=Z.ref(!1),i=Z.ref(""),s=Z.ref(!1),c=Z.computed(()=>({type:l.buttonType||"warning",size:l.buttonSize||"small"})),F=[".doc",".docx",".xls",".xlsx",".wps",".et",".csv",".txt",".rtf",".odt","ods",".mht",".ppt",".pptx",".odp",".pdf","xps","."],h=Z.computed(()=>n.value.some(Q=>F.some(m=>Q.fileName.endsWith(m)))),o=Z.computed(()=>n.value.find(Q=>F.some(m=>Q.fileName.endsWith(m))));async function V(){if(!l.attachToken){n.value=[];return}try{s.value=!0,n.value=await d.getFileList(l.attachToken)}catch(Q){console.error("Failed to load file list:",Q),n.value=[]}finally{s.value=!1}}function W(){const Q=o.value;if(!Q){console.warn("No previewable files found");return}i.value=new URL("uploads/preview/"+(Q.token||Q.id),location.origin).toString(),a.value=!0}return V(),(Q,m)=>(Z.openBlock(),Z.createElementBlock("div",FC,[Z.createVNode(Z.unref(v.ElButton),{type:c.value.type,size:c.value.size,plain:e.buttonPlain!==void 0?e.buttonPlain:!0,round:e.buttonRound,circle:e.buttonCircle,loading:s.value,disabled:e.buttonDisabled||!h.value,icon:e.buttonIcon,class:Z.normalizeClass(e.buttonClass),onClick:W,link:""},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(e.buttonText||"预览"),1)]),_:1},8,["type","size","plain","round","circle","loading","disabled","icon","class"]),Z.createVNode(NG,{src:i.value,modelValue:a.value,"onUpdate:modelValue":m[0]||(m[0]=R=>a.value=R)},null,8,["src","modelValue"])]))}}),[["__scopeId","data-v-815ea2b4"]]),uG=Wl(ZC),rG=Wl(bG),pG=Wl(hC),oC={class:"text-box"},MG=Wl(Rt(Z.defineComponent({__name:"AceTip",props:{type:{default:"primary"},text:{default:""}},setup(e){const l=e;return(t,d)=>(Z.openBlock(),Z.createElementBlock("div",{class:"ace-tip-sfc",style:Z.normalizeStyle({backgroundColor:`var(--el-color-${l.type}-light-9)`,border:` var(--el-color-${l.type})`})},[Z.renderSlot(t.$slots,"icon",{},void 0,!0),Z.createElementVNode("p",oC,Z.toDisplayString(l.text),1)],4))}}),[["__scopeId","data-v-c5804df8"]]));function SG(e,l,t){const d=Z.reactive({});let n=[];l||(l=$.createAxiosWithoutCache()),l.setDefaultRequestConfig({validationErrorProcessor:s=>{n=s}});for(const s of e){const c={trigger:"blur",validator:(F,h,o)=>{if(!n)return;let V=!1;for(const W of n){let Q=W.fieldName;Q!=null&&Q.endsWith("[]")&&(Q=Q.substring(0,Q.length-2)),Q===s&&(V=!0,o(new Error(W.message)))}V||o()}};t&&t[s]?Array.isArray(t[s])?d[s]=[c,...t[s]]:d[s]=[c,t[s]]:d[s]=c}return{removeFieldError:s=>{n=n.filter(c=>c.fieldName!==s)},clearFiledErrors:()=>{n=[]},axios:l,rules:d}}function Bb(e,l){let t={};e={...e},l={...l};const d=Object.keys(e),n=Object.keys(l);return d.length>0&&n.length===0?e:d.length===0&&n.length>0?l:d.length===0&&n.length===0?{}:(n.forEach(a=>{d.includes(a)?Array.isArray(e[a])&&Array.isArray(l[a])?t[a]=[...e[a],...l[a]]:!Array.isArray(e[a])&&Array.isArray(l[a])?t[a]=[e[a],...l[a]]:Array.isArray(e[a])&&!Array.isArray(l[a])?t[a]=[...e[a],l[a]]:!Array.isArray(e[a])&&!Array.isArray(l[a])&&(t[a]=[e[a],l[a]]):t[a]=l[a],delete e[a],delete l[a]}),t={...t,...e},t)}const JG=Wl(Z.defineComponent({__name:"JaForm",props:{model:{},inline:{type:Boolean,default:!1},labelPosition:{default:"top"},labelWidth:{},labelSuffix:{},hideRequiredAsterisk:{type:Boolean,default:!0},showMessage:{type:Boolean,default:!0},inlineMessage:{type:Boolean,default:!0},statusIcon:{type:Boolean,default:!1},validateOnRuleChange:{type:Boolean,default:!0},rules:{},size:{default:"small"},disabled:{type:Boolean},scrollToError:{type:Boolean,default:!0},validator:{},requiredPosition:{default:"right"},requireAsteriskPosition:{},scrollIntoViewOptions:{}},emits:["validate","click"],setup(e,{expose:l}){const t=Z.ref(void 0),d=e;Z.provide("aceFormValidator",d.validator),Z.provide("aceFormModel",d.model),Z.provide("aceFormSize",d.size),Z.provide("aceFormRequiredPosition",d.requiredPosition);const n=Z.ref({}),a=Z.computed(()=>d.model.formData?d.model.formData:d.model);return l({elForm:t,getElForm:()=>t.value,validate:async(i,s)=>{t.value&&(t.value.clearValidate(),d.rules&&Object.keys(d.rules).length>0?await t.value.validate((c,F)=>{c?i().then(()=>{var h;(h=d.validator)==null||h.clearFiledErrors()}).catch(()=>{n.value=Bb(d.rules,d.validator.rules),t.value.validate(),s&&s()}):console.log("error submit!",F)}):i().then(()=>{var c;(c=d.validator)==null||c.clearFiledErrors()}).catch(async()=>{n.value=Bb(d.rules,d.validator.rules),await t.value.validate(),s&&s()}))},getRules:()=>n.value}),Z.watch(()=>d.model.formData,()=>{var i;(i=d.validator)==null||i.clearFiledErrors()}),Z.watch(()=>d.rules,()=>{d.rules&&(n.value=Bb(d.rules,d.validator.rules))},{immediate:!0}),(i,s)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElForm),{ref_key:"formRef",ref:t,model:a.value,rules:n.value,inline:e.inline,"label-position":e.labelPosition,"label-width":e.labelWidth,"label-suffix":e.labelSuffix,"hide-required-asterisk":e.hideRequiredAsterisk,"show-message":e.showMessage,"inline-message":e.inlineMessage,"status-icon":e.statusIcon,"validate-on-rule-change":e.validateOnRuleChange,size:e.size,disabled:e.disabled,"scroll-to-error":e.scrollToError,onValidate:s[0]||(s[0]=(c,F,h)=>i.$emit("validate",c,F,h)),onClick:s[1]||(s[1]=()=>i.$emit("click"))},{default:Z.withCtx(()=>[Z.renderSlot(i.$slots,"default")]),_:3},8,["model","rules","inline","label-position","label-width","label-suffix","hide-required-asterisk","show-message","inline-message","status-icon","validate-on-rule-change","size","disabled","scroll-to-error"]))}})),VC={key:0,style:{color:"red"}},WC=["innerHTML"],QC={key:1,style:{color:"red"}},ts=Wl(Z.defineComponent({__name:"JaFormItem",props:{prop:{},rules:{},label:{},labelWidth:{},labelRemark:{},required:{type:Boolean,default:!1},error:{},showMessage:{type:Boolean,default:!0},inlineMessage:{type:Boolean,default:!0},size:{default:"small"},requiredPosition:{},labelGap:{default:"4px"},labelPosition:{},validateStatus:{},for:{}},setup(e,{expose:l}){const t=Z.inject("aceFormRequiredPosition"),d=e;Z.provide("aceFormItemProp",d.prop);const n=Z.computed(()=>d.requiredPosition||t),a=Z.ref(null);return l({resetField:()=>{a.value.resetField()},clearValidate:()=>{a.value.clearValidate()},elFormItem:a}),(i,s)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElFormItem),{ref_key:"formItem",ref:a,prop:e.prop,rules:e.rules,"label-width":e.labelWidth,error:e.error,"show-message":e.showMessage,"inline-message":e.inlineMessage,size:e.size},{label:Z.withCtx(()=>[Z.createElementVNode("div",{style:Z.normalizeStyle([{display:"flex"},{gap:e.labelGap}])},[d.required&&n.value==="left"?(Z.openBlock(),Z.createElementBlock("span",VC,"*")):Z.createCommentVNode("",!0),Z.createVNode(Z.unref(v.ElText),{class:"el-form-item__label"},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(d.label)+" ",1),e.labelRemark?(Z.openBlock(),Z.createBlock(Z.unref(v.ElTooltip),{key:0,placement:"top"},{content:Z.withCtx(()=>[Z.createElementVNode("div",{innerHTML:e.labelRemark},null,8,WC)]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElIcon),null,{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.QuestionFilled))]),_:1})]),_:1})):Z.createCommentVNode("",!0)]),_:1}),d.required&&n.value==="right"?(Z.openBlock(),Z.createElementBlock("span",QC,"*")):Z.createCommentVNode("",!0)],4)]),default:Z.withCtx(()=>[Z.renderSlot(i.$slots,"default"),Z.renderSlot(i.$slots,"error")]),_:3},8,["prop","rules","label-width","error","show-message","inline-message","size"]))}})),EW=Wl(Z.defineComponent({__name:"JaInput",props:{maxLength:{},minLength:{},inputmode:{},name:{},ariaLabel:{},id:{},size:{},disabled:{type:Boolean,default:!1},modelValue:{},modelModifiers:{},maxlength:{},minlength:{},type:{default:"text"},resize:{},autosize:{default:!1},autocomplete:{default:"off"},formatter:{},parser:{},placeholder:{},form:{},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},clearIcon:{},showPassword:{type:Boolean,default:!1},showWordLimit:{type:Boolean,default:!1},wordLimitPosition:{},suffixIcon:{},prefixIcon:{},containerRole:{},tabindex:{},validateEvent:{type:Boolean,default:!0},inputStyle:{},autofocus:{type:Boolean,default:!1},rows:{default:2}},emits:["blur","focus","change","input","clear"],setup(e,{expose:l,emit:t}){const d=e,n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=Z.ref(),c=t;function F(V){i.removeFieldError(a),Nt(n.formData,a,h.value),c("change",V)}const h=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{h.value=pl(n.formData,a)},{deep:!0});const o=Z.computed(()=>{const{modelValue:V,maxLength:W,minLength:Q,...m}=d;return{...m,maxlength:d.maxlength??d.maxLength,minlength:d.minlength??d.minLength}});return l({focus(){var V;(V=s.value)==null||V.focus()},blur(){var V;(V=s.value)==null||V.blur()},select(){var V;(V=s.value)==null||V.select()},clear(){var V;(V=s.value)==null||V.clear()},elInput:s}),(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElInput),Z.mergeProps({ref_key:"input",ref:s,modelValue:h.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>h.value=Q)},{...o.value,...V.$attrs},{onBlur:W[1]||(W[1]=Q=>V.$emit("blur",Q)),onFocus:W[2]||(W[2]=Q=>V.$emit("focus",Q)),onChange:F,onInput:W[3]||(W[3]=Q=>V.$emit("input",Q)),onClear:W[4]||(W[4]=()=>V.$emit("clear"))}),Z.createSlots({_:2},[Z.renderList(V.$slots,(Q,m)=>({name:m,fn:Z.withCtx(()=>[Z.renderSlot(V.$slots,m)])}))]),1040,["modelValue"]))}})),TG=Wl(Z.defineComponent({__name:"JaCheckbox",props:{ariaControls:{},modelValue:{},label:{},value:{},indeterminate:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},checked:{type:Boolean,default:!1},name:{},trueValue:{},falseValue:{},trueLabel:{},falseLabel:{},id:{},border:{type:Boolean},size:{},tabindex:{},validateEvent:{type:Boolean,default:!0}},emits:["change"],setup(e,{expose:l,emit:t}){const d=e,n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=Z.ref(),c=t;function F(V){i.removeFieldError(a),Nt(n.formData,a,h.value),c("change",V)}const h=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{h.value=pl(n.formData,a)});const o=Z.computed(()=>{const{modelValue:V,...W}=d;return W});return l({elCheckbox:s}),(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElCheckbox),Z.mergeProps({ref_key:"checkbox",ref:s,modelValue:h.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>h.value=Q),onChange:F},{...o.value,...V.$attrs}),{default:Z.withCtx(()=>[Z.renderSlot(V.$slots,"default")]),_:3},16,["modelValue"]))}})),GG=Wl(Z.defineComponent({__name:"JaInputNumber",props:{inputmode:{},align:{},disabledScientific:{type:Boolean},ariaLabel:{},id:{},step:{default:1},stepStrictly:{type:Boolean,default:!1},max:{default:1/0},min:{default:-1/0},modelValue:{},readonly:{type:Boolean,default:!1},disabled:{type:Boolean},size:{default:"small"},controls:{type:Boolean,default:!0},controlsPosition:{},valueOnClear:{},name:{},placeholder:{},precision:{},validateEvent:{type:Boolean,default:!0}},emits:["blur","focus","change"],setup(e,{expose:l,emit:t}){const d=e,n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=Z.computed(()=>d.size?d.size:Z.inject("aceFormSize")),c=Z.ref(),F=t;function h(W){i.removeFieldError(a),Nt(n.formData,a,o.value),F("change",W)}const o=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{const W=pl(n.formData,a);o.value=W},{deep:!0});const V=Z.computed(()=>{const{modelValue:W,...Q}=d;return Q});return l({focus(){var W,Q;(Q=(W=c==null?void 0:c.value)==null?void 0:W.focus)==null||Q.call(W)},blur(){var W,Q;(Q=(W=c==null?void 0:c.value)==null?void 0:W.blur)==null||Q.call(W)},elInputNumber:c}),(W,Q)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElInputNumber),Z.mergeProps({ref_key:"input",ref:c,modelValue:o.value,"onUpdate:modelValue":Q[0]||(Q[0]=m=>o.value=m),modelModifiers:{number:!0}},{...V.value,...W.$attrs},{size:s.value,onChange:h,onBlur:Q[1]||(Q[1]=m=>W.$emit("blur",m)),onFocus:Q[2]||(Q[2]=m=>W.$emit("focus",m))}),{default:Z.withCtx(()=>[Z.renderSlot(W.$slots,"decrease-icon"),Z.renderSlot(W.$slots,"increase-icon")]),_:3},16,["modelValue","size"]))}})),XG=Wl(Z.defineComponent({__name:"JaSelect",props:{ariaLabel:{},emptyValues:{},valueOnClear:{},name:{},id:{},modelValue:{},autocomplete:{},automaticDropdown:{type:Boolean},size:{},effect:{},disabled:{type:Boolean},clearable:{type:Boolean},filterable:{type:Boolean},allowCreate:{type:Boolean},loading:{type:Boolean},popperClass:{},popperStyle:{},popperOptions:{},remote:{type:Boolean},debounce:{},loadingText:{},noMatchText:{},noDataText:{},remoteMethod:{},filterMethod:{},multiple:{type:Boolean},multipleLimit:{},placeholder:{},defaultFirstOption:{type:Boolean},reserveKeyword:{type:Boolean},valueKey:{},collapseTags:{type:Boolean},collapseTagsTooltip:{type:Boolean},maxCollapseTags:{},teleported:{type:Boolean},persistent:{type:Boolean},clearIcon:{},fitInputWidth:{type:Boolean},suffixIcon:{},tagType:{},tagEffect:{},validateEvent:{type:Boolean},remoteShowSuffix:{type:Boolean},showArrow:{type:Boolean},offset:{},placement:{},fallbackPlacements:{},tabindex:{},appendTo:{},options:{},props:{}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t,c=e;function F(V){i.removeFieldError(a),Nt(n.formData,a,h.value),s("change",V)}const h=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{h.value=pl(n.formData,a)},{deep:!0});const o=Z.computed(()=>{const{modelValue:V,...W}=c;return W});return l({focus:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.focus)==null?void 0:W.call(V)},blur:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.blur)==null?void 0:W.call(V)},elSelect:d}),(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElSelect),Z.mergeProps({ref_key:"input",ref:d,modelValue:h.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>h.value=Q),onChange:F},{...o.value,...V.$attrs}),Z.createSlots({_:2},[Z.renderList(V.$slots,(Q,m)=>({name:m,fn:Z.withCtx(()=>[Z.renderSlot(V.$slots,m)])}))]),1040,["modelValue"]))}})),yG=Wl(Z.defineComponent({__name:"JaDatePicker",props:{type:{},showNow:{type:Boolean},showConfirm:{type:Boolean},showFooter:{type:Boolean},showWeekNumber:{type:Boolean},ariaLabel:{},emptyValues:{},valueOnClear:{},disabledDate:{},cellClassName:{},shortcuts:{},arrowControl:{type:Boolean},tabindex:{},validateEvent:{type:Boolean},unlinkPanels:{type:Boolean},placement:{},fallbackPlacements:{},disabledHours:{},disabledMinutes:{},disabledSeconds:{},automaticDropdown:{type:Boolean},id:{},name:{},popperClass:{},popperStyle:{},format:{},valueFormat:{},dateFormat:{},timeFormat:{},clearable:{type:Boolean},clearIcon:{},editable:{type:Boolean},prefixIcon:{},size:{},readonly:{type:Boolean},disabled:{type:Boolean},placeholder:{},popperOptions:{},modelValue:{},rangeSeparator:{},startPlaceholder:{},endPlaceholder:{},defaultValue:{},defaultTime:{},isRange:{type:Boolean}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t,c=e,F=Z.ref({});function h(W){i.removeFieldError(a),Nt(n.formData,a,o.value),s("change",W)}const o=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{o.value=pl(n.formData,a)},{deep:!0});const V=Z.computed(()=>{const{modelValue:W,...Q}=c;return Q});return Z.onMounted(()=>{d.value&&Object.entries(d.value).filter(([Q,m])=>m instanceof Function).forEach(([Q,m])=>{F.value[Q]=m})}),l(F.value),(W,Q)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElDatePicker),Z.mergeProps({ref_key:"input",ref:d,modelValue:Z.unref(n).formData[Z.unref(a)],"onUpdate:modelValue":Q[0]||(Q[0]=m=>Z.unref(n).formData[Z.unref(a)]=m),onChange:h},{...V.value,...W.$attrs}),Z.createSlots({_:2},[Z.renderList(W.$slots,(m,R)=>({name:R,fn:Z.withCtx(()=>[Z.renderSlot(W.$slots,R)])}))]),1040,["modelValue"]))}}));function mC(e){const l=["Ctrl","Alt","Shift","Meta"],t=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0","Tab","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter","Escape","Space"];if(e.length<2)return!1;for(let n=0;n<e.length-1;n++)if(!l.includes(e[n]))return!1;const d=e[e.length-1];return t.includes(d)}let b0={};function BG(e,l,t){var n;const d=((n=e.arg)==null?void 0:n.split("+"))??[];if(!(!d||d.length===0))if(mC(d)){if(l.__vueShortcutHandler__)return;const a=i=>{var h;let s=!0;for(const o of d)o==="Ctrl"&&!i.ctrlKey&&(s=!1),o==="Alt"&&!i.altKey&&(s=!1),o==="Shift"&&!i.shiftKey&&(s=!1),o==="Meta"&&!i.metaKey&&(s=!1);const c=d.length>0?d[d.length-1]:null;i.key&&c&&i.key.toUpperCase()!==c.toUpperCase()&&(s=!1);let F=!1;t.component?F=(h=t.component.props)==null?void 0:h.disabled:t.props?F=t.props.disabled:F=l.hasAttribute("disabled"),s&&!F&&(i.preventDefault(),e.value?e.value(l,e,t):(l.focus(),l.click()))};RC({keys:e.arg,handler:a,el:l,prev:b0[e.arg]})}else console.warn(`Invalid shortcut key combination: ${d.join("+")}`)}function YG(e){e.__vueShortcutHandler__&&NC(e.__vueShortcutHandler__)}function RC(e){const l=e.prev,t=(window.rawWindow??window).document;l&&t.removeEventListener("keydown",l.handler),t.addEventListener("keydown",e.handler),b0[e.keys]=e,e.el.__vueShortcutHandler__=e}function NC(e){const l=b0[e.keys];if(l&&l==e){const t=(window.rawWindow??window).document;t.removeEventListener("keydown",e.handler),e.prev?(t.addEventListener("keydown",e.prev.handler),b0[e.keys]=e.prev):b0[e.keys]=void 0}else if(l){let t=l;for(;t&&t.prev!=e;)t=t.prev;t&&(t.prev=e.prev)}e.prev&&delete e.prev,delete e.el.__vueShortcutHandler__}const bC=e=>{if(e.offsetParent===null)return!1;const l=e.getBoundingClientRect(),t=window.rawWindow??window;return l.top<=t.innerHeight&&l.bottom>=0&&l.left<=t.innerWidth&&l.right>=0},uC={root:null,rootMargin:"0px",threshold:.1},CW={mounted(e,l,t){bC(e)&&BG(l,e,t);const d=a=>{a.forEach(i=>{i.isIntersecting?BG(l,e,t):YG(e)})},n=new IntersectionObserver(d,uC);e.__visibilityObserver__=n,n.observe(e)},unmounted(e){e.__visibilityObserver__.disconnect(),delete e.__visibilityObserver__,YG(e)}};function kG(e,l){e.disable?(l.disabled=!0,l.classList.add("disabled")):l.style.display="none"}const zG={mounted(e,l){const t=$.useLoginUser(),{value:d,modifiers:n}=l,a=typeof d=="string"?d.split(/,/):d??[];!a||a.length===0||(n.any?a.some(i=>t.hasRole(i))||kG(n,e):a.every(i=>t.hasRole(i))||kG(n,e))}},u0=Z.defineComponent({__name:"JaButton",props:{tooltip:{},shortcut:{},auth:{},authModifiers:{default:()=>({disable:!0,any:!1})},tooltipPlacement:{default:"bottom"},size:{},disabled:{type:Boolean},type:{},icon:{},nativeType:{},loading:{type:Boolean},loadingIcon:{},plain:{type:Boolean},text:{type:Boolean},link:{type:Boolean},bg:{type:Boolean},autofocus:{type:Boolean},round:{type:Boolean},circle:{type:Boolean},color:{},dark:{type:Boolean},autoInsertSpace:{type:Boolean},tag:{}},setup(e,{expose:l}){const t=Z.ref(),d=e,n=CW,a=Z.computed(()=>{const{tooltip:i,shortcut:s,auth:c,authModifiers:F,tooltipPlacement:h,...o}=d;return o});return l({elButton:t}),(i,s)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTooltip),{placement:e.tooltipPlacement,"append-to":"body",disabled:!e.tooltip&&!e.shortcut},{content:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(`${d.tooltip??""} ${d.shortcut?"(":""}${d.shortcut??""}${d.shortcut?")":""}`),1)]),default:Z.withCtx(()=>[Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),Z.mergeProps({ref_key:"input",ref:t},{...a.value,...i.$attrs}),Z.createSlots({_:2},[Z.renderList(i.$slots,(c,F)=>({name:F,fn:Z.withCtx(()=>[Z.renderSlot(i.$slots,F)])}))]),1040)),[[Z.unref(zG),e.auth,e.authModifiers],[Z.unref(n),void 0,e.shortcut]])]),_:3},8,["placement","disabled"]))}}),Jt=Wl(u0),LG=Wl(Z.defineComponent({__name:"JaDropdownButton",props:{tooltip:{},shortcut:{},buttonText:{},tooltipPlacement:{default:"top"},type:{default:"default"}},setup(e,{expose:l}){const t=Z.ref(),d=Z.ref(),n=e,a=CW;l({elButton:t,elDropdown:d});function i(s){s.focus()}return(s,c)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTooltip),{placement:e.tooltipPlacement,disabled:!e.tooltip&&!e.shortcut},{content:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(`${n.tooltip??""} ${n.tooltip?"(":""}${n.shortcut??""}${n.tooltip?")":""}`),1)]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElDropdown),Z.mergeProps({size:"default",ref_key:"dropdown",ref:d,trigger:"click"},s.$attrs),Z.createSlots({default:Z.withCtx(()=>[Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{ref_key:"input",ref:t,type:e.type,size:"default"},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(n.buttonText)+" ",1),Z.createVNode(Z.unref(v.ElIcon),{class:"el-icon--right"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.ArrowDown))]),_:1})]),_:1},8,["type"])),[[Z.unref(a),i,e.shortcut]])]),_:2},[Z.renderList(s.$slots,(F,h)=>({name:h,fn:Z.withCtx(()=>[Z.renderSlot(s.$slots,h)])}))]),1040)]),_:3},8,["placement","disabled"]))}})),IG=Wl(Z.defineComponent({__name:"JaSwitch",props:{ariaLabel:{},modelValue:{},disabled:{type:Boolean},loading:{type:Boolean},size:{},width:{},inlinePrompt:{type:Boolean},inactiveActionIcon:{},activeActionIcon:{},activeIcon:{},inactiveIcon:{},activeText:{},inactiveText:{},activeValue:{},inactiveValue:{},name:{},validateEvent:{type:Boolean},beforeChange:{type:Function},id:{},tabindex:{}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t,c=e;function F(V){i.removeFieldError(a),Nt(n.formData,a,h.value),s("change",V)}const h=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{h.value=pl(n.formData,a)},{deep:!0});const o=Z.computed(()=>{const{modelValue:V,...W}=c;return W});return l({focus:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.focus)==null?void 0:W.call(V)},blur:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.blur)==null?void 0:W.call(V)},elSwitch:d}),(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElSwitch),Z.mergeProps({ref_key:"input",ref:d,modelValue:h.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>h.value=Q),onChange:F},{...o.value,...V.$attrs}),Z.createSlots({_:2},[Z.renderList(V.$slots,(Q,m)=>({name:m,fn:Z.withCtx(()=>[Z.renderSlot(V.$slots,m)])}))]),1040,["modelValue"]))}})),rC={style:{width:"100%"}},pC=["onClick"],DG=Z.defineComponent({__name:"StringListInput",props:{modelValue:{},size:{}},emits:["update:modelValue","change"],setup(e,{emit:l}){var h;const t=e,d=l;function n(o){i.value.splice(o,1)}function a(){i.value.push({v:""})}const i=Z.ref(((h=t.modelValue)==null?void 0:h.map(o=>({v:o})))??[{v:""}]);let s=!1,c=!1;Z.onBeforeMount(()=>F(t.modelValue));function F(o){if(c){c=!1;return}s=!0,o?(i.value=o.map(V=>({v:V})),i.value.length==0&&i.value.push({v:""})):i.value=[{v:""}]}return Z.watch(()=>t.modelValue,o=>{F(o)}),Z.watch(()=>i.value,()=>{if(s){s=!1;return}c=!0;const o=i.value.map(V=>V.v).filter(V=>V&&V.length>0);d("update:modelValue",o),d("change",o)},{deep:!0}),(o,V)=>(Z.openBlock(),Z.createElementBlock("div",rC,[Z.createVNode(Z.unref(v.ElSpace),{direction:"vertical",style:{"align-items":"stretch",width:"100%"}},{default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(i.value,(W,Q)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElInput),{key:Q,modelValue:W.v,"onUpdate:modelValue":m=>W.v=m,size:e.size},{append:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElTooltip),{content:"删除",placement:"right"},{default:Z.withCtx(()=>{var m;return[Z.withDirectives(Z.createElementVNode("div",{onClick:R=>n(Q),style:{margin:"0 -20px",padding:"0 20px"}},[Z.createVNode(Z.unref(v.ElIcon),null,{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.Minus))]),_:1})],8,pC),[[Z.vShow,Q<(((m=i.value)==null?void 0:m.length)??0)-1]])]}),_:2},1024),Z.createVNode(Z.unref(v.ElTooltip),{content:"添加",placement:"right"},{default:Z.withCtx(()=>{var m;return[Z.withDirectives(Z.createElementVNode("div",{onClick:V[0]||(V[0]=R=>a()),style:{margin:"0 -20px",padding:"0 20px"}},[Z.createVNode(Z.unref(v.ElIcon),null,{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.Plus))]),_:1})],512),[[Z.vShow,Q===(((m=i.value)==null?void 0:m.length)??0)-1]])]}),_:2},1024)]),_:2},1032,["modelValue","onUpdate:modelValue","size"]))),128))]),_:1})]))}}),wG=Wl(Z.defineComponent({__name:"JaStringList",emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d)??[""]);return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)??[""]},{deep:!0}),(c,F)=>(Z.openBlock(),Z.createBlock(DG,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),onChange:i},c.$attrs),null,16,["modelValue"]))}})),EG=Wl(DG),MC={style:{width:"100%"},class:"ja-number-list"},SC={class:"el-input-group__append"},JC={class:"el-input-group__append"},CG=Rt(Z.defineComponent({__name:"NumberListInput",props:{modelValue:{},precision:{},step:{},size:{}},emits:["update:modelValue","change"],setup(e,{emit:l}){var h;const t=e,d=l;function n(o){i.value.splice(o,1)}function a(){i.value.push({v:0})}const i=Z.ref(((h=t.modelValue)==null?void 0:h.map(o=>({v:o})))??[{v:0}]);let s=!1,c=!1;Z.onBeforeMount(()=>F(t.modelValue));function F(o){if(o){if(c){c=!1;return}s=!0,o?(i.value=o.map(V=>({v:V})),i.value.length==0&&i.value.push({v:0})):i.value=[{v:0}]}}return Z.watch(()=>t.modelValue,o=>{F(o)}),Z.watch(()=>i.value,()=>{if(s){s=!1;return}c=!0;const o=i.value.map(V=>V.v);d("update:modelValue",o),d("change",o)},{deep:!0}),(o,V)=>{const W=Z.resolveComponent("el-tooltip");return Z.openBlock(),Z.createElementBlock("div",MC,[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(i.value,(Q,m)=>(Z.openBlock(),Z.createElementBlock("div",{class:"ja-input-box",key:m},[Z.createVNode(Z.unref(v.ElInputNumber),{modelValue:Q.v,"onUpdate:modelValue":R=>Q.v=R,precision:e.precision,size:e.size,step:e.step},null,8,["modelValue","onUpdate:modelValue","precision","size","step"]),Z.createVNode(W,{content:"删除",placement:"right"},{default:Z.withCtx(()=>{var R;return[Z.withDirectives(Z.createElementVNode("div",SC,[Z.createVNode(Z.unref(v.ElButton),{link:"",icon:Z.unref(Nl.Minus),onClick:r=>n(m),size:e.size},null,8,["icon","onClick","size"])],512),[[Z.vShow,m<(((R=i.value)==null?void 0:R.length)??0)-1]])]}),_:2},1024),Z.createVNode(W,{content:"添加",placement:"right"},{default:Z.withCtx(()=>{var R;return[Z.withDirectives(Z.createElementVNode("div",JC,[Z.createVNode(Z.unref(v.ElButton),{onClick:V[0]||(V[0]=r=>a()),size:e.size,link:"",icon:Z.unref(Nl.Plus)},null,8,["size","icon"])],512),[[Z.vShow,m===(((R=i.value)==null?void 0:R.length)??0)-1]])]}),_:2},1024)]))),128))])}}}),[["__scopeId","data-v-a3fae0c2"]]),xG=Wl(Z.defineComponent({__name:"JaNumberList",emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d)??[0]);return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)??[0]},{deep:!0}),(c,F)=>(Z.openBlock(),Z.createBlock(CG,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),onChange:i},c.$attrs),null,16,["modelValue"]))}})),gG=Wl(CG),TC={style:{width:"100%"},class:"ja-enum-list"},GC={class:"el-input-group__append"},XC={class:"el-input-group__append"},jG=Rt(Z.defineComponent({__name:"EnumListInput",props:{modelValue:{},enumValues:{},size:{}},emits:["update:modelValue","change"],setup(e,{emit:l}){var h;const t=e,d=l;function n(o){i.value.splice(o,1)}function a(){i.value.push({v:""})}const i=Z.ref(((h=t.modelValue)==null?void 0:h.map(o=>({v:o})))??[{v:""}]);let s=!1,c=!1;Z.onBeforeMount(()=>F(t.modelValue));function F(o){if(c){c=!1;return}s=!0,i.value=o.map(V=>({v:V})),i.value.length==0&&i.value.push({v:""})}return Z.watch(()=>t.modelValue,o=>{F(o)}),Z.watch(()=>i.value,()=>{if(s){s=!1;return}c=!0;const o=i.value.map(V=>V.v).filter(V=>V&&V.length>0);d("update:modelValue",o),d("change",o)},{deep:!0}),(o,V)=>{const W=Z.resolveComponent("el-option"),Q=Z.resolveComponent("el-tooltip");return Z.openBlock(),Z.createElementBlock("div",TC,[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(i.value,(m,R)=>(Z.openBlock(),Z.createElementBlock("div",{class:"ja-input-box",key:R},[Z.createVNode(Z.unref(v.ElSelect),{modelValue:m.v,"onUpdate:modelValue":r=>m.v=r,size:e.size},{default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(Object.keys(t.enumValues),r=>(Z.openBlock(),Z.createBlock(W,{key:r,label:r,value:t.enumValues[r]},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue","size"]),Z.createVNode(Q,{content:"删除",placement:"right"},{default:Z.withCtx(()=>{var r;return[Z.withDirectives(Z.createElementVNode("div",GC,[Z.createVNode(Z.unref(v.ElButton),{link:"",icon:Z.unref(Nl.Minus),onClick:b=>n(R),size:e.size},null,8,["icon","onClick","size"])],512),[[Z.vShow,R<(((r=i.value)==null?void 0:r.length)??0)-1]])]}),_:2},1024),Z.createVNode(Q,{content:"添加",placement:"right"},{default:Z.withCtx(()=>{var r;return[Z.withDirectives(Z.createElementVNode("div",XC,[Z.createVNode(Z.unref(v.ElButton),{onClick:V[0]||(V[0]=b=>a()),size:e.size,link:"",icon:Z.unref(Nl.Plus)},null,8,["size","icon"])],512),[[Z.vShow,R===(((r=i.value)==null?void 0:r.length)??0)-1]])]}),_:2},1024)]))),128))])}}}),[["__scopeId","data-v-49923459"]]),OG=Wl(Z.defineComponent({__name:"JaEnumList",props:{enumValues:{}},emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d)??[""]);return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)??[""]},{deep:!0}),(c,F)=>(Z.openBlock(),Z.createBlock(jG,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),"enum-values":e.enumValues,onChange:i},c.$attrs),null,16,["modelValue","enum-values"]))}})),vG=Wl(jG),yC={style:{width:"100%"},class:"ja-enum-list"},BC={class:"splitter"},YC={class:"el-input-group__append"},kC={class:"el-input-group__append"},KG=Rt(Z.defineComponent({__name:"MapItemListInput",props:{modelValue:{},enumValues:{},valueType:{default:"String"},size:{}},emits:["update:modelValue","change"],setup(e,{emit:l}){const t=e,d=l;function n(W){var Q;(Q=i.value)==null||Q.splice(W,1)}function a(){var W;(W=i.value)==null||W.push({k:""})}const i=Z.ref([]);let s=!1,c=!1,F=Z.ref(),h=Z.ref({});function o(){switch(console.log("map item value comp type:",t.valueType),t.valueType){case"String":F.value=v.ElInput,h.value={};break;case"Integer":case"Long":F.value=v.ElInputNumber;break;case"Decimal":F.value=v.ElInputNumber,h.value={precision:2,step:.1};break;case"Enum":F.value=v.ElSelect;break;case"Boolean":F.value=v.ElSwitch;break;case"DATE":F.value=v.ElDatePicker,h.value={type:"date"};break;case"TIMESTAMP":F.value=v.ElDatePicker,h.value={type:"datetime"};break}}Z.onBeforeMount(()=>{V(t.modelValue),o()});function V(W){if(c){c=!1;return}if(W){s=!0;const Q=Object.keys(W);i.value=Q.map(m=>({k:m,v:W[m]})),i.value.length==0&&i.value.push({k:""})}else i.value=[{k:""}]}return Z.watch(()=>t.modelValue,W=>{V(W)},{deep:!0}),Z.watch(()=>i.value,()=>{var Q;if(s){s=!1;return}c=!0;const W=(Q=i.value)==null?void 0:Q.filter(m=>m.k&&m.v).reduce((m,R)=>(m[R.k]=R.v,m),{});d("update:modelValue",W),d("change",W)},{deep:!0}),Z.watch(()=>t.valueType,()=>{o()}),(W,Q)=>{const m=Z.resolveComponent("el-text"),R=Z.resolveComponent("el-option"),r=Z.resolveComponent("el-tooltip");return Z.openBlock(),Z.createElementBlock("div",yC,[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(i.value,(b,u)=>(Z.openBlock(),Z.createElementBlock("div",{class:"ja-input-box",key:u},[Z.createVNode(Z.unref(v.ElInput),{modelValue:b.k,"onUpdate:modelValue":J=>b.k=J,size:e.size,placeholder:"键"},null,8,["modelValue","onUpdate:modelValue","size"]),Z.createElementVNode("div",BC,[Z.createVNode(m,null,{default:Z.withCtx(()=>[...Q[1]||(Q[1]=[Z.createTextVNode(":",-1)])]),_:1})]),(Z.openBlock(),Z.createBlock(Z.resolveDynamicComponent(Z.unref(F)),Z.mergeProps({modelValue:b.v,"onUpdate:modelValue":J=>b.v=J,size:e.size,placeholder:"值"},{ref_for:!0},Z.unref(h)),{default:Z.withCtx(()=>[t.valueType=="Enum"?(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,{key:0},Z.renderList(Object.keys(t.enumValues??{}),J=>(Z.openBlock(),Z.createBlock(R,{key:J,label:J,value:t.enumValues?t.enumValues[J]:""},null,8,["label","value"]))),128)):Z.createCommentVNode("",!0)]),_:1},16,["modelValue","onUpdate:modelValue","size"])),Z.createVNode(r,{content:"删除",placement:"right"},{default:Z.withCtx(()=>{var J;return[Z.withDirectives(Z.createElementVNode("div",YC,[Z.createVNode(Z.unref(v.ElButton),{link:"",icon:Z.unref(Nl.Minus),onClick:G=>n(u),size:e.size},null,8,["icon","onClick","size"])],512),[[Z.vShow,u<(((J=i.value)==null?void 0:J.length)??0)-1]])]}),_:2},1024),Z.createVNode(r,{content:"添加",placement:"right"},{default:Z.withCtx(()=>{var J;return[Z.withDirectives(Z.createElementVNode("div",kC,[Z.createVNode(Z.unref(v.ElButton),{onClick:Q[0]||(Q[0]=G=>a()),size:e.size,link:"",icon:Z.unref(Nl.Plus)},null,8,["size","icon"])],512),[[Z.vShow,u===(((J=i.value)==null?void 0:J.length)??0)-1]])]}),_:2},1024)]))),128))])}}}),[["__scopeId","data-v-bebb510c"]]),fG=Wl(Z.defineComponent({__name:"JaMapItemList",emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d)??{"":""});return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)??{"":""}}),(c,F)=>(Z.openBlock(),Z.createBlock(KG,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),onChange:i},c.$attrs),null,16,["modelValue"]))}})),HG=Wl(KG);function zC(e,l){return{...e,label:typeof l=="string"&&typeof e[l]=="string"?e[l]:"",children:[]}}function es(e,l){const t={},d=[];for(let n=0;n<e.length;n++){const a=e[n],i=zC(a,l);t[a.id]=i,a.parentId?t[a.parentId].children.push(i):d.push(i)}return d}const Yb="-1",PG="-100",AG=Wl(Z.defineComponent({__name:"DepartmentPicker",props:Z.mergeModels({realmId:{},modelValue:{},size:{default:"default"},showNodeAll:{type:Boolean,default:!1},allId:{default:Yb},multiple:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:Z.mergeModels(["change"],["update:modelValue"]),setup(e,{emit:l}){const t=$.createAxiosWithoutCache(),d=$.useDepartmentApi(t),n=e,a=l,i=Z.useModel(e,"modelValue");if(n.multiple&&!Array.isArray(i.value))throw new Error("部门选择器设置multiple为true,但是绑定的v-model值是单值");if(!n.multiple&&Array.isArray(i.value))throw new Error("部门选择器未设置multiple为true,但是绑定的v-model值是数组");const s=Z.reactive({department:[]}),c=()=>{n.realmId&&d.getNormal(n.realmId??"0",$.FromDeptSelect.BAT).then(h=>{s.department=[...es(h,"name")],n.showNodeAll&&s.department.unshift({label:"所有部门",id:n.allId,children:[],hasChildren:!1,sortIndex:0,sortPath:"",dataVersion:0,disabled:!0})})},F=h=>{a("change",Array.isArray(h)?s.department.filter(o=>h.findIndex(V=>o.id===V)>=0):s.department.find(o=>o.id===h))};return c(),Z.watch(()=>n.realmId,()=>{c()}),(h,o)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTreeSelect),Z.mergeProps({style:{width:"100%"},data:s.department,size:n.size,"node-key":"id","check-strictly":"","current-node-key":i.value,"highlight-current":"",modelValue:i.value,"onUpdate:modelValue":o[0]||(o[0]=V=>i.value=V),multiple:e.multiple,onChange:F},h.$attrs,{"collapse-tags":"","collapse-tags-tooltip":"","tag-type":"info",teleported:""}),null,16,["data","size","current-node-key","modelValue","multiple"]))}})),_G=Z.ref(Date.now());function qG(){_G.value=Date.now()}function kb(){return _G}const zb=`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1280.000000pt' height='1248.000000pt' viewBox='-384 -374 2048 2048' preserveAspectRatio='xMidYMid meet'%3E%3Cg transform='translate(0.000000,1248.000000) scale(0.100000,-0.100000)'
412
412
  fill='%23fff' stroke='none'%3E%3Cpath d='M6005 12474 c-22 -2 -89 -9 -149 -14 -542 -53 -1087 -253 -1556 -571
413
413
  -1089 -738 -1659 -2029 -1470 -3331 117 -802 507 -1518 1129 -2075 454 -406
414
414
  1057 -697 1666 -802 220 -39 317 -46 595 -46 278 0 375 7 595 46 1218 211
@@ -421,4 +421,4 @@ c-58 -10 -181 -38 -275 -61 -807 -204 -1528 -616 -2120 -1210 -726 -728 -1170
421
421
  19 4525 19 4730 0 495 -47 873 -112 1690 -291 697 -153 961 -197 1230 -208
422
422
  254 -10 438 21 605 103 172 84 315 254 390 463 74 203 108 420 117 736 34
423
423
  1230 -451 2439 -1332 3320 -707 707 -1608 1156 -2597 1294 -206 29 -201 30
424
- -283 -33z'/%3E%3C/g%3E%3C/svg%3E`,xW=Wl(Rt(Z.defineComponent({__name:"JaAvatar",props:{userId:{},username:{},realm:{},doNotLoadAvatar:{type:Boolean,default:!1},hasAvatar:{type:Boolean},firstName:{},size:{},shape:{},icon:{},src:{},alt:{},srcSet:{},fit:{}},setup(e){const l=e,t=kb(),d=Z.ref(!1),n=Z.ref(),a=Z.ref();d.value=!0,Z.onMounted(async()=>{await Z.nextTick()});const i=Z.computed(()=>{if(!(d.value&&l.hasAvatar&&!l.doNotLoadAvatar))return l.firstName?"":zb;if(l.userId&&l.userId.length>0){const F="/ace-app-service/avatar/"+l.userId;return window.appDescriptor.env.isDevMode()?new URL("/ace"+F,location.origin).toString()+"?t="+t.value.toString():new URL(F,location.origin).toString()+"?t="+t.value.toString()}if(l.realm&&l.realm.length>0&&l.username&&l.username.length>0){const F="/ace-app-service/avatar/"+l.realm+"/"+l.username;return window.appDescriptor.env.isDevMode()?new URL("/ace"+F,location.origin).toString()+"?t="+t.value.toString():new URL(F,location.origin).toString()+"?t="+t.value.toString()}return l.firstName?"":zb});function s(F){var V;if(!F)return;let o=((V=n.value)==null?void 0:V.$el.clientWidth)/2.8;F.style.fontSize=o+"px"}Z.onUnmounted(()=>{}),Z.watch(a,()=>s(a.value));const c=Z.computed(()=>{const{userId:F,username:h,realm:o,doNotLoadAvatar:V,hasAvatar:W,firstName:Q,...m}=l;return m});return(F,h)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElAvatar),Z.mergeProps({src:i.value},{...c.value,...F.$attrs},{ref_key:"avatar",ref:n,class:"ja-avatar"}),{default:Z.withCtx(()=>[l.firstName&&l.firstName.length>0?(Z.openBlock(),Z.createElementBlock("span",{key:0,class:"user-name-avatar",ref_key:"usernameSpan",ref:a},Z.toDisplayString(e.firstName),513)):(Z.openBlock(),Z.createBlock(Z.unref(v.ElImage),{key:1,style:{height:"100%"},src:Z.unref(zb),alt:"用户头像"},null,8,["src"]))]),_:1},16,["src"]))}}),[["__scopeId","data-v-0a2b65e1"]]));let Lb;function LC(){return Lb||(Lb=$.createAxiosWithoutCache()),Lb}const IC={class:"portrait"},DC={class:"user-info"},wC={class:"dropdown"},EC={class:"header"},CC={class:"tools"},xC={style:{margin:"0","font-weight":"600"}},gC={style:{margin:"0","font-size":"14px",color:"var(--el-color-info-light-3)"}},jC={style:{margin:"0"}},r0=Wl(Rt(Z.defineComponent({__name:"UserInfoTag",props:{closable:{type:Boolean,default:!1},userId:{},fullName:{default:"无名氏"},realm:{},username:{},theme:{default:"skyGray"},hasAvatar:{type:Boolean},placement:{default:"bottom"}},emits:["closed"],setup(e,{emit:l}){const t={primary:"user-info-tag--root theme-primary",success:"user-info-tag--root theme-success",warning:"user-info-tag--root theme-warning",danger:"user-info-tag--root theme-danger",info:"user-info-tag--root theme-info",lotusPink:"user-info-tag--root theme-lotus-pink",wineRed:"user-info-tag--root theme-wine-red",autumnOrange:"user-info-tag--root theme-autumn-orange",sunYellow:"user-info-tag--root theme-sun-yellow",seaBlue:"user-info-tag--root theme-sea-blue",moonlightBlue:"user-info-tag--root theme-moonlight-blue",clovePurple:"user-info-tag--root theme-clove-purple",skyGray:"user-info-tag--root theme-sky-gray"},d=e,n=Z.ref();let a=LC(),i=$.useLoading(a),s=$.useUserApi(a);const c=Z.ref(!1),F=Z.ref(!1),h=l;Z.onUnmounted(()=>{a=void 0,i=void 0,s=void 0});function o(){if(!n.value)if(d.userId)s==null||s.getById(d.userId).then(R=>{n.value=R,V()});else if(d.username&&d.realm){let R=d.username;if(R.indexOf("\\")>=0){const r=R.split("\\");R=r[r.length-1]}s==null||s.getByUserName(d.realm,R).then(r=>{n.value=r,V()})}else throw new Error("user-info-tag组件的userId和(realm, userName)属性不能都为空")}function V(){n.value&&(s==null||s.checkBookmarked(n.value.id).then(R=>c.value=R))}function W(){F.value=!1,h("closed",d.userId,d.realm,d.username)}function Q(){n.value&&(s==null||s.bookmarkUser(n.value.id).then(()=>c.value=!0))}function m(){n.value&&(s==null||s.unbookmarkUser(n.value.id).then(()=>c.value=!1))}return(R,r)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElPopover),{width:"auto","hide-after":200,onBeforeEnter:o,placement:e.placement,visible:F.value,"onUpdate:visible":r[3]||(r[3]=b=>F.value=b)},{reference:Z.withCtx(()=>[Z.createElementVNode("div",{class:Z.normalizeClass(t[d.theme])},[Z.createElementVNode("div",IC,[Z.createVNode(Z.unref(xW),{size:24,"user-id":e.userId,realm:e.realm,username:e.username,"has-avatar":!1},null,8,["user-id","realm","username"])]),Z.createElementVNode("div",DC,[Z.createTextVNode(Z.toDisplayString(e.fullName)+" ",1),e.closable?(Z.openBlock(),Z.createElementBlock("div",{key:0,class:"close-btn",onClick:r[0]||(r[0]=b=>W())},[Z.createVNode(Z.unref(v.ElIcon),{size:10},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.Close))]),_:1})])):Z.createCommentVNode("",!0)])],2)]),default:Z.withCtx(()=>{var b,u,J,G,T,y,k;return[Z.withDirectives((Z.openBlock(),Z.createElementBlock("div",wC,[Z.createElementVNode("div",EC,[Z.createVNode(Z.unref(xW),{"user-id":e.userId,realm:e.realm,username:e.username,size:75,"has-avatar":(b=n.value)==null?void 0:b.hasAvatar,style:{"margin-bottom":"8px"}},null,8,["user-id","realm","username","has-avatar"]),Z.createElementVNode("div",CC,[Z.createVNode(Z.unref(v.ElTooltip),{content:c.value?"取消常用人员":"设置为常用人员"},{default:Z.withCtx(()=>[c.value?(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:1,color:"#FFBF29",onClick:r[2]||(r[2]=X=>m()),size:16},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.StarFilled))]),_:1})):(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:0,onClick:r[1]||(r[1]=X=>Q()),size:16},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.Star))]),_:1}))]),_:1},8,["content"])])]),Z.createElementVNode("div",null,[Z.createElementVNode("p",xC,Z.toDisplayString(e.fullName),1),Z.createElementVNode("p",gC," @"+Z.toDisplayString(((J=(u=n.value)==null?void 0:u.department)==null?void 0:J.name)??"无归属部门"),1)]),Z.createElementVNode("p",jC,[r[4]||(r[4]=Z.createElementVNode("span",{class:"label"},"手机:",-1)),Z.createTextVNode(" "+Z.toDisplayString(!((G=n.value)!=null&&G.mobile)||n.value.mobile.length===0?"(未填写手机号)":(T=n.value)==null?void 0:T.mobile)+" ",1),r[5]||(r[5]=Z.createElementVNode("br",null,null,-1)),r[6]||(r[6]=Z.createElementVNode("span",{class:"label"},"邮箱:",-1)),Z.createTextVNode(" "+Z.toDisplayString(!((y=n.value)!=null&&y.email)||n.value.email.length===0?"(未填写邮箱号)":(k=n.value)==null?void 0:k.email),1)])])),[[Z.vShow,F.value],[Z.unref(v.vLoading),!!Z.unref(i)]])]}),_:1},8,["placement","visible"]))}}),[["__scopeId","data-v-51ad1216"]]));function gW(e){var l=typeof e;return e!=null&&(l=="object"||l=="function")}var OC=typeof global=="object"&&global&&global.Object===Object&&global,vC=typeof self=="object"&&self&&self.Object===Object&&self,$G=OC||vC||Function("return this")(),Ib=function(){return $G.Date.now()},KC=/\s/;function fC(e){for(var l=e.length;l--&&KC.test(e.charAt(l)););return l}var HC=/^\s+/;function lX(e){return e&&e.slice(0,fC(e)+1).replace(HC,"")}var ZU=$G.Symbol,tX=Object.prototype,PC=tX.hasOwnProperty,AC=tX.toString,p0=ZU?ZU.toStringTag:void 0;function _C(e){var l=PC.call(e,p0),t=e[p0];try{e[p0]=void 0;var d=!0}catch{}var n=AC.call(e);return d&&(l?e[p0]=t:delete e[p0]),n}var qC=Object.prototype,$C=qC.toString;function l9(e){return $C.call(e)}var t9="[object Null]",e9="[object Undefined]",eX=ZU?ZU.toStringTag:void 0;function d9(e){return e==null?e===void 0?e9:t9:eX&&eX in Object(e)?_C(e):l9(e)}function n9(e){return e!=null&&typeof e=="object"}var a9="[object Symbol]";function dX(e){return typeof e=="symbol"||n9(e)&&d9(e)==a9}var nX=NaN,i9=/^[-+]0x[0-9a-f]+$/i,s9=/^0b[01]+$/i,c9=/^0o[0-7]+$/i,U9=parseInt;function aX(e){if(typeof e=="number")return e;if(dX(e))return nX;if(gW(e)){var l=typeof e.valueOf=="function"?e.valueOf():e;e=gW(l)?l+"":l}if(typeof e!="string")return e===0?e:+e;e=lX(e);var t=s9.test(e);return t||c9.test(e)?U9(e.slice(2),t?2:8):i9.test(e)?nX:+e}var Z9="Expected a function",F9=Math.max,h9=Math.min;function Db(e,l,t){var d,n,a,i,s,c,F=0,h=!1,o=!1,V=!0;if(typeof e!="function")throw new TypeError(Z9);l=aX(l)||0,gW(t)&&(h=!!t.leading,o="maxWait"in t,a=o?F9(aX(t.maxWait)||0,l):a,V="trailing"in t?!!t.trailing:V);function W(T){var y=d,k=n;return d=n=void 0,F=T,i=e.apply(k,y),i}function Q(T){return F=T,s=setTimeout(r,l),h?W(T):i}function m(T){var y=T-c,k=T-F,X=l-y;return o?h9(X,a-k):X}function R(T){var y=T-c,k=T-F;return c===void 0||y>=l||y<0||o&&k>=a}function r(){var T=Ib();if(R(T))return b(T);s=setTimeout(r,m(T))}function b(T){return s=void 0,V&&d?W(T):(d=n=void 0,i)}function u(){s!==void 0&&clearTimeout(s),F=0,d=c=n=s=void 0}function J(){return s===void 0?i:b(Ib())}function G(){var T=Ib(),y=R(T);if(d=arguments,n=this,c=T,y){if(s===void 0)return Q(c);if(o)return clearTimeout(s),s=setTimeout(r,l),W(c)}return s===void 0&&(s=setTimeout(r,l)),i}return G.cancel=u,G.flush=J,G}const jW=Z.ref([]);function OW(){const e=$.useRealmApi(),l=async()=>{if(jW.value.length!==0)return;const d={};jW.value=await e.getAll(d)};return{realms:jW,getAllRealms:l,getDefaultRealm:async()=>(await l(),jW.value.find(d=>d.name==="ace-platform"))}}function wb(e,l,t,d,n,a){const i=Z.ref({}),s=Z.ref({currentPage:1,pageSize:50}),c=Z.ref({total:0,users:[]});n||(n=$.createAxiosWithoutCache());const F=$.useUserApi(n),h=$.useLoading(n),o=Z.ref(!1);function V(){m().then(R=>{t&&t(R,o.value),o.value=!1})}const W=Db(V,300);function Q(){c.value.total=0,c.value.users=[],s.value.currentPage!==1?s.value.currentPage=1:W()}Z.watch(i,()=>{o.value=!0,Q()},{deep:!0}),Z.watch(()=>s.value.pageSize,()=>{o.value=!0,Q()}),Z.watch(()=>s.value.currentPage,()=>{m().then(R=>{t&&t(R,o.value),o.value=!1})});async function m(){if(e&&!e())return Promise.resolve(void 0);if(!i.value.realmId){const X=await OW().getDefaultRealm();i.value.realmId=X.id}const R=$.useUserQueryBuilder(),r=R.getQEntity();R.and(r.realm.id.eq(i.value.realmId)).and(r.recycled.eq(!1));const b=i.value.currentDept;b&&(b.id==PG?R.and(r.department.isNull()):b.id!==Yb&&R.and(r.department.sortPath.startWith(b.sortPath)));const u=i.value.classificationLevel;u&&R.and(r.classifiedLevel.loe(u));const J=i.value.currentGroup;J&&R.and(r.userGroups.any().group.sortPath.startWith(J.sortPath));const G=i.value.currentCustomGroup;G&&R.and(r.customGroups.any().customGroup.sortPath.startWith(G.sortPath));const T=i.value.name;if(T){const X="%"+T.split("").join("%")+"%";R.and(r.username.like(X).or(r.fullName.like(X)).or(r.pinYinName.like(X)).or(r.mobile.like(X)))}l&&R.and(l(r));const y=i.value.currentSort;y&&R.orderBy(y);const k=R.build();if(a)return F.queryUserRefs(k).then(X=>(c.value.users=X,X));{const X=s.value.currentPage-1;return F.queryUserRefsPaged(k,X,s.value.pageSize).then(L=>(d&&X>0?c.value.users.push(...L.content):c.value.users=L.content,c.value.total=L.totalElements,L.content))}}return{queryParams:i,pageParams:s,queryResult:c,queryUsers:m,loading:h}}const Eb=Wl(Rt(Z.defineComponent({__name:"departmentTree",props:Z.mergeModels({realmId:{},showNoDepartment:{type:Boolean,default:!1},multiple:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:Z.mergeModels(["change","loaded"],["update:modelValue"]),setup(e,{expose:l,emit:t}){const d=Z.ref(),n=$.createAxiosWithoutCache(),a=$.useLoading(n),i=$.useDepartmentApi(n),s=e,c=t,F=Z.useModel(e,"modelValue"),h=Z.computed({get(){var Q;return(Q=F.value)==null?void 0:Q.id},set(Q){F.value=o.departments.find(m=>m.id===Q)??null}}),o=Z.shallowReactive({departments:[]}),V=async()=>{if(!s.realmId)return;const Q=await i.getNormal(s.realmId,$.FromDeptSelect.BT);o.departments=[{id:Yb,label:"所有部门",name:"所有部门",shortCode:"",children:[],hasChildren:!1,sortIndex:-1,sortPath:"",dataVersion:0,entity:!1,attributes:{}},...s.showNoDepartment?[{id:PG,label:"无归属部门",name:"无归属部门",shortCode:"",children:[],hasChildren:!1,sortIndex:-100,sortPath:"no_dept",dataVersion:0,entity:!1,attributes:{}}]:[],...es(Q,"name")],h.value=o.departments[0].id,c("loaded",o.departments)},W=Q=>{F.value=Q,c("change",Q)};return Z.watch(()=>s.realmId,()=>{V()}),l({reload:V}),V(),(Q,m)=>Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElTree),{ref_key:"deptTree",ref:d,data:Z.unref(o).departments,size:"default","node-key":"id","default-expand-all":"","highlight-current":"","current-node-key":h.value,"expand-on-click-node":!1,onCurrentChange:W,props:{class:R=>{var r;return((r=F.value)==null?void 0:r.id)===R.id?"selected-group":"group"}}},null,8,["data","current-node-key","props"])),[[Z.unref(v.vLoading),Z.unref(a)]])}}),[["__scopeId","data-v-b247a32f"]])),Cb="com.csicit.ace.scrollbar.wrapped";var o9="Expected a function";function M0(e,l,t){var d=!0,n=!0;if(typeof e!="function")throw new TypeError(o9);return gW(t)&&(d="leading"in t?!!t.leading:d,n="trailing"in t?!!t.trailing:n),Db(e,l,{leading:d,maxWait:l,trailing:n})}const Xn=new Map,xb=new Map;let Hl=null,Ll;async function FU(e,l){let t=Xn.get(l);if(t)return t;let d=xb.get(l);return d?await d:(d=e().then(n=>(Xn.set(l,n),n)).finally(()=>{xb.delete(l)}),xb.set(l,d),await d)}async function iX(e){Ll||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl));const l=await FU(()=>Ll.getAll(!0),"all");return e?l:l.filter(t=>t.name!=="ace-app-manage")}async function V9(e){Ll||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl)),await FU(()=>Ll.getAll(!0),"all");let l=Xn.get("all").find(t=>t.id===e);return l||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl),l=await Ll.getById(e),l&&(Xn.get("all").find(t=>t.id===l.id)||Xn.get("all").push(l))),l}async function W9(e){Ll||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl)),await FU(()=>Ll.getAll(!0),"all");let l=Xn.get("all").find(t=>t.name===e);return l||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl),l=await Ll.getByName(e),l&&(Xn.get("all").find(t=>t.id===l.id)||Xn.get("all").push(l))),l}async function sX(){return Ll||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl)),await FU(Ll.getManageable,"manageable")}async function cX(){return Ll||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl)),await FU(Ll.getAccessible,"accessible")}async function UX(){return Ll||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl)),(await FU(()=>Ll.getGlobalApp().then(e=>[e]),"global"))[0]}async function Q9(){Xn.clear(),await Promise.all([iX(),sX(),cX(),UX()])}function hU(){return{getAll:iX,getByName:W9,getById:V9,getManageable:sX,getAccessible:cX,getGlobal:UX,refresh:Q9}}const S0=new Map;let oU=new Map;function ZX(e,l,t,d){return e+":"+l+":"+(t??"")+":"+(d?"all":"by-category")}function FX(){return{refreshGroupsCache(){S0.clear()},async getGroups(e,l,t,d){const n=ZX(e,l,t,d);let a=S0.get(n);if(a)return a;let i=oU.get(n);if(i)return await i;const s=$.createAxiosWithoutCache(),c=$.useUserGroupApi(s);return d?i=c.getAll(e,l):i=c.getByAppIdAndRealm(e,l,t),i=i.then(F=>(S0.set(n,F),F)).finally(()=>{oU.delete(n)}),oU.set(n,i),await i},async getGlobalGroups(e,l){const d=ZX("[global-app]",e,l,!0);let n=S0.get(d);if(n)return n;let a=oU.get(d);if(a)return await a;const i=$.createAxiosWithoutCache();return a=$.useUserGroupApi(i).getGlobalGroups(e,l).then(c=>(S0.set(d,c),c)).finally(()=>{oU.delete(d)}),oU.set(d,a),await a}}}const m9={class:"ja-user-group-tree"},R9={class:"name"},gb=Wl(Rt(Z.defineComponent({__name:"userGroupTree",props:Z.mergeModels({realmId:{},multiple:{type:Boolean},showConsoleApp:{type:Boolean},appId:{},nodeHeight:{default:"auto"},category:{},global:{type:Boolean},showAllCategory:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:Z.mergeModels(["change","loaded"],["update:modelValue"]),async setup(e,{expose:l,emit:t}){let d,n;const a=Z.ref(),i=$.createAxiosWithoutCache(),s=$.useLoading(i),c=e,F=t,h=Z.useModel(e,"modelValue"),o=Z.ref(c.appId),V=Z.computed({get(){var y;return(y=h.value)==null?void 0:y.id},set(y){h.value=J.groups.find(k=>k.id===y)??null}}),{getGlobal:W,getAccessible:Q}=hU(),{getGroups:m,getGlobalGroups:R}=FX();let[r,b]=([d,n]=Z.withAsyncContext(()=>Promise.all([W(),Q()])),d=await d,n(),d);if(b=[...b],b.unshift(r),!c.showConsoleApp){const y=b.findIndex(k=>k.name=="ace-app-manage");y>=0&&b.splice(y,1)}const u=Z.ref(b);o.value||(o.value=r.id);const J=Z.shallowReactive({groups:[]}),G=async()=>{if(!c.realmId||!o.value)return;let y;c.global?y=await R(c.realmId):y=await m(o.value,c.realmId,c.category,c.showAllCategory),J.groups=[...es(y,"name")],!h.value&&J.groups.length>0&&(V.value=J.groups[0].id),F("loaded",J.groups)},T=y=>{h.value=y,F("change",y)};return Z.watch(()=>({appId:c.appId,realmId:c.realmId,category:c.category}),()=>{G()},{deep:!0,immediate:!0}),Z.watch(()=>c.appId,()=>{o.value=c.appId}),l({reload:G,elTree:a}),(y,k)=>(Z.openBlock(),Z.createElementBlock("div",m9,[c.appId?Z.createCommentVNode("",!0):(Z.openBlock(),Z.createBlock(Z.unref(v.ElSelect),{key:0,modelValue:o.value,"onUpdate:modelValue":k[0]||(k[0]=X=>o.value=X),style:{width:"100%"}},{default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(u.value,X=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElOption),{key:X.id,label:X.caption,value:X.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])),Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElTree),Z.mergeProps({style:{width:"100%","--ja-group-tree-node-height":c.nodeHeight},ref_key:"groupTree",ref:a,data:Z.unref(J).groups,size:"default","node-key":"id","highlight-current":"","default-expand-all":"","current-node-key":V.value,"expand-on-click-node":!1},y.$attrs,{onCurrentChange:T,props:{class:X=>{var L;return((L=h.value)==null?void 0:L.id)===X.id?"selected-group":"group"}}}),{default:Z.withCtx(({data:X})=>[Z.createElementVNode("div",null,[Z.createElementVNode("div",R9,[Z.createTextVNode(Z.toDisplayString(X.label)+" ",1),X.resourceScoped?(Z.openBlock(),Z.createBlock(Z.unref(v.ElTag),{key:0,type:"info"},{default:Z.withCtx(()=>[...k[1]||(k[1]=[Z.createTextVNode("资源域",-1)])]),_:1})):Z.createCommentVNode("",!0)])])]),_:1},16,["style","data","current-node-key","props"])),[[Z.unref(v.vLoading),Z.unref(s)]])]))}}),[["__scopeId","data-v-029d0f4c"]])),N9=Wl(Rt(Z.defineComponent({__name:"customGroupTree",props:Z.mergeModels({multiple:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:Z.mergeModels(["change","loaded"],["update:modelValue"]),setup(e,{expose:l,emit:t}){const d=Z.ref(),n=$.createAxiosWithoutCache(),a=$.useLoading(n),i=$.useCustomGroupApi(n),s=t,c=Z.useModel(e,"modelValue"),F=Z.computed({get(){var W;return(W=c.value)==null?void 0:W.id},set(W){c.value=h.groups.find(Q=>Q.id===W)??null}}),h=Z.shallowReactive({groups:[]}),o=async()=>{const W=await i.getAll();h.groups=[...es(W,"name")],h.groups.length>0&&(c.value=h.groups[0],F.value=c.value.id),s("loaded",h.groups)},V=W=>{c.value=W,s("change",W)};return l({reload:o}),o(),(W,Q)=>Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElTree),{ref_key:"deptTree",ref:d,data:Z.unref(h).groups,size:"default","node-key":"id","default-expand-all":"","highlight-current":"","current-node-key":F.value,"expand-on-click-node":!1,onCurrentChange:V,props:{class:m=>{var R;return((R=c.value)==null?void 0:R.id)===m.id?"selected-group":"group"}}},null,8,["data","current-node-key","props"])),[[Z.unref(v.vLoading),Z.unref(a)]])}}),[["__scopeId","data-v-4e04bc5c"]])),b9={class:"ja-user-select-dialog"},u9={class:"ja-user-select-dialog__content"},r9={style:{display:"flex","flex-direction":"row","align-content":"baseline",width:"100%",gap:"0"}},jb=Wl(Rt(Z.defineComponent({__name:"userSelectDialog",props:Z.mergeModels({realmId:{type:String,required:!1},multiple:{type:Boolean,required:!1,default:!1},classificationLevel:{type:Number,required:!1,default:0},customFilter:{type:Function,required:!1},maxSelect:{type:Number,required:!1,default:0}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e,{expose:l}){const t=e,d=Z.useModel(e,"modelValue"),n=Z.ref();async function a(){if(t.realmId)n.value=t.realmId;else{const f=await OW().getDefaultRealm();n.value=f.id}}if(a(),t.multiple){if(d.value||(d.value=[]),!Array.isArray(d.value))throw new Error("多选模式的选择用户对话框(multiple设置为true)的v-model必须是数组类型")}else if(Array.isArray(d.value))throw new Error("单选模式的选择用户对话框(multiple设置为false)的v-model只能为空或是单个UserReference对象");const i=Z.ref(!1),s=Z.ref(),c=Z.ref(),F=Z.ref(),h=$.createAxiosWithoutCache(),o=$.useLoading(h),V=Z.ref(!1),W=Z.ref([]),Q=Z.reactive(new Map),m=Z.ref("dept");Z.provide(Cb,void 0);const R=Z.ref(Array.isArray(d.value)?[...d.value]:d.value),r=wb(void 0,t.customFilter,f=>{V.value||(W.value=f??[])},!1,h,!0),b=[{key:"user",dataKey:"id",width:290,title:"用户",cellRenderer:({cellData:f,rowData:x,rowIndex:A})=>{const{hasAvatar:al,fullName:_}=x,K=x,tl=A;return Z.h("div",{class:"user-row",onMousedown:()=>Y(K),onMouseenter:()=>z(K),onMouseup:B,onMouseover:el=>O(el,tl)},[Z.h(v.ElIcon,{color:"#0D6A9F"},()=>y(K)?Z.h(Nl.Check):void 0),Z.h(r0,{userId:f,theme:k(K),placement:"right-start",hasAvatar:!1,fullName:_}),Z.h("div",{style:"flex:auto"})])}}],u=Z.ref(!1),J=Z.ref(),G=M0(w,100),T=M0(X,100);Z.watch(s,()=>{m.value=="dept"&&(r.queryParams.value.currentDept=s.value)}),Z.watch(c,()=>{m.value=="group"&&(r.queryParams.value.currentGroup=c.value)}),Z.watch(F,()=>{m.value=="customGroup"&&(r.queryParams.value.currentCustomGroup=F.value)}),Z.watch(()=>t.classificationLevel,()=>{r.queryParams.value.classificationLevel=t.classificationLevel}),Z.watch(m,()=>{m.value==="dept"?(r.queryParams.value.currentDept=s.value,r.queryParams.value.currentGroup=void 0,r.queryParams.value.currentCustomGroup=void 0):m.value==="group"?(r.queryParams.value.currentDept=void 0,r.queryParams.value.currentCustomGroup=void 0,r.queryParams.value.currentGroup=c.value):m.value==="customGroup"&&(r.queryParams.value.currentDept=void 0,r.queryParams.value.currentCustomGroup=F.value,r.queryParams.value.currentGroup=void 0)});function y(f){return Array.isArray(R.value)?Q.has(f.id):R.value&&R.value.id===f.id}function k(f){return y(f)?"autumnOrange":"skyGray"}function X(f){if(Array.isArray(R.value)){const x=R.value.findIndex(A=>A.id===f.id);if(x>=0)Q.delete(f.id),R.value.splice(x,1);else{if(t.maxSelect>0&&R.value.length>=t.maxSelect){v.ElMessage({message:`已超过最大选择数量 ${t.maxSelect}`,type:"warning",plain:!0});return}Q.set(f.id,f),R.value.push(f)}}else R.value=f}Z.onUnmounted(()=>{G.cancel(),T.cancel()});function L(){if(Array.isArray(R.value)){const f=r.queryResult.value.users.filter(x=>!y(x));if(t.maxSelect>0){const x=t.maxSelect-R.value.length;if(x>0){const A=f.slice(0,x);A.forEach(al=>Q.set(al.id,al)),R.value.push(...A)}}else f.forEach(x=>Q.set(x.id,x)),R.value.push(...f)}}function D(){Array.isArray(R.value)&&(Q.clear(),R.value.splice(0))}function C(){if(Array.isArray(R.value)){const f=r.queryResult.value.users.filter(x=>!y(x));if(Q.clear(),t.maxSelect>0){const x=f.slice(0,t.maxSelect);x.forEach(A=>Q.set(A.id,A)),R.value.splice(0),R.value.push(...x)}else f.forEach(x=>Q.set(x.id,x)),R.value.splice(0),R.value.push(...f)}}function I(){if(t.multiple&&Array.isArray(R.value)&&t.maxSelect>0&&R.value.length>t.maxSelect){v.ElMessage({message:`已超过最大选择数量 ${t.maxSelect}`,type:"warning",plain:!0});return}d.value=R.value,i.value=!1}function P(){V.value=!V.value,V.value?Array.isArray(R.value)?W.value=[...R.value]:W.value=R.value?[R.value]:[]:W.value=r.queryResult.value.users}function H(){!r.queryParams.value.realmId&&n.value&&(r.queryParams.value.realmId=n.value),R.value=Array.isArray(d.value)?[...d.value]:d.value,Array.isArray(d.value)&&(Q.clear(),d.value.forEach(f=>Q.set(f.id,f)))}function Y(f){X(f),u.value=!0}function B(){u.value=!1}function z(f){u.value&&X(f)}let g;function w(){g&&g<W.value.length&&J.value.scrollToRow(g+1),g=void 0}function O(f,x){u.value=f.buttons>0,u.value&&(g=x,G())}return l({show(){i.value=!0}}),(f,x)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElDialog),{modelValue:i.value,"onUpdate:modelValue":x[5]||(x[5]=A=>i.value=A),"destroy-on-close":"",draggable:"",width:"640",title:"选择人员","append-to-body":"",onOpen:H},{footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{type:"primary",shortcut:"Ctrl+Alt+Enter",onClick:I,size:"default"},{default:Z.withCtx(()=>[...x[10]||(x[10]=[Z.createTextVNode("确定 ",-1)])]),_:1}),Z.createVNode(Z.unref(v.ElButton),{plain:"",size:"default",onClick:x[4]||(x[4]=A=>i.value=!1)},{default:Z.withCtx(()=>[...x[11]||(x[11]=[Z.createTextVNode("取消",-1)])]),_:1})]),default:Z.withCtx(()=>[Z.createElementVNode("div",b9,[Z.createVNode(Z.unref(v.ElTabs),{class:"ja-user-select-dialog__left",modelValue:m.value,"onUpdate:modelValue":x[3]||(x[3]=A=>m.value=A)},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElTabPane),{name:"dept",label:"按部门",class:"ja-user-select-dialog__left-dept-pane"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElScrollbar),{height:"400"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Eb),{modelValue:s.value,"onUpdate:modelValue":x[0]||(x[0]=A=>s.value=A),"realm-id":n.value},null,8,["modelValue","realm-id"])]),_:1})]),_:1}),Z.createVNode(Z.unref(v.ElTabPane),{name:"group",label:"按用户组"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElScrollbar),{height:"400"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(gb),{modelValue:c.value,"onUpdate:modelValue":x[1]||(x[1]=A=>c.value=A),"show-all-category":"","realm-id":n.value},null,8,["modelValue","realm-id"])]),_:1})]),_:1}),Z.createVNode(Z.unref(v.ElTabPane),{name:"customGroup",label:"按自定义组"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElScrollbar),{height:"400"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(N9),{modelValue:F.value,"onUpdate:modelValue":x[2]||(x[2]=A=>F.value=A)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),Z.createElementVNode("div",u9,[Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElTableV2),{ref_key:"userTable",ref:J,"row-height":40,"header-height":40,columns:b,data:W.value,width:300,height:450,fixed:""},{header:Z.withCtx(()=>[Z.createElementVNode("div",r9,[Z.createVNode(Z.unref(v.ElText),{style:{flex:"auto","font-weight":"600"}},{default:Z.withCtx(()=>[x[6]||(x[6]=Z.createTextVNode(" 人员 ",-1)),Z.createVNode(Z.unref(v.ElTooltip),{content:"切换筛选条件,不会清除已选人员。支持鼠标拖动多选。"},{default:Z.withCtx(()=>[t.multiple?(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:0},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.QuestionFilled))]),_:1})):Z.createCommentVNode("",!0)]),_:1})]),_:1}),t.multiple?(Z.openBlock(),Z.createBlock(Z.unref(v.ElText),{key:0,style:{flex:"none","margin-right":"12px"}},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElTooltip),{content:V.value?"显示所有人员":"只显示选中人员"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElIcon),{size:"15",onClick:P},{default:Z.withCtx(()=>[V.value?(Z.openBlock(),Z.createBlock(Z.unref(Nl.View),{key:1})):(Z.openBlock(),Z.createBlock(Z.unref(Nl.Hide),{key:0}))]),_:1})]),_:1},8,["content"])]),_:1})):Z.createCommentVNode("",!0),t.multiple?(Z.openBlock(),Z.createBlock(Z.unref(Jt),{key:1,plain:"",style:{flex:"none"},link:"",tooltip:"全部选中",shortcut:"Ctrl+A",onClick:L},{default:Z.withCtx(()=>[...x[7]||(x[7]=[Z.createTextVNode("全选 ",-1)])]),_:1})):Z.createCommentVNode("",!0),t.multiple?(Z.openBlock(),Z.createBlock(Z.unref(Jt),{key:2,plain:"",style:{flex:"none"},link:"",tooltip:"清除全部选中项",shortcut:"Ctrl+Q",onClick:D},{default:Z.withCtx(()=>[...x[8]||(x[8]=[Z.createTextVNode("全消 ",-1)])]),_:1})):Z.createCommentVNode("",!0),t.multiple?(Z.openBlock(),Z.createBlock(Z.unref(Jt),{key:3,plain:"",style:{flex:"none"},link:"",tooltip:"清除选中项,并选中之前未被选中项",shortcut:"Ctrl+F",onClick:C},{default:Z.withCtx(()=>[...x[9]||(x[9]=[Z.createTextVNode("反选 ",-1)])]),_:1})):Z.createCommentVNode("",!0)])]),_:1},8,["data"])),[[Z.unref(v.vLoading),Z.unref(o)]])])])]),_:1},8,["modelValue"]))}}),[["__scopeId","data-v-90712d51"]])),Ob=Wl(Z.defineComponent({__name:"Scrollbar",props:{ariaLabel:{},ariaOrientation:{},distance:{},height:{},maxHeight:{},native:{type:Boolean},wrapStyle:{},wrapClass:{},viewClass:{},viewStyle:{},noresize:{type:Boolean},tag:{},always:{type:Boolean},minSize:{},tabindex:{},id:{},role:{}},setup(e,{expose:l}){const t=e,d=Z.ref(),n=Z.ref([]),a=new Map;l({elScrollbar:d}),Z.provide(Cb,n);let i=!1;Z.watch(n,()=>{i&&c()},{deep:!0});const s=new IntersectionObserver(h=>{h.forEach(o=>{const V=a.get(o.target);V==null||V.onInView(o.isIntersecting)})});async function c(){var o;await Z.nextTick();const h=(o=d.value)==null?void 0:o.$el;if(!(!n.value||!h)){try{for(let V=0;V<n.value.length;V++)if(n.value[V]){const W=n.value[V],Q=W.childElement.getBoundingClientRect(),m=h.getBoundingClientRect();Q.top>=m.top&&Q.bottom<=m.bottom&&Q.left>=m.left&&Q.right<=m.right&&W.onInView(!0),a.set(W.childElement,W),s.observe(W.childElement)}}finally{n.value&&n.value.splice(0)}i=!0}}Z.onMounted(async()=>{await c()}),Z.onUnmounted(()=>{a.forEach(h=>{s.disconnect()})});const F=Z.computed(()=>t);return(h,o)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElScrollbar),Z.mergeProps({ref_key:"scroll",ref:d,class:"scroll-container"},{...F.value,...h.$attrs}),Z.createSlots({_:2},[Z.renderList(h.$slots,(V,W)=>({name:W,fn:Z.withCtx(()=>[Z.renderSlot(h.$slots,W)])}))]),1040))}}));function p9(e,l){for(var t=-1,d=e==null?0:e.length,n=Array(d);++t<d;)n[t]=l(e[t],t,e);return n}var M9=Array.isArray,hX=ZU?ZU.prototype:void 0,oX=hX?hX.toString:void 0;function vb(e){if(typeof e=="string")return e;if(M9(e))return p9(e,vb)+"";if(dX(e))return oX?oX.call(e):"";var l=e+"";return l=="0"&&1/e==-1/0?"-0":l}function S9(e,l,t,d){for(var n=e.length,a=t+-1;++a<n;)if(l(e[a],a,e))return a;return-1}function J9(e){return e!==e}function T9(e,l,t){for(var d=t-1,n=e.length;++d<n;)if(e[d]===l)return d;return-1}function VX(e,l,t){return l===l?T9(e,l,t):S9(e,J9,t)}function G9(e){return e==null?"":vb(e)}function X9(e,l,t){var d=-1,n=e.length;l<0&&(l=-l>n?0:n+l),t=t>n?n:t,t<0&&(t+=n),n=l>t?0:t-l>>>0,l>>>=0;for(var a=Array(n);++d<n;)a[d]=e[d+l];return a}function y9(e,l,t){var d=e.length;return t=t===void 0?d:t,!l&&t>=d?e:X9(e,l,t)}var B9="\\ud800-\\udfff",Y9="\\u0300-\\u036f",k9="\\ufe20-\\ufe2f",z9="\\u20d0-\\u20ff",L9=Y9+k9+z9,I9="\\ufe0e\\ufe0f",D9="\\u200d",w9=RegExp("["+D9+B9+L9+I9+"]");function E9(e){return w9.test(e)}function C9(e){return e.split("")}var WX="\\ud800-\\udfff",x9="\\u0300-\\u036f",g9="\\ufe20-\\ufe2f",j9="\\u20d0-\\u20ff",O9=x9+g9+j9,v9="\\ufe0e\\ufe0f",K9="["+WX+"]",Kb="["+O9+"]",fb="\\ud83c[\\udffb-\\udfff]",f9="(?:"+Kb+"|"+fb+")",QX="[^"+WX+"]",mX="(?:\\ud83c[\\udde6-\\uddff]){2}",RX="[\\ud800-\\udbff][\\udc00-\\udfff]",H9="\\u200d",NX=f9+"?",bX="["+v9+"]?",P9="(?:"+H9+"(?:"+[QX,mX,RX].join("|")+")"+bX+NX+")*",A9=bX+NX+P9,_9="(?:"+[QX+Kb+"?",Kb,mX,RX,K9].join("|")+")",q9=RegExp(fb+"(?="+fb+")|"+_9+A9,"g");function $9(e){return e.match(q9)||[]}function uX(e){return E9(e)?$9(e):C9(e)}function lx(e,l){for(var t=e.length;t--&&VX(l,e[t],0)>-1;);return t}function tx(e,l){for(var t=-1,d=e.length;++t<d&&VX(l,e[t],0)>-1;);return t}function ex(e,l,t){if(e=G9(e),e&&l===void 0)return lX(e);if(!e||!(l=vb(l)))return e;var d=uX(e),n=uX(l),a=tx(d,n),i=lx(d,n)+1;return y9(d,a,i).join("")}const J0=new Map,vW={mounted(e){let l;if(e instanceof HTMLInputElement)l=setTimeout(()=>e==null?void 0:e.focus(),500),J0.set(e,l);else{const t=e.querySelectorAll("input");t.length>0&&t.item(0)instanceof HTMLInputElement&&(l=setTimeout(()=>{var d;return(d=t==null?void 0:t.item(0))==null?void 0:d.focus()},500),J0.set(e,l))}},onUnmounted(e){J0.has(e)&&(clearTimeout(J0.get(e)),J0.delete(e))}},dx={class:"ja-custom-group-manager"},nx=Rt(Z.defineComponent({__name:"CustomGroupManager",props:{users:{default:()=>[]}},setup(e,{expose:l}){const t=Z.ref(!1),d=$.createAxiosWithoutCache(),n=$.useCustomGroupApi(d),a=Z.ref(),i={label:"name",children:"children",isLeaf:(J,G)=>!J.hasChildren,class:J=>{var G;return J.id===((G=s.value)==null?void 0:G.id)?"selected-group":"group"}},s=Z.ref(),c=Z.ref(!1),F=Z.ref(),h=$.useLoading(d),o=e,V={};async function W(){const J=es(await n.getAll()),G={id:"-1",name:"[顶级组]",children:J,dataVersion:0,hasChildren:J.length>0,label:"",parentId:void 0,sortIndex:0,sortPath:""};return a.value=[G],G}async function Q(){s.value=await W()}function m(J){s.value=J}function R(){F.value=void 0,c.value=!0}async function r(){var J,G;await n.create({name:F.value,parentId:((J=s.value)==null?void 0:J.id)=="-1"||(G=s.value)==null?void 0:G.id}),c.value=!1,await W()}async function b(){s.value&&s.value.id!=="-1"&&(await v.ElMessageBox.confirm("确定要删除选中的自定义组?","确认删除"),await n.delete(s.value.id),await W(),s.value=void 0)}async function u(){var J;if(!s.value||s.value.id==="-1"){v.ElMessage.warning("请选择要保存到的自定义用户组");return}await n.setMembers({id:s.value.id,userIds:((J=o.users)==null?void 0:J.map(G=>G.id))??[]},V),t.value=!1}return l({show(){t.value=!0},close(){t.value=!1}}),(J,G)=>(Z.openBlock(),Z.createElementBlock(Z.Fragment,null,[Z.createVNode(Z.unref(v.ElDialog),{modelValue:t.value,"onUpdate:modelValue":G[1]||(G[1]=T=>t.value=T),"destroy-on-close":"","append-to-body":"",draggable:"",title:"保存为自定义组",width:"360",onOpen:Q},{footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{type:"primary",shortcut:"Alt+O",loading:Z.unref(h),onClick:u},{default:Z.withCtx(()=>[...G[6]||(G[6]=[Z.createTextVNode("确定 ",-1)])]),_:1},8,["loading"]),Z.createVNode(Z.unref(v.ElButton),{onClick:G[0]||(G[0]=T=>t.value=!1)},{default:Z.withCtx(()=>[...G[7]||(G[7]=[Z.createTextVNode("取消",-1)])]),_:1})]),default:Z.withCtx(()=>[Z.createElementVNode("div",dx,[Z.createVNode(Z.unref(v.ElSpace),null,{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElText),null,{default:Z.withCtx(()=>[...G[5]||(G[5]=[Z.createTextVNode("请创建或选择要保存为的自定义组:",-1)])]),_:1}),Z.createVNode(Z.unref(Jt),{circle:"",icon:Z.unref(Nl.Plus),tooltip:"添加自定义组",shortcut:"Alt+G",size:"small",onClick:R,loading:Z.unref(h)},null,8,["icon","loading"]),Z.createVNode(Z.unref(Jt),{circle:"",icon:Z.unref(Nl.Minus),tooltip:"删除自定义组",shortcut:"Alt+D",size:"small",onClick:b,loading:Z.unref(h)},null,8,["icon","loading"])]),_:1}),Z.createVNode(Z.unref(v.ElScrollbar),{height:"360px"},{default:Z.withCtx(()=>{var T;return[Z.createVNode(Z.unref(v.ElTree),{data:a.value,"node-key":"id",props:i,"default-expand-all":"","expand-on-click-node":!1,onCurrentChange:m,"current-node-key":((T=s.value)==null?void 0:T.id)??-1},null,8,["data","current-node-key"])]}),_:1})])]),_:1},8,["modelValue"]),Z.createVNode(Z.unref(v.ElDialog),{modelValue:c.value,"onUpdate:modelValue":G[4]||(G[4]=T=>c.value=T),"destroy-on-close":"","append-to-body":"",title:"添加自定义组",width:"360px"},{footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{type:"primary",shortcut:"Alt+P",onClick:r,loading:Z.unref(h),size:"default"},{default:Z.withCtx(()=>[...G[8]||(G[8]=[Z.createTextVNode(" 确定 ",-1)])]),_:1},8,["loading"]),Z.createVNode(Z.unref(v.ElButton),{onClick:G[3]||(G[3]=T=>c.value=!1),size:"default"},{default:Z.withCtx(()=>[...G[9]||(G[9]=[Z.createTextVNode("取消",-1)])]),_:1})]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElForm),{"label-position":"top"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElFormItem),{label:"自定义组名",required:""},{default:Z.withCtx(()=>[Z.withDirectives(Z.createVNode(Z.unref(v.ElInput),{modelValue:F.value,"onUpdate:modelValue":G[2]||(G[2]=T=>F.value=T),style:{width:"100%"}},null,8,["modelValue"]),[[Z.unref(vW)]])]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}}),[["__scopeId","data-v-1bab28b9"]]),ax={class:"ja-user-list"},ix=["onMouseenter","onMousedown","onMouseover"],sx={key:0,class:"page-indicator"},cx={class:"nb-spinner"},Ux=1,rX=Rt(Z.defineComponent({__name:"JaUserList",props:Z.mergeModels({emptyText:{},multiple:{type:Boolean},total:{},pageSize:{},height:{},loading:{type:Boolean},users:{},maxSelect:{}},{modelValue:{required:!0},modelModifiers:{},page:{required:!0},pageModifiers:{}}),emits:Z.mergeModels(["arrowKeyDown","itemClicked"],["update:modelValue","update:page"]),setup(e,{expose:l,emit:t}){const d=e,n=Z.ref(0),a=Z.ref(),i=Z.ref(!1),s=Z.useModel(e,"modelValue"),c=Z.useModel(e,"page"),F=t,o=M0(()=>{var I;const C=(I=a.value)==null?void 0:I.wrapRef;C&&C.scrollHeight-C.scrollTop<=C.clientHeight+Ux&&c.value<d.total/d.pageSize&&c.value++},200);function V(C){if(d.multiple){if(!Array.isArray(s.value))throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组");const I=s.value.findIndex(P=>P.id==C.id);if(I<0){if(d.maxSelect&&d.maxSelect>0&&s.value.length>=d.maxSelect){v.ElMessage({message:`已超过最大选择数量 ${d.maxSelect}`,plain:!0,type:"warning"});return}s.value.push(C)}else s.value.splice(I,1)}else{if(Array.isArray(s.value))throw new Error("UserPicker组件设置为单选模式时,v-model必须绑定UserReference对象或null");s.value!==null&&C.id===s.value.id?s.value=null:s.value=C}}let W;function Q(C){V(C),i.value=!0,W=C}function m(){i.value=!1,F("itemClicked",W),W=void 0}function R(C){console.log("点击"),i.value&&V(C)}function r(){n.value<d.users.length-1&&n.value++,u()}function b(){n.value>0&&n.value--,u()}const u=()=>{Z.nextTick(()=>{var P,H,Y;const C=(P=a.value)==null?void 0:P.$refs.wrapRef,I=C==null?void 0:C.querySelectorAll("li")[n.value];if(I&&C){const B=I.offsetTop,z=I.offsetTop+I.offsetHeight,g=C.scrollTop,w=C.scrollTop+C.clientHeight;z>w?(H=a.value)==null||H.scrollTo(0,z-C.clientHeight+I.offsetHeight-38):B<g&&((Y=a.value)==null||Y.scrollTo(0,B))}})},J=M0(r,100),G=M0(b,100);function T(C,I){var P;if(n.value=I,i.value=C.buttons>0,i.value){const H=(P=a.value)==null?void 0:P.$refs.wrapRef,Y=C.target;if(Y&&H){const B=Y.offsetTop,z=Y.offsetTop+Y.offsetHeight,g=H.scrollTop,w=H.scrollTop+H.clientHeight;z+20>w?J():B<g+20&&G()}}}function y(C){var I;if(d.multiple){if(!Array.isArray(s.value))throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组");return s.value.some(P=>P.id===C.id)}else{if(Array.isArray(s.value))throw new Error("UserPicker组件设置为单选模式时,v-model必须绑定UserReference对象");return((I=s.value)==null?void 0:I.id)===C.id}}const k=C=>{var I;return Array.isArray(X.value)?X.value.some(P=>P.id===C.id)?"autumnOrange":"skyGray":((I=X.value)==null?void 0:I.id)===C.id?"autumnOrange":"skyGray"},X=Z.computed(()=>{const C=Array.isArray(s.value);if(d.multiple&&C)return s.value;if(!d.multiple&&!C)return s.value?[s.value]:[];if(!d.multiple&&C)return s.value;throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组")});function L(C){return C===n.value?"active":""}const D=Z.computed(()=>d.loading&&d.users.length==0);return l({scrollUp(){b()},scrollDown(){r()},activeIndex:n}),Z.watch(()=>d.users,()=>{n.value=0},{deep:!1}),Z.onUnmounted(()=>{J.cancel(),G.cancel(),o.cancel()}),(C,I)=>(Z.openBlock(),Z.createElementBlock("div",ax,[Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElScrollbar),{height:e.height,ref_key:"scrollbar",ref:a,always:"",onScroll:Z.unref(o)},{default:Z.withCtx(()=>[e.users.length>0?(Z.openBlock(),Z.createElementBlock("ul",{key:0,onMouseup:m},[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(e.users,(P,H)=>(Z.openBlock(),Z.createElementBlock("li",{key:P.id,class:Z.normalizeClass(L(H)),onMouseenter:Y=>i.value&&R(P),onMousedown:Y=>Q(P),onMouseover:Y=>T(Y,H)},[Z.createVNode(Z.unref(v.ElIcon),{color:"#0D6A9F"},{default:Z.withCtx(()=>[y(P)?(Z.openBlock(),Z.createBlock(Z.unref(Nl.Check),{key:0})):Z.createCommentVNode("",!0)]),_:2},1024),Z.createVNode(Z.unref(r0),{"user-id":P.id,"full-name":P.fullName,"has-avatar":P.hasAvatar,placement:"left-start",theme:k(P)},null,8,["user-id","full-name","has-avatar","theme"])],42,ix))),128))],32)):(Z.openBlock(),Z.createBlock(Z.unref(v.ElEmpty),{key:1,description:e.emptyText},null,8,["description"]))]),_:1},8,["height","onScroll"])),[[Z.unref(v.vLoading),D.value]]),e.users.length>0?(Z.openBlock(),Z.createElementBlock("div",sx,[Z.withDirectives(Z.createElementVNode("div",cx,null,512),[[Z.vShow,e.loading]]),Z.createTextVNode(" 已加载 "+Z.toDisplayString(c.value)+" /"+Z.toDisplayString(Math.ceil(e.total/e.pageSize))+"页 ",1)])):Z.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-84465c25"]]),Zx={class:"ja-user-picker__root"},Fx={style:{display:"flex","align-items":"center"}},hx={class:"ja-user-picker-bookmark__dropdown"},ox={style:{width:"100%",display:"flex","align-content":"center","justify-content":"end","margin-bottom":"4px"}},Vx={style:{color:"var(--el-color-info-light-5)"}},Wx={class:"dropdown-header"},Qx={key:0,class:"ja-user-picker__tag-container"},mx={key:0,class:"more-tag"},Rx={key:1},T0=0,pX=Rt(Z.defineComponent({__name:"UserPicker",props:Z.mergeModels({trigger:{default:"hover"},realmId:{},shortcut:{default:"Ctrl+Alt+U"},multiple:{type:Boolean,default:!1},classificationLevel:{default:0},customFilter:{},maxShowCount:{default:20},height:{},maxHeight:{default:"100%"},showUserTag:{type:Boolean,default:!0},maxSelect:{default:0},disabled:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e,t=Z.ref(),d=Z.ref();async function n(){if(l.realmId)t.value=l.realmId;else{const w=await OW().getDefaultRealm();t.value=w.id}}n(),Z.watch(()=>l.realmId,n);const a=$.createAxiosWithoutCache(),i=$.useUserApi(a),s=Z.shallowRef([]),c=Z.useModel(e,"modelValue"),F=Z.ref(),h=Z.ref(!1),{queryResult:o,queryParams:V,pageParams:W,loading:Q}=wb(()=>V.value.name!=null&&V.value.name.length>T0,l.customFilter,(w,O)=>{var f,x;w?(s.value=o.value.users,O&&((x=(f=R.value)==null?void 0:f.elScrollbar)==null||x.scrollTo(0,0))):G()},!0,a,!1),m=Z.ref(),R=Z.ref(),r=Z.ref(),b=Z.ref(),u=Z.ref();function J(w){if(l.multiple){if(!Array.isArray(c.value))throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组");const O=c.value.findIndex(f=>f.id==w.id);if(O<0){if(l.maxSelect>0&&c.value.length>=l.maxSelect){v.ElMessage({message:`已超过最大选择数量 ${l.maxSelect}`,plain:!0,type:"warning"});return}c.value.push(w)}else c.value.splice(O,1)}else{if(Array.isArray(c.value))throw new Error("UserPicker组件设置为单选模式时,v-model必须绑定UserReference对象或者null");c.value!==null&&w.id===c.value.id?c.value=null:c.value=w}}function G(){l.realmId&&(V.value.realmId=l.realmId),V.value.name&&V.value.name.length>T0&&(V.value.name=void 0);const w=$.useUserQueryBuilder();if(l.customFilter){const O=w.getQEntity();w.and(l.customFilter(O))}i.getBookmarkedUsers(w.build()).then(O=>{s.value=O}),setTimeout(()=>{var O;(O=F.value)==null||O.focus()},300)}function T(){var w;h.value=!1,(w=m.value)==null||w.$el.focus()}function y(){var w;(w=b.value)==null||w.show()}function k(w){if(!l.disabled)if(Array.isArray(c.value)){const O=c.value.findIndex(f=>f.id==w);O>=0&&c.value.splice(O,1)}else c.value=null}function X(){var w;u.value.scrollDown(),(w=F.value)==null||w.focus()}function L(){var w;u.value.scrollUp(),(w=F.value)==null||w.focus()}function D(){var w;J(s.value[(w=u.value)==null?void 0:w.activeIndex])}function C(){l.disabled||(h.value=!0)}function I(){const w=c.value,O=s.value.filter(f=>!w.some(x=>x.id===f.id));if(l.maxSelect>0){const f=l.maxSelect-w.length;f>0&&w.push(...O.slice(0,f))}else w.push(...O)}function P(){l.multiple?c.value=[]:c.value=null}function H(){var w;(w=F.value)==null||w.focus()}const Y=Z.computed(()=>{if(l.multiple&&Array.isArray(c.value))return c.value;if(!l.multiple&&!Array.isArray(c.value))return c.value?[c.value]:[];throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组")});function B(){var w;l.disabled||((w=r.value)==null||w.show(),h.value=!1)}function z(){l.disabled||(h.value=!0)}const g=Z.computed(()=>Y.value.slice(0,l.maxShowCount));return Z.watch(()=>l.classificationLevel,()=>{V.value.classificationLevel=l.classificationLevel}),(w,O)=>(Z.openBlock(),Z.createElementBlock(Z.Fragment,null,[Z.createVNode(Z.unref(Ob),Z.mergeProps({"max-height":l.maxHeight,height:l.height},w.$attrs,{style:{"overflow-x":"hidden"}}),{default:Z.withCtx(()=>[Z.withDirectives((Z.openBlock(),Z.createElementBlock("div",Zx,[Z.createVNode(Z.unref(v.ElPopover),{ref_key:"bookmarkDropdown",ref:d,onShow:G,onHide:T,visible:h.value,"onUpdate:visible":O[3]||(O[3]=f=>h.value=f),width:"auto",teleported:"",trigger:l.trigger,disabled:l.disabled},{reference:Z.withCtx(()=>[Z.createElementVNode("div",Fx,[w.$slots.default?Z.renderSlot(w.$slots,"default",{key:0},void 0,!0):(Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{key:1,circle:"",icon:Z.unref(Nl.Plus),size:"small",ref_key:"btn",ref:m,disabled:l.disabled,onMouseover:z},null,8,["icon","disabled"]))])]),default:Z.withCtx(()=>[Z.createElementVNode("div",hx,[Z.createElementVNode("div",ox,[Z.createVNode(Z.unref(v.ElSpace),{style:{flex:"auto"}},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{circle:"",size:"small",onClick:B,plain:"",type:"primary",tooltip:"对话框筛选(大批量选择)",shortcut:"Ctrl+Alt+I",icon:Z.unref(Nl.Notebook)},null,8,["icon"]),Z.createVNode(Z.unref(Jt),{circle:"",size:"small",onClick:P,type:"danger",plain:"",icon:Z.unref(Nl.Delete),tooltip:"清空选择",shortcut:"Alt+C"},null,8,["icon"]),l.multiple?(Z.openBlock(),Z.createBlock(Z.unref(Jt),{key:0,circle:"",size:"small",onClick:I,type:"success",plain:"",icon:Z.unref(Nl.Finished),tooltip:"全选(已加载的数据)",shortcut:"Ctrl+A"},null,8,["icon"])):Z.createCommentVNode("",!0),Z.createVNode(Z.unref(Jt),{circle:"",size:"small",onClick:y,type:"warning",icon:Z.unref(Nl.Setting),plain:"",tooltip:"将已选中用户保存为自定义组,方便以后选择使用"},null,8,["icon"])]),_:1}),Z.createElementVNode("div",Vx," 弹出快捷键:"+Z.toDisplayString(l.shortcut),1)]),Z.createVNode(Z.unref(v.ElInput),{modelValue:Z.unref(V).name,"onUpdate:modelValue":O[0]||(O[0]=f=>Z.unref(V).name=f),ref_key:"inputSearchText",ref:F,"suffix-icon":Z.unref(Nl.Search),placeholder:"请输入拼音名、姓名或手机号查询",autocomplete:"off",onKeydown:[Z.withKeys(D,["enter"]),Z.withKeys(Z.withModifiers(L,["stop","prevent"]),["up"]),Z.withKeys(Z.withModifiers(X,["stop","prevent"]),["down"])]},null,8,["modelValue","suffix-icon","onKeydown"]),Z.createElementVNode("div",Wx,[Z.createVNode(Z.unref(v.ElText),null,{default:Z.withCtx(()=>[Z.unref(V).name&&Z.unref(V).name.length>T0?(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:0},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.Search))]),_:1})):(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:1,color:"#FFBF29"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.StarFilled))]),_:1})),Z.createTextVNode(" "+Z.toDisplayString(Z.unref(V).name&&Z.unref(V).name.length>T0?"查询结果":"常用人员"),1)]),_:1})]),Z.createVNode(rX,{ref_key:"userList",ref:u,total:Z.unref(o).total,"empty-text":Z.unref(V).name&&Z.unref(V).name.length>T0?void 0:"无可选常用人员","page-size":Z.unref(W).pageSize,loading:Z.unref(Q),users:s.value,height:300,modelValue:c.value,"onUpdate:modelValue":O[1]||(O[1]=f=>c.value=f),page:Z.unref(W).currentPage,"onUpdate:page":O[2]||(O[2]=f=>Z.unref(W).currentPage=f),multiple:l.multiple,maxSelect:l.maxSelect,onItemClicked:H,onArrowKeyDown:H},null,8,["total","empty-text","page-size","loading","users","modelValue","page","multiple","maxSelect"])])]),_:3},8,["visible","trigger","disabled"]),l.showUserTag?(Z.openBlock(),Z.createElementBlock("div",Qx,[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(g.value,f=>(Z.openBlock(),Z.createBlock(Z.unref(r0),{key:f.id,"user-id":f.id,"full-name":f.fullName,closable:!l.disabled,"has-avatar":f.hasAvatar,onClosed:k},null,8,["user-id","full-name","closable","has-avatar"]))),128)),Y.value.length>l.maxShowCount?(Z.openBlock(),Z.createElementBlock("div",mx," +"+Z.toDisplayString(Y.value.length-l.maxShowCount)+"人 ",1)):Z.createCommentVNode("",!0),Y.value.length===0?(Z.openBlock(),Z.createElementBlock("div",Rx,[Z.createVNode(Z.unref(v.ElText),{type:"info"},{default:Z.withCtx(()=>[...O[5]||(O[5]=[Z.createTextVNode(" <暂无选中人员>",-1)])]),_:1})])):Z.createCommentVNode("",!0)])):Z.createCommentVNode("",!0),Z.createVNode(Z.unref(jb),{ref_key:"dialogUserSelector",ref:r,multiple:l.multiple,"realm-id":t.value,classificationLevel:l.classificationLevel,customFilter:l.customFilter,maxSelect:l.maxSelect,modelValue:c.value,"onUpdate:modelValue":O[4]||(O[4]=f=>c.value=f)},null,8,["multiple","realm-id","classificationLevel","customFilter","maxSelect","modelValue"])])),[[Z.unref(CW),l.disabled?void 0:C,l.shortcut]])]),_:3},16,["max-height","height"]),Z.createVNode(nx,{ref_key:"dlgCustomGroupManager",ref:b,users:Array.isArray(c.value)?c.value:c.value?[c.value]:null},null,8,["users"])],64))}}),[["__scopeId","data-v-8c204f38"]]),Nx=Z.defineComponent({__name:"JaUserPicker",emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d)??[]);return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)??[]},{deep:!0}),(c,F)=>(Z.openBlock(),Z.createBlock(pX,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),onChange:i},c.$attrs),{default:Z.withCtx(()=>[Z.renderSlot(c.$slots,"default")]),_:3},16,["modelValue"]))}}),MX=Wl(pX),SX=Wl(Nx),JX=Wl(rX),TX=Wl(Z.defineComponent({__name:"JaTimePicker",props:{showNow:{type:Boolean},showConfirm:{type:Boolean},showFooter:{type:Boolean},showWeekNumber:{type:Boolean},ariaLabel:{},emptyValues:{},valueOnClear:{},disabledDate:{},cellClassName:{},shortcuts:{},arrowControl:{type:Boolean},tabindex:{},validateEvent:{type:Boolean},unlinkPanels:{type:Boolean},placement:{},fallbackPlacements:{},disabledHours:{},disabledMinutes:{},disabledSeconds:{},automaticDropdown:{type:Boolean},id:{},name:{},popperClass:{},popperStyle:{},format:{},valueFormat:{},dateFormat:{},timeFormat:{},type:{},clearable:{type:Boolean},clearIcon:{},editable:{type:Boolean},prefixIcon:{},size:{},readonly:{type:Boolean},disabled:{type:Boolean},placeholder:{},popperOptions:{},modelValue:{},rangeSeparator:{},startPlaceholder:{},endPlaceholder:{},defaultValue:{},defaultTime:{},isRange:{type:Boolean}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t,c=e,F=Z.ref({});function h(W){i.removeFieldError(a),Nt(n.formData,a,o.value),s("change",W)}const o=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{o.value=pl(n.formData,a)},{deep:!0});const V=Z.computed(()=>{const{modelValue:W,...Q}=c;return Q});return Z.onMounted(()=>{d.value&&Object.entries(d.value).filter(([Q,m])=>m instanceof Function).forEach(([Q,m])=>{F.value[Q]=m})}),l(F.value),(W,Q)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTimePicker),Z.mergeProps({ref_key:"input",ref:d,modelValue:Z.unref(n).formData[Z.unref(a)],"onUpdate:modelValue":Q[0]||(Q[0]=m=>Z.unref(n).formData[Z.unref(a)]=m),onChange:h},{...V.value,...W.$attrs}),Z.createSlots({_:2},[Z.renderList(W.$slots,(m,R)=>({name:R,fn:Z.withCtx(()=>[Z.renderSlot(W.$slots,R)])}))]),1040,["modelValue"]))}})),GX=Wl(Z.defineComponent({__name:"UserGroupPicker",props:Z.mergeModels({realmId:{},appId:{},modelValue:{},size:{default:"default"},multiple:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:Z.mergeModels(["change"],["update:modelValue"]),setup(e,{emit:l}){const t=$.createAxiosWithoutCache(),d=$.useUserGroupApi(t),n=e,a=Z.useModel(e,"modelValue"),i=l;if(n.multiple&&!Array.isArray(a.value))throw new Error("用户组选择器设置multiple为true,但是绑定的v-model值是单值");if(!n.multiple&&Array.isArray(a.value))throw new Error("用户组选择器未设置multiple为true,但是绑定的v-model值是数组");const s=Z.reactive({groups:[]}),c=()=>{!n.realmId||!n.appId||d.getByAppIdAndRealm(n.appId,n.realmId??"0").then(h=>{s.groups=[...es(h,"name")],!a.value&&!n.multiple&&(a.value=s.groups[0].id)})},F=h=>{i("change",Array.isArray(h)?s.groups.filter(o=>h.findIndex(V=>o.id===V)>=0):s.groups.find(o=>o.id===h))};return c(),Z.watch(()=>n.realmId,()=>{c()}),Z.watch(()=>n.appId,c),(h,o)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTreeSelect),Z.mergeProps({style:{width:"100%"},data:s.groups,size:n.size,"node-key":"id","check-strictly":"","current-node-key":a.value,"highlight-current":"",modelValue:a.value,"onUpdate:modelValue":o[0]||(o[0]=V=>a.value=V),multiple:e.multiple,onChange:F},h.$attrs,{"collapse-tags":"","collapse-tags-tooltip":"","tag-type":"info",teleported:""}),null,16,["data","size","current-node-key","modelValue","multiple"]))}})),XX=Wl(Z.defineComponent({__name:"JaAutoComplete",props:{valueKey:{},modelValue:{},debounce:{},placement:{},fetchSuggestions:{},popperClass:{},popperStyle:{},triggerOnFocus:{type:Boolean},selectWhenUnmatched:{type:Boolean},hideLoading:{type:Boolean},teleported:{type:Boolean},appendTo:{},highlightFirstItem:{type:Boolean},fitInputWidth:{type:Boolean},loopNavigation:{type:Boolean},inputmode:{},name:{},ariaLabel:{},id:{},size:{},disabled:{type:Boolean},modelModifiers:{},maxlength:{},minlength:{},type:{},resize:{},autosize:{},autocomplete:{},formatter:{},parser:{},placeholder:{},form:{},readonly:{type:Boolean},clearable:{type:Boolean},clearIcon:{},showPassword:{type:Boolean},showWordLimit:{type:Boolean},wordLimitPosition:{},suffixIcon:{},prefixIcon:{},containerRole:{},tabindex:{},validateEvent:{type:Boolean},inputStyle:{},autofocus:{type:Boolean},rows:{}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t;function c(V){i.removeFieldError(a),Nt(n.formData,a,F.value),s("change",V)}const F=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{F.value=pl(n.formData,a)},{deep:!0}),l({elAutocomplete:d});const h=e,o=Z.computed(()=>h);return(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElAutocomplete),Z.mergeProps({ref_key:"input",ref:d,modelValue:F.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>F.value=Q),onChange:c},{...o.value,...V.$attrs}),Z.createSlots({_:2},[Z.renderList(V.$slots,(Q,m)=>({name:m,fn:Z.withCtx(()=>[Z.renderSlot(V.$slots,m)])}))]),1040,["modelValue"]))}})),yX=Wl(Z.defineComponent({__name:"JaRadioGroup",props:{ariaLabel:{},id:{},size:{},disabled:{type:Boolean},modelValue:{},fill:{},textColor:{},name:{},validateEvent:{type:Boolean},options:{},props:{},type:{}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t,c=e;function F(V){i.removeFieldError(a),Nt(n.formData,a,h.value),s("change",V)}const h=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{h.value=pl(n.formData,a)},{deep:!0});const o=Z.computed(()=>{const{modelValue:V,...W}=c;return W});return l({focus:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.focus)==null?void 0:W.call(V)},blur:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.blur)==null?void 0:W.call(V)},elRadioGroup:d}),(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElRadioGroup),Z.mergeProps({ref_key:"input",ref:d,modelValue:h.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>h.value=Q),onChange:F},{...o.value,...V.$attrs}),Z.createSlots({_:2},[Z.renderList(V.$slots,(Q,m)=>({name:m,fn:Z.withCtx(()=>[Z.renderSlot(V.$slots,m)])}))]),1040,["modelValue"]))}})),KW=new Map;let Hb=new Map;function Pb(){return{refreshRolesCache(e){KW.delete(e),console.log("roles cache cleared for app:",e,KW.get(e))},async getRoles(e){let l=KW.get(e);if(l)return l;let t=Hb.get(e);if(t)return await t;const d=$.createAxiosWithoutCache();return t=$.useRoleApi(d).getAllRole(e).then(a=>(KW.set(e,a),a)).finally(()=>{Hb.delete(e)}),Hb.set(e,t),await t}}}const bx=Z.defineComponent({__name:"baseRolePicker",props:Z.mergeModels({appName:{}},{modelValue:{},modelModifiers:{}}),emits:Z.mergeModels(["change"],["update:modelValue"]),setup(e,{expose:l,emit:t}){const{getRoles:d}=Pb(),n=e,a=Z.ref(),i=Z.ref([]),s=hU(),c=async()=>{n.appName&&(a.value=await s.getByName(n.appName),i.value=await d(a.value.id),F.value?o.value=m(F.value,i.value):o.value=void 0)},F=Z.useModel(e,"modelValue"),h=t,o=Z.ref();Z.watch(()=>n.appName,c),c();const V={label:R=>R.caption?R.caption:R.name,isLeaf:R=>!R.hasChildren},W=Z.ref();function Q(R){o.value=m(R,i.value),h("change",R)}function m(R,r){for(let b=0;b<r.length;b++){if(r[b].name===R)return r[b];const u=r[b].children;if(u){const J=m(R,u);if(J)return J}}}return l({loadData:c,currentRole:o,elTreeSelect:W}),(R,r)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTreeSelect),Z.mergeProps({ref_key:"select",ref:W,data:i.value,"node-key":"name","current-node-key":F.value,"value-key":"name",props:V},R.$attrs,{clearable:"","check-strictly":"","highlight-current":!0,onChange:Q,modelValue:F.value,"onUpdate:modelValue":r[0]||(r[0]=b=>F.value=b)}),Z.createSlots({_:2},[Z.renderList(R.$slots,(b,u)=>({name:u,fn:Z.withCtx(()=>[Z.renderSlot(R.$slots,u)])}))]),1040,["data","current-node-key","modelValue"]))}}),ux=Z.defineComponent({__name:"I18nBundleEditor",props:Z.mergeModels({appId:{},preKey:{}},{modelValue:{type:Boolean,default:!1,required:!0},modelModifiers:{}}),emits:Z.mergeModels(["success"],["update:modelValue"]),setup(e,{emit:l}){const t=Z.useModel(e,"modelValue"),d=e,n=$.createAxiosWithoutCache(),a=$.useAppMessageApi(n),i=Z.ref(),s=Z.ref(""),c=Z.ref({}),F=l,h=hU();function o(){W(),s.value=d.preKey??"",c.value={}}async function V(){const Q={key:s.value,messages:c.value,appInstance:{id:d.appId}};await a.createBundle(Q),t.value=!1,F("success",s.value)}async function W(){i.value=await h.getById(d.appId)}return Z.watch(()=>d.appId,async()=>{await W()}),(Q,m)=>{const R=Z.resolveDirective("focus");return Z.openBlock(),Z.createBlock(Z.unref(v.ElDrawer),{"destroy-on-close":"","append-to-body":"",modelValue:t.value,"onUpdate:modelValue":m[2]||(m[2]=r=>t.value=r),title:"创建国际化文本",onOpen:o},{footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{size:"default",shortcut:"Alt+Enter",type:"primary",onClick:V},{default:Z.withCtx(()=>[...m[3]||(m[3]=[Z.createTextVNode("确定 ",-1)])]),_:1}),Z.createVNode(Z.unref(v.ElButton),{size:"default",plain:"",onClick:m[1]||(m[1]=r=>t.value=!1)},{default:Z.withCtx(()=>[...m[4]||(m[4]=[Z.createTextVNode("取消",-1)])]),_:1})]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElForm),{"label-position":"top",size:"default"},{default:Z.withCtx(()=>{var r;return[Z.createVNode(Z.unref(v.ElFormItem),{label:"文本键",required:""},{default:Z.withCtx(()=>[Z.withDirectives(Z.createVNode(Z.unref(v.ElInput),{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=b=>s.value=b)},null,8,["modelValue"]),[[R]])]),_:1}),(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList((r=i.value)==null?void 0:r.supportedLocales,b=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElFormItem),{key:b,label:b},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElInput),{type:"textarea",rows:4,modelValue:c.value[b],"onUpdate:modelValue":u=>c.value[b]=u},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]))),128))]}),_:1})]),_:1},8,["modelValue"])}}}),rx={class:"ja-input-i18n"},Ab=Wl(Rt(Z.defineComponent({__name:"InputI18n",props:Z.mergeModels({appId:{},size:{default:"default"},textarea:{type:Boolean,default:!1},disabled:{type:Boolean}},{modelValue:{default:""},modelModifiers:{}}),emits:Z.mergeModels(["change","focus","blur"],["update:modelValue"]),setup(e,{expose:l,emit:t}){const d=e,n=Z.useModel(e,"modelValue"),a=$.createAxiosWithoutCache(),i=$.useAppMessageApi(a),s=$.useLoginUser().locale,c=Z.ref(),F=Z.ref(!1),h=Z.ref(!1),o=Z.ref(),V=Z.ref(""),W=hU(),Q=Z.ref(""),m=Z.ref(""),R=Z.ref(),r=t,b=Db(J,500);let u;async function J(L){if(L||(L=n.value),!d.appId)return;m.value=L;const D=await W.getById(d.appId);if(V.value=D.name,!L||L.length===0||!V.value){m.value="";return}let C=L;L&&L.length>0&&(C=ex(C),C.startsWith("{")&&C.endsWith("}")&&(C=C.substring(1,C.length-1)));const P=(await i.getByKey(V.value,C,{cancelDuplicatedRequest:!1})).find(H=>H.locale===s);P&&(await Z.nextTick(),m.value=P.message)}async function G(L){Q.value=L,c.value=await i.searchKeys(V.value,L)}async function T(){var L;F.value=!0,await Z.nextTick(),r("focus"),(L=o.value)==null||L.focus()}function y(){u=setTimeout(()=>{F.value=!1},200),r("blur")}Z.onUnmounted(()=>{b.cancel(),u&&clearTimeout(u)}),Z.watch(n,()=>{b()},{deep:!0}),m.value||b();function k(L){r("change",L)}async function X(L){await G(Q.value),n.value="{"+L+"}",R.value.focus}return l({focus(){R==null||R.value.focus()},blur(){o==null||o.value.blur()}}),(L,D)=>(Z.openBlock(),Z.createElementBlock("div",rx,[Z.withDirectives(Z.createVNode(Z.unref(v.ElInput),{ref_key:"selectI18n",ref:R,onFocus:T,modelValue:m.value,"onUpdate:modelValue":D[0]||(D[0]=C=>m.value=C),size:e.size,disabled:e.disabled,type:e.textarea?"textarea":void 0},null,8,["modelValue","size","disabled","type"]),[[Z.vShow,!F.value]]),Z.withDirectives(Z.createVNode(Z.unref(v.ElSelect),{ref_key:"select",ref:o,filterable:"",remote:"","remote-method":G,disabled:e.disabled,"default-first-option":"","reserve-keyword":"","remote-show-suffix":"",onChange:k,size:e.size,"allow-create":"",clearable:"",onBlur:y,modelValue:n.value,"onUpdate:modelValue":D[2]||(D[2]=C=>n.value=C)},{footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{link:"",style:{width:"100%"},type:"primary",onClick:D[1]||(D[1]=C=>h.value=!0),shortcut:"Alt+I"},{default:Z.withCtx(()=>[...D[4]||(D[4]=[Z.createTextVNode(" 新建国际化文本(Alt+I) ",-1)])]),_:1})]),default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(c.value,C=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElOption),{key:C,value:"{"+C+"}",label:"{"+C+"}"},null,8,["value","label"]))),128))]),_:1},8,["disabled","size","modelValue"]),[[Z.vShow,F.value]]),Z.createVNode(ux,{"app-id":e.appId,"pre-key":Q.value,modelValue:h.value,"onUpdate:modelValue":D[3]||(D[3]=C=>h.value=C),onSuccess:X},null,8,["app-id","pre-key","modelValue"])]))}}),[["__scopeId","data-v-f71b8ca0"]])),_b=new Map;let qb=new Map;function BX(){return{refreshRoleCategoryCache(e){_b.delete(e)},async getRoleCategories(e){let l=_b.get(e);if(l)return l;let t=qb.get(e);if(t)return await t;const d=$.createAxiosWithoutCache();return t=$.useRoleCategoryApi(d).getAllRole(e).then(a=>(_b.set(e,a),a)).finally(()=>{qb.delete(e)}),qb.set(e,t),await t}}}const px=["onClick"],Mx={style:{flex:"1"}},Sx={style:{display:"flex",padding:"0 20px 0 10px"}},Jx={style:{flex:"1"}},Tx={key:0,style:{flex:"1","text-align":"right"}},YX=Z.defineComponent({__name:"RoleCategorySelector",props:Z.mergeModels({appId:{},allowEdit:{type:Boolean}},{modelValue:{required:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e,t=$.createAxiosWithoutCache(),d=$.useRoleCategoryApi(t),n=Z.useModel(e,"modelValue"),{getRoleCategories:a,refreshRoleCategoryCache:i}=BX(),s=Z.ref([]),c=Z.ref();async function F(){l.appId&&(s.value=await a(l.appId),s.value.length>0&&(n.value=s.value[0].name),console.log(`Loading categories for ${l.appId}`,s.value))}async function h(){if(!l.appId)throw new Error("appId 参数不能为空");c.value&&!await m()||(c.value={id:"0",name:"",app:{id:l.appId},dataVersion:0},s.value.push(c.value))}async function o(R){c.value&&!await m()||(c.value=R)}async function V(){c.value&&!await m()||(c.value=void 0)}async function W(R){if(c.value){if(!await m())return;c.value=void 0}await d.delete({id:R.id,dataVersion:R.dataVersion}),i(l.appId),s.value.splice(s.value.indexOf(R),1)}function Q(R,r){r===c.value&&(R.preventDefault(),R.stopPropagation())}async function m(){if(!c.value)return!0;if(!c.value.name||c.value.name.length<1)return v.ElMessage.error("类别名称不能为空"),!1;try{let R;return c.value.id=="0"?R=await d.create({name:c.value.name,app:c.value.app},{popValidationErrorNotification:!0}):R=await d.update({...c.value},{popValidationErrorNotification:!0}),i(l.appId),c.value.id=R.id,c.value.dataVersion=R.dataVersion,!0}catch{return!1}}return Z.watch(()=>l.appId,F,{immediate:!0}),(R,r)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElSelect),{modelValue:n.value,"onUpdate:modelValue":r[2]||(r[2]=b=>n.value=b),placeholder:"[未分类]"},{header:Z.withCtx(()=>[Z.createElementVNode("div",Sx,[Z.createElementVNode("div",Jx,[Z.createVNode(Z.unref(v.ElText),null,{default:Z.withCtx(()=>[r[3]||(r[3]=Z.createElementVNode("b",null,"业务分类",-1)),Z.createVNode(Z.unref(v.ElTooltip),{content:"业务分类限制角色只能授予同分类的用户组"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElIcon),null,{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.InfoFilled))]),_:1})]),_:1})]),_:1})]),e.allowEdit?(Z.openBlock(),Z.createElementBlock("div",Tx,[Z.createVNode(u0,{size:"small",type:"primary",plain:"",icon:Z.unref(Nl.Plus),shortcut:"Alt+A",link:"",tooltip:"添加",onClick:Z.withModifiers(h,["prevent","stop"])},null,8,["icon"])])):Z.createCommentVNode("",!0)])]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElOption),{label:"[未分类]",value:""}),(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(s.value,b=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElOption),{key:b.id,label:b.name,value:b.name},{default:Z.withCtx(()=>[Z.createElementVNode("div",{style:{display:"flex",margin:"0 -32px 0 -20px",padding:"0 32px 0 20px"},onClick:u=>Q(u,b)},[Z.createElementVNode("div",Mx,[b!==c.value?(Z.openBlock(),Z.createBlock(Z.unref(v.ElText),{key:0},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(b.name),1)]),_:2},1024)):Z.createCommentVNode("",!0),b===c.value?Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElInput),{key:1,onClick:r[0]||(r[0]=Z.withModifiers(()=>{},["prevent","stop"])),size:"small",modelValue:c.value.name,"onUpdate:modelValue":r[1]||(r[1]=u=>c.value.name=u),maxlength:"255",onKeydown:Z.withKeys(V,["enter"])},null,8,["modelValue"])),[[Z.unref(vW)]]):Z.createCommentVNode("",!0)]),Z.createElementVNode("div",null,[b!==c.value&&e.allowEdit?(Z.openBlock(),Z.createBlock(u0,{key:0,size:"small",type:"primary",icon:Z.unref(Nl.Edit),link:"",onClick:Z.withModifiers(u=>o(b),["stop","prevent"]),tooltip:"修改"},null,8,["icon","onClick"])):Z.createCommentVNode("",!0),b!==c.value&&e.allowEdit?(Z.openBlock(),Z.createBlock(u0,{key:1,size:"small",type:"danger",icon:Z.unref(Nl.Delete),link:"",onClick:Z.withModifiers(u=>W(b),["stop","prevent"]),tooltip:"删除"},null,8,["icon","onClick"])):Z.createCommentVNode("",!0),b===c.value&&e.allowEdit?(Z.openBlock(),Z.createBlock(u0,{key:2,size:"small",type:"primary",icon:Z.unref(Nl.Check),link:"",onClick:Z.withModifiers(V,["stop","prevent"]),tooltip:"提交"},null,8,["icon"])):Z.createCommentVNode("",!0)])],8,px)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue"]))}}),Gx=Z.defineComponent({__name:"RoleEditor",props:Z.mergeModels({appName:{},category:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:Z.mergeModels(["success"],["update:modelValue"]),setup(e,{emit:l}){const t=Z.useModel(e,"modelValue"),d=e,n=l,a={hasChildren:!1,parentId:"0",releaseSource:"",app:{id:"0"},caption:"",compositeRoles:[],dataVersion:0,description:"",id:"0",name:"",category:d.category},i=Z.ref({formData:{...a}}),s=$.createAxiosWithoutCache(),c=SG(Object.keys(a),s),F=$.useLoading(s),h=$.useRoleApi(s),o=Z.ref(),V=Z.ref(),W=Z.ref(),Q=hU(),{refreshRolesCache:m}=Pb();async function R(){if(i.value.formData={...a},!d.appName)throw new Error("rolePicker组件的appName属性不能为空");W.value=await Q.getByName(d.appName)}async function r(){var J,G;if(!d.appName)return;const b=i.value.formData,u=(J=V.value)==null?void 0:J.currentRole;(G=o.value)==null||G.validate(()=>h.create({addTo:u?{id:u.id,name:u.name,app:{id:W.value.id}}:void 0,app:{id:W.value.id},description:b.description,name:b.name,caption:b.caption,category:b.category}).then(T=>{m(W.value.id),n("success",T),t.value=!1}))}return(b,u)=>{const J=Z.resolveComponent("ja-form");return Z.openBlock(),Z.createBlock(Z.unref(v.ElDrawer),{"destroy-on-close":"","append-to-body":"",title:"新建角色",modelValue:t.value,"onUpdate:modelValue":u[3]||(u[3]=G=>t.value=G),onOpen:R},{footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{size:"default",type:"primary",onClick:r,loading:Z.unref(F),shortcut:"Alt+Enter"},{default:Z.withCtx(()=>[...u[4]||(u[4]=[Z.createTextVNode("确定 ",-1)])]),_:1},8,["loading"]),Z.createVNode(Z.unref(v.ElButton),{size:"default",onClick:u[2]||(u[2]=G=>t.value=!1)},{default:Z.withCtx(()=>[...u[5]||(u[5]=[Z.createTextVNode("取消",-1)])]),_:1})]),default:Z.withCtx(()=>[Z.createVNode(J,{ref_key:"formRef",ref:o,model:i.value,validator:Z.unref(c)},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(ts),{label:"角色名称",prop:"name",required:""},{default:Z.withCtx(()=>[Z.withDirectives(Z.createVNode(Z.unref(EW),null,null,512),[[Z.unref(vW)]])]),_:1}),Z.createVNode(Z.unref(ts),{label:"上级角色",prop:"none"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(fW),{ref_key:"rolePicker",ref:V,placeholder:"请选择上级角色,置空表示添加顶层角色","app-name":d.appName},null,8,["app-name"])]),_:1}),Z.createVNode(Z.unref(ts),{label:"角色标题",prop:"caption",required:""},{default:Z.withCtx(()=>{var G;return[Z.createVNode(Z.unref(Ab),{"app-id":(G=W.value)==null?void 0:G.id,size:"small",modelValue:i.value.formData.caption,"onUpdate:modelValue":u[0]||(u[0]=T=>i.value.formData.caption=T)},null,8,["app-id","modelValue"])]}),_:1}),Z.createVNode(Z.unref(ts),{label:"业务分类",prop:"category"},{default:Z.withCtx(()=>{var G;return[Z.createVNode(YX,{"app-id":(G=W.value)==null?void 0:G.id,modelValue:i.value.formData.category,"onUpdate:modelValue":u[1]||(u[1]=T=>i.value.formData.category=T)},null,8,["app-id","modelValue"])]}),_:1}),Z.createVNode(Z.unref(ts),{label:"角色说明",prop:"description"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(EW),{type:"textarea"})]),_:1})]),_:1},8,["model","validator"])]),_:1},8,["modelValue"])}}}),Xx={class:"ja-role-picker"},kX=Rt(Z.defineComponent({__name:"RolePickerRaw",props:Z.mergeModels({appName:{}},{modelValue:{required:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e,t=Z.useModel(e,"modelValue");function d(s){var c;t.value=s.name,(c=n.value)==null||c.loadData()}const n=Z.ref(),a=Z.ref(!1);function i(){a.value=!0}return(s,c)=>(Z.openBlock(),Z.createElementBlock("div",Xx,[Z.createVNode(Z.unref(fW),Z.mergeProps({ref_key:"picker",ref:n,"app-name":l.appName,style:{flex:"auto"}},s.$attrs,{modelValue:t.value,"onUpdate:modelValue":c[1]||(c[1]=F=>t.value=F)}),Z.createSlots({footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{link:"",type:"primary",icon:Z.unref(Nl.Plus),shortcut:"Alt+I",style:{width:"100%"},onClick:i},{default:Z.withCtx(()=>[...c[2]||(c[2]=[Z.createTextVNode(" 新建角色(Alt+I) ",-1)])]),_:1},8,["icon"]),Z.createVNode(Gx,{modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=F=>a.value=F),"app-name":l.appName,onSuccess:d},null,8,["modelValue","app-name"])]),_:2},[Z.renderList(s.$slots,(F,h)=>({name:h,fn:Z.withCtx(()=>[Z.renderSlot(s.$slots,h,{},void 0,!0)])}))]),1040,["app-name","modelValue"])]))}}),[["__scopeId","data-v-dd3083a0"]]),yx=Z.defineComponent({__name:"RolePicker",props:{appName:{}},emits:["change"],setup(e,{emit:l}){const t=e,d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=l;function c(h){i.removeFieldError(a),Nt(n.formData,a,F.value),s("change",h)}const F=Z.ref(pl(n.formData,a));return Z.watch(()=>n.formData,()=>{F.value=pl(n.formData,a)},{deep:!0}),(h,o)=>(Z.openBlock(),Z.createBlock(kX,Z.mergeProps({ref_key:"picker",ref:d,"app-name":t.appName,modelValue:F.value,"onUpdate:modelValue":o[0]||(o[0]=V=>F.value=V),onChange:c},h.$attrs),Z.createSlots({_:2},[Z.renderList(h.$slots,(V,W)=>({name:W,fn:Z.withCtx(()=>[Z.renderSlot(h.$slots,W)])}))]),1040,["app-name","modelValue"]))}}),fW=Wl(bx),zX=Wl(yx),LX=Wl(kX),IX=Wl(YX),DX=Z.defineComponent({__name:"ChannelPicker",props:Z.mergeModels({appName:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=$.createAxiosWithoutCache(),t=$.useChannelApi(l),d=e,n=Z.ref(),a=Z.ref(),i=Z.useModel(e,"modelValue");Z.onBeforeMount(()=>{s()});async function s(){console.log("load channels of app "+d.appName),d.appName&&(n.value=await t.getAll(d.appName),a.value=n.value)}function c(F){var h;a.value=((h=n.value)==null?void 0:h.filter(o=>o.name.indexOf(F)>-1))??[]}return Z.watch(()=>d.appName,s),(F,h)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElSelect),Z.mergeProps({filterable:"","filter-method":c,"value-key":"id",modelValue:i.value,"onUpdate:modelValue":h[0]||(h[0]=o=>i.value=o)},F.$attrs),{default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(a.value,o=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElOption),{key:o.id,label:o.name,value:o},null,8,["label","value"]))),128))]),_:1},16,["modelValue"]))}}),wX=Wl(Z.defineComponent({__name:"JaChannelPicker",emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d));return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)},{deep:!0}),(c,F)=>(Z.openBlock(),Z.createBlock(DX,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),onChange:i},c.$attrs),null,16,["modelValue"]))}})),EX=Wl(DX),$b=new Map;let lu=new Map;function CX(){return{refreshProperties(e){$b.delete(e)},async getProperties(e){let l=$b.get(e);if(l)return l;let t=lu.get(e);if(t)return await t;const d=$.createAxiosWithoutCache();return t=$.useEntityApi(d).getProperties(e).then(a=>($b.set(e,a),a)).finally(()=>{lu.delete(e)}),lu.set(e,t),await t}}}const Bx={class:"ja-property-picker__dropdown"},Yx={key:0},kx=["onMouseenter","onClick"],zx={key:0,class:"entity-type"},Lx={key:1},xX=Rt(Z.defineComponent({__name:"PropertyPicker",props:Z.mergeModels({entityId:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e;let t;const d=Z.useModel(e,"modelValue"),n=Z.ref([]),a=$.createAxiosWithoutCache(),{getProperties:i}=CX(),s=Z.ref(),c={},F=Z.ref(0),h=$.useLoading(a),o=Z.ref(!1),V=Z.ref(!1),W=Z.ref(),Q=Z.ref(),m=Z.ref("");let R=Z.ref(!1);async function r(){t||(t=l.entityId),t?s.value=await i(t):s.value=[]}function b(B){let z;B?z=B.join("."):z="",z!==d.value&&(d.value=z),Z.nextTick(async()=>{var w;t=l.entityId,await r();let g=c[t];if(g){for(let O=0;O<B.length;O++){const f=B[O];let x=g.find(A=>A.name===f);x&&x.entityType?(t=x.entityType.id,O<B.length-1?(await r(),g=c[t]):x.dataType==="ENTITY"&&x.collectionType==="NONE"?(t=x.entityType.id,r()):(t="-1",r())):(t="-1",r())}(w=W.value)==null||w.focus()}})}function u(B){return B.caption&&B.caption.length>0?B.name+"("+B.caption+")":B.name}function J(B){F.value=B}function G(B){return F.value===B?"active":""}function T(B){var z,g;(z=n.value)==null||z.push(B.name),m.value="",(g=W.value)==null||g.focus()}function y(B){var z;(z=n.value)==null||z.pop()}function k(){var g;if(!t)return;const B=c[t];if(!B)return;const z=(g=W.value)==null?void 0:g.value;z&&z.length>0?s.value=[...B].filter(w=>w.name.toLowerCase().indexOf(z.toLowerCase())>-1):s.value=B,H()}function X(){s.value&&(F.value<s.value.length-1&&F.value++,H())}function L(){F.value>0&&F.value--,H()}function D(){if(!s.value)return;const B=s.value[F.value];B&&T(B)}function C(){var B;m.value&&m.value.length>0||(B=n.value)==null||B.pop()}function I(B){B&&Z.nextTick(()=>{var z;(z=W.value)==null||z.focus()}),R.value=B}const P=Z.computed(()=>{var B;return n.value&&n.value.length>0?(B=n.value)==null?void 0:B.join("."):"请选择属性"}),H=()=>{Z.nextTick(()=>{var g,w,O;const B=(g=Q.value)==null?void 0:g.$refs.wrapRef,z=B==null?void 0:B.querySelectorAll("li")[F.value];if(z&&B){const f=z.offsetTop,x=z.offsetTop+z.offsetHeight,A=B.scrollTop,al=B.scrollTop+B.clientHeight;x>al?(w=Q.value)==null||w.scrollTo(0,x-B.clientHeight+z.offsetHeight-38):f<A&&((O=Q.value)==null||O.scrollTo(0,f))}})};Z.watch(()=>l.entityId,r),Z.watch(n,()=>b(n.value),{deep:!0});function Y(){if(d.value&&d.value.length>0){const B=d.value.split(".");B.length!==n.value.length&&(n.value=B)}else n.value.length>0&&(n.value=[])}return Z.watch(d,()=>{Y()}),d.value&&d.value.length>0?Y():r(),Z.watch(s,()=>{F.value=0,H()}),(B,z)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElDropdown),{onVisibleChange:I},{dropdown:Z.withCtx(()=>[Z.createElementVNode("div",Bx,[Z.createElementVNode("div",{class:Z.normalizeClass(["el-input-tag el-input-tag--small el-input-tag__wrapper",{"is-hovering":o.value,"is-focused":V.value}]),onMouseenter:z[3]||(z[3]=g=>o.value=!0),onMouseleave:z[4]||(z[4]=g=>o.value=!1)},[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(n.value,g=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTag),{id:g,onClose:w=>y(),closable:""},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(g),1)]),_:2},1032,["id","onClose"]))),256)),Z.withDirectives(Z.createElementVNode("input",{ref_key:"filterInput",ref:W,type:"text",style:{flex:"auto"},class:"el-input-tag__input","onUpdate:modelValue":z[0]||(z[0]=g=>m.value=g),placeholder:"属性名过滤",onFocus:z[1]||(z[1]=g=>V.value=!0),onBlur:z[2]||(z[2]=g=>V.value=!1),onKeydown:[Z.withKeys(C,["delete"]),Z.withKeys(X,["down"]),Z.withKeys(L,["up"]),Z.withKeys(D,["enter"])],onInput:k},null,544),[[Z.vModelText,m.value]])],34),Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElScrollbar),{height:"300px",always:"",ref_key:"scrollbar",ref:Q},{default:Z.withCtx(()=>{var g;return[((g=s.value)==null?void 0:g.length)??!1?(Z.openBlock(),Z.createElementBlock("ul",Yx,[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(s.value,(w,O)=>(Z.openBlock(),Z.createElementBlock("li",{key:w.id,onMouseenter:f=>J(O),onClick:f=>T(w),class:Z.normalizeClass(G(O))},[w.dataType==="ENTITY"?(Z.openBlock(),Z.createElementBlock("span",zx,Z.toDisplayString(u(w)),1)):(Z.openBlock(),Z.createElementBlock("span",Lx,Z.toDisplayString(u(w)),1))],42,kx))),128))])):(Z.openBlock(),Z.createBlock(Z.unref(v.ElEmpty),{key:1,description:"无可选属性"}))]}),_:1})),[[Z.unref(v.vLoading),Z.unref(h)]])])]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElTag),{type:"primary"},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(P.value)+" ",1),Z.unref(R)?(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:0},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.ArrowUp))]),_:1})):(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:1},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.ArrowDown))]),_:1}))]),_:1})]),_:1}))}}),[["__scopeId","data-v-7bf2d619"]]),gX=Wl(Z.defineComponent({__name:"JaPropertyPicker",emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d)??"");return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)??""},{deep:!0}),(c,F)=>(Z.openBlock(),Z.createBlock(xX,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),onChange:i},c.$attrs),null,16,["modelValue"]))}})),jX=Wl(xX),OX=Wl(Z.defineComponent({__name:"JaCheckboxGroup",props:{ariaLabel:{},modelValue:{},disabled:{type:Boolean},min:{},max:{},size:{},fill:{},textColor:{},tag:{},validateEvent:{type:Boolean},options:{},props:{},type:{}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t,c=e;function F(V){i.removeFieldError(a),Nt(n.formData,a,h.value),s("change",V)}const h=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{h.value=pl(n.formData,a)},{deep:!0});const o=Z.computed(()=>{const{modelValue:V,...W}=c;return W});return l({focus:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.focus)==null?void 0:W.call(V)},blur:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.blur)==null?void 0:W.call(V)},elCheckboxGroup:d}),(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElCheckboxGroup),Z.mergeProps({ref_key:"input",ref:d,modelValue:h.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>h.value=Q),onChange:F},{...o.value,...V.$attrs}),Z.createSlots({_:2},[Z.renderList(V.$slots,(Q,m)=>({name:m,fn:Z.withCtx(()=>[Z.renderSlot(V.$slots,m)])}))]),1040,["modelValue"]))}})),vX=Wl(Z.defineComponent({__name:"EnumPicker",props:Z.mergeModels({clearable:{type:Boolean,default:!0},filterable:{type:Boolean,default:!0},keyField:{default:"value"},multiple:{type:Boolean,default:!1},name:{},serviceName:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e,t=Z.ref([]),d=Z.ref(!1),n=Z.useModel(e,"modelValue"),a=$.createAxiosWithoutCache(),i=$.useEnumApi(a);async function s(){!l.name||!l.serviceName||(d.value=!0,i.queryByName(l.serviceName,l.name).then(h=>{t.value=h.values}).finally(()=>{d.value=!1}))}const c=Z.computed(()=>l.multiple?n.value.map(h=>h[l.keyField])||[]:n.value[0]!==void 0?n.value[0][l.keyField]:""),F=h=>{if(typeof h=="string"){const o=t.value.find(V=>V[l.keyField]===h);n.value=o?[o]:[]}else n.value=t.value.filter(o=>h.includes(o[l.keyField]))};return s(),Z.watch(()=>l.name,s),Z.watch(()=>l.serviceName,s),(h,o)=>{const V=Z.resolveDirective("loading");return Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElSelect),{"model-value":c.value,filterable:l.filterable,multiple:l.multiple,clearable:l.clearable,onChange:F},{default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(t.value,W=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElOption),{key:W.id,value:W[l.keyField],label:W.text},null,8,["value","label"]))),128))]),_:1},8,["model-value","filterable","multiple","clearable"])),[[V,d.value]])}}})),Ix=Object.freeze(Object.defineProperty({__proto__:null,AceTip:MG,JaAutocomplete:XX,JaAvatar:xW,JaBaseRolePicker:fW,JaButton:Jt,JaChannelPicker:wX,JaChannelPickerRaw:EX,JaCheckbox:TG,JaCheckboxGroup:OX,JaDatePicker:yG,JaDepartmentPicker:AG,JaDepartmentTree:Eb,JaDropdownButton:LG,JaEnumList:OG,JaEnumListRaw:vG,JaEnumPicker:vX,JaFilePreviewer:pG,JaForm:JG,JaFormItem:ts,JaInput:EW,JaInputI18nRaw:Ab,JaInputNumber:GG,JaMapItemList:fG,JaMapItemListRaw:HG,JaNumberList:xG,JaNumberListRaw:gG,JaPropertyPicker:gX,JaPropertyPickerRaw:jX,JaRadioGroup:yX,JaRoleCategorySelector:IX,JaRolePicker:zX,JaRolePickerRaw:LX,JaScrollbar:Ob,JaSelect:XG,JaStringList:wG,JaStringListRaw:EG,JaSwitch:IG,JaTimePicker:TX,JaUploader:uG,JaUploaderRaw:rG,JaUserGroupPicker:GX,JaUserGroupTree:gb,JaUserInfoTag:r0,JaUserList:JX,JaUserPicker:SX,JaUserPickerRaw:MX,JaUserSelectDialog:jb,getAvatarToken:kb,updateAvatarToken:qG},Symbol.toStringTag,{value:"Module"}));function KX(e){e.directive("focus",vW),e.directive("shortcut",CW),e.directive("auth",zG)}const Dx=[{text:"近一天",value:()=>{const e=new Date,l=new Date;return l.setDate(l.getDate()-1),[l,e]}},{text:"近三天",value:()=>{const e=new Date,l=new Date;return l.setDate(l.getDate()-3),[l,e]}},{text:"近一周",value:()=>{const e=new Date,l=new Date;return l.setDate(l.getDate()-7),[l,e]}},{text:"近一月",value:()=>{const e=new Date,l=new Date;return l.setMonth(l.getMonth()-1),[l,e]}},{text:"近三月",value:()=>{const e=new Date,l=new Date;return l.setMonth(l.getMonth()-3),[l,e]}},{text:"近半年",value:()=>{const e=new Date,l=new Date;return l.setMonth(l.getMonth()-6),[l,e]}},{text:"近一年",value:()=>{const e=new Date,l=new Date;return l.setFullYear(l.getFullYear()-1),[l,e]}}];function wx(e){if(!e)throw new Error("无法获取到应用名称,请确保VITE_APP_NAME环境变量已配置或者在创建时传入appName参数。");if(!window.microApp)throw new Error("无法获取到window.microApp。");const l=Z.ref(new Set),t=(F,h=!0,o=!0)=>{const V={sender:e,timestamp:Date.now(),payload:F};h?window.microApp.forceDispatch(V):window.microApp.dispatch(V,W=>{console.log("消息是否有返回值",W)}),o&&i()},d=(F,h=!0)=>{const o={sender:"app-demo",timestamp:Date.now(),payload:F};window.microApp.setGlobalData(o),h&&i()},n=(F,h=!0)=>{window.microApp.addGlobalDataListener(F,h)},a=()=>window.microApp.getData(),i=()=>{window.microApp.clearData()},s=(F,h=!1)=>{window.microApp.addDataListener(F,h),l.value.add(F)},c=F=>{window.microApp.removeDataListener(F),l.value.delete(F)};return Z.onUnmounted(()=>{window.microApp.clearDataListener(),l.value.clear()}),{sendMessage:t,onMessage:s,clearCache:i,getBaseAppData:a,offMessage:c,listeners:l,sendGlobalMessage:d,onGlobalMessage:n}}let fX=null,G0;function Ex(){return{async getDataTypes(){let e=fX;if(e)return e;if(G0)return await G0;const l=$.createAxiosWithoutCache();return G0=$.useEntityApi(l).getPropertyDataTypes().then(d=>(fX=d,d)).finally(()=>{G0=void 0}),await G0}}}let HX=null,X0;function Cx(){return{async getConstraintProviders(){let e=HX;if(e)return e;if(X0)return await X0;const l=$.createAxiosWithoutCache();return X0=$.useConstraintApi(l).getConstraintProviders().then(d=>(HX=d,d)).finally(()=>{X0=void 0}),await X0}}}const tu=new Map;let eu=new Map;function xx(){return{refreshFileConfigurationCache(e){tu.delete(e)},async getFileConfigurations(e){let l=tu.get(e);if(l)return l;let t=eu.get(e);if(t)return await t;const d=$.createAxiosWithoutCache();return t=$.useFileConfigurationApi(d).getByAppService(e,0,9999999).then(a=>(tu.set(e,a.content),a.content)).finally(()=>{eu.delete(e)}),eu.set(e,t),await t}}}const du=new Map;let nu=new Map;function gx(){return{refreshNumberTemplatesCache(e){du.delete(e)},async getNumberTemplates(e){let l=du.get(e);if(l)return l;let t=nu.get(e);if(t)return await t;const d=$.createAxiosWithoutCache();return t=$.useStringIdTemplateApi(d).getByApp(e,0,9999999).then(a=>(du.set(e,a.content),a.content)).finally(()=>{nu.delete(e)}),nu.set(e,t),await t}}}const au=new Map;let iu=new Map;function jx(){return{refreshEntitiesCache(e){au.delete(e)},async getEntities(e){let l=au.get(e);if(l)return l;let t=iu.get(e);if(t)return await t;const d=$.createAxiosWithoutCache();return t=$.useEntityApi(d).getAll(e).then(a=>(au.set(e,a),a)).finally(()=>{iu.delete(e)}),iu.set(e,t),await t}}}const Ox={install(e){for(const[l,t]of Object.entries(Ix))e.component(l,t);KX(e)}};ll.AceTip=MG,ll.AceVueUI=Ox,ll.JaAutocomplete=XX,ll.JaAvatar=xW,ll.JaBaseRolePicker=fW,ll.JaButton=Jt,ll.JaChannelPicker=wX,ll.JaChannelPickerRaw=EX,ll.JaCheckbox=TG,ll.JaCheckboxGroup=OX,ll.JaDatePicker=yG,ll.JaDepartmentPicker=AG,ll.JaDepartmentTree=Eb,ll.JaDropdownButton=LG,ll.JaEnumList=OG,ll.JaEnumListRaw=vG,ll.JaEnumPicker=vX,ll.JaFilePreviewer=pG,ll.JaForm=JG,ll.JaFormItem=ts,ll.JaInput=EW,ll.JaInputI18nRaw=Ab,ll.JaInputNumber=GG,ll.JaMapItemList=fG,ll.JaMapItemListRaw=HG,ll.JaNumberList=xG,ll.JaNumberListRaw=gG,ll.JaPropertyPicker=gX,ll.JaPropertyPickerRaw=jX,ll.JaRadioGroup=yX,ll.JaRoleCategorySelector=IX,ll.JaRolePicker=zX,ll.JaRolePickerRaw=LX,ll.JaScrollbar=Ob,ll.JaSelect=XG,ll.JaStringList=wG,ll.JaStringListRaw=EG,ll.JaSwitch=IG,ll.JaTimePicker=TX,ll.JaUploader=uG,ll.JaUploaderRaw=rG,ll.JaUserGroupPicker=GX,ll.JaUserGroupTree=gb,ll.JaUserInfoTag=r0,ll.JaUserList=JX,ll.JaUserPicker=SX,ll.JaUserPickerRaw=MX,ll.JaUserSelectDialog=jb,ll.SCROLL_BAR_WRAPPED_INJECT_KEY=Cb,ll.getAvatarToken=kb,ll.installDirectives=KX,ll.shortcuts=Dx,ll.updateAvatarToken=qG,ll.useAppInstances=hU,ll.useBackendValidations=SG,ll.useBridge=wx,ll.useConstraintProviders=Cx,ll.useEntities=jx,ll.useEntityPropDataTypes=Ex,ll.useFileConfigurations=xx,ll.useGroups=FX,ll.useNumberTemplates=gx,ll.useProperties=CX,ll.useRealms=OW,ll.useRoleCategories=BX,ll.useRoles=Pb,ll.useSystemClassificationLevelMap=ru,ll.useSystemClassificationLevels=uu,ll.useTreeData=es,ll.useUserClassificationLevel=py,ll.useUserClassificationLevelMap=My,ll.useUserRefQuery=wb,Object.defineProperty(ll,Symbol.toStringTag,{value:"Module"})});
424
+ -283 -33z'/%3E%3C/g%3E%3C/svg%3E`,xW=Wl(Rt(Z.defineComponent({__name:"JaAvatar",props:{userId:{},username:{},realm:{},doNotLoadAvatar:{type:Boolean,default:!1},hasAvatar:{type:Boolean},firstName:{},size:{},shape:{},icon:{},src:{},alt:{},srcSet:{},fit:{}},setup(e){const l=e,t=kb(),d=Z.ref(!1),n=Z.ref(),a=Z.ref();d.value=!0,Z.onMounted(async()=>{await Z.nextTick()});const i=Z.computed(()=>{if(!(d.value&&l.hasAvatar&&!l.doNotLoadAvatar))return l.firstName?"":zb;if(l.userId&&l.userId.length>0){const F="/ace-app-service/avatar/"+l.userId;return window.appDescriptor.env.isDevMode()?new URL("/ace"+F,location.origin).toString()+"?t="+t.value.toString():new URL(F,location.origin).toString()+"?t="+t.value.toString()}if(l.realm&&l.realm.length>0&&l.username&&l.username.length>0){const F="/ace-app-service/avatar/"+l.realm+"/"+l.username;return window.appDescriptor.env.isDevMode()?new URL("/ace"+F,location.origin).toString()+"?t="+t.value.toString():new URL(F,location.origin).toString()+"?t="+t.value.toString()}return l.firstName?"":zb});function s(F){var V;if(!F)return;let o=((V=n.value)==null?void 0:V.$el.clientWidth)/2.8;F.style.fontSize=o+"px"}Z.onUnmounted(()=>{}),Z.watch(a,()=>s(a.value));const c=Z.computed(()=>{const{userId:F,username:h,realm:o,doNotLoadAvatar:V,hasAvatar:W,firstName:Q,...m}=l;return m});return(F,h)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElAvatar),Z.mergeProps({src:i.value},{...c.value,...F.$attrs},{ref_key:"avatar",ref:n,class:"ja-avatar"}),{default:Z.withCtx(()=>[l.firstName&&l.firstName.length>0?(Z.openBlock(),Z.createElementBlock("span",{key:0,class:"user-name-avatar",ref_key:"usernameSpan",ref:a},Z.toDisplayString(e.firstName),513)):(Z.openBlock(),Z.createBlock(Z.unref(v.ElImage),{key:1,style:{height:"100%"},src:Z.unref(zb),alt:"用户头像"},null,8,["src"]))]),_:1},16,["src"]))}}),[["__scopeId","data-v-0a2b65e1"]]));let Lb;function LC(){return Lb||(Lb=$.createAxiosWithoutCache()),Lb}const IC={class:"portrait"},DC={class:"user-info"},wC={class:"dropdown"},EC={class:"header"},CC={class:"tools"},xC={style:{margin:"0","font-weight":"600"}},gC={style:{margin:"0","font-size":"14px",color:"var(--el-color-info-light-3)"}},jC={style:{margin:"0"}},r0=Wl(Rt(Z.defineComponent({__name:"UserInfoTag",props:{closable:{type:Boolean,default:!1},userId:{},fullName:{default:"无名氏"},realm:{},username:{},theme:{default:"skyGray"},hasAvatar:{type:Boolean},placement:{default:"bottom"}},emits:["closed"],setup(e,{emit:l}){const t={primary:"user-info-tag--root theme-primary",success:"user-info-tag--root theme-success",warning:"user-info-tag--root theme-warning",danger:"user-info-tag--root theme-danger",info:"user-info-tag--root theme-info",lotusPink:"user-info-tag--root theme-lotus-pink",wineRed:"user-info-tag--root theme-wine-red",autumnOrange:"user-info-tag--root theme-autumn-orange",sunYellow:"user-info-tag--root theme-sun-yellow",seaBlue:"user-info-tag--root theme-sea-blue",moonlightBlue:"user-info-tag--root theme-moonlight-blue",clovePurple:"user-info-tag--root theme-clove-purple",skyGray:"user-info-tag--root theme-sky-gray"},d=e,n=Z.ref();let a=LC(),i=$.useLoading(a),s=$.useUserApi(a);const c=Z.ref(!1),F=Z.ref(!1),h=l;Z.onUnmounted(()=>{a=void 0,i=void 0,s=void 0});function o(){if(!n.value)if(d.userId)s==null||s.getById(d.userId).then(R=>{n.value=R,V()});else if(d.username&&d.realm){let R=d.username;if(R.indexOf("\\")>=0){const r=R.split("\\");R=r[r.length-1]}s==null||s.getByUserName(d.realm,R).then(r=>{n.value=r,V()})}else throw new Error("user-info-tag组件的userId和(realm, userName)属性不能都为空")}function V(){n.value&&(s==null||s.checkBookmarked(n.value.id).then(R=>c.value=R))}function W(){F.value=!1,h("closed",d.userId,d.realm,d.username)}function Q(){n.value&&(s==null||s.bookmarkUser(n.value.id).then(()=>c.value=!0))}function m(){n.value&&(s==null||s.unbookmarkUser(n.value.id).then(()=>c.value=!1))}return(R,r)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElPopover),{width:"auto","hide-after":200,onBeforeEnter:o,placement:e.placement,visible:F.value,"onUpdate:visible":r[3]||(r[3]=b=>F.value=b)},{reference:Z.withCtx(()=>[Z.createElementVNode("div",{class:Z.normalizeClass(t[d.theme])},[Z.createElementVNode("div",IC,[Z.createVNode(Z.unref(xW),{size:24,"user-id":e.userId,realm:e.realm,username:e.username,"has-avatar":!1},null,8,["user-id","realm","username"])]),Z.createElementVNode("div",DC,[Z.createTextVNode(Z.toDisplayString(e.fullName)+" ",1),e.closable?(Z.openBlock(),Z.createElementBlock("div",{key:0,class:"close-btn",onClick:r[0]||(r[0]=b=>W())},[Z.createVNode(Z.unref(v.ElIcon),{size:10},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.Close))]),_:1})])):Z.createCommentVNode("",!0)])],2)]),default:Z.withCtx(()=>{var b,u,J,G,T,y,k;return[Z.withDirectives((Z.openBlock(),Z.createElementBlock("div",wC,[Z.createElementVNode("div",EC,[Z.createVNode(Z.unref(xW),{"user-id":e.userId,realm:e.realm,username:e.username,size:75,"has-avatar":(b=n.value)==null?void 0:b.hasAvatar,style:{"margin-bottom":"8px"}},null,8,["user-id","realm","username","has-avatar"]),Z.createElementVNode("div",CC,[Z.createVNode(Z.unref(v.ElTooltip),{content:c.value?"取消常用人员":"设置为常用人员"},{default:Z.withCtx(()=>[c.value?(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:1,color:"#FFBF29",onClick:r[2]||(r[2]=X=>m()),size:16},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.StarFilled))]),_:1})):(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:0,onClick:r[1]||(r[1]=X=>Q()),size:16},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.Star))]),_:1}))]),_:1},8,["content"])])]),Z.createElementVNode("div",null,[Z.createElementVNode("p",xC,Z.toDisplayString(e.fullName),1),Z.createElementVNode("p",gC," @"+Z.toDisplayString(((J=(u=n.value)==null?void 0:u.department)==null?void 0:J.name)??"无归属部门"),1)]),Z.createElementVNode("p",jC,[r[4]||(r[4]=Z.createElementVNode("span",{class:"label"},"手机:",-1)),Z.createTextVNode(" "+Z.toDisplayString(!((G=n.value)!=null&&G.mobile)||n.value.mobile.length===0?"(未填写手机号)":(T=n.value)==null?void 0:T.mobile)+" ",1),r[5]||(r[5]=Z.createElementVNode("br",null,null,-1)),r[6]||(r[6]=Z.createElementVNode("span",{class:"label"},"邮箱:",-1)),Z.createTextVNode(" "+Z.toDisplayString(!((y=n.value)!=null&&y.email)||n.value.email.length===0?"(未填写邮箱号)":(k=n.value)==null?void 0:k.email),1)])])),[[Z.vShow,F.value],[Z.unref(v.vLoading),!!Z.unref(i)]])]}),_:1},8,["placement","visible"]))}}),[["__scopeId","data-v-51ad1216"]]));function gW(e){var l=typeof e;return e!=null&&(l=="object"||l=="function")}var OC=typeof global=="object"&&global&&global.Object===Object&&global,vC=typeof self=="object"&&self&&self.Object===Object&&self,$G=OC||vC||Function("return this")(),Ib=function(){return $G.Date.now()},KC=/\s/;function fC(e){for(var l=e.length;l--&&KC.test(e.charAt(l)););return l}var HC=/^\s+/;function lX(e){return e&&e.slice(0,fC(e)+1).replace(HC,"")}var ZU=$G.Symbol,tX=Object.prototype,PC=tX.hasOwnProperty,AC=tX.toString,p0=ZU?ZU.toStringTag:void 0;function _C(e){var l=PC.call(e,p0),t=e[p0];try{e[p0]=void 0;var d=!0}catch{}var n=AC.call(e);return d&&(l?e[p0]=t:delete e[p0]),n}var qC=Object.prototype,$C=qC.toString;function l9(e){return $C.call(e)}var t9="[object Null]",e9="[object Undefined]",eX=ZU?ZU.toStringTag:void 0;function d9(e){return e==null?e===void 0?e9:t9:eX&&eX in Object(e)?_C(e):l9(e)}function n9(e){return e!=null&&typeof e=="object"}var a9="[object Symbol]";function dX(e){return typeof e=="symbol"||n9(e)&&d9(e)==a9}var nX=NaN,i9=/^[-+]0x[0-9a-f]+$/i,s9=/^0b[01]+$/i,c9=/^0o[0-7]+$/i,U9=parseInt;function aX(e){if(typeof e=="number")return e;if(dX(e))return nX;if(gW(e)){var l=typeof e.valueOf=="function"?e.valueOf():e;e=gW(l)?l+"":l}if(typeof e!="string")return e===0?e:+e;e=lX(e);var t=s9.test(e);return t||c9.test(e)?U9(e.slice(2),t?2:8):i9.test(e)?nX:+e}var Z9="Expected a function",F9=Math.max,h9=Math.min;function Db(e,l,t){var d,n,a,i,s,c,F=0,h=!1,o=!1,V=!0;if(typeof e!="function")throw new TypeError(Z9);l=aX(l)||0,gW(t)&&(h=!!t.leading,o="maxWait"in t,a=o?F9(aX(t.maxWait)||0,l):a,V="trailing"in t?!!t.trailing:V);function W(T){var y=d,k=n;return d=n=void 0,F=T,i=e.apply(k,y),i}function Q(T){return F=T,s=setTimeout(r,l),h?W(T):i}function m(T){var y=T-c,k=T-F,X=l-y;return o?h9(X,a-k):X}function R(T){var y=T-c,k=T-F;return c===void 0||y>=l||y<0||o&&k>=a}function r(){var T=Ib();if(R(T))return b(T);s=setTimeout(r,m(T))}function b(T){return s=void 0,V&&d?W(T):(d=n=void 0,i)}function u(){s!==void 0&&clearTimeout(s),F=0,d=c=n=s=void 0}function J(){return s===void 0?i:b(Ib())}function G(){var T=Ib(),y=R(T);if(d=arguments,n=this,c=T,y){if(s===void 0)return Q(c);if(o)return clearTimeout(s),s=setTimeout(r,l),W(c)}return s===void 0&&(s=setTimeout(r,l)),i}return G.cancel=u,G.flush=J,G}const jW=Z.ref([]);function OW(){const e=$.useRealmApi(),l=async()=>{if(jW.value.length!==0)return;const d={};jW.value=await e.getAll(d)};return{realms:jW,getAllRealms:l,getDefaultRealm:async()=>(await l(),jW.value.find(d=>d.name==="ace-platform"))}}function wb(e,l,t,d,n,a){const i=Z.ref({}),s=Z.ref({currentPage:1,pageSize:50}),c=Z.ref({total:0,users:[]});n||(n=$.createAxiosWithoutCache());const F=$.useUserApi(n),h=$.useLoading(n),o=Z.ref(!1);function V(){m().then(R=>{t&&t(R,o.value),o.value=!1})}const W=Db(V,300);function Q(){c.value.total=0,c.value.users=[],s.value.currentPage!==1?s.value.currentPage=1:W()}Z.watch(i,()=>{o.value=!0,Q()},{deep:!0}),Z.watch(()=>s.value.pageSize,()=>{o.value=!0,Q()}),Z.watch(()=>s.value.currentPage,()=>{m().then(R=>{t&&t(R,o.value),o.value=!1})});async function m(){if(e&&!e())return Promise.resolve(void 0);if(!i.value.realmId){const X=await OW().getDefaultRealm();i.value.realmId=X.id}const R=$.useUserQueryBuilder(),r=R.getQEntity();R.and(r.realm.id.eq(i.value.realmId)).and(r.recycled.eq(!1));const b=i.value.currentDept;b&&(b.id==PG?R.and(r.department.isNull()):b.id!==Yb&&R.and(r.department.sortPath.startWith(b.sortPath)));const u=i.value.classificationLevel;u&&R.and(r.classifiedLevel.loe(u));const J=i.value.currentGroup;J&&R.and(r.userGroups.any().group.sortPath.startWith(J.sortPath));const G=i.value.currentCustomGroup;G&&R.and(r.customGroups.any().customGroup.sortPath.startWith(G.sortPath));const T=i.value.name;if(T){const X="%"+T.split("").join("%")+"%";R.and(r.username.like(X).or(r.fullName.like(X)).or(r.pinYinName.like(X)).or(r.mobile.like(X)))}l&&R.and(l(r));const y=i.value.currentSort;y&&R.orderBy(y);const k=R.build();if(a)return F.queryUserRefs(k).then(X=>(c.value.users=X,X));{const X=s.value.currentPage-1;return F.queryUserRefsPaged(k,X,s.value.pageSize).then(L=>(d&&X>0?c.value.users.push(...L.content):c.value.users=L.content,c.value.total=L.totalElements,L.content))}}return{queryParams:i,pageParams:s,queryResult:c,queryUsers:m,loading:h}}const Eb=Wl(Rt(Z.defineComponent({__name:"departmentTree",props:Z.mergeModels({realmId:{},showNoDepartment:{type:Boolean,default:!1},multiple:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:Z.mergeModels(["change","loaded"],["update:modelValue"]),setup(e,{expose:l,emit:t}){const d=Z.ref(),n=$.createAxiosWithoutCache(),a=$.useLoading(n),i=$.useDepartmentApi(n),s=e,c=t,F=Z.useModel(e,"modelValue"),h=Z.computed({get(){var Q;return(Q=F.value)==null?void 0:Q.id},set(Q){F.value=o.departments.find(m=>m.id===Q)??null}}),o=Z.shallowReactive({departments:[]}),V=async()=>{if(!s.realmId)return;const Q=await i.getNormal(s.realmId,$.FromDeptSelect.BT);o.departments=[{id:Yb,label:"所有部门",name:"所有部门",shortCode:"",children:[],hasChildren:!1,sortIndex:-1,sortPath:"",dataVersion:0,entity:!1,attributes:{}},...s.showNoDepartment?[{id:PG,label:"无归属部门",name:"无归属部门",shortCode:"",children:[],hasChildren:!1,sortIndex:-100,sortPath:"no_dept",dataVersion:0,entity:!1,attributes:{}}]:[],...es(Q,"name")],h.value=o.departments[0].id,c("loaded",o.departments)},W=Q=>{F.value=Q,c("change",Q)};return Z.watch(()=>s.realmId,()=>{V()}),l({reload:V}),V(),(Q,m)=>Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElTree),{ref_key:"deptTree",ref:d,data:Z.unref(o).departments,size:"default","node-key":"id","default-expand-all":"","highlight-current":"","current-node-key":h.value,"expand-on-click-node":!1,onCurrentChange:W,props:{class:R=>{var r;return((r=F.value)==null?void 0:r.id)===R.id?"selected-group":"group"}}},null,8,["data","current-node-key","props"])),[[Z.unref(v.vLoading),Z.unref(a)]])}}),[["__scopeId","data-v-b247a32f"]])),Cb="com.csicit.ace.scrollbar.wrapped";var o9="Expected a function";function M0(e,l,t){var d=!0,n=!0;if(typeof e!="function")throw new TypeError(o9);return gW(t)&&(d="leading"in t?!!t.leading:d,n="trailing"in t?!!t.trailing:n),Db(e,l,{leading:d,maxWait:l,trailing:n})}const Xn=new Map,xb=new Map;let Hl=null,Ll;async function FU(e,l){let t=Xn.get(l);if(t)return t;let d=xb.get(l);return d?await d:(d=e().then(n=>(Xn.set(l,n),n)).finally(()=>{xb.delete(l)}),xb.set(l,d),await d)}async function iX(e){Ll||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl));const l=await FU(()=>Ll.getAll(!0),"all");return e?l:l.filter(t=>t.name!=="ace-app-manage")}async function V9(e){Ll||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl)),await FU(()=>Ll.getAll(!0),"all");let l=Xn.get("all").find(t=>t.id===e);return l||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl),l=await Ll.getById(e),l&&(Xn.get("all").find(t=>t.id===l.id)||Xn.get("all").push(l))),l}async function W9(e){Ll||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl)),await FU(()=>Ll.getAll(!0),"all");let l=Xn.get("all").find(t=>t.name===e);return l||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl),l=await Ll.getByName(e),l&&(Xn.get("all").find(t=>t.id===l.id)||Xn.get("all").push(l))),l}async function sX(){return Ll||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl)),await FU(Ll.getManageable,"manageable")}async function cX(){return Ll||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl)),await FU(Ll.getAccessible,"accessible")}async function UX(){return Ll||(Hl=Hl||$.createAxiosWithoutCache(),Ll=Ll||$.useAppApi(Hl)),(await FU(()=>Ll.getGlobalApp().then(e=>[e]),"global"))[0]}async function Q9(){Xn.clear(),await Promise.all([iX(),sX(),cX(),UX()])}function hU(){return{getAll:iX,getByName:W9,getById:V9,getManageable:sX,getAccessible:cX,getGlobal:UX,refresh:Q9}}const S0=new Map;let oU=new Map;function ZX(e,l,t,d){return e+":"+l+":"+(t??"")+":"+(d?"all":"by-category")}function FX(){return{refreshGroupsCache(){S0.clear()},async getGroups(e,l,t,d){const n=ZX(e,l,t,d);let a=S0.get(n);if(a)return a;let i=oU.get(n);if(i)return await i;const s=$.createAxiosWithoutCache(),c=$.useUserGroupApi(s);return d?i=c.getAll(e,l):i=c.getByAppIdAndRealm(e,l,t),i=i.then(F=>(S0.set(n,F),F)).finally(()=>{oU.delete(n)}),oU.set(n,i),await i},async getGlobalGroups(e,l){const d=ZX("[global-app]",e,l,!0);let n=S0.get(d);if(n)return n;let a=oU.get(d);if(a)return await a;const i=$.createAxiosWithoutCache();return a=$.useUserGroupApi(i).getGlobalGroups(e,l).then(c=>(S0.set(d,c),c)).finally(()=>{oU.delete(d)}),oU.set(d,a),await a}}}const m9={class:"ja-user-group-tree"},R9={class:"name"},gb=Wl(Rt(Z.defineComponent({__name:"userGroupTree",props:Z.mergeModels({realmId:{},multiple:{type:Boolean},showConsoleApp:{type:Boolean},appId:{},nodeHeight:{default:"auto"},category:{},global:{type:Boolean},showAllCategory:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:Z.mergeModels(["change","loaded"],["update:modelValue"]),async setup(e,{expose:l,emit:t}){let d,n;const a=Z.ref(),i=$.createAxiosWithoutCache(),s=$.useLoading(i),c=e,F=t,h=Z.useModel(e,"modelValue"),o=Z.ref(c.appId),V=Z.computed({get(){var y;return(y=h.value)==null?void 0:y.id},set(y){h.value=J.groups.find(k=>k.id===y)??null}}),{getGlobal:W,getAccessible:Q}=hU(),{getGroups:m,getGlobalGroups:R}=FX();let[r,b]=([d,n]=Z.withAsyncContext(()=>Promise.all([W(),Q()])),d=await d,n(),d);if(b=[...b],b.unshift(r),!c.showConsoleApp){const y=b.findIndex(k=>k.name=="ace-app-manage");y>=0&&b.splice(y,1)}const u=Z.ref(b);o.value||(o.value=r.id);const J=Z.shallowReactive({groups:[]}),G=async()=>{if(!c.realmId||!o.value)return;let y;c.global?y=await R(c.realmId):y=await m(o.value,c.realmId,c.category,c.showAllCategory),J.groups=[...es(y,"name")],!h.value&&J.groups.length>0&&(V.value=J.groups[0].id),F("loaded",J.groups)},T=y=>{h.value=y,F("change",y)};return Z.watch(()=>({appId:c.appId,realmId:c.realmId,category:c.category}),()=>{G()},{deep:!0,immediate:!0}),Z.watch(()=>c.appId,()=>{o.value=c.appId}),l({reload:G,elTree:a}),(y,k)=>(Z.openBlock(),Z.createElementBlock("div",m9,[c.appId?Z.createCommentVNode("",!0):(Z.openBlock(),Z.createBlock(Z.unref(v.ElSelect),{key:0,modelValue:o.value,"onUpdate:modelValue":k[0]||(k[0]=X=>o.value=X),style:{width:"100%"}},{default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(u.value,X=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElOption),{key:X.id,label:X.caption,value:X.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])),Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElTree),Z.mergeProps({style:{width:"100%","--ja-group-tree-node-height":c.nodeHeight},ref_key:"groupTree",ref:a,data:Z.unref(J).groups,size:"default","node-key":"id","highlight-current":"","default-expand-all":"","current-node-key":V.value,"expand-on-click-node":!1},y.$attrs,{onCurrentChange:T,props:{class:X=>{var L;return((L=h.value)==null?void 0:L.id)===X.id?"selected-group":"group"}}}),{default:Z.withCtx(({data:X})=>[Z.createElementVNode("div",null,[Z.createElementVNode("div",R9,[Z.createTextVNode(Z.toDisplayString(X.label)+" ",1),X.resourceScoped?(Z.openBlock(),Z.createBlock(Z.unref(v.ElTag),{key:0,type:"info"},{default:Z.withCtx(()=>[...k[1]||(k[1]=[Z.createTextVNode("资源域",-1)])]),_:1})):Z.createCommentVNode("",!0)])])]),_:1},16,["style","data","current-node-key","props"])),[[Z.unref(v.vLoading),Z.unref(s)]])]))}}),[["__scopeId","data-v-029d0f4c"]])),N9=Wl(Rt(Z.defineComponent({__name:"customGroupTree",props:Z.mergeModels({multiple:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:Z.mergeModels(["change","loaded"],["update:modelValue"]),setup(e,{expose:l,emit:t}){const d=Z.ref(),n=$.createAxiosWithoutCache(),a=$.useLoading(n),i=$.useCustomGroupApi(n),s=t,c=Z.useModel(e,"modelValue"),F=Z.computed({get(){var W;return(W=c.value)==null?void 0:W.id},set(W){c.value=h.groups.find(Q=>Q.id===W)??null}}),h=Z.shallowReactive({groups:[]}),o=async()=>{const W=await i.getAll();h.groups=[...es(W,"name")],h.groups.length>0&&(c.value=h.groups[0],F.value=c.value.id),s("loaded",h.groups)},V=W=>{c.value=W,s("change",W)};return l({reload:o}),o(),(W,Q)=>Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElTree),{ref_key:"deptTree",ref:d,data:Z.unref(h).groups,size:"default","node-key":"id","default-expand-all":"","highlight-current":"","current-node-key":F.value,"expand-on-click-node":!1,onCurrentChange:V,props:{class:m=>{var R;return((R=c.value)==null?void 0:R.id)===m.id?"selected-group":"group"}}},null,8,["data","current-node-key","props"])),[[Z.unref(v.vLoading),Z.unref(a)]])}}),[["__scopeId","data-v-4e04bc5c"]])),b9={class:"ja-user-select-dialog"},u9={class:"ja-user-select-dialog__content"},r9={style:{display:"flex","flex-direction":"row","align-content":"baseline",width:"100%",gap:"0"}},jb=Wl(Rt(Z.defineComponent({__name:"userSelectDialog",props:Z.mergeModels({realmId:{type:String,required:!1},multiple:{type:Boolean,required:!1,default:!1},classificationLevel:{type:Number,required:!1,default:0},customFilter:{type:Function,required:!1},maxSelect:{type:Number,required:!1,default:0}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e,{expose:l}){const t=e,d=Z.useModel(e,"modelValue"),n=Z.ref();async function a(){if(t.realmId)n.value=t.realmId;else{const K=await OW().getDefaultRealm();n.value=K.id}}if(a(),t.multiple){if(d.value||(d.value=[]),!Array.isArray(d.value))throw new Error("多选模式的选择用户对话框(multiple设置为true)的v-model必须是数组类型")}else if(Array.isArray(d.value))throw new Error("单选模式的选择用户对话框(multiple设置为false)的v-model只能为空或是单个UserReference对象");const i=Z.ref(!1),s=Z.ref(),c=Z.ref(),F=Z.ref(),h=$.createAxiosWithoutCache(),o=$.useLoading(h),V=Z.ref(!1),W=Z.ref([]),Q=Z.reactive(new Map),m=Z.ref("dept");Z.provide(Cb,void 0);const R=Z.ref(Array.isArray(d.value)?[...d.value]:d.value),r=wb(void 0,t.customFilter,K=>{V.value||(W.value=K??[])},!1,h,!0),b=[{key:"user",dataKey:"id",width:290,title:"用户",cellRenderer:({cellData:K,rowData:x,rowIndex:_})=>{const{hasAvatar:al,fullName:P}=x,A=x,tl=_;return Z.h("div",{class:"user-row",onMousedown:()=>Y(A),onMouseenter:()=>z(A),onMouseup:B,onMouseover:el=>O(el,tl)},[Z.h(v.ElIcon,{color:"#0D6A9F"},()=>y(A)?Z.h(Nl.Check):void 0),Z.h(r0,{userId:K,theme:k(A),placement:"right-start",hasAvatar:!1,fullName:P}),Z.h("div",{style:"flex:auto"})])}}],u=Z.ref(!1),J=Z.ref(),G=M0(w,100),T=M0(X,100);Z.watch(s,()=>{m.value=="dept"&&(r.queryParams.value.currentDept=s.value)}),Z.watch(c,()=>{m.value=="group"&&(r.queryParams.value.currentGroup=c.value)}),Z.watch(F,()=>{m.value=="customGroup"&&(r.queryParams.value.currentCustomGroup=F.value)}),Z.watch(()=>t.classificationLevel,()=>{r.queryParams.value.classificationLevel=t.classificationLevel}),Z.watch(m,()=>{m.value==="dept"?(r.queryParams.value.currentDept=s.value,r.queryParams.value.currentGroup=void 0,r.queryParams.value.currentCustomGroup=void 0):m.value==="group"?(r.queryParams.value.currentDept=void 0,r.queryParams.value.currentCustomGroup=void 0,r.queryParams.value.currentGroup=c.value):m.value==="customGroup"&&(r.queryParams.value.currentDept=void 0,r.queryParams.value.currentCustomGroup=F.value,r.queryParams.value.currentGroup=void 0)});function y(K){return Array.isArray(R.value)?Q.has(K.id):R.value&&R.value.id===K.id}function k(K){return y(K)?"autumnOrange":"skyGray"}function X(K){if(Array.isArray(R.value)){const x=R.value.findIndex(_=>_.id===K.id);if(x>=0)Q.delete(K.id),R.value.splice(x,1);else{if(t.maxSelect>0&&R.value.length>=t.maxSelect){v.ElMessage({message:`已超过最大选择数量 ${t.maxSelect}`,type:"warning",plain:!0});return}Q.set(K.id,K),R.value.push(K)}}else R.value=K}Z.onUnmounted(()=>{G.cancel(),T.cancel()});function L(){if(Array.isArray(R.value)){const K=r.queryResult.value.users.filter(x=>!y(x));if(t.maxSelect>0){const x=t.maxSelect-R.value.length;if(x>0){const _=K.slice(0,x);_.forEach(al=>Q.set(al.id,al)),R.value.push(..._)}}else K.forEach(x=>Q.set(x.id,x)),R.value.push(...K)}}function D(){Array.isArray(R.value)&&(Q.clear(),R.value.splice(0))}function C(){if(Array.isArray(R.value)){const K=r.queryResult.value.users.filter(x=>!y(x));if(Q.clear(),t.maxSelect>0){const x=K.slice(0,t.maxSelect);x.forEach(_=>Q.set(_.id,_)),R.value.splice(0),R.value.push(...x)}else K.forEach(x=>Q.set(x.id,x)),R.value.splice(0),R.value.push(...K)}}function I(){if(t.multiple&&Array.isArray(R.value)&&t.maxSelect>0&&R.value.length>t.maxSelect){v.ElMessage({message:`已超过最大选择数量 ${t.maxSelect}`,type:"warning",plain:!0});return}d.value=R.value,i.value=!1}function H(){V.value=!V.value,V.value?Array.isArray(R.value)?W.value=[...R.value]:W.value=R.value?[R.value]:[]:W.value=r.queryResult.value.users}function f(){!r.queryParams.value.realmId&&n.value&&(r.queryParams.value.realmId=n.value),R.value=Array.isArray(d.value)?[...d.value]:d.value,Array.isArray(d.value)&&(Q.clear(),d.value.forEach(K=>Q.set(K.id,K)))}function Y(K){X(K),u.value=!0}function B(){u.value=!1}function z(K){u.value&&X(K)}let g;function w(){g&&g<W.value.length&&J.value.scrollToRow(g+1),g=void 0}function O(K,x){u.value=K.buttons>0,u.value&&(g=x,G())}return l({show(){i.value=!0}}),(K,x)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElDialog),{modelValue:i.value,"onUpdate:modelValue":x[5]||(x[5]=_=>i.value=_),"destroy-on-close":"",draggable:"",width:"640",title:"选择人员","append-to-body":"",onOpen:f},{footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{type:"primary",shortcut:"Ctrl+Alt+Enter",onClick:I,size:"default"},{default:Z.withCtx(()=>[...x[10]||(x[10]=[Z.createTextVNode("确定 ",-1)])]),_:1}),Z.createVNode(Z.unref(v.ElButton),{plain:"",size:"default",onClick:x[4]||(x[4]=_=>i.value=!1)},{default:Z.withCtx(()=>[...x[11]||(x[11]=[Z.createTextVNode("取消",-1)])]),_:1})]),default:Z.withCtx(()=>[Z.createElementVNode("div",b9,[Z.createVNode(Z.unref(v.ElTabs),{class:"ja-user-select-dialog__left",modelValue:m.value,"onUpdate:modelValue":x[3]||(x[3]=_=>m.value=_)},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElTabPane),{name:"dept",label:"按部门",class:"ja-user-select-dialog__left-dept-pane"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElScrollbar),{height:"400"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Eb),{modelValue:s.value,"onUpdate:modelValue":x[0]||(x[0]=_=>s.value=_),"realm-id":n.value},null,8,["modelValue","realm-id"])]),_:1})]),_:1}),Z.createVNode(Z.unref(v.ElTabPane),{name:"group",label:"按用户组"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElScrollbar),{height:"400"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(gb),{modelValue:c.value,"onUpdate:modelValue":x[1]||(x[1]=_=>c.value=_),"show-all-category":"","realm-id":n.value},null,8,["modelValue","realm-id"])]),_:1})]),_:1}),Z.createVNode(Z.unref(v.ElTabPane),{name:"customGroup",label:"按自定义组"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElScrollbar),{height:"400"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(N9),{modelValue:F.value,"onUpdate:modelValue":x[2]||(x[2]=_=>F.value=_)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),Z.createElementVNode("div",u9,[Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElTableV2),{ref_key:"userTable",ref:J,"row-height":40,"header-height":40,columns:b,data:W.value,width:300,height:450,fixed:""},{header:Z.withCtx(()=>[Z.createElementVNode("div",r9,[Z.createVNode(Z.unref(v.ElText),{style:{flex:"auto","font-weight":"600"}},{default:Z.withCtx(()=>[x[6]||(x[6]=Z.createTextVNode(" 人员 ",-1)),Z.createVNode(Z.unref(v.ElTooltip),{content:"切换筛选条件,不会清除已选人员。支持鼠标拖动多选。"},{default:Z.withCtx(()=>[t.multiple?(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:0},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.QuestionFilled))]),_:1})):Z.createCommentVNode("",!0)]),_:1})]),_:1}),t.multiple?(Z.openBlock(),Z.createBlock(Z.unref(v.ElText),{key:0,style:{flex:"none","margin-right":"12px"}},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElTooltip),{content:V.value?"显示所有人员":"只显示选中人员"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElIcon),{size:"15",onClick:H},{default:Z.withCtx(()=>[V.value?(Z.openBlock(),Z.createBlock(Z.unref(Nl.View),{key:1})):(Z.openBlock(),Z.createBlock(Z.unref(Nl.Hide),{key:0}))]),_:1})]),_:1},8,["content"])]),_:1})):Z.createCommentVNode("",!0),t.multiple?(Z.openBlock(),Z.createBlock(Z.unref(Jt),{key:1,plain:"",style:{flex:"none"},link:"",tooltip:"全部选中",shortcut:"Ctrl+A",onClick:L},{default:Z.withCtx(()=>[...x[7]||(x[7]=[Z.createTextVNode("全选 ",-1)])]),_:1})):Z.createCommentVNode("",!0),t.multiple?(Z.openBlock(),Z.createBlock(Z.unref(Jt),{key:2,plain:"",style:{flex:"none"},link:"",tooltip:"清除全部选中项",shortcut:"Ctrl+Q",onClick:D},{default:Z.withCtx(()=>[...x[8]||(x[8]=[Z.createTextVNode("全消 ",-1)])]),_:1})):Z.createCommentVNode("",!0),t.multiple?(Z.openBlock(),Z.createBlock(Z.unref(Jt),{key:3,plain:"",style:{flex:"none"},link:"",tooltip:"清除选中项,并选中之前未被选中项",shortcut:"Ctrl+F",onClick:C},{default:Z.withCtx(()=>[...x[9]||(x[9]=[Z.createTextVNode("反选 ",-1)])]),_:1})):Z.createCommentVNode("",!0)])]),_:1},8,["data"])),[[Z.unref(v.vLoading),Z.unref(o)]])])])]),_:1},8,["modelValue"]))}}),[["__scopeId","data-v-90712d51"]])),Ob=Wl(Z.defineComponent({__name:"Scrollbar",props:{ariaLabel:{},ariaOrientation:{},distance:{},height:{},maxHeight:{},native:{type:Boolean},wrapStyle:{},wrapClass:{},viewClass:{},viewStyle:{},noresize:{type:Boolean},tag:{},always:{type:Boolean},minSize:{},tabindex:{},id:{},role:{}},setup(e,{expose:l}){const t=e,d=Z.ref(),n=Z.ref([]),a=new Map;l({elScrollbar:d}),Z.provide(Cb,n);let i=!1;Z.watch(n,()=>{i&&c()},{deep:!0});const s=new IntersectionObserver(h=>{h.forEach(o=>{const V=a.get(o.target);V==null||V.onInView(o.isIntersecting)})});async function c(){var o;await Z.nextTick();const h=(o=d.value)==null?void 0:o.$el;if(!(!n.value||!h)){try{for(let V=0;V<n.value.length;V++)if(n.value[V]){const W=n.value[V],Q=W.childElement.getBoundingClientRect(),m=h.getBoundingClientRect();Q.top>=m.top&&Q.bottom<=m.bottom&&Q.left>=m.left&&Q.right<=m.right&&W.onInView(!0),a.set(W.childElement,W),s.observe(W.childElement)}}finally{n.value&&n.value.splice(0)}i=!0}}Z.onMounted(async()=>{await c()}),Z.onUnmounted(()=>{a.forEach(h=>{s.disconnect()})});const F=Z.computed(()=>t);return(h,o)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElScrollbar),Z.mergeProps({ref_key:"scroll",ref:d,class:"scroll-container"},{...F.value,...h.$attrs}),Z.createSlots({_:2},[Z.renderList(h.$slots,(V,W)=>({name:W,fn:Z.withCtx(()=>[Z.renderSlot(h.$slots,W)])}))]),1040))}}));function p9(e,l){for(var t=-1,d=e==null?0:e.length,n=Array(d);++t<d;)n[t]=l(e[t],t,e);return n}var M9=Array.isArray,hX=ZU?ZU.prototype:void 0,oX=hX?hX.toString:void 0;function vb(e){if(typeof e=="string")return e;if(M9(e))return p9(e,vb)+"";if(dX(e))return oX?oX.call(e):"";var l=e+"";return l=="0"&&1/e==-1/0?"-0":l}function S9(e,l,t,d){for(var n=e.length,a=t+-1;++a<n;)if(l(e[a],a,e))return a;return-1}function J9(e){return e!==e}function T9(e,l,t){for(var d=t-1,n=e.length;++d<n;)if(e[d]===l)return d;return-1}function VX(e,l,t){return l===l?T9(e,l,t):S9(e,J9,t)}function G9(e){return e==null?"":vb(e)}function X9(e,l,t){var d=-1,n=e.length;l<0&&(l=-l>n?0:n+l),t=t>n?n:t,t<0&&(t+=n),n=l>t?0:t-l>>>0,l>>>=0;for(var a=Array(n);++d<n;)a[d]=e[d+l];return a}function y9(e,l,t){var d=e.length;return t=t===void 0?d:t,!l&&t>=d?e:X9(e,l,t)}var B9="\\ud800-\\udfff",Y9="\\u0300-\\u036f",k9="\\ufe20-\\ufe2f",z9="\\u20d0-\\u20ff",L9=Y9+k9+z9,I9="\\ufe0e\\ufe0f",D9="\\u200d",w9=RegExp("["+D9+B9+L9+I9+"]");function E9(e){return w9.test(e)}function C9(e){return e.split("")}var WX="\\ud800-\\udfff",x9="\\u0300-\\u036f",g9="\\ufe20-\\ufe2f",j9="\\u20d0-\\u20ff",O9=x9+g9+j9,v9="\\ufe0e\\ufe0f",K9="["+WX+"]",Kb="["+O9+"]",fb="\\ud83c[\\udffb-\\udfff]",f9="(?:"+Kb+"|"+fb+")",QX="[^"+WX+"]",mX="(?:\\ud83c[\\udde6-\\uddff]){2}",RX="[\\ud800-\\udbff][\\udc00-\\udfff]",H9="\\u200d",NX=f9+"?",bX="["+v9+"]?",P9="(?:"+H9+"(?:"+[QX,mX,RX].join("|")+")"+bX+NX+")*",A9=bX+NX+P9,_9="(?:"+[QX+Kb+"?",Kb,mX,RX,K9].join("|")+")",q9=RegExp(fb+"(?="+fb+")|"+_9+A9,"g");function $9(e){return e.match(q9)||[]}function uX(e){return E9(e)?$9(e):C9(e)}function lx(e,l){for(var t=e.length;t--&&VX(l,e[t],0)>-1;);return t}function tx(e,l){for(var t=-1,d=e.length;++t<d&&VX(l,e[t],0)>-1;);return t}function ex(e,l,t){if(e=G9(e),e&&l===void 0)return lX(e);if(!e||!(l=vb(l)))return e;var d=uX(e),n=uX(l),a=tx(d,n),i=lx(d,n)+1;return y9(d,a,i).join("")}const J0=new Map,vW={mounted(e){let l;if(e instanceof HTMLInputElement)l=setTimeout(()=>e==null?void 0:e.focus(),500),J0.set(e,l);else{const t=e.querySelectorAll("input");t.length>0&&t.item(0)instanceof HTMLInputElement&&(l=setTimeout(()=>{var d;return(d=t==null?void 0:t.item(0))==null?void 0:d.focus()},500),J0.set(e,l))}},onUnmounted(e){J0.has(e)&&(clearTimeout(J0.get(e)),J0.delete(e))}},dx={class:"ja-custom-group-manager"},nx=Rt(Z.defineComponent({__name:"CustomGroupManager",props:{users:{default:()=>[]}},setup(e,{expose:l}){const t=Z.ref(!1),d=$.createAxiosWithoutCache(),n=$.useCustomGroupApi(d),a=Z.ref(),i={label:"name",children:"children",isLeaf:(J,G)=>!J.hasChildren,class:J=>{var G;return J.id===((G=s.value)==null?void 0:G.id)?"selected-group":"group"}},s=Z.ref(),c=Z.ref(!1),F=Z.ref(),h=$.useLoading(d),o=e,V={};async function W(){const J=es(await n.getAll()),G={id:"-1",name:"[顶级组]",children:J,dataVersion:0,hasChildren:J.length>0,label:"",parentId:void 0,sortIndex:0,sortPath:""};return a.value=[G],G}async function Q(){s.value=await W()}function m(J){s.value=J}function R(){F.value=void 0,c.value=!0}async function r(){var J,G;await n.create({name:F.value,parentId:((J=s.value)==null?void 0:J.id)=="-1"||(G=s.value)==null?void 0:G.id}),c.value=!1,await W()}async function b(){s.value&&s.value.id!=="-1"&&(await v.ElMessageBox.confirm("确定要删除选中的自定义组?","确认删除"),await n.delete(s.value.id),await W(),s.value=void 0)}async function u(){var J;if(!s.value||s.value.id==="-1"){v.ElMessage.warning("请选择要保存到的自定义用户组");return}await n.setMembers({id:s.value.id,userIds:((J=o.users)==null?void 0:J.map(G=>G.id))??[]},V),t.value=!1}return l({show(){t.value=!0},close(){t.value=!1}}),(J,G)=>(Z.openBlock(),Z.createElementBlock(Z.Fragment,null,[Z.createVNode(Z.unref(v.ElDialog),{modelValue:t.value,"onUpdate:modelValue":G[1]||(G[1]=T=>t.value=T),"destroy-on-close":"","append-to-body":"",draggable:"",title:"保存为自定义组",width:"360",onOpen:Q},{footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{type:"primary",shortcut:"Alt+O",loading:Z.unref(h),onClick:u},{default:Z.withCtx(()=>[...G[6]||(G[6]=[Z.createTextVNode("确定 ",-1)])]),_:1},8,["loading"]),Z.createVNode(Z.unref(v.ElButton),{onClick:G[0]||(G[0]=T=>t.value=!1)},{default:Z.withCtx(()=>[...G[7]||(G[7]=[Z.createTextVNode("取消",-1)])]),_:1})]),default:Z.withCtx(()=>[Z.createElementVNode("div",dx,[Z.createVNode(Z.unref(v.ElSpace),null,{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElText),null,{default:Z.withCtx(()=>[...G[5]||(G[5]=[Z.createTextVNode("请创建或选择要保存为的自定义组:",-1)])]),_:1}),Z.createVNode(Z.unref(Jt),{circle:"",icon:Z.unref(Nl.Plus),tooltip:"添加自定义组",shortcut:"Alt+G",size:"small",onClick:R,loading:Z.unref(h)},null,8,["icon","loading"]),Z.createVNode(Z.unref(Jt),{circle:"",icon:Z.unref(Nl.Minus),tooltip:"删除自定义组",shortcut:"Alt+D",size:"small",onClick:b,loading:Z.unref(h)},null,8,["icon","loading"])]),_:1}),Z.createVNode(Z.unref(v.ElScrollbar),{height:"360px"},{default:Z.withCtx(()=>{var T;return[Z.createVNode(Z.unref(v.ElTree),{data:a.value,"node-key":"id",props:i,"default-expand-all":"","expand-on-click-node":!1,onCurrentChange:m,"current-node-key":((T=s.value)==null?void 0:T.id)??-1},null,8,["data","current-node-key"])]}),_:1})])]),_:1},8,["modelValue"]),Z.createVNode(Z.unref(v.ElDialog),{modelValue:c.value,"onUpdate:modelValue":G[4]||(G[4]=T=>c.value=T),"destroy-on-close":"","append-to-body":"",title:"添加自定义组",width:"360px"},{footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{type:"primary",shortcut:"Alt+P",onClick:r,loading:Z.unref(h),size:"default"},{default:Z.withCtx(()=>[...G[8]||(G[8]=[Z.createTextVNode(" 确定 ",-1)])]),_:1},8,["loading"]),Z.createVNode(Z.unref(v.ElButton),{onClick:G[3]||(G[3]=T=>c.value=!1),size:"default"},{default:Z.withCtx(()=>[...G[9]||(G[9]=[Z.createTextVNode("取消",-1)])]),_:1})]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElForm),{"label-position":"top"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElFormItem),{label:"自定义组名",required:""},{default:Z.withCtx(()=>[Z.withDirectives(Z.createVNode(Z.unref(v.ElInput),{modelValue:F.value,"onUpdate:modelValue":G[2]||(G[2]=T=>F.value=T),style:{width:"100%"}},null,8,["modelValue"]),[[Z.unref(vW)]])]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}}),[["__scopeId","data-v-1bab28b9"]]),ax={class:"ja-user-list"},ix=["onMouseenter","onMousedown","onMouseover"],sx={key:0,class:"page-indicator"},cx={class:"nb-spinner"},Ux=1,rX=Rt(Z.defineComponent({__name:"JaUserList",props:Z.mergeModels({emptyText:{},multiple:{type:Boolean},total:{},pageSize:{},height:{},loading:{type:Boolean},users:{},maxSelect:{}},{modelValue:{required:!0},modelModifiers:{},page:{required:!0},pageModifiers:{}}),emits:Z.mergeModels(["arrowKeyDown","itemClicked"],["update:modelValue","update:page"]),setup(e,{expose:l,emit:t}){const d=e,n=Z.ref(0),a=Z.ref(),i=Z.ref(!1),s=Z.useModel(e,"modelValue"),c=Z.useModel(e,"page"),F=t,o=M0(()=>{var I;const C=(I=a.value)==null?void 0:I.wrapRef;C&&C.scrollHeight-C.scrollTop<=C.clientHeight+Ux&&c.value<d.total/d.pageSize&&c.value++},200);function V(C){if(d.multiple){if(!Array.isArray(s.value))throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组");const I=s.value.findIndex(H=>H.id==C.id);if(I<0){if(d.maxSelect&&d.maxSelect>0&&s.value.length>=d.maxSelect){v.ElMessage({message:`已超过最大选择数量 ${d.maxSelect}`,plain:!0,type:"warning"});return}s.value.push(C)}else s.value.splice(I,1)}else{if(Array.isArray(s.value))throw new Error("UserPicker组件设置为单选模式时,v-model必须绑定UserReference对象或null");s.value!==null&&C.id===s.value.id?s.value=null:s.value=C}}let W;function Q(C){V(C),i.value=!0,W=C}function m(){i.value=!1,F("itemClicked",W),W=void 0}function R(C){console.log("点击"),i.value&&V(C)}function r(){n.value<d.users.length-1&&n.value++,u()}function b(){n.value>0&&n.value--,u()}const u=()=>{Z.nextTick(()=>{var H,f,Y;const C=(H=a.value)==null?void 0:H.$refs.wrapRef,I=C==null?void 0:C.querySelectorAll("li")[n.value];if(I&&C){const B=I.offsetTop,z=I.offsetTop+I.offsetHeight,g=C.scrollTop,w=C.scrollTop+C.clientHeight;z>w?(f=a.value)==null||f.scrollTo(0,z-C.clientHeight+I.offsetHeight-38):B<g&&((Y=a.value)==null||Y.scrollTo(0,B))}})},J=M0(r,100),G=M0(b,100);function T(C,I){var H;if(n.value=I,i.value=C.buttons>0,i.value){const f=(H=a.value)==null?void 0:H.$refs.wrapRef,Y=C.target;if(Y&&f){const B=Y.offsetTop,z=Y.offsetTop+Y.offsetHeight,g=f.scrollTop,w=f.scrollTop+f.clientHeight;z+20>w?J():B<g+20&&G()}}}function y(C){var I;if(d.multiple){if(!Array.isArray(s.value))throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组");return s.value.some(H=>H.id===C.id)}else{if(Array.isArray(s.value))throw new Error("UserPicker组件设置为单选模式时,v-model必须绑定UserReference对象");return((I=s.value)==null?void 0:I.id)===C.id}}const k=C=>{var I;return Array.isArray(X.value)?X.value.some(H=>H.id===C.id)?"autumnOrange":"skyGray":((I=X.value)==null?void 0:I.id)===C.id?"autumnOrange":"skyGray"},X=Z.computed(()=>{const C=Array.isArray(s.value);if(d.multiple&&C)return s.value;if(!d.multiple&&!C)return s.value?[s.value]:[];if(!d.multiple&&C)return s.value;throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组")});function L(C){return C===n.value?"active":""}const D=Z.computed(()=>d.loading&&d.users.length==0);return l({scrollUp(){b()},scrollDown(){r()},activeIndex:n}),Z.watch(()=>d.users,()=>{n.value=0},{deep:!1}),Z.onUnmounted(()=>{J.cancel(),G.cancel(),o.cancel()}),(C,I)=>(Z.openBlock(),Z.createElementBlock("div",ax,[Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElScrollbar),{height:e.height,ref_key:"scrollbar",ref:a,always:"",onScroll:Z.unref(o)},{default:Z.withCtx(()=>[e.users.length>0?(Z.openBlock(),Z.createElementBlock("ul",{key:0,onMouseup:m},[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(e.users,(H,f)=>(Z.openBlock(),Z.createElementBlock("li",{key:H.id,class:Z.normalizeClass(L(f)),onMouseenter:Y=>i.value&&R(H),onMousedown:Y=>Q(H),onMouseover:Y=>T(Y,f)},[Z.createVNode(Z.unref(v.ElIcon),{color:"#0D6A9F"},{default:Z.withCtx(()=>[y(H)?(Z.openBlock(),Z.createBlock(Z.unref(Nl.Check),{key:0})):Z.createCommentVNode("",!0)]),_:2},1024),Z.createVNode(Z.unref(r0),{"user-id":H.id,"full-name":H.fullName,"has-avatar":H.hasAvatar,placement:"left-start",theme:k(H)},null,8,["user-id","full-name","has-avatar","theme"])],42,ix))),128))],32)):(Z.openBlock(),Z.createBlock(Z.unref(v.ElEmpty),{key:1,description:e.emptyText},null,8,["description"]))]),_:1},8,["height","onScroll"])),[[Z.unref(v.vLoading),D.value]]),e.users.length>0?(Z.openBlock(),Z.createElementBlock("div",sx,[Z.withDirectives(Z.createElementVNode("div",cx,null,512),[[Z.vShow,e.loading]]),Z.createTextVNode(" 已加载 "+Z.toDisplayString(c.value)+" /"+Z.toDisplayString(Math.ceil(e.total/e.pageSize))+"页 ",1)])):Z.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-84465c25"]]),Zx={class:"ja-user-picker__root"},Fx={style:{display:"flex","align-items":"center"}},hx={class:"ja-user-picker-bookmark__dropdown"},ox={style:{width:"100%",display:"flex","align-content":"center","justify-content":"end","margin-bottom":"4px"}},Vx={style:{color:"var(--el-color-info-light-5)"}},Wx={class:"dropdown-header"},Qx={key:0,class:"ja-user-picker__tag-container"},mx={key:0,class:"more-tag"},Rx={key:1},T0=0,pX=Rt(Z.defineComponent({__name:"UserPicker",props:Z.mergeModels({trigger:{default:"hover"},realmId:{},shortcut:{default:"Ctrl+Alt+U"},multiple:{type:Boolean,default:!1},classificationLevel:{default:0},customFilter:{},maxShowCount:{default:20},height:{},maxHeight:{default:"100%"},showUserTag:{type:Boolean,default:!0},maxSelect:{default:0},disabled:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e,t=Z.ref(),d=Z.ref();async function n(){if(l.realmId)t.value=l.realmId;else{const w=await OW().getDefaultRealm();t.value=w.id}}n(),Z.watch(()=>l.realmId,n);const a=$.createAxiosWithoutCache(),i=$.useUserApi(a),s=Z.shallowRef([]),c=Z.useModel(e,"modelValue"),F=Z.ref(),h=Z.ref(!1),{queryResult:o,queryParams:V,pageParams:W,loading:Q}=wb(()=>V.value.name!=null&&V.value.name.length>T0,l.customFilter,(w,O)=>{var K,x;w?(s.value=o.value.users,O&&((x=(K=R.value)==null?void 0:K.elScrollbar)==null||x.scrollTo(0,0))):G()},!0,a,!1),m=Z.ref(),R=Z.ref(),r=Z.ref(),b=Z.ref(),u=Z.ref();function J(w){if(l.multiple){if(!Array.isArray(c.value))throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组");const O=c.value.findIndex(K=>K.id==w.id);if(O<0){if(l.maxSelect>0&&c.value.length>=l.maxSelect){v.ElMessage({message:`已超过最大选择数量 ${l.maxSelect}`,plain:!0,type:"warning"});return}c.value.push(w)}else c.value.splice(O,1)}else{if(Array.isArray(c.value))throw new Error("UserPicker组件设置为单选模式时,v-model必须绑定UserReference对象或者null");c.value!==null&&w.id===c.value.id?c.value=null:c.value=w}}function G(){l.realmId&&(V.value.realmId=l.realmId),V.value.name&&V.value.name.length>T0&&(V.value.name=void 0);const w=$.useUserQueryBuilder();if(l.customFilter){const O=w.getQEntity();w.and(l.customFilter(O))}i.getBookmarkedUsers(w.build()).then(O=>{s.value=O}),setTimeout(()=>{var O;(O=F.value)==null||O.focus()},300)}function T(){var w;h.value=!1,(w=m.value)==null||w.$el.focus()}function y(){var w;(w=b.value)==null||w.show()}function k(w){if(!l.disabled)if(Array.isArray(c.value)){const O=c.value.findIndex(K=>K.id==w);O>=0&&c.value.splice(O,1)}else c.value=null}function X(){var w;u.value.scrollDown(),(w=F.value)==null||w.focus()}function L(){var w;u.value.scrollUp(),(w=F.value)==null||w.focus()}function D(){var w;J(s.value[(w=u.value)==null?void 0:w.activeIndex])}function C(){l.disabled||(h.value=!0)}function I(){const w=c.value,O=s.value.filter(K=>!w.some(x=>x.id===K.id));if(l.maxSelect>0){const K=l.maxSelect-w.length;K>0&&w.push(...O.slice(0,K))}else w.push(...O)}function H(){l.multiple?c.value=[]:c.value=null}function f(){var w;(w=F.value)==null||w.focus()}const Y=Z.computed(()=>{if(l.multiple&&Array.isArray(c.value))return c.value;if(!l.multiple&&!Array.isArray(c.value))return c.value?[c.value]:[];throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组")});function B(){var w;l.disabled||((w=r.value)==null||w.show(),h.value=!1)}function z(){l.disabled||(h.value=!0)}const g=Z.computed(()=>Y.value.slice(0,l.maxShowCount));return Z.watch(()=>l.classificationLevel,()=>{V.value.classificationLevel=l.classificationLevel}),(w,O)=>(Z.openBlock(),Z.createElementBlock(Z.Fragment,null,[Z.createVNode(Z.unref(Ob),Z.mergeProps({"max-height":l.maxHeight,height:l.height},w.$attrs,{style:{"overflow-x":"hidden"}}),{default:Z.withCtx(()=>[Z.withDirectives((Z.openBlock(),Z.createElementBlock("div",Zx,[Z.createVNode(Z.unref(v.ElPopover),{ref_key:"bookmarkDropdown",ref:d,onShow:G,onHide:T,visible:h.value,"onUpdate:visible":O[3]||(O[3]=K=>h.value=K),width:"auto",teleported:"",trigger:l.trigger,disabled:l.disabled},{reference:Z.withCtx(()=>[Z.createElementVNode("div",Fx,[w.$slots.default?Z.renderSlot(w.$slots,"default",{key:0},void 0,!0):(Z.openBlock(),Z.createBlock(Z.unref(v.ElButton),{key:1,circle:"",icon:Z.unref(Nl.Plus),size:"small",ref_key:"btn",ref:m,disabled:l.disabled,onMouseover:z},null,8,["icon","disabled"]))])]),default:Z.withCtx(()=>[Z.createElementVNode("div",hx,[Z.createElementVNode("div",ox,[Z.createVNode(Z.unref(v.ElSpace),{style:{flex:"auto"}},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{circle:"",size:"small",onClick:B,plain:"",type:"primary",tooltip:"对话框筛选(大批量选择)",shortcut:"Ctrl+Alt+I",icon:Z.unref(Nl.Notebook)},null,8,["icon"]),Z.createVNode(Z.unref(Jt),{circle:"",size:"small",onClick:H,type:"danger",plain:"",icon:Z.unref(Nl.Delete),tooltip:"清空选择",shortcut:"Alt+C"},null,8,["icon"]),l.multiple?(Z.openBlock(),Z.createBlock(Z.unref(Jt),{key:0,circle:"",size:"small",onClick:I,type:"success",plain:"",icon:Z.unref(Nl.Finished),tooltip:"全选(已加载的数据)",shortcut:"Ctrl+A"},null,8,["icon"])):Z.createCommentVNode("",!0),Z.createVNode(Z.unref(Jt),{circle:"",size:"small",onClick:y,type:"warning",icon:Z.unref(Nl.Setting),plain:"",tooltip:"将已选中用户保存为自定义组,方便以后选择使用"},null,8,["icon"])]),_:1}),Z.createElementVNode("div",Vx," 弹出快捷键:"+Z.toDisplayString(l.shortcut),1)]),Z.createVNode(Z.unref(v.ElInput),{modelValue:Z.unref(V).name,"onUpdate:modelValue":O[0]||(O[0]=K=>Z.unref(V).name=K),ref_key:"inputSearchText",ref:F,"suffix-icon":Z.unref(Nl.Search),placeholder:"请输入拼音名、姓名或手机号查询",autocomplete:"off",onKeydown:[Z.withKeys(D,["enter"]),Z.withKeys(Z.withModifiers(L,["stop","prevent"]),["up"]),Z.withKeys(Z.withModifiers(X,["stop","prevent"]),["down"])]},null,8,["modelValue","suffix-icon","onKeydown"]),Z.createElementVNode("div",Wx,[Z.createVNode(Z.unref(v.ElText),null,{default:Z.withCtx(()=>[Z.unref(V).name&&Z.unref(V).name.length>T0?(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:0},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.Search))]),_:1})):(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:1,color:"#FFBF29"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.StarFilled))]),_:1})),Z.createTextVNode(" "+Z.toDisplayString(Z.unref(V).name&&Z.unref(V).name.length>T0?"查询结果":"常用人员"),1)]),_:1})]),Z.createVNode(rX,{ref_key:"userList",ref:u,total:Z.unref(o).total,"empty-text":Z.unref(V).name&&Z.unref(V).name.length>T0?void 0:"无可选常用人员","page-size":Z.unref(W).pageSize,loading:Z.unref(Q),users:s.value,height:300,modelValue:c.value,"onUpdate:modelValue":O[1]||(O[1]=K=>c.value=K),page:Z.unref(W).currentPage,"onUpdate:page":O[2]||(O[2]=K=>Z.unref(W).currentPage=K),multiple:l.multiple,maxSelect:l.maxSelect,onItemClicked:f,onArrowKeyDown:f},null,8,["total","empty-text","page-size","loading","users","modelValue","page","multiple","maxSelect"])])]),_:3},8,["visible","trigger","disabled"]),l.showUserTag?(Z.openBlock(),Z.createElementBlock("div",Qx,[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(g.value,K=>(Z.openBlock(),Z.createBlock(Z.unref(r0),{key:K.id,"user-id":K.id,"full-name":K.fullName,closable:!l.disabled,"has-avatar":K.hasAvatar,onClosed:k},null,8,["user-id","full-name","closable","has-avatar"]))),128)),Y.value.length>l.maxShowCount?(Z.openBlock(),Z.createElementBlock("div",mx," +"+Z.toDisplayString(Y.value.length-l.maxShowCount)+"人 ",1)):Z.createCommentVNode("",!0),Y.value.length===0?(Z.openBlock(),Z.createElementBlock("div",Rx,[Z.createVNode(Z.unref(v.ElText),{type:"info"},{default:Z.withCtx(()=>[...O[5]||(O[5]=[Z.createTextVNode(" <暂无选中人员>",-1)])]),_:1})])):Z.createCommentVNode("",!0)])):Z.createCommentVNode("",!0),Z.createVNode(Z.unref(jb),{ref_key:"dialogUserSelector",ref:r,multiple:l.multiple,"realm-id":t.value,classificationLevel:l.classificationLevel,customFilter:l.customFilter,maxSelect:l.maxSelect,modelValue:c.value,"onUpdate:modelValue":O[4]||(O[4]=K=>c.value=K)},null,8,["multiple","realm-id","classificationLevel","customFilter","maxSelect","modelValue"])])),[[Z.unref(CW),l.disabled?void 0:C,l.shortcut]])]),_:3},16,["max-height","height"]),Z.createVNode(nx,{ref_key:"dlgCustomGroupManager",ref:b,users:Array.isArray(c.value)?c.value:c.value?[c.value]:null},null,8,["users"])],64))}}),[["__scopeId","data-v-8c204f38"]]),Nx=Z.defineComponent({__name:"JaUserPicker",emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d)??[]);return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)??[]},{deep:!0}),(c,F)=>(Z.openBlock(),Z.createBlock(pX,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),onChange:i},c.$attrs),{default:Z.withCtx(()=>[Z.renderSlot(c.$slots,"default")]),_:3},16,["modelValue"]))}}),MX=Wl(pX),SX=Wl(Nx),JX=Wl(rX),TX=Wl(Z.defineComponent({__name:"JaTimePicker",props:{showNow:{type:Boolean},showConfirm:{type:Boolean},showFooter:{type:Boolean},showWeekNumber:{type:Boolean},ariaLabel:{},emptyValues:{},valueOnClear:{},disabledDate:{},cellClassName:{},shortcuts:{},arrowControl:{type:Boolean},tabindex:{},validateEvent:{type:Boolean},unlinkPanels:{type:Boolean},placement:{},fallbackPlacements:{},disabledHours:{},disabledMinutes:{},disabledSeconds:{},automaticDropdown:{type:Boolean},id:{},name:{},popperClass:{},popperStyle:{},format:{},valueFormat:{},dateFormat:{},timeFormat:{},type:{},clearable:{type:Boolean},clearIcon:{},editable:{type:Boolean},prefixIcon:{},size:{},readonly:{type:Boolean},disabled:{type:Boolean},placeholder:{},popperOptions:{},modelValue:{},rangeSeparator:{},startPlaceholder:{},endPlaceholder:{},defaultValue:{},defaultTime:{},isRange:{type:Boolean}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t,c=e,F=Z.ref({});function h(W){i.removeFieldError(a),Nt(n.formData,a,o.value),s("change",W)}const o=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{o.value=pl(n.formData,a)},{deep:!0});const V=Z.computed(()=>{const{modelValue:W,...Q}=c;return Q});return Z.onMounted(()=>{d.value&&Object.entries(d.value).filter(([Q,m])=>m instanceof Function).forEach(([Q,m])=>{F.value[Q]=m})}),l(F.value),(W,Q)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTimePicker),Z.mergeProps({ref_key:"input",ref:d,modelValue:Z.unref(n).formData[Z.unref(a)],"onUpdate:modelValue":Q[0]||(Q[0]=m=>Z.unref(n).formData[Z.unref(a)]=m),onChange:h},{...V.value,...W.$attrs}),Z.createSlots({_:2},[Z.renderList(W.$slots,(m,R)=>({name:R,fn:Z.withCtx(()=>[Z.renderSlot(W.$slots,R)])}))]),1040,["modelValue"]))}})),GX=Wl(Z.defineComponent({__name:"UserGroupPicker",props:Z.mergeModels({realmId:{},appId:{},modelValue:{},size:{default:"default"},multiple:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:Z.mergeModels(["change"],["update:modelValue"]),setup(e,{emit:l}){const t=$.createAxiosWithoutCache(),d=$.useUserGroupApi(t),n=e,a=Z.useModel(e,"modelValue"),i=l;if(n.multiple&&!Array.isArray(a.value))throw new Error("用户组选择器设置multiple为true,但是绑定的v-model值是单值");if(!n.multiple&&Array.isArray(a.value))throw new Error("用户组选择器未设置multiple为true,但是绑定的v-model值是数组");const s=Z.reactive({groups:[]}),c=()=>{!n.realmId||!n.appId||d.getByAppIdAndRealm(n.appId,n.realmId??"0").then(h=>{s.groups=[...es(h,"name")],!a.value&&!n.multiple&&(a.value=s.groups[0].id)})},F=h=>{i("change",Array.isArray(h)?s.groups.filter(o=>h.findIndex(V=>o.id===V)>=0):s.groups.find(o=>o.id===h))};return c(),Z.watch(()=>n.realmId,()=>{c()}),Z.watch(()=>n.appId,c),(h,o)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTreeSelect),Z.mergeProps({style:{width:"100%"},data:s.groups,size:n.size,"node-key":"id","check-strictly":"","current-node-key":a.value,"highlight-current":"",modelValue:a.value,"onUpdate:modelValue":o[0]||(o[0]=V=>a.value=V),multiple:e.multiple,onChange:F},h.$attrs,{"collapse-tags":"","collapse-tags-tooltip":"","tag-type":"info",teleported:""}),null,16,["data","size","current-node-key","modelValue","multiple"]))}})),XX=Wl(Z.defineComponent({__name:"JaAutoComplete",props:{valueKey:{},modelValue:{},debounce:{},placement:{},fetchSuggestions:{},popperClass:{},popperStyle:{},triggerOnFocus:{type:Boolean},selectWhenUnmatched:{type:Boolean},hideLoading:{type:Boolean},teleported:{type:Boolean},appendTo:{},highlightFirstItem:{type:Boolean},fitInputWidth:{type:Boolean},loopNavigation:{type:Boolean},inputmode:{},name:{},ariaLabel:{},id:{},size:{},disabled:{type:Boolean},modelModifiers:{},maxlength:{},minlength:{},type:{},resize:{},autosize:{},autocomplete:{},formatter:{},parser:{},placeholder:{},form:{},readonly:{type:Boolean},clearable:{type:Boolean},clearIcon:{},showPassword:{type:Boolean},showWordLimit:{type:Boolean},wordLimitPosition:{},suffixIcon:{},prefixIcon:{},containerRole:{},tabindex:{},validateEvent:{type:Boolean},inputStyle:{},autofocus:{type:Boolean},rows:{}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t;function c(V){i.removeFieldError(a),Nt(n.formData,a,F.value),s("change",V)}const F=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{F.value=pl(n.formData,a)},{deep:!0}),l({elAutocomplete:d});const h=e,o=Z.computed(()=>h);return(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElAutocomplete),Z.mergeProps({ref_key:"input",ref:d,modelValue:F.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>F.value=Q),onChange:c},{...o.value,...V.$attrs}),Z.createSlots({_:2},[Z.renderList(V.$slots,(Q,m)=>({name:m,fn:Z.withCtx(()=>[Z.renderSlot(V.$slots,m)])}))]),1040,["modelValue"]))}})),yX=Wl(Z.defineComponent({__name:"JaRadioGroup",props:{ariaLabel:{},id:{},size:{},disabled:{type:Boolean},modelValue:{},fill:{},textColor:{},name:{},validateEvent:{type:Boolean},options:{},props:{},type:{}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t,c=e;function F(V){i.removeFieldError(a),Nt(n.formData,a,h.value),s("change",V)}const h=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{h.value=pl(n.formData,a)},{deep:!0});const o=Z.computed(()=>{const{modelValue:V,...W}=c;return W});return l({focus:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.focus)==null?void 0:W.call(V)},blur:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.blur)==null?void 0:W.call(V)},elRadioGroup:d}),(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElRadioGroup),Z.mergeProps({ref_key:"input",ref:d,modelValue:h.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>h.value=Q),onChange:F},{...o.value,...V.$attrs}),Z.createSlots({_:2},[Z.renderList(V.$slots,(Q,m)=>({name:m,fn:Z.withCtx(()=>[Z.renderSlot(V.$slots,m)])}))]),1040,["modelValue"]))}})),KW=new Map;let Hb=new Map;function Pb(){return{refreshRolesCache(e){KW.delete(e),console.log("roles cache cleared for app:",e,KW.get(e))},async getRoles(e){let l=KW.get(e);if(l)return l;let t=Hb.get(e);if(t)return await t;const d=$.createAxiosWithoutCache();return t=$.useRoleApi(d).getAllRole(e).then(a=>(KW.set(e,a),a)).finally(()=>{Hb.delete(e)}),Hb.set(e,t),await t}}}const bx=Z.defineComponent({__name:"baseRolePicker",props:Z.mergeModels({appName:{}},{modelValue:{},modelModifiers:{}}),emits:Z.mergeModels(["change"],["update:modelValue"]),setup(e,{expose:l,emit:t}){const{getRoles:d}=Pb(),n=e,a=Z.ref(),i=Z.ref([]),s=hU(),c=async()=>{n.appName&&(a.value=await s.getByName(n.appName),i.value=await d(a.value.id),F.value?o.value=m(F.value,i.value):o.value=void 0)},F=Z.useModel(e,"modelValue"),h=t,o=Z.ref();Z.watch(()=>n.appName,c),c();const V={label:R=>R.caption?R.caption:R.name,isLeaf:R=>!R.hasChildren},W=Z.ref();function Q(R){o.value=m(R,i.value),h("change",R)}function m(R,r){for(let b=0;b<r.length;b++){if(r[b].name===R)return r[b];const u=r[b].children;if(u){const J=m(R,u);if(J)return J}}}return l({loadData:c,currentRole:o,elTreeSelect:W}),(R,r)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTreeSelect),Z.mergeProps({ref_key:"select",ref:W,data:i.value,"node-key":"name","current-node-key":F.value,"value-key":"name",props:V},R.$attrs,{clearable:"","check-strictly":"","highlight-current":!0,onChange:Q,modelValue:F.value,"onUpdate:modelValue":r[0]||(r[0]=b=>F.value=b)}),Z.createSlots({_:2},[Z.renderList(R.$slots,(b,u)=>({name:u,fn:Z.withCtx(()=>[Z.renderSlot(R.$slots,u)])}))]),1040,["data","current-node-key","modelValue"]))}}),ux=Z.defineComponent({__name:"I18nBundleEditor",props:Z.mergeModels({appId:{},preKey:{}},{modelValue:{type:Boolean,default:!1,required:!0},modelModifiers:{}}),emits:Z.mergeModels(["success"],["update:modelValue"]),setup(e,{emit:l}){const t=Z.useModel(e,"modelValue"),d=e,n=$.createAxiosWithoutCache(),a=$.useAppMessageApi(n),i=Z.ref(),s=Z.ref(""),c=Z.ref({}),F=l,h=hU();function o(){W(),s.value=d.preKey??"",c.value={}}async function V(){const Q={key:s.value,messages:c.value,appInstance:{id:d.appId}};await a.createBundle(Q),t.value=!1,F("success",s.value)}async function W(){i.value=await h.getById(d.appId)}return Z.watch(()=>d.appId,async()=>{await W()}),(Q,m)=>{const R=Z.resolveDirective("focus");return Z.openBlock(),Z.createBlock(Z.unref(v.ElDrawer),{"destroy-on-close":"","append-to-body":"",modelValue:t.value,"onUpdate:modelValue":m[2]||(m[2]=r=>t.value=r),title:"创建国际化文本",onOpen:o},{footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{size:"default",shortcut:"Alt+Enter",type:"primary",onClick:V},{default:Z.withCtx(()=>[...m[3]||(m[3]=[Z.createTextVNode("确定 ",-1)])]),_:1}),Z.createVNode(Z.unref(v.ElButton),{size:"default",plain:"",onClick:m[1]||(m[1]=r=>t.value=!1)},{default:Z.withCtx(()=>[...m[4]||(m[4]=[Z.createTextVNode("取消",-1)])]),_:1})]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElForm),{"label-position":"top",size:"default"},{default:Z.withCtx(()=>{var r;return[Z.createVNode(Z.unref(v.ElFormItem),{label:"文本键",required:""},{default:Z.withCtx(()=>[Z.withDirectives(Z.createVNode(Z.unref(v.ElInput),{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=b=>s.value=b)},null,8,["modelValue"]),[[R]])]),_:1}),(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList((r=i.value)==null?void 0:r.supportedLocales,b=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElFormItem),{key:b,label:b},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElInput),{type:"textarea",rows:4,modelValue:c.value[b],"onUpdate:modelValue":u=>c.value[b]=u},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]))),128))]}),_:1})]),_:1},8,["modelValue"])}}}),rx={class:"ja-input-i18n"},Ab=Wl(Rt(Z.defineComponent({__name:"InputI18n",props:Z.mergeModels({appId:{},size:{default:"default"},textarea:{type:Boolean,default:!1},disabled:{type:Boolean}},{modelValue:{default:""},modelModifiers:{}}),emits:Z.mergeModels(["change","focus","blur"],["update:modelValue"]),setup(e,{expose:l,emit:t}){const d=e,n=Z.useModel(e,"modelValue"),a=$.createAxiosWithoutCache(),i=$.useAppMessageApi(a),s=$.useLoginUser().locale,c=Z.ref(),F=Z.ref(!1),h=Z.ref(!1),o=Z.ref(),V=Z.ref(""),W=hU(),Q=Z.ref(""),m=Z.ref(""),R=Z.ref(),r=t,b=Db(J,500);let u;async function J(L){if(L||(L=n.value),!d.appId)return;m.value=L;const D=await W.getById(d.appId);if(V.value=D.name,!L||L.length===0||!V.value){m.value="";return}let C=L;L&&L.length>0&&(C=ex(C),C.startsWith("{")&&C.endsWith("}")&&(C=C.substring(1,C.length-1)));const H=(await i.getByKey(V.value,C,{cancelDuplicatedRequest:!1})).find(f=>f.locale===s);H&&(await Z.nextTick(),m.value=H.message)}async function G(L){Q.value=L,c.value=await i.searchKeys(V.value,L)}async function T(){var L;F.value=!0,await Z.nextTick(),r("focus"),(L=o.value)==null||L.focus()}function y(){u=setTimeout(()=>{F.value=!1},200),r("blur")}Z.onUnmounted(()=>{b.cancel(),u&&clearTimeout(u)}),Z.watch(n,()=>{b()},{deep:!0}),m.value||b();function k(L){r("change",L)}async function X(L){await G(Q.value),n.value="{"+L+"}",R.value.focus}return l({focus(){R==null||R.value.focus()},blur(){o==null||o.value.blur()}}),(L,D)=>(Z.openBlock(),Z.createElementBlock("div",rx,[Z.withDirectives(Z.createVNode(Z.unref(v.ElInput),{ref_key:"selectI18n",ref:R,onFocus:T,modelValue:m.value,"onUpdate:modelValue":D[0]||(D[0]=C=>m.value=C),size:e.size,disabled:e.disabled,type:e.textarea?"textarea":void 0},null,8,["modelValue","size","disabled","type"]),[[Z.vShow,!F.value]]),Z.withDirectives(Z.createVNode(Z.unref(v.ElSelect),{ref_key:"select",ref:o,filterable:"",remote:"","remote-method":G,disabled:e.disabled,"default-first-option":"","reserve-keyword":"","remote-show-suffix":"",onChange:k,size:e.size,"allow-create":"",clearable:"",onBlur:y,modelValue:n.value,"onUpdate:modelValue":D[2]||(D[2]=C=>n.value=C)},{footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{link:"",style:{width:"100%"},type:"primary",onClick:D[1]||(D[1]=C=>h.value=!0),shortcut:"Alt+I"},{default:Z.withCtx(()=>[...D[4]||(D[4]=[Z.createTextVNode(" 新建国际化文本(Alt+I) ",-1)])]),_:1})]),default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(c.value,C=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElOption),{key:C,value:"{"+C+"}",label:"{"+C+"}"},null,8,["value","label"]))),128))]),_:1},8,["disabled","size","modelValue"]),[[Z.vShow,F.value]]),Z.createVNode(ux,{"app-id":e.appId,"pre-key":Q.value,modelValue:h.value,"onUpdate:modelValue":D[3]||(D[3]=C=>h.value=C),onSuccess:X},null,8,["app-id","pre-key","modelValue"])]))}}),[["__scopeId","data-v-f71b8ca0"]])),_b=new Map;let qb=new Map;function BX(){return{refreshRoleCategoryCache(e){_b.delete(e)},async getRoleCategories(e){let l=_b.get(e);if(l)return l;let t=qb.get(e);if(t)return await t;const d=$.createAxiosWithoutCache();return t=$.useRoleCategoryApi(d).getAllRole(e).then(a=>(_b.set(e,a),a)).finally(()=>{qb.delete(e)}),qb.set(e,t),await t}}}const px=["onClick"],Mx={style:{flex:"1"}},Sx={style:{display:"flex",padding:"0 20px 0 10px"}},Jx={style:{flex:"1"}},Tx={key:0,style:{flex:"1","text-align":"right"}},YX=Z.defineComponent({__name:"RoleCategorySelector",props:Z.mergeModels({appId:{},allowEdit:{type:Boolean}},{modelValue:{required:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e,t=$.createAxiosWithoutCache(),d=$.useRoleCategoryApi(t),n=Z.useModel(e,"modelValue"),{getRoleCategories:a,refreshRoleCategoryCache:i}=BX(),s=Z.ref([]),c=Z.ref();async function F(){l.appId&&(s.value=await a(l.appId),s.value.length>0&&(n.value=s.value[0].name),console.log(`Loading categories for ${l.appId}`,s.value))}async function h(){if(!l.appId)throw new Error("appId 参数不能为空");c.value&&!await m()||(c.value={id:"0",name:"",app:{id:l.appId},dataVersion:0},s.value.push(c.value))}async function o(R){c.value&&!await m()||(c.value=R)}async function V(){c.value&&!await m()||(c.value=void 0)}async function W(R){if(c.value){if(!await m())return;c.value=void 0}await d.delete({id:R.id,dataVersion:R.dataVersion}),i(l.appId),s.value.splice(s.value.indexOf(R),1)}function Q(R,r){r===c.value&&(R.preventDefault(),R.stopPropagation())}async function m(){if(!c.value)return!0;if(!c.value.name||c.value.name.length<1)return v.ElMessage.error("类别名称不能为空"),!1;try{let R;return c.value.id=="0"?R=await d.create({name:c.value.name,app:c.value.app},{popValidationErrorNotification:!0}):R=await d.update({...c.value},{popValidationErrorNotification:!0}),i(l.appId),c.value.id=R.id,c.value.dataVersion=R.dataVersion,!0}catch{return!1}}return Z.watch(()=>l.appId,F,{immediate:!0}),(R,r)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElSelect),{modelValue:n.value,"onUpdate:modelValue":r[2]||(r[2]=b=>n.value=b),placeholder:"[未分类]"},{header:Z.withCtx(()=>[Z.createElementVNode("div",Sx,[Z.createElementVNode("div",Jx,[Z.createVNode(Z.unref(v.ElText),null,{default:Z.withCtx(()=>[r[3]||(r[3]=Z.createElementVNode("b",null,"业务分类",-1)),Z.createVNode(Z.unref(v.ElTooltip),{content:"业务分类限制角色只能授予同分类的用户组"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElIcon),null,{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.InfoFilled))]),_:1})]),_:1})]),_:1})]),e.allowEdit?(Z.openBlock(),Z.createElementBlock("div",Tx,[Z.createVNode(u0,{size:"small",type:"primary",plain:"",icon:Z.unref(Nl.Plus),shortcut:"Alt+A",link:"",tooltip:"添加",onClick:Z.withModifiers(h,["prevent","stop"])},null,8,["icon"])])):Z.createCommentVNode("",!0)])]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElOption),{label:"[未分类]",value:""}),(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(s.value,b=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElOption),{key:b.id,label:b.name,value:b.name},{default:Z.withCtx(()=>[Z.createElementVNode("div",{style:{display:"flex",margin:"0 -32px 0 -20px",padding:"0 32px 0 20px"},onClick:u=>Q(u,b)},[Z.createElementVNode("div",Mx,[b!==c.value?(Z.openBlock(),Z.createBlock(Z.unref(v.ElText),{key:0},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(b.name),1)]),_:2},1024)):Z.createCommentVNode("",!0),b===c.value?Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElInput),{key:1,onClick:r[0]||(r[0]=Z.withModifiers(()=>{},["prevent","stop"])),size:"small",modelValue:c.value.name,"onUpdate:modelValue":r[1]||(r[1]=u=>c.value.name=u),maxlength:"255",onKeydown:Z.withKeys(V,["enter"])},null,8,["modelValue"])),[[Z.unref(vW)]]):Z.createCommentVNode("",!0)]),Z.createElementVNode("div",null,[b!==c.value&&e.allowEdit?(Z.openBlock(),Z.createBlock(u0,{key:0,size:"small",type:"primary",icon:Z.unref(Nl.Edit),link:"",onClick:Z.withModifiers(u=>o(b),["stop","prevent"]),tooltip:"修改"},null,8,["icon","onClick"])):Z.createCommentVNode("",!0),b!==c.value&&e.allowEdit?(Z.openBlock(),Z.createBlock(u0,{key:1,size:"small",type:"danger",icon:Z.unref(Nl.Delete),link:"",onClick:Z.withModifiers(u=>W(b),["stop","prevent"]),tooltip:"删除"},null,8,["icon","onClick"])):Z.createCommentVNode("",!0),b===c.value&&e.allowEdit?(Z.openBlock(),Z.createBlock(u0,{key:2,size:"small",type:"primary",icon:Z.unref(Nl.Check),link:"",onClick:Z.withModifiers(V,["stop","prevent"]),tooltip:"提交"},null,8,["icon"])):Z.createCommentVNode("",!0)])],8,px)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue"]))}}),Gx=Z.defineComponent({__name:"RoleEditor",props:Z.mergeModels({appName:{},category:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:Z.mergeModels(["success"],["update:modelValue"]),setup(e,{emit:l}){const t=Z.useModel(e,"modelValue"),d=e,n=l,a={hasChildren:!1,parentId:"0",releaseSource:"",app:{id:"0"},caption:"",compositeRoles:[],dataVersion:0,description:"",id:"0",name:"",category:d.category},i=Z.ref({formData:{...a}}),s=$.createAxiosWithoutCache(),c=SG(Object.keys(a),s),F=$.useLoading(s),h=$.useRoleApi(s),o=Z.ref(),V=Z.ref(),W=Z.ref(),Q=hU(),{refreshRolesCache:m}=Pb();async function R(){if(i.value.formData={...a},!d.appName)throw new Error("rolePicker组件的appName属性不能为空");W.value=await Q.getByName(d.appName)}async function r(){var J,G;if(!d.appName)return;const b=i.value.formData,u=(J=V.value)==null?void 0:J.currentRole;(G=o.value)==null||G.validate(()=>h.create({addTo:u?{id:u.id,name:u.name,app:{id:W.value.id}}:void 0,app:{id:W.value.id},description:b.description,name:b.name,caption:b.caption,category:b.category}).then(T=>{m(W.value.id),n("success",T),t.value=!1}))}return(b,u)=>{const J=Z.resolveComponent("ja-form");return Z.openBlock(),Z.createBlock(Z.unref(v.ElDrawer),{"destroy-on-close":"","append-to-body":"",title:"新建角色",modelValue:t.value,"onUpdate:modelValue":u[3]||(u[3]=G=>t.value=G),onOpen:R},{footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{size:"default",type:"primary",onClick:r,loading:Z.unref(F),shortcut:"Alt+Enter"},{default:Z.withCtx(()=>[...u[4]||(u[4]=[Z.createTextVNode("确定 ",-1)])]),_:1},8,["loading"]),Z.createVNode(Z.unref(v.ElButton),{size:"default",onClick:u[2]||(u[2]=G=>t.value=!1)},{default:Z.withCtx(()=>[...u[5]||(u[5]=[Z.createTextVNode("取消",-1)])]),_:1})]),default:Z.withCtx(()=>[Z.createVNode(J,{ref_key:"formRef",ref:o,model:i.value,validator:Z.unref(c)},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(ts),{label:"角色名称",prop:"name",required:""},{default:Z.withCtx(()=>[Z.withDirectives(Z.createVNode(Z.unref(EW),null,null,512),[[Z.unref(vW)]])]),_:1}),Z.createVNode(Z.unref(ts),{label:"上级角色",prop:"none"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(fW),{ref_key:"rolePicker",ref:V,placeholder:"请选择上级角色,置空表示添加顶层角色","app-name":d.appName},null,8,["app-name"])]),_:1}),Z.createVNode(Z.unref(ts),{label:"角色标题",prop:"caption",required:""},{default:Z.withCtx(()=>{var G;return[Z.createVNode(Z.unref(Ab),{"app-id":(G=W.value)==null?void 0:G.id,size:"small",modelValue:i.value.formData.caption,"onUpdate:modelValue":u[0]||(u[0]=T=>i.value.formData.caption=T)},null,8,["app-id","modelValue"])]}),_:1}),Z.createVNode(Z.unref(ts),{label:"业务分类",prop:"category"},{default:Z.withCtx(()=>{var G;return[Z.createVNode(YX,{"app-id":(G=W.value)==null?void 0:G.id,modelValue:i.value.formData.category,"onUpdate:modelValue":u[1]||(u[1]=T=>i.value.formData.category=T)},null,8,["app-id","modelValue"])]}),_:1}),Z.createVNode(Z.unref(ts),{label:"角色说明",prop:"description"},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(EW),{type:"textarea"})]),_:1})]),_:1},8,["model","validator"])]),_:1},8,["modelValue"])}}}),Xx={class:"ja-role-picker"},kX=Rt(Z.defineComponent({__name:"RolePickerRaw",props:Z.mergeModels({appName:{}},{modelValue:{required:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e,t=Z.useModel(e,"modelValue");function d(s){var c;t.value=s.name,(c=n.value)==null||c.loadData()}const n=Z.ref(),a=Z.ref(!1);function i(){a.value=!0}return(s,c)=>(Z.openBlock(),Z.createElementBlock("div",Xx,[Z.createVNode(Z.unref(fW),Z.mergeProps({ref_key:"picker",ref:n,"app-name":l.appName,style:{flex:"auto"}},s.$attrs,{modelValue:t.value,"onUpdate:modelValue":c[1]||(c[1]=F=>t.value=F)}),Z.createSlots({footer:Z.withCtx(()=>[Z.createVNode(Z.unref(Jt),{link:"",type:"primary",icon:Z.unref(Nl.Plus),shortcut:"Alt+I",style:{width:"100%"},onClick:i},{default:Z.withCtx(()=>[...c[2]||(c[2]=[Z.createTextVNode(" 新建角色(Alt+I) ",-1)])]),_:1},8,["icon"]),Z.createVNode(Gx,{modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=F=>a.value=F),"app-name":l.appName,onSuccess:d},null,8,["modelValue","app-name"])]),_:2},[Z.renderList(s.$slots,(F,h)=>({name:h,fn:Z.withCtx(()=>[Z.renderSlot(s.$slots,h,{},void 0,!0)])}))]),1040,["app-name","modelValue"])]))}}),[["__scopeId","data-v-dd3083a0"]]),yx=Z.defineComponent({__name:"RolePicker",props:{appName:{}},emits:["change"],setup(e,{emit:l}){const t=e,d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=l;function c(h){i.removeFieldError(a),Nt(n.formData,a,F.value),s("change",h)}const F=Z.ref(pl(n.formData,a));return Z.watch(()=>n.formData,()=>{F.value=pl(n.formData,a)},{deep:!0}),(h,o)=>(Z.openBlock(),Z.createBlock(kX,Z.mergeProps({ref_key:"picker",ref:d,"app-name":t.appName,modelValue:F.value,"onUpdate:modelValue":o[0]||(o[0]=V=>F.value=V),onChange:c},h.$attrs),Z.createSlots({_:2},[Z.renderList(h.$slots,(V,W)=>({name:W,fn:Z.withCtx(()=>[Z.renderSlot(h.$slots,W)])}))]),1040,["app-name","modelValue"]))}}),fW=Wl(bx),zX=Wl(yx),LX=Wl(kX),IX=Wl(YX),DX=Z.defineComponent({__name:"ChannelPicker",props:Z.mergeModels({appName:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=$.createAxiosWithoutCache(),t=$.useChannelApi(l),d=e,n=Z.ref(),a=Z.ref(),i=Z.useModel(e,"modelValue");Z.onBeforeMount(()=>{s()});async function s(){console.log("load channels of app "+d.appName),d.appName&&(n.value=await t.getAll(d.appName),a.value=n.value)}function c(F){var h;a.value=((h=n.value)==null?void 0:h.filter(o=>o.name.indexOf(F)>-1))??[]}return Z.watch(()=>d.appName,s),(F,h)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElSelect),Z.mergeProps({filterable:"","filter-method":c,"value-key":"id",modelValue:i.value,"onUpdate:modelValue":h[0]||(h[0]=o=>i.value=o)},F.$attrs),{default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(a.value,o=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElOption),{key:o.id,label:o.name,value:o},null,8,["label","value"]))),128))]),_:1},16,["modelValue"]))}}),wX=Wl(Z.defineComponent({__name:"JaChannelPicker",emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d));return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)},{deep:!0}),(c,F)=>(Z.openBlock(),Z.createBlock(DX,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),onChange:i},c.$attrs),null,16,["modelValue"]))}})),EX=Wl(DX),$b=new Map;let lu=new Map;function CX(){return{refreshProperties(e){$b.delete(e)},async getProperties(e){let l=$b.get(e);if(l)return l;let t=lu.get(e);if(t)return await t;const d=$.createAxiosWithoutCache();return t=$.useEntityApi(d).getProperties(e).then(a=>($b.set(e,a),a)).finally(()=>{lu.delete(e)}),lu.set(e,t),await t}}}const Bx={class:"ja-property-picker__dropdown"},Yx={key:0},kx=["onMouseenter","onClick"],zx={key:0,class:"entity-type"},Lx={key:1},xX=Rt(Z.defineComponent({__name:"PropertyPicker",props:Z.mergeModels({entityId:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e;let t;const d=Z.useModel(e,"modelValue"),n=Z.ref([]),a=$.createAxiosWithoutCache(),{getProperties:i}=CX(),s=Z.ref(),c={},F=Z.ref(0),h=$.useLoading(a),o=Z.ref(!1),V=Z.ref(!1),W=Z.ref(),Q=Z.ref(),m=Z.ref("");let R=Z.ref(!1);async function r(){t||(t=l.entityId),t?s.value=await i(t):s.value=[]}function b(B){let z;B?z=B.join("."):z="",z!==d.value&&(d.value=z),Z.nextTick(async()=>{var w;t=l.entityId,await r();let g=c[t];if(g){for(let O=0;O<B.length;O++){const K=B[O];let x=g.find(_=>_.name===K);x&&x.entityType?(t=x.entityType.id,O<B.length-1?(await r(),g=c[t]):x.dataType==="ENTITY"&&x.collectionType==="NONE"?(t=x.entityType.id,r()):(t="-1",r())):(t="-1",r())}(w=W.value)==null||w.focus()}})}function u(B){return B.caption&&B.caption.length>0?B.name+"("+B.caption+")":B.name}function J(B){F.value=B}function G(B){return F.value===B?"active":""}function T(B){var z,g;(z=n.value)==null||z.push(B.name),m.value="",(g=W.value)==null||g.focus()}function y(B){var z;(z=n.value)==null||z.pop()}function k(){var g;if(!t)return;const B=c[t];if(!B)return;const z=(g=W.value)==null?void 0:g.value;z&&z.length>0?s.value=[...B].filter(w=>w.name.toLowerCase().indexOf(z.toLowerCase())>-1):s.value=B,f()}function X(){s.value&&(F.value<s.value.length-1&&F.value++,f())}function L(){F.value>0&&F.value--,f()}function D(){if(!s.value)return;const B=s.value[F.value];B&&T(B)}function C(){var B;m.value&&m.value.length>0||(B=n.value)==null||B.pop()}function I(B){B&&Z.nextTick(()=>{var z;(z=W.value)==null||z.focus()}),R.value=B}const H=Z.computed(()=>{var B;return n.value&&n.value.length>0?(B=n.value)==null?void 0:B.join("."):"请选择属性"}),f=()=>{Z.nextTick(()=>{var g,w,O;const B=(g=Q.value)==null?void 0:g.$refs.wrapRef,z=B==null?void 0:B.querySelectorAll("li")[F.value];if(z&&B){const K=z.offsetTop,x=z.offsetTop+z.offsetHeight,_=B.scrollTop,al=B.scrollTop+B.clientHeight;x>al?(w=Q.value)==null||w.scrollTo(0,x-B.clientHeight+z.offsetHeight-38):K<_&&((O=Q.value)==null||O.scrollTo(0,K))}})};Z.watch(()=>l.entityId,r),Z.watch(n,()=>b(n.value),{deep:!0});function Y(){if(d.value&&d.value.length>0){const B=d.value.split(".");B.length!==n.value.length&&(n.value=B)}else n.value.length>0&&(n.value=[])}return Z.watch(d,()=>{Y()}),d.value&&d.value.length>0?Y():r(),Z.watch(s,()=>{F.value=0,f()}),(B,z)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElDropdown),{onVisibleChange:I},{dropdown:Z.withCtx(()=>[Z.createElementVNode("div",Bx,[Z.createElementVNode("div",{class:Z.normalizeClass(["el-input-tag el-input-tag--small el-input-tag__wrapper",{"is-hovering":o.value,"is-focused":V.value}]),onMouseenter:z[3]||(z[3]=g=>o.value=!0),onMouseleave:z[4]||(z[4]=g=>o.value=!1)},[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(n.value,g=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElTag),{id:g,onClose:w=>y(),closable:""},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(g),1)]),_:2},1032,["id","onClose"]))),256)),Z.withDirectives(Z.createElementVNode("input",{ref_key:"filterInput",ref:W,type:"text",style:{flex:"auto"},class:"el-input-tag__input","onUpdate:modelValue":z[0]||(z[0]=g=>m.value=g),placeholder:"属性名过滤",onFocus:z[1]||(z[1]=g=>V.value=!0),onBlur:z[2]||(z[2]=g=>V.value=!1),onKeydown:[Z.withKeys(C,["delete"]),Z.withKeys(X,["down"]),Z.withKeys(L,["up"]),Z.withKeys(D,["enter"])],onInput:k},null,544),[[Z.vModelText,m.value]])],34),Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElScrollbar),{height:"300px",always:"",ref_key:"scrollbar",ref:Q},{default:Z.withCtx(()=>{var g;return[((g=s.value)==null?void 0:g.length)??!1?(Z.openBlock(),Z.createElementBlock("ul",Yx,[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(s.value,(w,O)=>(Z.openBlock(),Z.createElementBlock("li",{key:w.id,onMouseenter:K=>J(O),onClick:K=>T(w),class:Z.normalizeClass(G(O))},[w.dataType==="ENTITY"?(Z.openBlock(),Z.createElementBlock("span",zx,Z.toDisplayString(u(w)),1)):(Z.openBlock(),Z.createElementBlock("span",Lx,Z.toDisplayString(u(w)),1))],42,kx))),128))])):(Z.openBlock(),Z.createBlock(Z.unref(v.ElEmpty),{key:1,description:"无可选属性"}))]}),_:1})),[[Z.unref(v.vLoading),Z.unref(h)]])])]),default:Z.withCtx(()=>[Z.createVNode(Z.unref(v.ElTag),{type:"primary"},{default:Z.withCtx(()=>[Z.createTextVNode(Z.toDisplayString(H.value)+" ",1),Z.unref(R)?(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:0},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.ArrowUp))]),_:1})):(Z.openBlock(),Z.createBlock(Z.unref(v.ElIcon),{key:1},{default:Z.withCtx(()=>[Z.createVNode(Z.unref(Nl.ArrowDown))]),_:1}))]),_:1})]),_:1}))}}),[["__scopeId","data-v-7bf2d619"]]),gX=Wl(Z.defineComponent({__name:"JaPropertyPicker",emits:["change"],setup(e,{emit:l}){const t=Z.inject("aceFormModel"),d=Z.inject("aceFormItemProp"),n=Z.inject("aceFormValidator"),a=l;function i(c){n.removeFieldError(d),Nt(t.formData,d,s.value),a("change",c)}const s=Z.ref(pl(t.formData,d)??"");return Z.watch(()=>t.formData,()=>{s.value=pl(t.formData,d)??""},{deep:!0}),(c,F)=>(Z.openBlock(),Z.createBlock(xX,Z.mergeProps({modelValue:s.value,"onUpdate:modelValue":F[0]||(F[0]=h=>s.value=h),onChange:i},c.$attrs),null,16,["modelValue"]))}})),jX=Wl(xX),OX=Wl(Z.defineComponent({__name:"JaCheckboxGroup",props:{ariaLabel:{},modelValue:{},disabled:{type:Boolean},min:{},max:{},size:{},fill:{},textColor:{},tag:{},validateEvent:{type:Boolean},options:{},props:{},type:{}},emits:["change"],setup(e,{expose:l,emit:t}){const d=Z.ref(),n=Z.inject("aceFormModel"),a=Z.inject("aceFormItemProp"),i=Z.inject("aceFormValidator"),s=t,c=e;function F(V){i.removeFieldError(a),Nt(n.formData,a,h.value),s("change",V)}const h=Z.ref(pl(n.formData,a));Z.watch(()=>n.formData,()=>{h.value=pl(n.formData,a)},{deep:!0});const o=Z.computed(()=>{const{modelValue:V,...W}=c;return W});return l({focus:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.focus)==null?void 0:W.call(V)},blur:()=>{var V,W;return(W=(V=d.value)==null?void 0:V.blur)==null?void 0:W.call(V)},elCheckboxGroup:d}),(V,W)=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElCheckboxGroup),Z.mergeProps({ref_key:"input",ref:d,modelValue:h.value,"onUpdate:modelValue":W[0]||(W[0]=Q=>h.value=Q),onChange:F},{...o.value,...V.$attrs}),Z.createSlots({_:2},[Z.renderList(V.$slots,(Q,m)=>({name:m,fn:Z.withCtx(()=>[Z.renderSlot(V.$slots,m)])}))]),1040,["modelValue"]))}})),vX=Wl(Z.defineComponent({__name:"EnumPicker",props:Z.mergeModels({clearable:{type:Boolean,default:!0},filterable:{type:Boolean,default:!0},keyField:{default:"value"},multiple:{type:Boolean,default:!1},name:{},serviceName:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e,t=Z.ref([]),d=Z.ref(!1),n=Z.useModel(e,"modelValue"),a=$.createAxiosWithoutCache(),i=$.useEnumApi(a);async function s(){!l.name||!l.serviceName||(d.value=!0,i.queryByName(l.serviceName,l.name).then(h=>{t.value=h.values}).finally(()=>{d.value=!1}))}const c=Z.computed(()=>l.multiple?n.value.map(h=>h[l.keyField])||[]:n.value[0]!==void 0?n.value[0][l.keyField]:""),F=h=>{if(typeof h=="string"){const o=t.value.find(V=>V[l.keyField]===h);n.value=o?[o]:[]}else n.value=t.value.filter(o=>h.includes(o[l.keyField]))};return s(),Z.watch(()=>l.name,s),Z.watch(()=>l.serviceName,s),(h,o)=>{const V=Z.resolveDirective("loading");return Z.withDirectives((Z.openBlock(),Z.createBlock(Z.unref(v.ElSelect),{"model-value":c.value,filterable:l.filterable,multiple:l.multiple,clearable:l.clearable,onChange:F},{default:Z.withCtx(()=>[(Z.openBlock(!0),Z.createElementBlock(Z.Fragment,null,Z.renderList(t.value,W=>(Z.openBlock(),Z.createBlock(Z.unref(v.ElOption),{key:W.id,value:W[l.keyField],label:W.text},null,8,["value","label"]))),128))]),_:1},8,["model-value","filterable","multiple","clearable"])),[[V,d.value]])}}})),Ix=Object.freeze(Object.defineProperty({__proto__:null,AceTip:MG,JaAutocomplete:XX,JaAvatar:xW,JaBaseRolePicker:fW,JaButton:Jt,JaChannelPicker:wX,JaChannelPickerRaw:EX,JaCheckbox:TG,JaCheckboxGroup:OX,JaDatePicker:yG,JaDepartmentPicker:AG,JaDepartmentTree:Eb,JaDropdownButton:LG,JaEnumList:OG,JaEnumListRaw:vG,JaEnumPicker:vX,JaFilePreviewer:pG,JaForm:JG,JaFormItem:ts,JaInput:EW,JaInputI18nRaw:Ab,JaInputNumber:GG,JaMapItemList:fG,JaMapItemListRaw:HG,JaNumberList:xG,JaNumberListRaw:gG,JaPropertyPicker:gX,JaPropertyPickerRaw:jX,JaRadioGroup:yX,JaRoleCategorySelector:IX,JaRolePicker:zX,JaRolePickerRaw:LX,JaScrollbar:Ob,JaSelect:XG,JaStringList:wG,JaStringListRaw:EG,JaSwitch:IG,JaTimePicker:TX,JaUploader:uG,JaUploaderRaw:rG,JaUserGroupPicker:GX,JaUserGroupTree:gb,JaUserInfoTag:r0,JaUserList:JX,JaUserPicker:SX,JaUserPickerRaw:MX,JaUserSelectDialog:jb,getAvatarToken:kb,updateAvatarToken:qG},Symbol.toStringTag,{value:"Module"}));function KX(e){e.directive("focus",vW),e.directive("shortcut",CW),e.directive("auth",zG)}const Dx=[{text:"近一天",value:()=>{const e=new Date,l=new Date;return l.setDate(l.getDate()-1),[l,e]}},{text:"近三天",value:()=>{const e=new Date,l=new Date;return l.setDate(l.getDate()-3),[l,e]}},{text:"近一周",value:()=>{const e=new Date,l=new Date;return l.setDate(l.getDate()-7),[l,e]}},{text:"近一月",value:()=>{const e=new Date,l=new Date;return l.setMonth(l.getMonth()-1),[l,e]}},{text:"近三月",value:()=>{const e=new Date,l=new Date;return l.setMonth(l.getMonth()-3),[l,e]}},{text:"近半年",value:()=>{const e=new Date,l=new Date;return l.setMonth(l.getMonth()-6),[l,e]}},{text:"近一年",value:()=>{const e=new Date,l=new Date;return l.setFullYear(l.getFullYear()-1),[l,e]}}];function wx(e){if(!e)throw new Error("无法获取到应用名称,请确保VITE_APP_NAME环境变量已配置或者在创建时传入appName参数。");if(!window.microApp)throw new Error("无法获取到window.microApp。");const l=Z.ref(new Set),t=(F,h=!0,o=!0)=>{const V={sender:e,timestamp:Date.now(),payload:F};h?window.microApp.forceDispatch(V):window.microApp.dispatch(V,W=>{console.log("消息是否有返回值",W)}),o&&i()},d=(F,h=!0)=>{const o={sender:"app-demo",timestamp:Date.now(),payload:F};window.microApp.setGlobalData(o),h&&i()},n=(F,h=!0)=>{window.microApp.addGlobalDataListener(F,h)},a=()=>window.microApp.getData(),i=()=>{window.microApp.clearData()},s=(F,h=!1)=>{window.microApp.addDataListener(F,h),l.value.add(F)},c=F=>{window.microApp.removeDataListener(F),l.value.delete(F)};return Z.onUnmounted(()=>{window.microApp.clearDataListener(),l.value.clear()}),{sendMessage:t,onMessage:s,clearCache:i,getBaseAppData:a,offMessage:c,listeners:l,sendGlobalMessage:d,onGlobalMessage:n}}let fX=null,G0;function Ex(){return{async getDataTypes(){let e=fX;if(e)return e;if(G0)return await G0;const l=$.createAxiosWithoutCache();return G0=$.useEntityApi(l).getPropertyDataTypes().then(d=>(fX=d,d)).finally(()=>{G0=void 0}),await G0}}}let HX=null,X0;function Cx(){return{async getConstraintProviders(){let e=HX;if(e)return e;if(X0)return await X0;const l=$.createAxiosWithoutCache();return X0=$.useConstraintApi(l).getConstraintProviders().then(d=>(HX=d,d)).finally(()=>{X0=void 0}),await X0}}}const tu=new Map;let eu=new Map;function xx(){return{refreshFileConfigurationCache(e){tu.delete(e)},async getFileConfigurations(e){let l=tu.get(e);if(l)return l;let t=eu.get(e);if(t)return await t;const d=$.createAxiosWithoutCache();return t=$.useFileConfigurationApi(d).getByAppService(e,0,9999999).then(a=>(tu.set(e,a.content),a.content)).finally(()=>{eu.delete(e)}),eu.set(e,t),await t}}}const du=new Map;let nu=new Map;function gx(){return{refreshNumberTemplatesCache(e){du.delete(e)},async getNumberTemplates(e){let l=du.get(e);if(l)return l;let t=nu.get(e);if(t)return await t;const d=$.createAxiosWithoutCache();return t=$.useStringIdTemplateApi(d).getByApp(e,0,9999999).then(a=>(du.set(e,a.content),a.content)).finally(()=>{nu.delete(e)}),nu.set(e,t),await t}}}const au=new Map;let iu=new Map;function jx(){return{refreshEntitiesCache(e){au.delete(e)},async getEntities(e){let l=au.get(e);if(l)return l;let t=iu.get(e);if(t)return await t;const d=$.createAxiosWithoutCache();return t=$.useEntityApi(d).getAll(e).then(a=>(au.set(e,a),a)).finally(()=>{iu.delete(e)}),iu.set(e,t),await t}}}const Ox={install(e){for(const[l,t]of Object.entries(Ix))e.component(l,t);KX(e)}};ll.AceTip=MG,ll.AceVueUI=Ox,ll.JaAutocomplete=XX,ll.JaAvatar=xW,ll.JaBaseRolePicker=fW,ll.JaButton=Jt,ll.JaChannelPicker=wX,ll.JaChannelPickerRaw=EX,ll.JaCheckbox=TG,ll.JaCheckboxGroup=OX,ll.JaDatePicker=yG,ll.JaDepartmentPicker=AG,ll.JaDepartmentTree=Eb,ll.JaDropdownButton=LG,ll.JaEnumList=OG,ll.JaEnumListRaw=vG,ll.JaEnumPicker=vX,ll.JaFilePreviewer=pG,ll.JaForm=JG,ll.JaFormItem=ts,ll.JaInput=EW,ll.JaInputI18nRaw=Ab,ll.JaInputNumber=GG,ll.JaMapItemList=fG,ll.JaMapItemListRaw=HG,ll.JaNumberList=xG,ll.JaNumberListRaw=gG,ll.JaPropertyPicker=gX,ll.JaPropertyPickerRaw=jX,ll.JaRadioGroup=yX,ll.JaRoleCategorySelector=IX,ll.JaRolePicker=zX,ll.JaRolePickerRaw=LX,ll.JaScrollbar=Ob,ll.JaSelect=XG,ll.JaStringList=wG,ll.JaStringListRaw=EG,ll.JaSwitch=IG,ll.JaTimePicker=TX,ll.JaUploader=uG,ll.JaUploaderRaw=rG,ll.JaUserGroupPicker=GX,ll.JaUserGroupTree=gb,ll.JaUserInfoTag=r0,ll.JaUserList=JX,ll.JaUserPicker=SX,ll.JaUserPickerRaw=MX,ll.JaUserSelectDialog=jb,ll.SCROLL_BAR_WRAPPED_INJECT_KEY=Cb,ll.getAvatarToken=kb,ll.installDirectives=KX,ll.shortcuts=Dx,ll.updateAvatarToken=qG,ll.useAppInstances=hU,ll.useBackendValidations=SG,ll.useBridge=wx,ll.useConstraintProviders=Cx,ll.useEntities=jx,ll.useEntityPropDataTypes=Ex,ll.useFileConfigurations=xx,ll.useGroups=FX,ll.useNumberTemplates=gx,ll.useProperties=CX,ll.useRealms=OW,ll.useRoleCategories=BX,ll.useRoles=Pb,ll.useSystemClassificationLevelMap=ru,ll.useSystemClassificationLevels=uu,ll.useTreeData=es,ll.useUserClassificationLevel=py,ll.useUserClassificationLevelMap=My,ll.useUserRefQuery=wb,Object.defineProperty(ll,Symbol.toStringTag,{value:"Module"})});