@llamaindex/workflow-debugger 0.0.0

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/dist/app.js ADDED
@@ -0,0 +1,223 @@
1
+ var Yg=s=>{throw TypeError(s)};var ad=(s,e,t)=>e.has(s)||Yg("Cannot "+t);var Ze=(s,e,t)=>(ad(s,e,"read from private field"),t?t.call(s):e.get(s)),Hn=(s,e,t)=>e.has(s)?Yg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),Kt=(s,e,t,n)=>(ad(s,e,"write to private field"),n?n.call(s,t):e.set(s,t),t),Un=(s,e,t)=>(ad(s,e,"access private method"),t);var Kg=(s,e,t,n)=>({set _(i){Kt(s,e,i,t)},get _(){return Ze(s,e,n)}});function Zx(s,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in s)){const a=Object.getOwnPropertyDescriptor(n,i);a&&Object.defineProperty(s,i,a.get?a:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&n(l)}).observe(document,{childList:!0,subtree:!0});function t(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(i){if(i.ep)return;i.ep=!0;const a=t(i);fetch(i.href,a)}})();function gh(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ld={exports:{}},vo={},cd={exports:{}},Le={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Qg;function eS(){if(Qg)return Le;Qg=1;var s=Symbol.for("react.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),g=Symbol.iterator;function m(F){return F===null||typeof F!="object"?null:(F=g&&F[g]||F["@@iterator"],typeof F=="function"?F:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,w={};function S(F,Y,q){this.props=F,this.context=Y,this.refs=w,this.updater=q||y}S.prototype.isReactComponent={},S.prototype.setState=function(F,Y){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,Y,"setState")},S.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function E(){}E.prototype=S.prototype;function P(F,Y,q){this.props=F,this.context=Y,this.refs=w,this.updater=q||y}var k=P.prototype=new E;k.constructor=P,x(k,S.prototype),k.isPureReactComponent=!0;var T=Array.isArray,R=Object.prototype.hasOwnProperty,I={current:null},N={key:!0,ref:!0,__self:!0,__source:!0};function D(F,Y,q){var te,se={},ie=null,H=null;if(Y!=null)for(te in Y.ref!==void 0&&(H=Y.ref),Y.key!==void 0&&(ie=""+Y.key),Y)R.call(Y,te)&&!N.hasOwnProperty(te)&&(se[te]=Y[te]);var ae=arguments.length-2;if(ae===1)se.children=q;else if(1<ae){for(var de=Array(ae),ce=0;ce<ae;ce++)de[ce]=arguments[ce+2];se.children=de}if(F&&F.defaultProps)for(te in ae=F.defaultProps,ae)se[te]===void 0&&(se[te]=ae[te]);return{$$typeof:s,type:F,key:ie,ref:H,props:se,_owner:I.current}}function V(F,Y){return{$$typeof:s,type:F.type,key:Y,ref:F.ref,props:F.props,_owner:F._owner}}function j(F){return typeof F=="object"&&F!==null&&F.$$typeof===s}function G(F){var Y={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(q){return Y[q]})}var Z=/\/+/g;function K(F,Y){return typeof F=="object"&&F!==null&&F.key!=null?G(""+F.key):Y.toString(36)}function J(F,Y,q,te,se){var ie=typeof F;(ie==="undefined"||ie==="boolean")&&(F=null);var H=!1;if(F===null)H=!0;else switch(ie){case"string":case"number":H=!0;break;case"object":switch(F.$$typeof){case s:case e:H=!0}}if(H)return H=F,se=se(H),F=te===""?"."+K(H,0):te,T(se)?(q="",F!=null&&(q=F.replace(Z,"$&/")+"/"),J(se,Y,q,"",function(ce){return ce})):se!=null&&(j(se)&&(se=V(se,q+(!se.key||H&&H.key===se.key?"":(""+se.key).replace(Z,"$&/")+"/")+F)),Y.push(se)),1;if(H=0,te=te===""?".":te+":",T(F))for(var ae=0;ae<F.length;ae++){ie=F[ae];var de=te+K(ie,ae);H+=J(ie,Y,q,de,se)}else if(de=m(F),typeof de=="function")for(F=de.call(F),ae=0;!(ie=F.next()).done;)ie=ie.value,de=te+K(ie,ae++),H+=J(ie,Y,q,de,se);else if(ie==="object")throw Y=String(F),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return H}function ee(F,Y,q){if(F==null)return F;var te=[],se=0;return J(F,te,"","",function(ie){return Y.call(q,ie,se++)}),te}function B(F){if(F._status===-1){var Y=F._result;Y=Y(),Y.then(function(q){(F._status===0||F._status===-1)&&(F._status=1,F._result=q)},function(q){(F._status===0||F._status===-1)&&(F._status=2,F._result=q)}),F._status===-1&&(F._status=0,F._result=Y)}if(F._status===1)return F._result.default;throw F._result}var $={current:null},M={transition:null},Q={ReactCurrentDispatcher:$,ReactCurrentBatchConfig:M,ReactCurrentOwner:I};function ne(){throw Error("act(...) is not supported in production builds of React.")}return Le.Children={map:ee,forEach:function(F,Y,q){ee(F,function(){Y.apply(this,arguments)},q)},count:function(F){var Y=0;return ee(F,function(){Y++}),Y},toArray:function(F){return ee(F,function(Y){return Y})||[]},only:function(F){if(!j(F))throw Error("React.Children.only expected to receive a single React element child.");return F}},Le.Component=S,Le.Fragment=t,Le.Profiler=i,Le.PureComponent=P,Le.StrictMode=n,Le.Suspense=d,Le.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q,Le.act=ne,Le.cloneElement=function(F,Y,q){if(F==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+F+".");var te=x({},F.props),se=F.key,ie=F.ref,H=F._owner;if(Y!=null){if(Y.ref!==void 0&&(ie=Y.ref,H=I.current),Y.key!==void 0&&(se=""+Y.key),F.type&&F.type.defaultProps)var ae=F.type.defaultProps;for(de in Y)R.call(Y,de)&&!N.hasOwnProperty(de)&&(te[de]=Y[de]===void 0&&ae!==void 0?ae[de]:Y[de])}var de=arguments.length-2;if(de===1)te.children=q;else if(1<de){ae=Array(de);for(var ce=0;ce<de;ce++)ae[ce]=arguments[ce+2];te.children=ae}return{$$typeof:s,type:F.type,key:se,ref:ie,props:te,_owner:H}},Le.createContext=function(F){return F={$$typeof:l,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},F.Provider={$$typeof:a,_context:F},F.Consumer=F},Le.createElement=D,Le.createFactory=function(F){var Y=D.bind(null,F);return Y.type=F,Y},Le.createRef=function(){return{current:null}},Le.forwardRef=function(F){return{$$typeof:c,render:F}},Le.isValidElement=j,Le.lazy=function(F){return{$$typeof:f,_payload:{_status:-1,_result:F},_init:B}},Le.memo=function(F,Y){return{$$typeof:h,type:F,compare:Y===void 0?null:Y}},Le.startTransition=function(F){var Y=M.transition;M.transition={};try{F()}finally{M.transition=Y}},Le.unstable_act=ne,Le.useCallback=function(F,Y){return $.current.useCallback(F,Y)},Le.useContext=function(F){return $.current.useContext(F)},Le.useDebugValue=function(){},Le.useDeferredValue=function(F){return $.current.useDeferredValue(F)},Le.useEffect=function(F,Y){return $.current.useEffect(F,Y)},Le.useId=function(){return $.current.useId()},Le.useImperativeHandle=function(F,Y,q){return $.current.useImperativeHandle(F,Y,q)},Le.useInsertionEffect=function(F,Y){return $.current.useInsertionEffect(F,Y)},Le.useLayoutEffect=function(F,Y){return $.current.useLayoutEffect(F,Y)},Le.useMemo=function(F,Y){return $.current.useMemo(F,Y)},Le.useReducer=function(F,Y,q){return $.current.useReducer(F,Y,q)},Le.useRef=function(F){return $.current.useRef(F)},Le.useState=function(F){return $.current.useState(F)},Le.useSyncExternalStore=function(F,Y,q){return $.current.useSyncExternalStore(F,Y,q)},Le.useTransition=function(){return $.current.useTransition()},Le.version="18.3.1",Le}var Jg;function mh(){return Jg||(Jg=1,cd.exports=eS()),cd.exports}/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Zg;function tS(){if(Zg)return vo;Zg=1;var s=mh(),e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function l(c,d,h){var f,g={},m=null,y=null;h!==void 0&&(m=""+h),d.key!==void 0&&(m=""+d.key),d.ref!==void 0&&(y=d.ref);for(f in d)n.call(d,f)&&!a.hasOwnProperty(f)&&(g[f]=d[f]);if(c&&c.defaultProps)for(f in d=c.defaultProps,d)g[f]===void 0&&(g[f]=d[f]);return{$$typeof:e,type:c,key:m,ref:y,props:g,_owner:i.current}}return vo.Fragment=t,vo.jsx=l,vo.jsxs=l,vo}var em;function nS(){return em||(em=1,ld.exports=tS()),ld.exports}var _=nS(),A=mh();const Oe=gh(A),vh=Zx({__proto__:null,default:Oe},[A]);var ul={},ud={exports:{}},Qt={},dd={exports:{}},hd={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var tm;function rS(){return tm||(tm=1,function(s){function e(M,Q){var ne=M.length;M.push(Q);e:for(;0<ne;){var F=ne-1>>>1,Y=M[F];if(0<i(Y,Q))M[F]=Q,M[ne]=Y,ne=F;else break e}}function t(M){return M.length===0?null:M[0]}function n(M){if(M.length===0)return null;var Q=M[0],ne=M.pop();if(ne!==Q){M[0]=ne;e:for(var F=0,Y=M.length,q=Y>>>1;F<q;){var te=2*(F+1)-1,se=M[te],ie=te+1,H=M[ie];if(0>i(se,ne))ie<Y&&0>i(H,se)?(M[F]=H,M[ie]=ne,F=ie):(M[F]=se,M[te]=ne,F=te);else if(ie<Y&&0>i(H,ne))M[F]=H,M[ie]=ne,F=ie;else break e}}return Q}function i(M,Q){var ne=M.sortIndex-Q.sortIndex;return ne!==0?ne:M.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;s.unstable_now=function(){return a.now()}}else{var l=Date,c=l.now();s.unstable_now=function(){return l.now()-c}}var d=[],h=[],f=1,g=null,m=3,y=!1,x=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(M){for(var Q=t(h);Q!==null;){if(Q.callback===null)n(h);else if(Q.startTime<=M)n(h),Q.sortIndex=Q.expirationTime,e(d,Q);else break;Q=t(h)}}function T(M){if(w=!1,k(M),!x)if(t(d)!==null)x=!0,B(R);else{var Q=t(h);Q!==null&&$(T,Q.startTime-M)}}function R(M,Q){x=!1,w&&(w=!1,E(D),D=-1),y=!0;var ne=m;try{for(k(Q),g=t(d);g!==null&&(!(g.expirationTime>Q)||M&&!G());){var F=g.callback;if(typeof F=="function"){g.callback=null,m=g.priorityLevel;var Y=F(g.expirationTime<=Q);Q=s.unstable_now(),typeof Y=="function"?g.callback=Y:g===t(d)&&n(d),k(Q)}else n(d);g=t(d)}if(g!==null)var q=!0;else{var te=t(h);te!==null&&$(T,te.startTime-Q),q=!1}return q}finally{g=null,m=ne,y=!1}}var I=!1,N=null,D=-1,V=5,j=-1;function G(){return!(s.unstable_now()-j<V)}function Z(){if(N!==null){var M=s.unstable_now();j=M;var Q=!0;try{Q=N(!0,M)}finally{Q?K():(I=!1,N=null)}}else I=!1}var K;if(typeof P=="function")K=function(){P(Z)};else if(typeof MessageChannel<"u"){var J=new MessageChannel,ee=J.port2;J.port1.onmessage=Z,K=function(){ee.postMessage(null)}}else K=function(){S(Z,0)};function B(M){N=M,I||(I=!0,K())}function $(M,Q){D=S(function(){M(s.unstable_now())},Q)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(M){M.callback=null},s.unstable_continueExecution=function(){x||y||(x=!0,B(R))},s.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<M?Math.floor(1e3/M):5},s.unstable_getCurrentPriorityLevel=function(){return m},s.unstable_getFirstCallbackNode=function(){return t(d)},s.unstable_next=function(M){switch(m){case 1:case 2:case 3:var Q=3;break;default:Q=m}var ne=m;m=Q;try{return M()}finally{m=ne}},s.unstable_pauseExecution=function(){},s.unstable_requestPaint=function(){},s.unstable_runWithPriority=function(M,Q){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var ne=m;m=M;try{return Q()}finally{m=ne}},s.unstable_scheduleCallback=function(M,Q,ne){var F=s.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?F+ne:F):ne=F,M){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=ne+Y,M={id:f++,callback:Q,priorityLevel:M,startTime:ne,expirationTime:Y,sortIndex:-1},ne>F?(M.sortIndex=ne,e(h,M),t(d)===null&&M===t(h)&&(w?(E(D),D=-1):w=!0,$(T,ne-F))):(M.sortIndex=Y,e(d,M),x||y||(x=!0,B(R))),M},s.unstable_shouldYield=G,s.unstable_wrapCallback=function(M){var Q=m;return function(){var ne=m;m=Q;try{return M.apply(this,arguments)}finally{m=ne}}}}(hd)),hd}var nm;function sS(){return nm||(nm=1,dd.exports=rS()),dd.exports}/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var rm;function iS(){if(rm)return Qt;rm=1;var s=mh(),e=sS();function t(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,u=1;u<arguments.length;u++)o+="&args[]="+encodeURIComponent(arguments[u]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,i={};function a(r,o){l(r,o),l(r+"Capture",o)}function l(r,o){for(i[r]=o,r=0;r<o.length;r++)n.add(o[r])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},g={};function m(r){return d.call(g,r)?!0:d.call(f,r)?!1:h.test(r)?g[r]=!0:(f[r]=!0,!1)}function y(r,o,u,p){if(u!==null&&u.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return p?!1:u!==null?!u.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function x(r,o,u,p){if(o===null||typeof o>"u"||y(r,o,u,p))return!0;if(p)return!1;if(u!==null)switch(u.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function w(r,o,u,p,v,b,C){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=p,this.attributeNamespace=v,this.mustUseProperty=u,this.propertyName=r,this.type=o,this.sanitizeURL=b,this.removeEmptyString=C}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){S[r]=new w(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];S[o]=new w(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){S[r]=new w(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){S[r]=new w(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){S[r]=new w(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){S[r]=new w(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){S[r]=new w(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){S[r]=new w(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){S[r]=new w(r,5,!1,r.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function P(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(E,P);S[o]=new w(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(E,P);S[o]=new w(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(E,P);S[o]=new w(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){S[r]=new w(r,1,!1,r.toLowerCase(),null,!1,!1)}),S.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){S[r]=new w(r,1,!1,r.toLowerCase(),null,!0,!0)});function k(r,o,u,p){var v=S.hasOwnProperty(o)?S[o]:null;(v!==null?v.type!==0:p||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(x(o,u,v,p)&&(u=null),p||v===null?m(o)&&(u===null?r.removeAttribute(o):r.setAttribute(o,""+u)):v.mustUseProperty?r[v.propertyName]=u===null?v.type===3?!1:"":u:(o=v.attributeName,p=v.attributeNamespace,u===null?r.removeAttribute(o):(v=v.type,u=v===3||v===4&&u===!0?"":""+u,p?r.setAttributeNS(p,o,u):r.setAttribute(o,u))))}var T=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,R=Symbol.for("react.element"),I=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),j=Symbol.for("react.provider"),G=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),$=Symbol.for("react.offscreen"),M=Symbol.iterator;function Q(r){return r===null||typeof r!="object"?null:(r=M&&r[M]||r["@@iterator"],typeof r=="function"?r:null)}var ne=Object.assign,F;function Y(r){if(F===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);F=o&&o[1]||""}return`
34
+ `+F+r}var q=!1;function te(r,o){if(!r||q)return"";q=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(X){var p=X}Reflect.construct(r,[],o)}else{try{o.call()}catch(X){p=X}r.call(o.prototype)}else{try{throw Error()}catch(X){p=X}r()}}catch(X){if(X&&p&&typeof X.stack=="string"){for(var v=X.stack.split(`
35
+ `),b=p.stack.split(`
36
+ `),C=v.length-1,L=b.length-1;1<=C&&0<=L&&v[C]!==b[L];)L--;for(;1<=C&&0<=L;C--,L--)if(v[C]!==b[L]){if(C!==1||L!==1)do if(C--,L--,0>L||v[C]!==b[L]){var O=`
37
+ `+v[C].replace(" at new "," at ");return r.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",r.displayName)),O}while(1<=C&&0<=L);break}}}finally{q=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?Y(r):""}function se(r){switch(r.tag){case 5:return Y(r.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return r=te(r.type,!1),r;case 11:return r=te(r.type.render,!1),r;case 1:return r=te(r.type,!0),r;default:return""}}function ie(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case N:return"Fragment";case I:return"Portal";case V:return"Profiler";case D:return"StrictMode";case K:return"Suspense";case J:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case G:return(r.displayName||"Context")+".Consumer";case j:return(r._context.displayName||"Context")+".Provider";case Z:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case ee:return o=r.displayName||null,o!==null?o:ie(r.type)||"Memo";case B:o=r._payload,r=r._init;try{return ie(r(o))}catch{}}return null}function H(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(o);case 8:return o===D?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function ae(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function de(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function ce(r){var o=de(r)?"checked":"value",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),p=""+r[o];if(!r.hasOwnProperty(o)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var v=u.get,b=u.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return v.call(this)},set:function(C){p=""+C,b.call(this,C)}}),Object.defineProperty(r,o,{enumerable:u.enumerable}),{getValue:function(){return p},setValue:function(C){p=""+C},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Se(r){r._valueTracker||(r._valueTracker=ce(r))}function Pe(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),p="";return r&&(p=de(r)?r.checked?"true":"false":r.value),r=p,r!==u?(o.setValue(r),!0):!1}function be(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Ce(r,o){var u=o.checked;return ne({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function He(r,o){var u=o.defaultValue==null?"":o.defaultValue,p=o.checked!=null?o.checked:o.defaultChecked;u=ae(o.value!=null?o.value:u),r._wrapperState={initialChecked:p,initialValue:u,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function je(r,o){o=o.checked,o!=null&&k(r,"checked",o,!1)}function ft(r,o){je(r,o);var u=ae(o.value),p=o.type;if(u!=null)p==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(p==="submit"||p==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?fn(r,o.type,u):o.hasOwnProperty("defaultValue")&&fn(r,o.type,ae(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function Qe(r,o,u){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var p=o.type;if(!(p!=="submit"&&p!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,u||o===r.value||(r.value=o),r.defaultValue=o}u=r.name,u!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,u!==""&&(r.name=u)}function fn(r,o,u){(o!=="number"||be(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var nr=Array.isArray;function Pt(r,o,u,p){if(r=r.options,o){o={};for(var v=0;v<u.length;v++)o["$"+u[v]]=!0;for(u=0;u<r.length;u++)v=o.hasOwnProperty("$"+r[u].value),r[u].selected!==v&&(r[u].selected=v),v&&p&&(r[u].defaultSelected=!0)}else{for(u=""+ae(u),o=null,v=0;v<r.length;v++){if(r[v].value===u){r[v].selected=!0,p&&(r[v].defaultSelected=!0);return}o!==null||r[v].disabled||(o=r[v])}o!==null&&(o.selected=!0)}}function xr(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(t(91));return ne({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Ls(r,o){var u=o.value;if(u==null){if(u=o.children,o=o.defaultValue,u!=null){if(o!=null)throw Error(t(92));if(nr(u)){if(1<u.length)throw Error(t(93));u=u[0]}o=u}o==null&&(o=""),u=o}r._wrapperState={initialValue:ae(u)}}function ea(r,o){var u=ae(o.value),p=ae(o.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),o.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),p!=null&&(r.defaultValue=""+p)}function ta(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function na(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function On(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?na(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var rr,Zr=function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,u,p,v){MSApp.execUnsafeLocalFunction(function(){return r(o,u,p,v)})}:r}(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(rr=rr||document.createElement("div"),rr.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=rr.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function sr(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var Li={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rb=["Webkit","ms","Moz","O"];Object.keys(Li).forEach(function(r){rb.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Li[o]=Li[r]})});function uf(r,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||Li.hasOwnProperty(r)&&Li[r]?(""+o).trim():o+"px"}function df(r,o){r=r.style;for(var u in o)if(o.hasOwnProperty(u)){var p=u.indexOf("--")===0,v=uf(u,o[u],p);u==="float"&&(u="cssFloat"),p?r.setProperty(u,v):r[u]=v}}var sb=ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function wc(r,o){if(o){if(sb[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(t(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(t(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(t(61))}if(o.style!=null&&typeof o.style!="object")throw Error(t(62))}}function bc(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xc=null;function Sc(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Ac=null,Ms=null,Ds=null;function hf(r){if(r=to(r)){if(typeof Ac!="function")throw Error(t(280));var o=r.stateNode;o&&(o=_a(o),Ac(r.stateNode,r.type,o))}}function ff(r){Ms?Ds?Ds.push(r):Ds=[r]:Ms=r}function pf(){if(Ms){var r=Ms,o=Ds;if(Ds=Ms=null,hf(r),o)for(r=0;r<o.length;r++)hf(o[r])}}function gf(r,o){return r(o)}function mf(){}var Ec=!1;function vf(r,o,u){if(Ec)return r(o,u);Ec=!0;try{return gf(r,o,u)}finally{Ec=!1,(Ms!==null||Ds!==null)&&(mf(),pf())}}function Mi(r,o){var u=r.stateNode;if(u===null)return null;var p=_a(u);if(p===null)return null;u=p[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(r=r.type,p=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!p;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(t(231,o,typeof u));return u}var _c=!1;if(c)try{var Di={};Object.defineProperty(Di,"passive",{get:function(){_c=!0}}),window.addEventListener("test",Di,Di),window.removeEventListener("test",Di,Di)}catch{_c=!1}function ib(r,o,u,p,v,b,C,L,O){var X=Array.prototype.slice.call(arguments,3);try{o.apply(u,X)}catch(oe){this.onError(oe)}}var Oi=!1,ra=null,sa=!1,Cc=null,ob={onError:function(r){Oi=!0,ra=r}};function ab(r,o,u,p,v,b,C,L,O){Oi=!1,ra=null,ib.apply(ob,arguments)}function lb(r,o,u,p,v,b,C,L,O){if(ab.apply(this,arguments),Oi){if(Oi){var X=ra;Oi=!1,ra=null}else throw Error(t(198));sa||(sa=!0,Cc=X)}}function es(r){var o=r,u=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(u=o.return),r=o.return;while(r)}return o.tag===3?u:null}function yf(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function wf(r){if(es(r)!==r)throw Error(t(188))}function cb(r){var o=r.alternate;if(!o){if(o=es(r),o===null)throw Error(t(188));return o!==r?null:r}for(var u=r,p=o;;){var v=u.return;if(v===null)break;var b=v.alternate;if(b===null){if(p=v.return,p!==null){u=p;continue}break}if(v.child===b.child){for(b=v.child;b;){if(b===u)return wf(v),r;if(b===p)return wf(v),o;b=b.sibling}throw Error(t(188))}if(u.return!==p.return)u=v,p=b;else{for(var C=!1,L=v.child;L;){if(L===u){C=!0,u=v,p=b;break}if(L===p){C=!0,p=v,u=b;break}L=L.sibling}if(!C){for(L=b.child;L;){if(L===u){C=!0,u=b,p=v;break}if(L===p){C=!0,p=b,u=v;break}L=L.sibling}if(!C)throw Error(t(189))}}if(u.alternate!==p)throw Error(t(190))}if(u.tag!==3)throw Error(t(188));return u.stateNode.current===u?r:o}function bf(r){return r=cb(r),r!==null?xf(r):null}function xf(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=xf(r);if(o!==null)return o;r=r.sibling}return null}var Sf=e.unstable_scheduleCallback,Af=e.unstable_cancelCallback,ub=e.unstable_shouldYield,db=e.unstable_requestPaint,at=e.unstable_now,hb=e.unstable_getCurrentPriorityLevel,kc=e.unstable_ImmediatePriority,Ef=e.unstable_UserBlockingPriority,ia=e.unstable_NormalPriority,fb=e.unstable_LowPriority,_f=e.unstable_IdlePriority,oa=null,Fn=null;function pb(r){if(Fn&&typeof Fn.onCommitFiberRoot=="function")try{Fn.onCommitFiberRoot(oa,r,void 0,(r.current.flags&128)===128)}catch{}}var En=Math.clz32?Math.clz32:vb,gb=Math.log,mb=Math.LN2;function vb(r){return r>>>=0,r===0?32:31-(gb(r)/mb|0)|0}var aa=64,la=4194304;function Fi(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function ca(r,o){var u=r.pendingLanes;if(u===0)return 0;var p=0,v=r.suspendedLanes,b=r.pingedLanes,C=u&268435455;if(C!==0){var L=C&~v;L!==0?p=Fi(L):(b&=C,b!==0&&(p=Fi(b)))}else C=u&~v,C!==0?p=Fi(C):b!==0&&(p=Fi(b));if(p===0)return 0;if(o!==0&&o!==p&&(o&v)===0&&(v=p&-p,b=o&-o,v>=b||v===16&&(b&4194240)!==0))return o;if((p&4)!==0&&(p|=u&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=p;0<o;)u=31-En(o),v=1<<u,p|=r[u],o&=~v;return p}function yb(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function wb(r,o){for(var u=r.suspendedLanes,p=r.pingedLanes,v=r.expirationTimes,b=r.pendingLanes;0<b;){var C=31-En(b),L=1<<C,O=v[C];O===-1?((L&u)===0||(L&p)!==0)&&(v[C]=yb(L,o)):O<=o&&(r.expiredLanes|=L),b&=~L}}function Pc(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Cf(){var r=aa;return aa<<=1,(aa&4194240)===0&&(aa=64),r}function Tc(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function ji(r,o,u){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-En(o),r[o]=u}function bb(r,o){var u=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var p=r.eventTimes;for(r=r.expirationTimes;0<u;){var v=31-En(u),b=1<<v;o[v]=0,p[v]=-1,r[v]=-1,u&=~b}}function Rc(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var p=31-En(u),v=1<<p;v&o|r[p]&o&&(r[p]|=o),u&=~v}}var Ve=0;function kf(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Pf,Nc,Tf,Rf,Nf,Ic=!1,ua=[],Sr=null,Ar=null,Er=null,zi=new Map,$i=new Map,_r=[],xb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function If(r,o){switch(r){case"focusin":case"focusout":Sr=null;break;case"dragenter":case"dragleave":Ar=null;break;case"mouseover":case"mouseout":Er=null;break;case"pointerover":case"pointerout":zi.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":$i.delete(o.pointerId)}}function Bi(r,o,u,p,v,b){return r===null||r.nativeEvent!==b?(r={blockedOn:o,domEventName:u,eventSystemFlags:p,nativeEvent:b,targetContainers:[v]},o!==null&&(o=to(o),o!==null&&Nc(o)),r):(r.eventSystemFlags|=p,o=r.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),r)}function Sb(r,o,u,p,v){switch(o){case"focusin":return Sr=Bi(Sr,r,o,u,p,v),!0;case"dragenter":return Ar=Bi(Ar,r,o,u,p,v),!0;case"mouseover":return Er=Bi(Er,r,o,u,p,v),!0;case"pointerover":var b=v.pointerId;return zi.set(b,Bi(zi.get(b)||null,r,o,u,p,v)),!0;case"gotpointercapture":return b=v.pointerId,$i.set(b,Bi($i.get(b)||null,r,o,u,p,v)),!0}return!1}function Lf(r){var o=ts(r.target);if(o!==null){var u=es(o);if(u!==null){if(o=u.tag,o===13){if(o=yf(u),o!==null){r.blockedOn=o,Nf(r.priority,function(){Tf(u)});return}}else if(o===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function da(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=Mc(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var p=new u.constructor(u.type,u);xc=p,u.target.dispatchEvent(p),xc=null}else return o=to(u),o!==null&&Nc(o),r.blockedOn=u,!1;o.shift()}return!0}function Mf(r,o,u){da(r)&&u.delete(o)}function Ab(){Ic=!1,Sr!==null&&da(Sr)&&(Sr=null),Ar!==null&&da(Ar)&&(Ar=null),Er!==null&&da(Er)&&(Er=null),zi.forEach(Mf),$i.forEach(Mf)}function Hi(r,o){r.blockedOn===o&&(r.blockedOn=null,Ic||(Ic=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Ab)))}function Ui(r){function o(v){return Hi(v,r)}if(0<ua.length){Hi(ua[0],r);for(var u=1;u<ua.length;u++){var p=ua[u];p.blockedOn===r&&(p.blockedOn=null)}}for(Sr!==null&&Hi(Sr,r),Ar!==null&&Hi(Ar,r),Er!==null&&Hi(Er,r),zi.forEach(o),$i.forEach(o),u=0;u<_r.length;u++)p=_r[u],p.blockedOn===r&&(p.blockedOn=null);for(;0<_r.length&&(u=_r[0],u.blockedOn===null);)Lf(u),u.blockedOn===null&&_r.shift()}var Os=T.ReactCurrentBatchConfig,ha=!0;function Eb(r,o,u,p){var v=Ve,b=Os.transition;Os.transition=null;try{Ve=1,Lc(r,o,u,p)}finally{Ve=v,Os.transition=b}}function _b(r,o,u,p){var v=Ve,b=Os.transition;Os.transition=null;try{Ve=4,Lc(r,o,u,p)}finally{Ve=v,Os.transition=b}}function Lc(r,o,u,p){if(ha){var v=Mc(r,o,u,p);if(v===null)Qc(r,o,p,fa,u),If(r,p);else if(Sb(v,r,o,u,p))p.stopPropagation();else if(If(r,p),o&4&&-1<xb.indexOf(r)){for(;v!==null;){var b=to(v);if(b!==null&&Pf(b),b=Mc(r,o,u,p),b===null&&Qc(r,o,p,fa,u),b===v)break;v=b}v!==null&&p.stopPropagation()}else Qc(r,o,p,null,u)}}var fa=null;function Mc(r,o,u,p){if(fa=null,r=Sc(p),r=ts(r),r!==null)if(o=es(r),o===null)r=null;else if(u=o.tag,u===13){if(r=yf(o),r!==null)return r;r=null}else if(u===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return fa=r,null}function Df(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(hb()){case kc:return 1;case Ef:return 4;case ia:case fb:return 16;case _f:return 536870912;default:return 16}default:return 16}}var Cr=null,Dc=null,pa=null;function Of(){if(pa)return pa;var r,o=Dc,u=o.length,p,v="value"in Cr?Cr.value:Cr.textContent,b=v.length;for(r=0;r<u&&o[r]===v[r];r++);var C=u-r;for(p=1;p<=C&&o[u-p]===v[b-p];p++);return pa=v.slice(r,1<p?1-p:void 0)}function ga(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function ma(){return!0}function Ff(){return!1}function tn(r){function o(u,p,v,b,C){this._reactName=u,this._targetInst=v,this.type=p,this.nativeEvent=b,this.target=C,this.currentTarget=null;for(var L in r)r.hasOwnProperty(L)&&(u=r[L],this[L]=u?u(b):b[L]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?ma:Ff,this.isPropagationStopped=Ff,this}return ne(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=ma)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=ma)},persist:function(){},isPersistent:ma}),o}var Fs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Oc=tn(Fs),Vi=ne({},Fs,{view:0,detail:0}),Cb=tn(Vi),Fc,jc,Wi,va=ne({},Vi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$c,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Wi&&(Wi&&r.type==="mousemove"?(Fc=r.screenX-Wi.screenX,jc=r.screenY-Wi.screenY):jc=Fc=0,Wi=r),Fc)},movementY:function(r){return"movementY"in r?r.movementY:jc}}),jf=tn(va),kb=ne({},va,{dataTransfer:0}),Pb=tn(kb),Tb=ne({},Vi,{relatedTarget:0}),zc=tn(Tb),Rb=ne({},Fs,{animationName:0,elapsedTime:0,pseudoElement:0}),Nb=tn(Rb),Ib=ne({},Fs,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),Lb=tn(Ib),Mb=ne({},Fs,{data:0}),zf=tn(Mb),Db={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ob={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Fb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jb(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Fb[r])?!!o[r]:!1}function $c(){return jb}var zb=ne({},Vi,{key:function(r){if(r.key){var o=Db[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=ga(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?Ob[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$c,charCode:function(r){return r.type==="keypress"?ga(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ga(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),$b=tn(zb),Bb=ne({},va,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$f=tn(Bb),Hb=ne({},Vi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$c}),Ub=tn(Hb),Vb=ne({},Fs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Wb=tn(Vb),Gb=ne({},va,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),qb=tn(Gb),Xb=[9,13,27,32],Bc=c&&"CompositionEvent"in window,Gi=null;c&&"documentMode"in document&&(Gi=document.documentMode);var Yb=c&&"TextEvent"in window&&!Gi,Bf=c&&(!Bc||Gi&&8<Gi&&11>=Gi),Hf=" ",Uf=!1;function Vf(r,o){switch(r){case"keyup":return Xb.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wf(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var js=!1;function Kb(r,o){switch(r){case"compositionend":return Wf(o);case"keypress":return o.which!==32?null:(Uf=!0,Hf);case"textInput":return r=o.data,r===Hf&&Uf?null:r;default:return null}}function Qb(r,o){if(js)return r==="compositionend"||!Bc&&Vf(r,o)?(r=Of(),pa=Dc=Cr=null,js=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return Bf&&o.locale!=="ko"?null:o.data;default:return null}}var Jb={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Gf(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!Jb[r.type]:o==="textarea"}function qf(r,o,u,p){ff(p),o=Sa(o,"onChange"),0<o.length&&(u=new Oc("onChange","change",null,u,p),r.push({event:u,listeners:o}))}var qi=null,Xi=null;function Zb(r){dp(r,0)}function ya(r){var o=Us(r);if(Pe(o))return r}function ex(r,o){if(r==="change")return o}var Xf=!1;if(c){var Hc;if(c){var Uc="oninput"in document;if(!Uc){var Yf=document.createElement("div");Yf.setAttribute("oninput","return;"),Uc=typeof Yf.oninput=="function"}Hc=Uc}else Hc=!1;Xf=Hc&&(!document.documentMode||9<document.documentMode)}function Kf(){qi&&(qi.detachEvent("onpropertychange",Qf),Xi=qi=null)}function Qf(r){if(r.propertyName==="value"&&ya(Xi)){var o=[];qf(o,Xi,r,Sc(r)),vf(Zb,o)}}function tx(r,o,u){r==="focusin"?(Kf(),qi=o,Xi=u,qi.attachEvent("onpropertychange",Qf)):r==="focusout"&&Kf()}function nx(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ya(Xi)}function rx(r,o){if(r==="click")return ya(o)}function sx(r,o){if(r==="input"||r==="change")return ya(o)}function ix(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var _n=typeof Object.is=="function"?Object.is:ix;function Yi(r,o){if(_n(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var u=Object.keys(r),p=Object.keys(o);if(u.length!==p.length)return!1;for(p=0;p<u.length;p++){var v=u[p];if(!d.call(o,v)||!_n(r[v],o[v]))return!1}return!0}function Jf(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Zf(r,o){var u=Jf(r);r=0;for(var p;u;){if(u.nodeType===3){if(p=r+u.textContent.length,r<=o&&p>=o)return{node:u,offset:o-r};r=p}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Jf(u)}}function ep(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?ep(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function tp(){for(var r=window,o=be();o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=be(r.document)}return o}function Vc(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function ox(r){var o=tp(),u=r.focusedElem,p=r.selectionRange;if(o!==u&&u&&u.ownerDocument&&ep(u.ownerDocument.documentElement,u)){if(p!==null&&Vc(u)){if(o=p.start,r=p.end,r===void 0&&(r=o),"selectionStart"in u)u.selectionStart=o,u.selectionEnd=Math.min(r,u.value.length);else if(r=(o=u.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var v=u.textContent.length,b=Math.min(p.start,v);p=p.end===void 0?b:Math.min(p.end,v),!r.extend&&b>p&&(v=p,p=b,b=v),v=Zf(u,b);var C=Zf(u,p);v&&C&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==C.node||r.focusOffset!==C.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),r.removeAllRanges(),b>p?(r.addRange(o),r.extend(C.node,C.offset)):(o.setEnd(C.node,C.offset),r.addRange(o)))}}for(o=[],r=u;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<o.length;u++)r=o[u],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var ax=c&&"documentMode"in document&&11>=document.documentMode,zs=null,Wc=null,Ki=null,Gc=!1;function np(r,o,u){var p=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Gc||zs==null||zs!==be(p)||(p=zs,"selectionStart"in p&&Vc(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Ki&&Yi(Ki,p)||(Ki=p,p=Sa(Wc,"onSelect"),0<p.length&&(o=new Oc("onSelect","select",null,o,u),r.push({event:o,listeners:p}),o.target=zs)))}function wa(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var $s={animationend:wa("Animation","AnimationEnd"),animationiteration:wa("Animation","AnimationIteration"),animationstart:wa("Animation","AnimationStart"),transitionend:wa("Transition","TransitionEnd")},qc={},rp={};c&&(rp=document.createElement("div").style,"AnimationEvent"in window||(delete $s.animationend.animation,delete $s.animationiteration.animation,delete $s.animationstart.animation),"TransitionEvent"in window||delete $s.transitionend.transition);function ba(r){if(qc[r])return qc[r];if(!$s[r])return r;var o=$s[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in rp)return qc[r]=o[u];return r}var sp=ba("animationend"),ip=ba("animationiteration"),op=ba("animationstart"),ap=ba("transitionend"),lp=new Map,cp="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function kr(r,o){lp.set(r,o),a(o,[r])}for(var Xc=0;Xc<cp.length;Xc++){var Yc=cp[Xc],lx=Yc.toLowerCase(),cx=Yc[0].toUpperCase()+Yc.slice(1);kr(lx,"on"+cx)}kr(sp,"onAnimationEnd"),kr(ip,"onAnimationIteration"),kr(op,"onAnimationStart"),kr("dblclick","onDoubleClick"),kr("focusin","onFocus"),kr("focusout","onBlur"),kr(ap,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),ux=new Set("cancel close invalid load scroll toggle".split(" ").concat(Qi));function up(r,o,u){var p=r.type||"unknown-event";r.currentTarget=u,lb(p,o,void 0,r),r.currentTarget=null}function dp(r,o){o=(o&4)!==0;for(var u=0;u<r.length;u++){var p=r[u],v=p.event;p=p.listeners;e:{var b=void 0;if(o)for(var C=p.length-1;0<=C;C--){var L=p[C],O=L.instance,X=L.currentTarget;if(L=L.listener,O!==b&&v.isPropagationStopped())break e;up(v,L,X),b=O}else for(C=0;C<p.length;C++){if(L=p[C],O=L.instance,X=L.currentTarget,L=L.listener,O!==b&&v.isPropagationStopped())break e;up(v,L,X),b=O}}}if(sa)throw r=Cc,sa=!1,Cc=null,r}function Ye(r,o){var u=o[ru];u===void 0&&(u=o[ru]=new Set);var p=r+"__bubble";u.has(p)||(hp(o,r,2,!1),u.add(p))}function Kc(r,o,u){var p=0;o&&(p|=4),hp(u,r,p,o)}var xa="_reactListening"+Math.random().toString(36).slice(2);function Ji(r){if(!r[xa]){r[xa]=!0,n.forEach(function(u){u!=="selectionchange"&&(ux.has(u)||Kc(u,!1,r),Kc(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[xa]||(o[xa]=!0,Kc("selectionchange",!1,o))}}function hp(r,o,u,p){switch(Df(o)){case 1:var v=Eb;break;case 4:v=_b;break;default:v=Lc}u=v.bind(null,o,u,r),v=void 0,!_c||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),p?v!==void 0?r.addEventListener(o,u,{capture:!0,passive:v}):r.addEventListener(o,u,!0):v!==void 0?r.addEventListener(o,u,{passive:v}):r.addEventListener(o,u,!1)}function Qc(r,o,u,p,v){var b=p;if((o&1)===0&&(o&2)===0&&p!==null)e:for(;;){if(p===null)return;var C=p.tag;if(C===3||C===4){var L=p.stateNode.containerInfo;if(L===v||L.nodeType===8&&L.parentNode===v)break;if(C===4)for(C=p.return;C!==null;){var O=C.tag;if((O===3||O===4)&&(O=C.stateNode.containerInfo,O===v||O.nodeType===8&&O.parentNode===v))return;C=C.return}for(;L!==null;){if(C=ts(L),C===null)return;if(O=C.tag,O===5||O===6){p=b=C;continue e}L=L.parentNode}}p=p.return}vf(function(){var X=b,oe=Sc(u),le=[];e:{var re=lp.get(r);if(re!==void 0){var he=Oc,ge=r;switch(r){case"keypress":if(ga(u)===0)break e;case"keydown":case"keyup":he=$b;break;case"focusin":ge="focus",he=zc;break;case"focusout":ge="blur",he=zc;break;case"beforeblur":case"afterblur":he=zc;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":he=jf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=Pb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=Ub;break;case sp:case ip:case op:he=Nb;break;case ap:he=Wb;break;case"scroll":he=Cb;break;case"wheel":he=qb;break;case"copy":case"cut":case"paste":he=Lb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=$f}var ye=(o&4)!==0,lt=!ye&&r==="scroll",U=ye?re!==null?re+"Capture":null:re;ye=[];for(var z=X,W;z!==null;){W=z;var ue=W.stateNode;if(W.tag===5&&ue!==null&&(W=ue,U!==null&&(ue=Mi(z,U),ue!=null&&ye.push(Zi(z,ue,W)))),lt)break;z=z.return}0<ye.length&&(re=new he(re,ge,null,u,oe),le.push({event:re,listeners:ye}))}}if((o&7)===0){e:{if(re=r==="mouseover"||r==="pointerover",he=r==="mouseout"||r==="pointerout",re&&u!==xc&&(ge=u.relatedTarget||u.fromElement)&&(ts(ge)||ge[ir]))break e;if((he||re)&&(re=oe.window===oe?oe:(re=oe.ownerDocument)?re.defaultView||re.parentWindow:window,he?(ge=u.relatedTarget||u.toElement,he=X,ge=ge?ts(ge):null,ge!==null&&(lt=es(ge),ge!==lt||ge.tag!==5&&ge.tag!==6)&&(ge=null)):(he=null,ge=X),he!==ge)){if(ye=jf,ue="onMouseLeave",U="onMouseEnter",z="mouse",(r==="pointerout"||r==="pointerover")&&(ye=$f,ue="onPointerLeave",U="onPointerEnter",z="pointer"),lt=he==null?re:Us(he),W=ge==null?re:Us(ge),re=new ye(ue,z+"leave",he,u,oe),re.target=lt,re.relatedTarget=W,ue=null,ts(oe)===X&&(ye=new ye(U,z+"enter",ge,u,oe),ye.target=W,ye.relatedTarget=lt,ue=ye),lt=ue,he&&ge)t:{for(ye=he,U=ge,z=0,W=ye;W;W=Bs(W))z++;for(W=0,ue=U;ue;ue=Bs(ue))W++;for(;0<z-W;)ye=Bs(ye),z--;for(;0<W-z;)U=Bs(U),W--;for(;z--;){if(ye===U||U!==null&&ye===U.alternate)break t;ye=Bs(ye),U=Bs(U)}ye=null}else ye=null;he!==null&&fp(le,re,he,ye,!1),ge!==null&&lt!==null&&fp(le,lt,ge,ye,!0)}}e:{if(re=X?Us(X):window,he=re.nodeName&&re.nodeName.toLowerCase(),he==="select"||he==="input"&&re.type==="file")var we=ex;else if(Gf(re))if(Xf)we=sx;else{we=nx;var Ae=tx}else(he=re.nodeName)&&he.toLowerCase()==="input"&&(re.type==="checkbox"||re.type==="radio")&&(we=rx);if(we&&(we=we(r,X))){qf(le,we,u,oe);break e}Ae&&Ae(r,re,X),r==="focusout"&&(Ae=re._wrapperState)&&Ae.controlled&&re.type==="number"&&fn(re,"number",re.value)}switch(Ae=X?Us(X):window,r){case"focusin":(Gf(Ae)||Ae.contentEditable==="true")&&(zs=Ae,Wc=X,Ki=null);break;case"focusout":Ki=Wc=zs=null;break;case"mousedown":Gc=!0;break;case"contextmenu":case"mouseup":case"dragend":Gc=!1,np(le,u,oe);break;case"selectionchange":if(ax)break;case"keydown":case"keyup":np(le,u,oe)}var Ee;if(Bc)e:{switch(r){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else js?Vf(r,u)&&(Te="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(Te="onCompositionStart");Te&&(Bf&&u.locale!=="ko"&&(js||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&js&&(Ee=Of()):(Cr=oe,Dc="value"in Cr?Cr.value:Cr.textContent,js=!0)),Ae=Sa(X,Te),0<Ae.length&&(Te=new zf(Te,r,null,u,oe),le.push({event:Te,listeners:Ae}),Ee?Te.data=Ee:(Ee=Wf(u),Ee!==null&&(Te.data=Ee)))),(Ee=Yb?Kb(r,u):Qb(r,u))&&(X=Sa(X,"onBeforeInput"),0<X.length&&(oe=new zf("onBeforeInput","beforeinput",null,u,oe),le.push({event:oe,listeners:X}),oe.data=Ee))}dp(le,o)})}function Zi(r,o,u){return{instance:r,listener:o,currentTarget:u}}function Sa(r,o){for(var u=o+"Capture",p=[];r!==null;){var v=r,b=v.stateNode;v.tag===5&&b!==null&&(v=b,b=Mi(r,u),b!=null&&p.unshift(Zi(r,b,v)),b=Mi(r,o),b!=null&&p.push(Zi(r,b,v))),r=r.return}return p}function Bs(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function fp(r,o,u,p,v){for(var b=o._reactName,C=[];u!==null&&u!==p;){var L=u,O=L.alternate,X=L.stateNode;if(O!==null&&O===p)break;L.tag===5&&X!==null&&(L=X,v?(O=Mi(u,b),O!=null&&C.unshift(Zi(u,O,L))):v||(O=Mi(u,b),O!=null&&C.push(Zi(u,O,L)))),u=u.return}C.length!==0&&r.push({event:o,listeners:C})}var dx=/\r\n?/g,hx=/\u0000|\uFFFD/g;function pp(r){return(typeof r=="string"?r:""+r).replace(dx,`
38
+ `).replace(hx,"")}function Aa(r,o,u){if(o=pp(o),pp(r)!==o&&u)throw Error(t(425))}function Ea(){}var Jc=null,Zc=null;function eu(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var tu=typeof setTimeout=="function"?setTimeout:void 0,fx=typeof clearTimeout=="function"?clearTimeout:void 0,gp=typeof Promise=="function"?Promise:void 0,px=typeof queueMicrotask=="function"?queueMicrotask:typeof gp<"u"?function(r){return gp.resolve(null).then(r).catch(gx)}:tu;function gx(r){setTimeout(function(){throw r})}function nu(r,o){var u=o,p=0;do{var v=u.nextSibling;if(r.removeChild(u),v&&v.nodeType===8)if(u=v.data,u==="/$"){if(p===0){r.removeChild(v),Ui(o);return}p--}else u!=="$"&&u!=="$?"&&u!=="$!"||p++;u=v}while(u);Ui(o)}function Pr(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function mp(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"){if(o===0)return r;o--}else u==="/$"&&o++}r=r.previousSibling}return null}var Hs=Math.random().toString(36).slice(2),jn="__reactFiber$"+Hs,eo="__reactProps$"+Hs,ir="__reactContainer$"+Hs,ru="__reactEvents$"+Hs,mx="__reactListeners$"+Hs,vx="__reactHandles$"+Hs;function ts(r){var o=r[jn];if(o)return o;for(var u=r.parentNode;u;){if(o=u[ir]||u[jn]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=mp(r);r!==null;){if(u=r[jn])return u;r=mp(r)}return o}r=u,u=r.parentNode}return null}function to(r){return r=r[jn]||r[ir],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Us(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(t(33))}function _a(r){return r[eo]||null}var su=[],Vs=-1;function Tr(r){return{current:r}}function Ke(r){0>Vs||(r.current=su[Vs],su[Vs]=null,Vs--)}function Xe(r,o){Vs++,su[Vs]=r.current,r.current=o}var Rr={},It=Tr(Rr),Wt=Tr(!1),ns=Rr;function Ws(r,o){var u=r.type.contextTypes;if(!u)return Rr;var p=r.stateNode;if(p&&p.__reactInternalMemoizedUnmaskedChildContext===o)return p.__reactInternalMemoizedMaskedChildContext;var v={},b;for(b in u)v[b]=o[b];return p&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=v),v}function Gt(r){return r=r.childContextTypes,r!=null}function Ca(){Ke(Wt),Ke(It)}function vp(r,o,u){if(It.current!==Rr)throw Error(t(168));Xe(It,o),Xe(Wt,u)}function yp(r,o,u){var p=r.stateNode;if(o=o.childContextTypes,typeof p.getChildContext!="function")return u;p=p.getChildContext();for(var v in p)if(!(v in o))throw Error(t(108,H(r)||"Unknown",v));return ne({},u,p)}function ka(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Rr,ns=It.current,Xe(It,r),Xe(Wt,Wt.current),!0}function wp(r,o,u){var p=r.stateNode;if(!p)throw Error(t(169));u?(r=yp(r,o,ns),p.__reactInternalMemoizedMergedChildContext=r,Ke(Wt),Ke(It),Xe(It,r)):Ke(Wt),Xe(Wt,u)}var or=null,Pa=!1,iu=!1;function bp(r){or===null?or=[r]:or.push(r)}function yx(r){Pa=!0,bp(r)}function Nr(){if(!iu&&or!==null){iu=!0;var r=0,o=Ve;try{var u=or;for(Ve=1;r<u.length;r++){var p=u[r];do p=p(!0);while(p!==null)}or=null,Pa=!1}catch(v){throw or!==null&&(or=or.slice(r+1)),Sf(kc,Nr),v}finally{Ve=o,iu=!1}}return null}var Gs=[],qs=0,Ta=null,Ra=0,pn=[],gn=0,rs=null,ar=1,lr="";function ss(r,o){Gs[qs++]=Ra,Gs[qs++]=Ta,Ta=r,Ra=o}function xp(r,o,u){pn[gn++]=ar,pn[gn++]=lr,pn[gn++]=rs,rs=r;var p=ar;r=lr;var v=32-En(p)-1;p&=~(1<<v),u+=1;var b=32-En(o)+v;if(30<b){var C=v-v%5;b=(p&(1<<C)-1).toString(32),p>>=C,v-=C,ar=1<<32-En(o)+v|u<<v|p,lr=b+r}else ar=1<<b|u<<v|p,lr=r}function ou(r){r.return!==null&&(ss(r,1),xp(r,1,0))}function au(r){for(;r===Ta;)Ta=Gs[--qs],Gs[qs]=null,Ra=Gs[--qs],Gs[qs]=null;for(;r===rs;)rs=pn[--gn],pn[gn]=null,lr=pn[--gn],pn[gn]=null,ar=pn[--gn],pn[gn]=null}var nn=null,rn=null,Je=!1,Cn=null;function Sp(r,o){var u=wn(5,null,null,0);u.elementType="DELETED",u.stateNode=o,u.return=r,o=r.deletions,o===null?(r.deletions=[u],r.flags|=16):o.push(u)}function Ap(r,o){switch(r.tag){case 5:var u=r.type;return o=o.nodeType!==1||u.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,nn=r,rn=Pr(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,nn=r,rn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=rs!==null?{id:ar,overflow:lr}:null,r.memoizedState={dehydrated:o,treeContext:u,retryLane:1073741824},u=wn(18,null,null,0),u.stateNode=o,u.return=r,r.child=u,nn=r,rn=null,!0):!1;default:return!1}}function lu(r){return(r.mode&1)!==0&&(r.flags&128)===0}function cu(r){if(Je){var o=rn;if(o){var u=o;if(!Ap(r,o)){if(lu(r))throw Error(t(418));o=Pr(u.nextSibling);var p=nn;o&&Ap(r,o)?Sp(p,u):(r.flags=r.flags&-4097|2,Je=!1,nn=r)}}else{if(lu(r))throw Error(t(418));r.flags=r.flags&-4097|2,Je=!1,nn=r}}}function Ep(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;nn=r}function Na(r){if(r!==nn)return!1;if(!Je)return Ep(r),Je=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!eu(r.type,r.memoizedProps)),o&&(o=rn)){if(lu(r))throw _p(),Error(t(418));for(;o;)Sp(r,o),o=Pr(o.nextSibling)}if(Ep(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(t(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"){if(o===0){rn=Pr(r.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}r=r.nextSibling}rn=null}}else rn=nn?Pr(r.stateNode.nextSibling):null;return!0}function _p(){for(var r=rn;r;)r=Pr(r.nextSibling)}function Xs(){rn=nn=null,Je=!1}function uu(r){Cn===null?Cn=[r]:Cn.push(r)}var wx=T.ReactCurrentBatchConfig;function no(r,o,u){if(r=u.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(t(309));var p=u.stateNode}if(!p)throw Error(t(147,r));var v=p,b=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===b?o.ref:(o=function(C){var L=v.refs;C===null?delete L[b]:L[b]=C},o._stringRef=b,o)}if(typeof r!="string")throw Error(t(284));if(!u._owner)throw Error(t(290,r))}return r}function Ia(r,o){throw r=Object.prototype.toString.call(o),Error(t(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function Cp(r){var o=r._init;return o(r._payload)}function kp(r){function o(U,z){if(r){var W=U.deletions;W===null?(U.deletions=[z],U.flags|=16):W.push(z)}}function u(U,z){if(!r)return null;for(;z!==null;)o(U,z),z=z.sibling;return null}function p(U,z){for(U=new Map;z!==null;)z.key!==null?U.set(z.key,z):U.set(z.index,z),z=z.sibling;return U}function v(U,z){return U=zr(U,z),U.index=0,U.sibling=null,U}function b(U,z,W){return U.index=W,r?(W=U.alternate,W!==null?(W=W.index,W<z?(U.flags|=2,z):W):(U.flags|=2,z)):(U.flags|=1048576,z)}function C(U){return r&&U.alternate===null&&(U.flags|=2),U}function L(U,z,W,ue){return z===null||z.tag!==6?(z=td(W,U.mode,ue),z.return=U,z):(z=v(z,W),z.return=U,z)}function O(U,z,W,ue){var we=W.type;return we===N?oe(U,z,W.props.children,ue,W.key):z!==null&&(z.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===B&&Cp(we)===z.type)?(ue=v(z,W.props),ue.ref=no(U,z,W),ue.return=U,ue):(ue=nl(W.type,W.key,W.props,null,U.mode,ue),ue.ref=no(U,z,W),ue.return=U,ue)}function X(U,z,W,ue){return z===null||z.tag!==4||z.stateNode.containerInfo!==W.containerInfo||z.stateNode.implementation!==W.implementation?(z=nd(W,U.mode,ue),z.return=U,z):(z=v(z,W.children||[]),z.return=U,z)}function oe(U,z,W,ue,we){return z===null||z.tag!==7?(z=hs(W,U.mode,ue,we),z.return=U,z):(z=v(z,W),z.return=U,z)}function le(U,z,W){if(typeof z=="string"&&z!==""||typeof z=="number")return z=td(""+z,U.mode,W),z.return=U,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case R:return W=nl(z.type,z.key,z.props,null,U.mode,W),W.ref=no(U,null,z),W.return=U,W;case I:return z=nd(z,U.mode,W),z.return=U,z;case B:var ue=z._init;return le(U,ue(z._payload),W)}if(nr(z)||Q(z))return z=hs(z,U.mode,W,null),z.return=U,z;Ia(U,z)}return null}function re(U,z,W,ue){var we=z!==null?z.key:null;if(typeof W=="string"&&W!==""||typeof W=="number")return we!==null?null:L(U,z,""+W,ue);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case R:return W.key===we?O(U,z,W,ue):null;case I:return W.key===we?X(U,z,W,ue):null;case B:return we=W._init,re(U,z,we(W._payload),ue)}if(nr(W)||Q(W))return we!==null?null:oe(U,z,W,ue,null);Ia(U,W)}return null}function he(U,z,W,ue,we){if(typeof ue=="string"&&ue!==""||typeof ue=="number")return U=U.get(W)||null,L(z,U,""+ue,we);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case R:return U=U.get(ue.key===null?W:ue.key)||null,O(z,U,ue,we);case I:return U=U.get(ue.key===null?W:ue.key)||null,X(z,U,ue,we);case B:var Ae=ue._init;return he(U,z,W,Ae(ue._payload),we)}if(nr(ue)||Q(ue))return U=U.get(W)||null,oe(z,U,ue,we,null);Ia(z,ue)}return null}function ge(U,z,W,ue){for(var we=null,Ae=null,Ee=z,Te=z=0,_t=null;Ee!==null&&Te<W.length;Te++){Ee.index>Te?(_t=Ee,Ee=null):_t=Ee.sibling;var Be=re(U,Ee,W[Te],ue);if(Be===null){Ee===null&&(Ee=_t);break}r&&Ee&&Be.alternate===null&&o(U,Ee),z=b(Be,z,Te),Ae===null?we=Be:Ae.sibling=Be,Ae=Be,Ee=_t}if(Te===W.length)return u(U,Ee),Je&&ss(U,Te),we;if(Ee===null){for(;Te<W.length;Te++)Ee=le(U,W[Te],ue),Ee!==null&&(z=b(Ee,z,Te),Ae===null?we=Ee:Ae.sibling=Ee,Ae=Ee);return Je&&ss(U,Te),we}for(Ee=p(U,Ee);Te<W.length;Te++)_t=he(Ee,U,Te,W[Te],ue),_t!==null&&(r&&_t.alternate!==null&&Ee.delete(_t.key===null?Te:_t.key),z=b(_t,z,Te),Ae===null?we=_t:Ae.sibling=_t,Ae=_t);return r&&Ee.forEach(function($r){return o(U,$r)}),Je&&ss(U,Te),we}function ye(U,z,W,ue){var we=Q(W);if(typeof we!="function")throw Error(t(150));if(W=we.call(W),W==null)throw Error(t(151));for(var Ae=we=null,Ee=z,Te=z=0,_t=null,Be=W.next();Ee!==null&&!Be.done;Te++,Be=W.next()){Ee.index>Te?(_t=Ee,Ee=null):_t=Ee.sibling;var $r=re(U,Ee,Be.value,ue);if($r===null){Ee===null&&(Ee=_t);break}r&&Ee&&$r.alternate===null&&o(U,Ee),z=b($r,z,Te),Ae===null?we=$r:Ae.sibling=$r,Ae=$r,Ee=_t}if(Be.done)return u(U,Ee),Je&&ss(U,Te),we;if(Ee===null){for(;!Be.done;Te++,Be=W.next())Be=le(U,Be.value,ue),Be!==null&&(z=b(Be,z,Te),Ae===null?we=Be:Ae.sibling=Be,Ae=Be);return Je&&ss(U,Te),we}for(Ee=p(U,Ee);!Be.done;Te++,Be=W.next())Be=he(Ee,U,Te,Be.value,ue),Be!==null&&(r&&Be.alternate!==null&&Ee.delete(Be.key===null?Te:Be.key),z=b(Be,z,Te),Ae===null?we=Be:Ae.sibling=Be,Ae=Be);return r&&Ee.forEach(function(Jx){return o(U,Jx)}),Je&&ss(U,Te),we}function lt(U,z,W,ue){if(typeof W=="object"&&W!==null&&W.type===N&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case R:e:{for(var we=W.key,Ae=z;Ae!==null;){if(Ae.key===we){if(we=W.type,we===N){if(Ae.tag===7){u(U,Ae.sibling),z=v(Ae,W.props.children),z.return=U,U=z;break e}}else if(Ae.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===B&&Cp(we)===Ae.type){u(U,Ae.sibling),z=v(Ae,W.props),z.ref=no(U,Ae,W),z.return=U,U=z;break e}u(U,Ae);break}else o(U,Ae);Ae=Ae.sibling}W.type===N?(z=hs(W.props.children,U.mode,ue,W.key),z.return=U,U=z):(ue=nl(W.type,W.key,W.props,null,U.mode,ue),ue.ref=no(U,z,W),ue.return=U,U=ue)}return C(U);case I:e:{for(Ae=W.key;z!==null;){if(z.key===Ae)if(z.tag===4&&z.stateNode.containerInfo===W.containerInfo&&z.stateNode.implementation===W.implementation){u(U,z.sibling),z=v(z,W.children||[]),z.return=U,U=z;break e}else{u(U,z);break}else o(U,z);z=z.sibling}z=nd(W,U.mode,ue),z.return=U,U=z}return C(U);case B:return Ae=W._init,lt(U,z,Ae(W._payload),ue)}if(nr(W))return ge(U,z,W,ue);if(Q(W))return ye(U,z,W,ue);Ia(U,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,z!==null&&z.tag===6?(u(U,z.sibling),z=v(z,W),z.return=U,U=z):(u(U,z),z=td(W,U.mode,ue),z.return=U,U=z),C(U)):u(U,z)}return lt}var Ys=kp(!0),Pp=kp(!1),La=Tr(null),Ma=null,Ks=null,du=null;function hu(){du=Ks=Ma=null}function fu(r){var o=La.current;Ke(La),r._currentValue=o}function pu(r,o,u){for(;r!==null;){var p=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,p!==null&&(p.childLanes|=o)):p!==null&&(p.childLanes&o)!==o&&(p.childLanes|=o),r===u)break;r=r.return}}function Qs(r,o){Ma=r,du=Ks=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(qt=!0),r.firstContext=null)}function mn(r){var o=r._currentValue;if(du!==r)if(r={context:r,memoizedValue:o,next:null},Ks===null){if(Ma===null)throw Error(t(308));Ks=r,Ma.dependencies={lanes:0,firstContext:r}}else Ks=Ks.next=r;return o}var is=null;function gu(r){is===null?is=[r]:is.push(r)}function Tp(r,o,u,p){var v=o.interleaved;return v===null?(u.next=u,gu(o)):(u.next=v.next,v.next=u),o.interleaved=u,cr(r,p)}function cr(r,o){r.lanes|=o;var u=r.alternate;for(u!==null&&(u.lanes|=o),u=r,r=r.return;r!==null;)r.childLanes|=o,u=r.alternate,u!==null&&(u.childLanes|=o),u=r,r=r.return;return u.tag===3?u.stateNode:null}var Ir=!1;function mu(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Rp(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function ur(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Lr(r,o,u){var p=r.updateQueue;if(p===null)return null;if(p=p.shared,(ze&2)!==0){var v=p.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),p.pending=o,cr(r,u)}return v=p.interleaved,v===null?(o.next=o,gu(p)):(o.next=v.next,v.next=o),p.interleaved=o,cr(r,u)}function Da(r,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var p=o.lanes;p&=r.pendingLanes,u|=p,o.lanes=u,Rc(r,u)}}function Np(r,o){var u=r.updateQueue,p=r.alternate;if(p!==null&&(p=p.updateQueue,u===p)){var v=null,b=null;if(u=u.firstBaseUpdate,u!==null){do{var C={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};b===null?v=b=C:b=b.next=C,u=u.next}while(u!==null);b===null?v=b=o:b=b.next=o}else v=b=o;u={baseState:p.baseState,firstBaseUpdate:v,lastBaseUpdate:b,shared:p.shared,effects:p.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=o:r.next=o,u.lastBaseUpdate=o}function Oa(r,o,u,p){var v=r.updateQueue;Ir=!1;var b=v.firstBaseUpdate,C=v.lastBaseUpdate,L=v.shared.pending;if(L!==null){v.shared.pending=null;var O=L,X=O.next;O.next=null,C===null?b=X:C.next=X,C=O;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,L=oe.lastBaseUpdate,L!==C&&(L===null?oe.firstBaseUpdate=X:L.next=X,oe.lastBaseUpdate=O))}if(b!==null){var le=v.baseState;C=0,oe=X=O=null,L=b;do{var re=L.lane,he=L.eventTime;if((p&re)===re){oe!==null&&(oe=oe.next={eventTime:he,lane:0,tag:L.tag,payload:L.payload,callback:L.callback,next:null});e:{var ge=r,ye=L;switch(re=o,he=u,ye.tag){case 1:if(ge=ye.payload,typeof ge=="function"){le=ge.call(he,le,re);break e}le=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=ye.payload,re=typeof ge=="function"?ge.call(he,le,re):ge,re==null)break e;le=ne({},le,re);break e;case 2:Ir=!0}}L.callback!==null&&L.lane!==0&&(r.flags|=64,re=v.effects,re===null?v.effects=[L]:re.push(L))}else he={eventTime:he,lane:re,tag:L.tag,payload:L.payload,callback:L.callback,next:null},oe===null?(X=oe=he,O=le):oe=oe.next=he,C|=re;if(L=L.next,L===null){if(L=v.shared.pending,L===null)break;re=L,L=re.next,re.next=null,v.lastBaseUpdate=re,v.shared.pending=null}}while(!0);if(oe===null&&(O=le),v.baseState=O,v.firstBaseUpdate=X,v.lastBaseUpdate=oe,o=v.shared.interleaved,o!==null){v=o;do C|=v.lane,v=v.next;while(v!==o)}else b===null&&(v.shared.lanes=0);ls|=C,r.lanes=C,r.memoizedState=le}}function Ip(r,o,u){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var p=r[o],v=p.callback;if(v!==null){if(p.callback=null,p=u,typeof v!="function")throw Error(t(191,v));v.call(p)}}}var ro={},zn=Tr(ro),so=Tr(ro),io=Tr(ro);function os(r){if(r===ro)throw Error(t(174));return r}function vu(r,o){switch(Xe(io,o),Xe(so,r),Xe(zn,ro),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:On(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=On(o,r)}Ke(zn),Xe(zn,o)}function Js(){Ke(zn),Ke(so),Ke(io)}function Lp(r){os(io.current);var o=os(zn.current),u=On(o,r.type);o!==u&&(Xe(so,r),Xe(zn,u))}function yu(r){so.current===r&&(Ke(zn),Ke(so))}var tt=Tr(0);function Fa(r){for(var o=r;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var wu=[];function bu(){for(var r=0;r<wu.length;r++)wu[r]._workInProgressVersionPrimary=null;wu.length=0}var ja=T.ReactCurrentDispatcher,xu=T.ReactCurrentBatchConfig,as=0,nt=null,yt=null,At=null,za=!1,oo=!1,ao=0,bx=0;function Lt(){throw Error(t(321))}function Su(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!_n(r[u],o[u]))return!1;return!0}function Au(r,o,u,p,v,b){if(as=b,nt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,ja.current=r===null||r.memoizedState===null?Ex:_x,r=u(p,v),oo){b=0;do{if(oo=!1,ao=0,25<=b)throw Error(t(301));b+=1,At=yt=null,o.updateQueue=null,ja.current=Cx,r=u(p,v)}while(oo)}if(ja.current=Ha,o=yt!==null&&yt.next!==null,as=0,At=yt=nt=null,za=!1,o)throw Error(t(300));return r}function Eu(){var r=ao!==0;return ao=0,r}function $n(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return At===null?nt.memoizedState=At=r:At=At.next=r,At}function vn(){if(yt===null){var r=nt.alternate;r=r!==null?r.memoizedState:null}else r=yt.next;var o=At===null?nt.memoizedState:At.next;if(o!==null)At=o,yt=r;else{if(r===null)throw Error(t(310));yt=r,r={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},At===null?nt.memoizedState=At=r:At=At.next=r}return At}function lo(r,o){return typeof o=="function"?o(r):o}function _u(r){var o=vn(),u=o.queue;if(u===null)throw Error(t(311));u.lastRenderedReducer=r;var p=yt,v=p.baseQueue,b=u.pending;if(b!==null){if(v!==null){var C=v.next;v.next=b.next,b.next=C}p.baseQueue=v=b,u.pending=null}if(v!==null){b=v.next,p=p.baseState;var L=C=null,O=null,X=b;do{var oe=X.lane;if((as&oe)===oe)O!==null&&(O=O.next={lane:0,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null}),p=X.hasEagerState?X.eagerState:r(p,X.action);else{var le={lane:oe,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null};O===null?(L=O=le,C=p):O=O.next=le,nt.lanes|=oe,ls|=oe}X=X.next}while(X!==null&&X!==b);O===null?C=p:O.next=L,_n(p,o.memoizedState)||(qt=!0),o.memoizedState=p,o.baseState=C,o.baseQueue=O,u.lastRenderedState=p}if(r=u.interleaved,r!==null){v=r;do b=v.lane,nt.lanes|=b,ls|=b,v=v.next;while(v!==r)}else v===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function Cu(r){var o=vn(),u=o.queue;if(u===null)throw Error(t(311));u.lastRenderedReducer=r;var p=u.dispatch,v=u.pending,b=o.memoizedState;if(v!==null){u.pending=null;var C=v=v.next;do b=r(b,C.action),C=C.next;while(C!==v);_n(b,o.memoizedState)||(qt=!0),o.memoizedState=b,o.baseQueue===null&&(o.baseState=b),u.lastRenderedState=b}return[b,p]}function Mp(){}function Dp(r,o){var u=nt,p=vn(),v=o(),b=!_n(p.memoizedState,v);if(b&&(p.memoizedState=v,qt=!0),p=p.queue,ku(jp.bind(null,u,p,r),[r]),p.getSnapshot!==o||b||At!==null&&At.memoizedState.tag&1){if(u.flags|=2048,co(9,Fp.bind(null,u,p,v,o),void 0,null),Et===null)throw Error(t(349));(as&30)!==0||Op(u,o,v)}return v}function Op(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=nt.updateQueue,o===null?(o={lastEffect:null,stores:null},nt.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function Fp(r,o,u,p){o.value=u,o.getSnapshot=p,zp(o)&&$p(r)}function jp(r,o,u){return u(function(){zp(o)&&$p(r)})}function zp(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!_n(r,u)}catch{return!0}}function $p(r){var o=cr(r,1);o!==null&&Rn(o,r,1,-1)}function Bp(r){var o=$n();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:lo,lastRenderedState:r},o.queue=r,r=r.dispatch=Ax.bind(null,nt,r),[o.memoizedState,r]}function co(r,o,u,p){return r={tag:r,create:o,destroy:u,deps:p,next:null},o=nt.updateQueue,o===null?(o={lastEffect:null,stores:null},nt.updateQueue=o,o.lastEffect=r.next=r):(u=o.lastEffect,u===null?o.lastEffect=r.next=r:(p=u.next,u.next=r,r.next=p,o.lastEffect=r)),r}function Hp(){return vn().memoizedState}function $a(r,o,u,p){var v=$n();nt.flags|=r,v.memoizedState=co(1|o,u,void 0,p===void 0?null:p)}function Ba(r,o,u,p){var v=vn();p=p===void 0?null:p;var b=void 0;if(yt!==null){var C=yt.memoizedState;if(b=C.destroy,p!==null&&Su(p,C.deps)){v.memoizedState=co(o,u,b,p);return}}nt.flags|=r,v.memoizedState=co(1|o,u,b,p)}function Up(r,o){return $a(8390656,8,r,o)}function ku(r,o){return Ba(2048,8,r,o)}function Vp(r,o){return Ba(4,2,r,o)}function Wp(r,o){return Ba(4,4,r,o)}function Gp(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function qp(r,o,u){return u=u!=null?u.concat([r]):null,Ba(4,4,Gp.bind(null,o,r),u)}function Pu(){}function Xp(r,o){var u=vn();o=o===void 0?null:o;var p=u.memoizedState;return p!==null&&o!==null&&Su(o,p[1])?p[0]:(u.memoizedState=[r,o],r)}function Yp(r,o){var u=vn();o=o===void 0?null:o;var p=u.memoizedState;return p!==null&&o!==null&&Su(o,p[1])?p[0]:(r=r(),u.memoizedState=[r,o],r)}function Kp(r,o,u){return(as&21)===0?(r.baseState&&(r.baseState=!1,qt=!0),r.memoizedState=u):(_n(u,o)||(u=Cf(),nt.lanes|=u,ls|=u,r.baseState=!0),o)}function xx(r,o){var u=Ve;Ve=u!==0&&4>u?u:4,r(!0);var p=xu.transition;xu.transition={};try{r(!1),o()}finally{Ve=u,xu.transition=p}}function Qp(){return vn().memoizedState}function Sx(r,o,u){var p=Fr(r);if(u={lane:p,action:u,hasEagerState:!1,eagerState:null,next:null},Jp(r))Zp(o,u);else if(u=Tp(r,o,u,p),u!==null){var v=Ht();Rn(u,r,p,v),eg(u,o,p)}}function Ax(r,o,u){var p=Fr(r),v={lane:p,action:u,hasEagerState:!1,eagerState:null,next:null};if(Jp(r))Zp(o,v);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=o.lastRenderedReducer,b!==null))try{var C=o.lastRenderedState,L=b(C,u);if(v.hasEagerState=!0,v.eagerState=L,_n(L,C)){var O=o.interleaved;O===null?(v.next=v,gu(o)):(v.next=O.next,O.next=v),o.interleaved=v;return}}catch{}finally{}u=Tp(r,o,v,p),u!==null&&(v=Ht(),Rn(u,r,p,v),eg(u,o,p))}}function Jp(r){var o=r.alternate;return r===nt||o!==null&&o===nt}function Zp(r,o){oo=za=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function eg(r,o,u){if((u&4194240)!==0){var p=o.lanes;p&=r.pendingLanes,u|=p,o.lanes=u,Rc(r,u)}}var Ha={readContext:mn,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},Ex={readContext:mn,useCallback:function(r,o){return $n().memoizedState=[r,o===void 0?null:o],r},useContext:mn,useEffect:Up,useImperativeHandle:function(r,o,u){return u=u!=null?u.concat([r]):null,$a(4194308,4,Gp.bind(null,o,r),u)},useLayoutEffect:function(r,o){return $a(4194308,4,r,o)},useInsertionEffect:function(r,o){return $a(4,2,r,o)},useMemo:function(r,o){var u=$n();return o=o===void 0?null:o,r=r(),u.memoizedState=[r,o],r},useReducer:function(r,o,u){var p=$n();return o=u!==void 0?u(o):o,p.memoizedState=p.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},p.queue=r,r=r.dispatch=Sx.bind(null,nt,r),[p.memoizedState,r]},useRef:function(r){var o=$n();return r={current:r},o.memoizedState=r},useState:Bp,useDebugValue:Pu,useDeferredValue:function(r){return $n().memoizedState=r},useTransition:function(){var r=Bp(!1),o=r[0];return r=xx.bind(null,r[1]),$n().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,u){var p=nt,v=$n();if(Je){if(u===void 0)throw Error(t(407));u=u()}else{if(u=o(),Et===null)throw Error(t(349));(as&30)!==0||Op(p,o,u)}v.memoizedState=u;var b={value:u,getSnapshot:o};return v.queue=b,Up(jp.bind(null,p,b,r),[r]),p.flags|=2048,co(9,Fp.bind(null,p,b,u,o),void 0,null),u},useId:function(){var r=$n(),o=Et.identifierPrefix;if(Je){var u=lr,p=ar;u=(p&~(1<<32-En(p)-1)).toString(32)+u,o=":"+o+"R"+u,u=ao++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=bx++,o=":"+o+"r"+u.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},_x={readContext:mn,useCallback:Xp,useContext:mn,useEffect:ku,useImperativeHandle:qp,useInsertionEffect:Vp,useLayoutEffect:Wp,useMemo:Yp,useReducer:_u,useRef:Hp,useState:function(){return _u(lo)},useDebugValue:Pu,useDeferredValue:function(r){var o=vn();return Kp(o,yt.memoizedState,r)},useTransition:function(){var r=_u(lo)[0],o=vn().memoizedState;return[r,o]},useMutableSource:Mp,useSyncExternalStore:Dp,useId:Qp,unstable_isNewReconciler:!1},Cx={readContext:mn,useCallback:Xp,useContext:mn,useEffect:ku,useImperativeHandle:qp,useInsertionEffect:Vp,useLayoutEffect:Wp,useMemo:Yp,useReducer:Cu,useRef:Hp,useState:function(){return Cu(lo)},useDebugValue:Pu,useDeferredValue:function(r){var o=vn();return yt===null?o.memoizedState=r:Kp(o,yt.memoizedState,r)},useTransition:function(){var r=Cu(lo)[0],o=vn().memoizedState;return[r,o]},useMutableSource:Mp,useSyncExternalStore:Dp,useId:Qp,unstable_isNewReconciler:!1};function kn(r,o){if(r&&r.defaultProps){o=ne({},o),r=r.defaultProps;for(var u in r)o[u]===void 0&&(o[u]=r[u]);return o}return o}function Tu(r,o,u,p){o=r.memoizedState,u=u(p,o),u=u==null?o:ne({},o,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Ua={isMounted:function(r){return(r=r._reactInternals)?es(r)===r:!1},enqueueSetState:function(r,o,u){r=r._reactInternals;var p=Ht(),v=Fr(r),b=ur(p,v);b.payload=o,u!=null&&(b.callback=u),o=Lr(r,b,v),o!==null&&(Rn(o,r,v,p),Da(o,r,v))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var p=Ht(),v=Fr(r),b=ur(p,v);b.tag=1,b.payload=o,u!=null&&(b.callback=u),o=Lr(r,b,v),o!==null&&(Rn(o,r,v,p),Da(o,r,v))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=Ht(),p=Fr(r),v=ur(u,p);v.tag=2,o!=null&&(v.callback=o),o=Lr(r,v,p),o!==null&&(Rn(o,r,p,u),Da(o,r,p))}};function tg(r,o,u,p,v,b,C){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(p,b,C):o.prototype&&o.prototype.isPureReactComponent?!Yi(u,p)||!Yi(v,b):!0}function ng(r,o,u){var p=!1,v=Rr,b=o.contextType;return typeof b=="object"&&b!==null?b=mn(b):(v=Gt(o)?ns:It.current,p=o.contextTypes,b=(p=p!=null)?Ws(r,v):Rr),o=new o(u,b),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Ua,r.stateNode=o,o._reactInternals=r,p&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=b),o}function rg(r,o,u,p){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,p),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,p),o.state!==r&&Ua.enqueueReplaceState(o,o.state,null)}function Ru(r,o,u,p){var v=r.stateNode;v.props=u,v.state=r.memoizedState,v.refs={},mu(r);var b=o.contextType;typeof b=="object"&&b!==null?v.context=mn(b):(b=Gt(o)?ns:It.current,v.context=Ws(r,b)),v.state=r.memoizedState,b=o.getDerivedStateFromProps,typeof b=="function"&&(Tu(r,o,b,u),v.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&Ua.enqueueReplaceState(v,v.state,null),Oa(r,u,v,p),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function Zs(r,o){try{var u="",p=o;do u+=se(p),p=p.return;while(p);var v=u}catch(b){v=`
39
+ Error generating stack: `+b.message+`
40
+ `+b.stack}return{value:r,source:o,stack:v,digest:null}}function Nu(r,o,u){return{value:r,source:null,stack:u??null,digest:o??null}}function Iu(r,o){try{console.error(o.value)}catch(u){setTimeout(function(){throw u})}}var kx=typeof WeakMap=="function"?WeakMap:Map;function sg(r,o,u){u=ur(-1,u),u.tag=3,u.payload={element:null};var p=o.value;return u.callback=function(){Ka||(Ka=!0,qu=p),Iu(r,o)},u}function ig(r,o,u){u=ur(-1,u),u.tag=3;var p=r.type.getDerivedStateFromError;if(typeof p=="function"){var v=o.value;u.payload=function(){return p(v)},u.callback=function(){Iu(r,o)}}var b=r.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(u.callback=function(){Iu(r,o),typeof p!="function"&&(Dr===null?Dr=new Set([this]):Dr.add(this));var C=o.stack;this.componentDidCatch(o.value,{componentStack:C!==null?C:""})}),u}function og(r,o,u){var p=r.pingCache;if(p===null){p=r.pingCache=new kx;var v=new Set;p.set(o,v)}else v=p.get(o),v===void 0&&(v=new Set,p.set(o,v));v.has(u)||(v.add(u),r=Bx.bind(null,r,o,u),o.then(r,r))}function ag(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function lg(r,o,u,p,v){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(o=ur(-1,1),o.tag=2,Lr(u,o,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var Px=T.ReactCurrentOwner,qt=!1;function Bt(r,o,u,p){o.child=r===null?Pp(o,null,u,p):Ys(o,r.child,u,p)}function cg(r,o,u,p,v){u=u.render;var b=o.ref;return Qs(o,v),p=Au(r,o,u,p,b,v),u=Eu(),r!==null&&!qt?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,dr(r,o,v)):(Je&&u&&ou(o),o.flags|=1,Bt(r,o,p,v),o.child)}function ug(r,o,u,p,v){if(r===null){var b=u.type;return typeof b=="function"&&!ed(b)&&b.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(o.tag=15,o.type=b,dg(r,o,b,p,v)):(r=nl(u.type,null,p,o,o.mode,v),r.ref=o.ref,r.return=o,o.child=r)}if(b=r.child,(r.lanes&v)===0){var C=b.memoizedProps;if(u=u.compare,u=u!==null?u:Yi,u(C,p)&&r.ref===o.ref)return dr(r,o,v)}return o.flags|=1,r=zr(b,p),r.ref=o.ref,r.return=o,o.child=r}function dg(r,o,u,p,v){if(r!==null){var b=r.memoizedProps;if(Yi(b,p)&&r.ref===o.ref)if(qt=!1,o.pendingProps=p=b,(r.lanes&v)!==0)(r.flags&131072)!==0&&(qt=!0);else return o.lanes=r.lanes,dr(r,o,v)}return Lu(r,o,u,p,v)}function hg(r,o,u){var p=o.pendingProps,v=p.children,b=r!==null?r.memoizedState:null;if(p.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},Xe(ti,sn),sn|=u;else{if((u&1073741824)===0)return r=b!==null?b.baseLanes|u:u,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,Xe(ti,sn),sn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},p=b!==null?b.baseLanes:u,Xe(ti,sn),sn|=p}else b!==null?(p=b.baseLanes|u,o.memoizedState=null):p=u,Xe(ti,sn),sn|=p;return Bt(r,o,v,u),o.child}function fg(r,o){var u=o.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(o.flags|=512,o.flags|=2097152)}function Lu(r,o,u,p,v){var b=Gt(u)?ns:It.current;return b=Ws(o,b),Qs(o,v),u=Au(r,o,u,p,b,v),p=Eu(),r!==null&&!qt?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,dr(r,o,v)):(Je&&p&&ou(o),o.flags|=1,Bt(r,o,u,v),o.child)}function pg(r,o,u,p,v){if(Gt(u)){var b=!0;ka(o)}else b=!1;if(Qs(o,v),o.stateNode===null)Wa(r,o),ng(o,u,p),Ru(o,u,p,v),p=!0;else if(r===null){var C=o.stateNode,L=o.memoizedProps;C.props=L;var O=C.context,X=u.contextType;typeof X=="object"&&X!==null?X=mn(X):(X=Gt(u)?ns:It.current,X=Ws(o,X));var oe=u.getDerivedStateFromProps,le=typeof oe=="function"||typeof C.getSnapshotBeforeUpdate=="function";le||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(L!==p||O!==X)&&rg(o,C,p,X),Ir=!1;var re=o.memoizedState;C.state=re,Oa(o,p,C,v),O=o.memoizedState,L!==p||re!==O||Wt.current||Ir?(typeof oe=="function"&&(Tu(o,u,oe,p),O=o.memoizedState),(L=Ir||tg(o,u,L,p,re,O,X))?(le||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(o.flags|=4194308)):(typeof C.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=p,o.memoizedState=O),C.props=p,C.state=O,C.context=X,p=L):(typeof C.componentDidMount=="function"&&(o.flags|=4194308),p=!1)}else{C=o.stateNode,Rp(r,o),L=o.memoizedProps,X=o.type===o.elementType?L:kn(o.type,L),C.props=X,le=o.pendingProps,re=C.context,O=u.contextType,typeof O=="object"&&O!==null?O=mn(O):(O=Gt(u)?ns:It.current,O=Ws(o,O));var he=u.getDerivedStateFromProps;(oe=typeof he=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(L!==le||re!==O)&&rg(o,C,p,O),Ir=!1,re=o.memoizedState,C.state=re,Oa(o,p,C,v);var ge=o.memoizedState;L!==le||re!==ge||Wt.current||Ir?(typeof he=="function"&&(Tu(o,u,he,p),ge=o.memoizedState),(X=Ir||tg(o,u,X,p,re,ge,O)||!1)?(oe||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(p,ge,O),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(p,ge,O)),typeof C.componentDidUpdate=="function"&&(o.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof C.componentDidUpdate!="function"||L===r.memoizedProps&&re===r.memoizedState||(o.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||L===r.memoizedProps&&re===r.memoizedState||(o.flags|=1024),o.memoizedProps=p,o.memoizedState=ge),C.props=p,C.state=ge,C.context=O,p=X):(typeof C.componentDidUpdate!="function"||L===r.memoizedProps&&re===r.memoizedState||(o.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||L===r.memoizedProps&&re===r.memoizedState||(o.flags|=1024),p=!1)}return Mu(r,o,u,p,b,v)}function Mu(r,o,u,p,v,b){fg(r,o);var C=(o.flags&128)!==0;if(!p&&!C)return v&&wp(o,u,!1),dr(r,o,b);p=o.stateNode,Px.current=o;var L=C&&typeof u.getDerivedStateFromError!="function"?null:p.render();return o.flags|=1,r!==null&&C?(o.child=Ys(o,r.child,null,b),o.child=Ys(o,null,L,b)):Bt(r,o,L,b),o.memoizedState=p.state,v&&wp(o,u,!0),o.child}function gg(r){var o=r.stateNode;o.pendingContext?vp(r,o.pendingContext,o.pendingContext!==o.context):o.context&&vp(r,o.context,!1),vu(r,o.containerInfo)}function mg(r,o,u,p,v){return Xs(),uu(v),o.flags|=256,Bt(r,o,u,p),o.child}var Du={dehydrated:null,treeContext:null,retryLane:0};function Ou(r){return{baseLanes:r,cachePool:null,transitions:null}}function vg(r,o,u){var p=o.pendingProps,v=tt.current,b=!1,C=(o.flags&128)!==0,L;if((L=C)||(L=r!==null&&r.memoizedState===null?!1:(v&2)!==0),L?(b=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),Xe(tt,v&1),r===null)return cu(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(C=p.children,r=p.fallback,b?(p=o.mode,b=o.child,C={mode:"hidden",children:C},(p&1)===0&&b!==null?(b.childLanes=0,b.pendingProps=C):b=rl(C,p,0,null),r=hs(r,p,u,null),b.return=o,r.return=o,b.sibling=r,o.child=b,o.child.memoizedState=Ou(u),o.memoizedState=Du,r):Fu(o,C));if(v=r.memoizedState,v!==null&&(L=v.dehydrated,L!==null))return Tx(r,o,C,p,L,v,u);if(b){b=p.fallback,C=o.mode,v=r.child,L=v.sibling;var O={mode:"hidden",children:p.children};return(C&1)===0&&o.child!==v?(p=o.child,p.childLanes=0,p.pendingProps=O,o.deletions=null):(p=zr(v,O),p.subtreeFlags=v.subtreeFlags&14680064),L!==null?b=zr(L,b):(b=hs(b,C,u,null),b.flags|=2),b.return=o,p.return=o,p.sibling=b,o.child=p,p=b,b=o.child,C=r.child.memoizedState,C=C===null?Ou(u):{baseLanes:C.baseLanes|u,cachePool:null,transitions:C.transitions},b.memoizedState=C,b.childLanes=r.childLanes&~u,o.memoizedState=Du,p}return b=r.child,r=b.sibling,p=zr(b,{mode:"visible",children:p.children}),(o.mode&1)===0&&(p.lanes=u),p.return=o,p.sibling=null,r!==null&&(u=o.deletions,u===null?(o.deletions=[r],o.flags|=16):u.push(r)),o.child=p,o.memoizedState=null,p}function Fu(r,o){return o=rl({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Va(r,o,u,p){return p!==null&&uu(p),Ys(o,r.child,null,u),r=Fu(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function Tx(r,o,u,p,v,b,C){if(u)return o.flags&256?(o.flags&=-257,p=Nu(Error(t(422))),Va(r,o,C,p)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(b=p.fallback,v=o.mode,p=rl({mode:"visible",children:p.children},v,0,null),b=hs(b,v,C,null),b.flags|=2,p.return=o,b.return=o,p.sibling=b,o.child=p,(o.mode&1)!==0&&Ys(o,r.child,null,C),o.child.memoizedState=Ou(C),o.memoizedState=Du,b);if((o.mode&1)===0)return Va(r,o,C,null);if(v.data==="$!"){if(p=v.nextSibling&&v.nextSibling.dataset,p)var L=p.dgst;return p=L,b=Error(t(419)),p=Nu(b,p,void 0),Va(r,o,C,p)}if(L=(C&r.childLanes)!==0,qt||L){if(p=Et,p!==null){switch(C&-C){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(p.suspendedLanes|C))!==0?0:v,v!==0&&v!==b.retryLane&&(b.retryLane=v,cr(r,v),Rn(p,r,v,-1))}return Zu(),p=Nu(Error(t(421))),Va(r,o,C,p)}return v.data==="$?"?(o.flags|=128,o.child=r.child,o=Hx.bind(null,r),v._reactRetry=o,null):(r=b.treeContext,rn=Pr(v.nextSibling),nn=o,Je=!0,Cn=null,r!==null&&(pn[gn++]=ar,pn[gn++]=lr,pn[gn++]=rs,ar=r.id,lr=r.overflow,rs=o),o=Fu(o,p.children),o.flags|=4096,o)}function yg(r,o,u){r.lanes|=o;var p=r.alternate;p!==null&&(p.lanes|=o),pu(r.return,o,u)}function ju(r,o,u,p,v){var b=r.memoizedState;b===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:p,tail:u,tailMode:v}:(b.isBackwards=o,b.rendering=null,b.renderingStartTime=0,b.last=p,b.tail=u,b.tailMode=v)}function wg(r,o,u){var p=o.pendingProps,v=p.revealOrder,b=p.tail;if(Bt(r,o,p.children,u),p=tt.current,(p&2)!==0)p=p&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&yg(r,u,o);else if(r.tag===19)yg(r,u,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}p&=1}if(Xe(tt,p),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(u=o.child,v=null;u!==null;)r=u.alternate,r!==null&&Fa(r)===null&&(v=u),u=u.sibling;u=v,u===null?(v=o.child,o.child=null):(v=u.sibling,u.sibling=null),ju(o,!1,v,u,b);break;case"backwards":for(u=null,v=o.child,o.child=null;v!==null;){if(r=v.alternate,r!==null&&Fa(r)===null){o.child=v;break}r=v.sibling,v.sibling=u,u=v,v=r}ju(o,!0,u,null,b);break;case"together":ju(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Wa(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function dr(r,o,u){if(r!==null&&(o.dependencies=r.dependencies),ls|=o.lanes,(u&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(t(153));if(o.child!==null){for(r=o.child,u=zr(r,r.pendingProps),o.child=u,u.return=o;r.sibling!==null;)r=r.sibling,u=u.sibling=zr(r,r.pendingProps),u.return=o;u.sibling=null}return o.child}function Rx(r,o,u){switch(o.tag){case 3:gg(o),Xs();break;case 5:Lp(o);break;case 1:Gt(o.type)&&ka(o);break;case 4:vu(o,o.stateNode.containerInfo);break;case 10:var p=o.type._context,v=o.memoizedProps.value;Xe(La,p._currentValue),p._currentValue=v;break;case 13:if(p=o.memoizedState,p!==null)return p.dehydrated!==null?(Xe(tt,tt.current&1),o.flags|=128,null):(u&o.child.childLanes)!==0?vg(r,o,u):(Xe(tt,tt.current&1),r=dr(r,o,u),r!==null?r.sibling:null);Xe(tt,tt.current&1);break;case 19:if(p=(u&o.childLanes)!==0,(r.flags&128)!==0){if(p)return wg(r,o,u);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),Xe(tt,tt.current),p)break;return null;case 22:case 23:return o.lanes=0,hg(r,o,u)}return dr(r,o,u)}var bg,zu,xg,Sg;bg=function(r,o){for(var u=o.child;u!==null;){if(u.tag===5||u.tag===6)r.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},zu=function(){},xg=function(r,o,u,p){var v=r.memoizedProps;if(v!==p){r=o.stateNode,os(zn.current);var b=null;switch(u){case"input":v=Ce(r,v),p=Ce(r,p),b=[];break;case"select":v=ne({},v,{value:void 0}),p=ne({},p,{value:void 0}),b=[];break;case"textarea":v=xr(r,v),p=xr(r,p),b=[];break;default:typeof v.onClick!="function"&&typeof p.onClick=="function"&&(r.onclick=Ea)}wc(u,p);var C;u=null;for(X in v)if(!p.hasOwnProperty(X)&&v.hasOwnProperty(X)&&v[X]!=null)if(X==="style"){var L=v[X];for(C in L)L.hasOwnProperty(C)&&(u||(u={}),u[C]="")}else X!=="dangerouslySetInnerHTML"&&X!=="children"&&X!=="suppressContentEditableWarning"&&X!=="suppressHydrationWarning"&&X!=="autoFocus"&&(i.hasOwnProperty(X)?b||(b=[]):(b=b||[]).push(X,null));for(X in p){var O=p[X];if(L=v?.[X],p.hasOwnProperty(X)&&O!==L&&(O!=null||L!=null))if(X==="style")if(L){for(C in L)!L.hasOwnProperty(C)||O&&O.hasOwnProperty(C)||(u||(u={}),u[C]="");for(C in O)O.hasOwnProperty(C)&&L[C]!==O[C]&&(u||(u={}),u[C]=O[C])}else u||(b||(b=[]),b.push(X,u)),u=O;else X==="dangerouslySetInnerHTML"?(O=O?O.__html:void 0,L=L?L.__html:void 0,O!=null&&L!==O&&(b=b||[]).push(X,O)):X==="children"?typeof O!="string"&&typeof O!="number"||(b=b||[]).push(X,""+O):X!=="suppressContentEditableWarning"&&X!=="suppressHydrationWarning"&&(i.hasOwnProperty(X)?(O!=null&&X==="onScroll"&&Ye("scroll",r),b||L===O||(b=[])):(b=b||[]).push(X,O))}u&&(b=b||[]).push("style",u);var X=b;(o.updateQueue=X)&&(o.flags|=4)}},Sg=function(r,o,u,p){u!==p&&(o.flags|=4)};function uo(r,o){if(!Je)switch(r.tailMode){case"hidden":o=r.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var p=null;u!==null;)u.alternate!==null&&(p=u),u=u.sibling;p===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:p.sibling=null}}function Mt(r){var o=r.alternate!==null&&r.alternate.child===r.child,u=0,p=0;if(o)for(var v=r.child;v!==null;)u|=v.lanes|v.childLanes,p|=v.subtreeFlags&14680064,p|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)u|=v.lanes|v.childLanes,p|=v.subtreeFlags,p|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=p,r.childLanes=u,o}function Nx(r,o,u){var p=o.pendingProps;switch(au(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(o),null;case 1:return Gt(o.type)&&Ca(),Mt(o),null;case 3:return p=o.stateNode,Js(),Ke(Wt),Ke(It),bu(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(r===null||r.child===null)&&(Na(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Cn!==null&&(Ku(Cn),Cn=null))),zu(r,o),Mt(o),null;case 5:yu(o);var v=os(io.current);if(u=o.type,r!==null&&o.stateNode!=null)xg(r,o,u,p,v),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!p){if(o.stateNode===null)throw Error(t(166));return Mt(o),null}if(r=os(zn.current),Na(o)){p=o.stateNode,u=o.type;var b=o.memoizedProps;switch(p[jn]=o,p[eo]=b,r=(o.mode&1)!==0,u){case"dialog":Ye("cancel",p),Ye("close",p);break;case"iframe":case"object":case"embed":Ye("load",p);break;case"video":case"audio":for(v=0;v<Qi.length;v++)Ye(Qi[v],p);break;case"source":Ye("error",p);break;case"img":case"image":case"link":Ye("error",p),Ye("load",p);break;case"details":Ye("toggle",p);break;case"input":He(p,b),Ye("invalid",p);break;case"select":p._wrapperState={wasMultiple:!!b.multiple},Ye("invalid",p);break;case"textarea":Ls(p,b),Ye("invalid",p)}wc(u,b),v=null;for(var C in b)if(b.hasOwnProperty(C)){var L=b[C];C==="children"?typeof L=="string"?p.textContent!==L&&(b.suppressHydrationWarning!==!0&&Aa(p.textContent,L,r),v=["children",L]):typeof L=="number"&&p.textContent!==""+L&&(b.suppressHydrationWarning!==!0&&Aa(p.textContent,L,r),v=["children",""+L]):i.hasOwnProperty(C)&&L!=null&&C==="onScroll"&&Ye("scroll",p)}switch(u){case"input":Se(p),Qe(p,b,!0);break;case"textarea":Se(p),ta(p);break;case"select":case"option":break;default:typeof b.onClick=="function"&&(p.onclick=Ea)}p=v,o.updateQueue=p,p!==null&&(o.flags|=4)}else{C=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=na(u)),r==="http://www.w3.org/1999/xhtml"?u==="script"?(r=C.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof p.is=="string"?r=C.createElement(u,{is:p.is}):(r=C.createElement(u),u==="select"&&(C=r,p.multiple?C.multiple=!0:p.size&&(C.size=p.size))):r=C.createElementNS(r,u),r[jn]=o,r[eo]=p,bg(r,o,!1,!1),o.stateNode=r;e:{switch(C=bc(u,p),u){case"dialog":Ye("cancel",r),Ye("close",r),v=p;break;case"iframe":case"object":case"embed":Ye("load",r),v=p;break;case"video":case"audio":for(v=0;v<Qi.length;v++)Ye(Qi[v],r);v=p;break;case"source":Ye("error",r),v=p;break;case"img":case"image":case"link":Ye("error",r),Ye("load",r),v=p;break;case"details":Ye("toggle",r),v=p;break;case"input":He(r,p),v=Ce(r,p),Ye("invalid",r);break;case"option":v=p;break;case"select":r._wrapperState={wasMultiple:!!p.multiple},v=ne({},p,{value:void 0}),Ye("invalid",r);break;case"textarea":Ls(r,p),v=xr(r,p),Ye("invalid",r);break;default:v=p}wc(u,v),L=v;for(b in L)if(L.hasOwnProperty(b)){var O=L[b];b==="style"?df(r,O):b==="dangerouslySetInnerHTML"?(O=O?O.__html:void 0,O!=null&&Zr(r,O)):b==="children"?typeof O=="string"?(u!=="textarea"||O!=="")&&sr(r,O):typeof O=="number"&&sr(r,""+O):b!=="suppressContentEditableWarning"&&b!=="suppressHydrationWarning"&&b!=="autoFocus"&&(i.hasOwnProperty(b)?O!=null&&b==="onScroll"&&Ye("scroll",r):O!=null&&k(r,b,O,C))}switch(u){case"input":Se(r),Qe(r,p,!1);break;case"textarea":Se(r),ta(r);break;case"option":p.value!=null&&r.setAttribute("value",""+ae(p.value));break;case"select":r.multiple=!!p.multiple,b=p.value,b!=null?Pt(r,!!p.multiple,b,!1):p.defaultValue!=null&&Pt(r,!!p.multiple,p.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=Ea)}switch(u){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}}p&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Mt(o),null;case 6:if(r&&o.stateNode!=null)Sg(r,o,r.memoizedProps,p);else{if(typeof p!="string"&&o.stateNode===null)throw Error(t(166));if(u=os(io.current),os(zn.current),Na(o)){if(p=o.stateNode,u=o.memoizedProps,p[jn]=o,(b=p.nodeValue!==u)&&(r=nn,r!==null))switch(r.tag){case 3:Aa(p.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&Aa(p.nodeValue,u,(r.mode&1)!==0)}b&&(o.flags|=4)}else p=(u.nodeType===9?u:u.ownerDocument).createTextNode(p),p[jn]=o,o.stateNode=p}return Mt(o),null;case 13:if(Ke(tt),p=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Je&&rn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)_p(),Xs(),o.flags|=98560,b=!1;else if(b=Na(o),p!==null&&p.dehydrated!==null){if(r===null){if(!b)throw Error(t(318));if(b=o.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(t(317));b[jn]=o}else Xs(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Mt(o),b=!1}else Cn!==null&&(Ku(Cn),Cn=null),b=!0;if(!b)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=u,o):(p=p!==null,p!==(r!==null&&r.memoizedState!==null)&&p&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(tt.current&1)!==0?wt===0&&(wt=3):Zu())),o.updateQueue!==null&&(o.flags|=4),Mt(o),null);case 4:return Js(),zu(r,o),r===null&&Ji(o.stateNode.containerInfo),Mt(o),null;case 10:return fu(o.type._context),Mt(o),null;case 17:return Gt(o.type)&&Ca(),Mt(o),null;case 19:if(Ke(tt),b=o.memoizedState,b===null)return Mt(o),null;if(p=(o.flags&128)!==0,C=b.rendering,C===null)if(p)uo(b,!1);else{if(wt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(C=Fa(r),C!==null){for(o.flags|=128,uo(b,!1),p=C.updateQueue,p!==null&&(o.updateQueue=p,o.flags|=4),o.subtreeFlags=0,p=u,u=o.child;u!==null;)b=u,r=p,b.flags&=14680066,C=b.alternate,C===null?(b.childLanes=0,b.lanes=r,b.child=null,b.subtreeFlags=0,b.memoizedProps=null,b.memoizedState=null,b.updateQueue=null,b.dependencies=null,b.stateNode=null):(b.childLanes=C.childLanes,b.lanes=C.lanes,b.child=C.child,b.subtreeFlags=0,b.deletions=null,b.memoizedProps=C.memoizedProps,b.memoizedState=C.memoizedState,b.updateQueue=C.updateQueue,b.type=C.type,r=C.dependencies,b.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return Xe(tt,tt.current&1|2),o.child}r=r.sibling}b.tail!==null&&at()>ni&&(o.flags|=128,p=!0,uo(b,!1),o.lanes=4194304)}else{if(!p)if(r=Fa(C),r!==null){if(o.flags|=128,p=!0,u=r.updateQueue,u!==null&&(o.updateQueue=u,o.flags|=4),uo(b,!0),b.tail===null&&b.tailMode==="hidden"&&!C.alternate&&!Je)return Mt(o),null}else 2*at()-b.renderingStartTime>ni&&u!==1073741824&&(o.flags|=128,p=!0,uo(b,!1),o.lanes=4194304);b.isBackwards?(C.sibling=o.child,o.child=C):(u=b.last,u!==null?u.sibling=C:o.child=C,b.last=C)}return b.tail!==null?(o=b.tail,b.rendering=o,b.tail=o.sibling,b.renderingStartTime=at(),o.sibling=null,u=tt.current,Xe(tt,p?u&1|2:u&1),o):(Mt(o),null);case 22:case 23:return Ju(),p=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==p&&(o.flags|=8192),p&&(o.mode&1)!==0?(sn&1073741824)!==0&&(Mt(o),o.subtreeFlags&6&&(o.flags|=8192)):Mt(o),null;case 24:return null;case 25:return null}throw Error(t(156,o.tag))}function Ix(r,o){switch(au(o),o.tag){case 1:return Gt(o.type)&&Ca(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return Js(),Ke(Wt),Ke(It),bu(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return yu(o),null;case 13:if(Ke(tt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(t(340));Xs()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return Ke(tt),null;case 4:return Js(),null;case 10:return fu(o.type._context),null;case 22:case 23:return Ju(),null;case 24:return null;default:return null}}var Ga=!1,Dt=!1,Lx=typeof WeakSet=="function"?WeakSet:Set,fe=null;function ei(r,o){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(p){ot(r,o,p)}else u.current=null}function $u(r,o,u){try{u()}catch(p){ot(r,o,p)}}var Ag=!1;function Mx(r,o){if(Jc=ha,r=tp(),Vc(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var p=u.getSelection&&u.getSelection();if(p&&p.rangeCount!==0){u=p.anchorNode;var v=p.anchorOffset,b=p.focusNode;p=p.focusOffset;try{u.nodeType,b.nodeType}catch{u=null;break e}var C=0,L=-1,O=-1,X=0,oe=0,le=r,re=null;t:for(;;){for(var he;le!==u||v!==0&&le.nodeType!==3||(L=C+v),le!==b||p!==0&&le.nodeType!==3||(O=C+p),le.nodeType===3&&(C+=le.nodeValue.length),(he=le.firstChild)!==null;)re=le,le=he;for(;;){if(le===r)break t;if(re===u&&++X===v&&(L=C),re===b&&++oe===p&&(O=C),(he=le.nextSibling)!==null)break;le=re,re=le.parentNode}le=he}u=L===-1||O===-1?null:{start:L,end:O}}else u=null}u=u||{start:0,end:0}}else u=null;for(Zc={focusedElem:r,selectionRange:u},ha=!1,fe=o;fe!==null;)if(o=fe,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,fe=r;else for(;fe!==null;){o=fe;try{var ge=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(ge!==null){var ye=ge.memoizedProps,lt=ge.memoizedState,U=o.stateNode,z=U.getSnapshotBeforeUpdate(o.elementType===o.type?ye:kn(o.type,ye),lt);U.__reactInternalSnapshotBeforeUpdate=z}break;case 3:var W=o.stateNode.containerInfo;W.nodeType===1?W.textContent="":W.nodeType===9&&W.documentElement&&W.removeChild(W.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(t(163))}}catch(ue){ot(o,o.return,ue)}if(r=o.sibling,r!==null){r.return=o.return,fe=r;break}fe=o.return}return ge=Ag,Ag=!1,ge}function ho(r,o,u){var p=o.updateQueue;if(p=p!==null?p.lastEffect:null,p!==null){var v=p=p.next;do{if((v.tag&r)===r){var b=v.destroy;v.destroy=void 0,b!==void 0&&$u(o,u,b)}v=v.next}while(v!==p)}}function qa(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var u=o=o.next;do{if((u.tag&r)===r){var p=u.create;u.destroy=p()}u=u.next}while(u!==o)}}function Bu(r){var o=r.ref;if(o!==null){var u=r.stateNode;switch(r.tag){case 5:r=u;break;default:r=u}typeof o=="function"?o(r):o.current=r}}function Eg(r){var o=r.alternate;o!==null&&(r.alternate=null,Eg(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[jn],delete o[eo],delete o[ru],delete o[mx],delete o[vx])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function _g(r){return r.tag===5||r.tag===3||r.tag===4}function Cg(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||_g(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Hu(r,o,u){var p=r.tag;if(p===5||p===6)r=r.stateNode,o?u.nodeType===8?u.parentNode.insertBefore(r,o):u.insertBefore(r,o):(u.nodeType===8?(o=u.parentNode,o.insertBefore(r,u)):(o=u,o.appendChild(r)),u=u._reactRootContainer,u!=null||o.onclick!==null||(o.onclick=Ea));else if(p!==4&&(r=r.child,r!==null))for(Hu(r,o,u),r=r.sibling;r!==null;)Hu(r,o,u),r=r.sibling}function Uu(r,o,u){var p=r.tag;if(p===5||p===6)r=r.stateNode,o?u.insertBefore(r,o):u.appendChild(r);else if(p!==4&&(r=r.child,r!==null))for(Uu(r,o,u),r=r.sibling;r!==null;)Uu(r,o,u),r=r.sibling}var Tt=null,Pn=!1;function Mr(r,o,u){for(u=u.child;u!==null;)kg(r,o,u),u=u.sibling}function kg(r,o,u){if(Fn&&typeof Fn.onCommitFiberUnmount=="function")try{Fn.onCommitFiberUnmount(oa,u)}catch{}switch(u.tag){case 5:Dt||ei(u,o);case 6:var p=Tt,v=Pn;Tt=null,Mr(r,o,u),Tt=p,Pn=v,Tt!==null&&(Pn?(r=Tt,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):Tt.removeChild(u.stateNode));break;case 18:Tt!==null&&(Pn?(r=Tt,u=u.stateNode,r.nodeType===8?nu(r.parentNode,u):r.nodeType===1&&nu(r,u),Ui(r)):nu(Tt,u.stateNode));break;case 4:p=Tt,v=Pn,Tt=u.stateNode.containerInfo,Pn=!0,Mr(r,o,u),Tt=p,Pn=v;break;case 0:case 11:case 14:case 15:if(!Dt&&(p=u.updateQueue,p!==null&&(p=p.lastEffect,p!==null))){v=p=p.next;do{var b=v,C=b.destroy;b=b.tag,C!==void 0&&((b&2)!==0||(b&4)!==0)&&$u(u,o,C),v=v.next}while(v!==p)}Mr(r,o,u);break;case 1:if(!Dt&&(ei(u,o),p=u.stateNode,typeof p.componentWillUnmount=="function"))try{p.props=u.memoizedProps,p.state=u.memoizedState,p.componentWillUnmount()}catch(L){ot(u,o,L)}Mr(r,o,u);break;case 21:Mr(r,o,u);break;case 22:u.mode&1?(Dt=(p=Dt)||u.memoizedState!==null,Mr(r,o,u),Dt=p):Mr(r,o,u);break;default:Mr(r,o,u)}}function Pg(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new Lx),o.forEach(function(p){var v=Ux.bind(null,r,p);u.has(p)||(u.add(p),p.then(v,v))})}}function Tn(r,o){var u=o.deletions;if(u!==null)for(var p=0;p<u.length;p++){var v=u[p];try{var b=r,C=o,L=C;e:for(;L!==null;){switch(L.tag){case 5:Tt=L.stateNode,Pn=!1;break e;case 3:Tt=L.stateNode.containerInfo,Pn=!0;break e;case 4:Tt=L.stateNode.containerInfo,Pn=!0;break e}L=L.return}if(Tt===null)throw Error(t(160));kg(b,C,v),Tt=null,Pn=!1;var O=v.alternate;O!==null&&(O.return=null),v.return=null}catch(X){ot(v,o,X)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Tg(o,r),o=o.sibling}function Tg(r,o){var u=r.alternate,p=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Tn(o,r),Bn(r),p&4){try{ho(3,r,r.return),qa(3,r)}catch(ye){ot(r,r.return,ye)}try{ho(5,r,r.return)}catch(ye){ot(r,r.return,ye)}}break;case 1:Tn(o,r),Bn(r),p&512&&u!==null&&ei(u,u.return);break;case 5:if(Tn(o,r),Bn(r),p&512&&u!==null&&ei(u,u.return),r.flags&32){var v=r.stateNode;try{sr(v,"")}catch(ye){ot(r,r.return,ye)}}if(p&4&&(v=r.stateNode,v!=null)){var b=r.memoizedProps,C=u!==null?u.memoizedProps:b,L=r.type,O=r.updateQueue;if(r.updateQueue=null,O!==null)try{L==="input"&&b.type==="radio"&&b.name!=null&&je(v,b),bc(L,C);var X=bc(L,b);for(C=0;C<O.length;C+=2){var oe=O[C],le=O[C+1];oe==="style"?df(v,le):oe==="dangerouslySetInnerHTML"?Zr(v,le):oe==="children"?sr(v,le):k(v,oe,le,X)}switch(L){case"input":ft(v,b);break;case"textarea":ea(v,b);break;case"select":var re=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!b.multiple;var he=b.value;he!=null?Pt(v,!!b.multiple,he,!1):re!==!!b.multiple&&(b.defaultValue!=null?Pt(v,!!b.multiple,b.defaultValue,!0):Pt(v,!!b.multiple,b.multiple?[]:"",!1))}v[eo]=b}catch(ye){ot(r,r.return,ye)}}break;case 6:if(Tn(o,r),Bn(r),p&4){if(r.stateNode===null)throw Error(t(162));v=r.stateNode,b=r.memoizedProps;try{v.nodeValue=b}catch(ye){ot(r,r.return,ye)}}break;case 3:if(Tn(o,r),Bn(r),p&4&&u!==null&&u.memoizedState.isDehydrated)try{Ui(o.containerInfo)}catch(ye){ot(r,r.return,ye)}break;case 4:Tn(o,r),Bn(r);break;case 13:Tn(o,r),Bn(r),v=r.child,v.flags&8192&&(b=v.memoizedState!==null,v.stateNode.isHidden=b,!b||v.alternate!==null&&v.alternate.memoizedState!==null||(Gu=at())),p&4&&Pg(r);break;case 22:if(oe=u!==null&&u.memoizedState!==null,r.mode&1?(Dt=(X=Dt)||oe,Tn(o,r),Dt=X):Tn(o,r),Bn(r),p&8192){if(X=r.memoizedState!==null,(r.stateNode.isHidden=X)&&!oe&&(r.mode&1)!==0)for(fe=r,oe=r.child;oe!==null;){for(le=fe=oe;fe!==null;){switch(re=fe,he=re.child,re.tag){case 0:case 11:case 14:case 15:ho(4,re,re.return);break;case 1:ei(re,re.return);var ge=re.stateNode;if(typeof ge.componentWillUnmount=="function"){p=re,u=re.return;try{o=p,ge.props=o.memoizedProps,ge.state=o.memoizedState,ge.componentWillUnmount()}catch(ye){ot(p,u,ye)}}break;case 5:ei(re,re.return);break;case 22:if(re.memoizedState!==null){Ig(le);continue}}he!==null?(he.return=re,fe=he):Ig(le)}oe=oe.sibling}e:for(oe=null,le=r;;){if(le.tag===5){if(oe===null){oe=le;try{v=le.stateNode,X?(b=v.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none"):(L=le.stateNode,O=le.memoizedProps.style,C=O!=null&&O.hasOwnProperty("display")?O.display:null,L.style.display=uf("display",C))}catch(ye){ot(r,r.return,ye)}}}else if(le.tag===6){if(oe===null)try{le.stateNode.nodeValue=X?"":le.memoizedProps}catch(ye){ot(r,r.return,ye)}}else if((le.tag!==22&&le.tag!==23||le.memoizedState===null||le===r)&&le.child!==null){le.child.return=le,le=le.child;continue}if(le===r)break e;for(;le.sibling===null;){if(le.return===null||le.return===r)break e;oe===le&&(oe=null),le=le.return}oe===le&&(oe=null),le.sibling.return=le.return,le=le.sibling}}break;case 19:Tn(o,r),Bn(r),p&4&&Pg(r);break;case 21:break;default:Tn(o,r),Bn(r)}}function Bn(r){var o=r.flags;if(o&2){try{e:{for(var u=r.return;u!==null;){if(_g(u)){var p=u;break e}u=u.return}throw Error(t(160))}switch(p.tag){case 5:var v=p.stateNode;p.flags&32&&(sr(v,""),p.flags&=-33);var b=Cg(r);Uu(r,b,v);break;case 3:case 4:var C=p.stateNode.containerInfo,L=Cg(r);Hu(r,L,C);break;default:throw Error(t(161))}}catch(O){ot(r,r.return,O)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function Dx(r,o,u){fe=r,Rg(r)}function Rg(r,o,u){for(var p=(r.mode&1)!==0;fe!==null;){var v=fe,b=v.child;if(v.tag===22&&p){var C=v.memoizedState!==null||Ga;if(!C){var L=v.alternate,O=L!==null&&L.memoizedState!==null||Dt;L=Ga;var X=Dt;if(Ga=C,(Dt=O)&&!X)for(fe=v;fe!==null;)C=fe,O=C.child,C.tag===22&&C.memoizedState!==null?Lg(v):O!==null?(O.return=C,fe=O):Lg(v);for(;b!==null;)fe=b,Rg(b),b=b.sibling;fe=v,Ga=L,Dt=X}Ng(r)}else(v.subtreeFlags&8772)!==0&&b!==null?(b.return=v,fe=b):Ng(r)}}function Ng(r){for(;fe!==null;){var o=fe;if((o.flags&8772)!==0){var u=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Dt||qa(5,o);break;case 1:var p=o.stateNode;if(o.flags&4&&!Dt)if(u===null)p.componentDidMount();else{var v=o.elementType===o.type?u.memoizedProps:kn(o.type,u.memoizedProps);p.componentDidUpdate(v,u.memoizedState,p.__reactInternalSnapshotBeforeUpdate)}var b=o.updateQueue;b!==null&&Ip(o,b,p);break;case 3:var C=o.updateQueue;if(C!==null){if(u=null,o.child!==null)switch(o.child.tag){case 5:u=o.child.stateNode;break;case 1:u=o.child.stateNode}Ip(o,C,u)}break;case 5:var L=o.stateNode;if(u===null&&o.flags&4){u=L;var O=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":O.autoFocus&&u.focus();break;case"img":O.src&&(u.src=O.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var X=o.alternate;if(X!==null){var oe=X.memoizedState;if(oe!==null){var le=oe.dehydrated;le!==null&&Ui(le)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(t(163))}Dt||o.flags&512&&Bu(o)}catch(re){ot(o,o.return,re)}}if(o===r){fe=null;break}if(u=o.sibling,u!==null){u.return=o.return,fe=u;break}fe=o.return}}function Ig(r){for(;fe!==null;){var o=fe;if(o===r){fe=null;break}var u=o.sibling;if(u!==null){u.return=o.return,fe=u;break}fe=o.return}}function Lg(r){for(;fe!==null;){var o=fe;try{switch(o.tag){case 0:case 11:case 15:var u=o.return;try{qa(4,o)}catch(O){ot(o,u,O)}break;case 1:var p=o.stateNode;if(typeof p.componentDidMount=="function"){var v=o.return;try{p.componentDidMount()}catch(O){ot(o,v,O)}}var b=o.return;try{Bu(o)}catch(O){ot(o,b,O)}break;case 5:var C=o.return;try{Bu(o)}catch(O){ot(o,C,O)}}}catch(O){ot(o,o.return,O)}if(o===r){fe=null;break}var L=o.sibling;if(L!==null){L.return=o.return,fe=L;break}fe=o.return}}var Ox=Math.ceil,Xa=T.ReactCurrentDispatcher,Vu=T.ReactCurrentOwner,yn=T.ReactCurrentBatchConfig,ze=0,Et=null,pt=null,Rt=0,sn=0,ti=Tr(0),wt=0,fo=null,ls=0,Ya=0,Wu=0,po=null,Xt=null,Gu=0,ni=1/0,hr=null,Ka=!1,qu=null,Dr=null,Qa=!1,Or=null,Ja=0,go=0,Xu=null,Za=-1,el=0;function Ht(){return(ze&6)!==0?at():Za!==-1?Za:Za=at()}function Fr(r){return(r.mode&1)===0?1:(ze&2)!==0&&Rt!==0?Rt&-Rt:wx.transition!==null?(el===0&&(el=Cf()),el):(r=Ve,r!==0||(r=window.event,r=r===void 0?16:Df(r.type)),r)}function Rn(r,o,u,p){if(50<go)throw go=0,Xu=null,Error(t(185));ji(r,u,p),((ze&2)===0||r!==Et)&&(r===Et&&((ze&2)===0&&(Ya|=u),wt===4&&jr(r,Rt)),Yt(r,p),u===1&&ze===0&&(o.mode&1)===0&&(ni=at()+500,Pa&&Nr()))}function Yt(r,o){var u=r.callbackNode;wb(r,o);var p=ca(r,r===Et?Rt:0);if(p===0)u!==null&&Af(u),r.callbackNode=null,r.callbackPriority=0;else if(o=p&-p,r.callbackPriority!==o){if(u!=null&&Af(u),o===1)r.tag===0?yx(Dg.bind(null,r)):bp(Dg.bind(null,r)),px(function(){(ze&6)===0&&Nr()}),u=null;else{switch(kf(p)){case 1:u=kc;break;case 4:u=Ef;break;case 16:u=ia;break;case 536870912:u=_f;break;default:u=ia}u=Ug(u,Mg.bind(null,r))}r.callbackPriority=o,r.callbackNode=u}}function Mg(r,o){if(Za=-1,el=0,(ze&6)!==0)throw Error(t(327));var u=r.callbackNode;if(ri()&&r.callbackNode!==u)return null;var p=ca(r,r===Et?Rt:0);if(p===0)return null;if((p&30)!==0||(p&r.expiredLanes)!==0||o)o=tl(r,p);else{o=p;var v=ze;ze|=2;var b=Fg();(Et!==r||Rt!==o)&&(hr=null,ni=at()+500,us(r,o));do try{zx();break}catch(L){Og(r,L)}while(!0);hu(),Xa.current=b,ze=v,pt!==null?o=0:(Et=null,Rt=0,o=wt)}if(o!==0){if(o===2&&(v=Pc(r),v!==0&&(p=v,o=Yu(r,v))),o===1)throw u=fo,us(r,0),jr(r,p),Yt(r,at()),u;if(o===6)jr(r,p);else{if(v=r.current.alternate,(p&30)===0&&!Fx(v)&&(o=tl(r,p),o===2&&(b=Pc(r),b!==0&&(p=b,o=Yu(r,b))),o===1))throw u=fo,us(r,0),jr(r,p),Yt(r,at()),u;switch(r.finishedWork=v,r.finishedLanes=p,o){case 0:case 1:throw Error(t(345));case 2:ds(r,Xt,hr);break;case 3:if(jr(r,p),(p&130023424)===p&&(o=Gu+500-at(),10<o)){if(ca(r,0)!==0)break;if(v=r.suspendedLanes,(v&p)!==p){Ht(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=tu(ds.bind(null,r,Xt,hr),o);break}ds(r,Xt,hr);break;case 4:if(jr(r,p),(p&4194240)===p)break;for(o=r.eventTimes,v=-1;0<p;){var C=31-En(p);b=1<<C,C=o[C],C>v&&(v=C),p&=~b}if(p=v,p=at()-p,p=(120>p?120:480>p?480:1080>p?1080:1920>p?1920:3e3>p?3e3:4320>p?4320:1960*Ox(p/1960))-p,10<p){r.timeoutHandle=tu(ds.bind(null,r,Xt,hr),p);break}ds(r,Xt,hr);break;case 5:ds(r,Xt,hr);break;default:throw Error(t(329))}}}return Yt(r,at()),r.callbackNode===u?Mg.bind(null,r):null}function Yu(r,o){var u=po;return r.current.memoizedState.isDehydrated&&(us(r,o).flags|=256),r=tl(r,o),r!==2&&(o=Xt,Xt=u,o!==null&&Ku(o)),r}function Ku(r){Xt===null?Xt=r:Xt.push.apply(Xt,r)}function Fx(r){for(var o=r;;){if(o.flags&16384){var u=o.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var p=0;p<u.length;p++){var v=u[p],b=v.getSnapshot;v=v.value;try{if(!_n(b(),v))return!1}catch{return!1}}}if(u=o.child,o.subtreeFlags&16384&&u!==null)u.return=o,o=u;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function jr(r,o){for(o&=~Wu,o&=~Ya,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var u=31-En(o),p=1<<u;r[u]=-1,o&=~p}}function Dg(r){if((ze&6)!==0)throw Error(t(327));ri();var o=ca(r,0);if((o&1)===0)return Yt(r,at()),null;var u=tl(r,o);if(r.tag!==0&&u===2){var p=Pc(r);p!==0&&(o=p,u=Yu(r,p))}if(u===1)throw u=fo,us(r,0),jr(r,o),Yt(r,at()),u;if(u===6)throw Error(t(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,ds(r,Xt,hr),Yt(r,at()),null}function Qu(r,o){var u=ze;ze|=1;try{return r(o)}finally{ze=u,ze===0&&(ni=at()+500,Pa&&Nr())}}function cs(r){Or!==null&&Or.tag===0&&(ze&6)===0&&ri();var o=ze;ze|=1;var u=yn.transition,p=Ve;try{if(yn.transition=null,Ve=1,r)return r()}finally{Ve=p,yn.transition=u,ze=o,(ze&6)===0&&Nr()}}function Ju(){sn=ti.current,Ke(ti)}function us(r,o){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,fx(u)),pt!==null)for(u=pt.return;u!==null;){var p=u;switch(au(p),p.tag){case 1:p=p.type.childContextTypes,p!=null&&Ca();break;case 3:Js(),Ke(Wt),Ke(It),bu();break;case 5:yu(p);break;case 4:Js();break;case 13:Ke(tt);break;case 19:Ke(tt);break;case 10:fu(p.type._context);break;case 22:case 23:Ju()}u=u.return}if(Et=r,pt=r=zr(r.current,null),Rt=sn=o,wt=0,fo=null,Wu=Ya=ls=0,Xt=po=null,is!==null){for(o=0;o<is.length;o++)if(u=is[o],p=u.interleaved,p!==null){u.interleaved=null;var v=p.next,b=u.pending;if(b!==null){var C=b.next;b.next=v,p.next=C}u.pending=p}is=null}return r}function Og(r,o){do{var u=pt;try{if(hu(),ja.current=Ha,za){for(var p=nt.memoizedState;p!==null;){var v=p.queue;v!==null&&(v.pending=null),p=p.next}za=!1}if(as=0,At=yt=nt=null,oo=!1,ao=0,Vu.current=null,u===null||u.return===null){wt=1,fo=o,pt=null;break}e:{var b=r,C=u.return,L=u,O=o;if(o=Rt,L.flags|=32768,O!==null&&typeof O=="object"&&typeof O.then=="function"){var X=O,oe=L,le=oe.tag;if((oe.mode&1)===0&&(le===0||le===11||le===15)){var re=oe.alternate;re?(oe.updateQueue=re.updateQueue,oe.memoizedState=re.memoizedState,oe.lanes=re.lanes):(oe.updateQueue=null,oe.memoizedState=null)}var he=ag(C);if(he!==null){he.flags&=-257,lg(he,C,L,b,o),he.mode&1&&og(b,X,o),o=he,O=X;var ge=o.updateQueue;if(ge===null){var ye=new Set;ye.add(O),o.updateQueue=ye}else ge.add(O);break e}else{if((o&1)===0){og(b,X,o),Zu();break e}O=Error(t(426))}}else if(Je&&L.mode&1){var lt=ag(C);if(lt!==null){(lt.flags&65536)===0&&(lt.flags|=256),lg(lt,C,L,b,o),uu(Zs(O,L));break e}}b=O=Zs(O,L),wt!==4&&(wt=2),po===null?po=[b]:po.push(b),b=C;do{switch(b.tag){case 3:b.flags|=65536,o&=-o,b.lanes|=o;var U=sg(b,O,o);Np(b,U);break e;case 1:L=O;var z=b.type,W=b.stateNode;if((b.flags&128)===0&&(typeof z.getDerivedStateFromError=="function"||W!==null&&typeof W.componentDidCatch=="function"&&(Dr===null||!Dr.has(W)))){b.flags|=65536,o&=-o,b.lanes|=o;var ue=ig(b,L,o);Np(b,ue);break e}}b=b.return}while(b!==null)}zg(u)}catch(we){o=we,pt===u&&u!==null&&(pt=u=u.return);continue}break}while(!0)}function Fg(){var r=Xa.current;return Xa.current=Ha,r===null?Ha:r}function Zu(){(wt===0||wt===3||wt===2)&&(wt=4),Et===null||(ls&268435455)===0&&(Ya&268435455)===0||jr(Et,Rt)}function tl(r,o){var u=ze;ze|=2;var p=Fg();(Et!==r||Rt!==o)&&(hr=null,us(r,o));do try{jx();break}catch(v){Og(r,v)}while(!0);if(hu(),ze=u,Xa.current=p,pt!==null)throw Error(t(261));return Et=null,Rt=0,wt}function jx(){for(;pt!==null;)jg(pt)}function zx(){for(;pt!==null&&!ub();)jg(pt)}function jg(r){var o=Hg(r.alternate,r,sn);r.memoizedProps=r.pendingProps,o===null?zg(r):pt=o,Vu.current=null}function zg(r){var o=r;do{var u=o.alternate;if(r=o.return,(o.flags&32768)===0){if(u=Nx(u,o,sn),u!==null){pt=u;return}}else{if(u=Ix(u,o),u!==null){u.flags&=32767,pt=u;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{wt=6,pt=null;return}}if(o=o.sibling,o!==null){pt=o;return}pt=o=r}while(o!==null);wt===0&&(wt=5)}function ds(r,o,u){var p=Ve,v=yn.transition;try{yn.transition=null,Ve=1,$x(r,o,u,p)}finally{yn.transition=v,Ve=p}return null}function $x(r,o,u,p){do ri();while(Or!==null);if((ze&6)!==0)throw Error(t(327));u=r.finishedWork;var v=r.finishedLanes;if(u===null)return null;if(r.finishedWork=null,r.finishedLanes=0,u===r.current)throw Error(t(177));r.callbackNode=null,r.callbackPriority=0;var b=u.lanes|u.childLanes;if(bb(r,b),r===Et&&(pt=Et=null,Rt=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Qa||(Qa=!0,Ug(ia,function(){return ri(),null})),b=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||b){b=yn.transition,yn.transition=null;var C=Ve;Ve=1;var L=ze;ze|=4,Vu.current=null,Mx(r,u),Tg(u,r),ox(Zc),ha=!!Jc,Zc=Jc=null,r.current=u,Dx(u),db(),ze=L,Ve=C,yn.transition=b}else r.current=u;if(Qa&&(Qa=!1,Or=r,Ja=v),b=r.pendingLanes,b===0&&(Dr=null),pb(u.stateNode),Yt(r,at()),o!==null)for(p=r.onRecoverableError,u=0;u<o.length;u++)v=o[u],p(v.value,{componentStack:v.stack,digest:v.digest});if(Ka)throw Ka=!1,r=qu,qu=null,r;return(Ja&1)!==0&&r.tag!==0&&ri(),b=r.pendingLanes,(b&1)!==0?r===Xu?go++:(go=0,Xu=r):go=0,Nr(),null}function ri(){if(Or!==null){var r=kf(Ja),o=yn.transition,u=Ve;try{if(yn.transition=null,Ve=16>r?16:r,Or===null)var p=!1;else{if(r=Or,Or=null,Ja=0,(ze&6)!==0)throw Error(t(331));var v=ze;for(ze|=4,fe=r.current;fe!==null;){var b=fe,C=b.child;if((fe.flags&16)!==0){var L=b.deletions;if(L!==null){for(var O=0;O<L.length;O++){var X=L[O];for(fe=X;fe!==null;){var oe=fe;switch(oe.tag){case 0:case 11:case 15:ho(8,oe,b)}var le=oe.child;if(le!==null)le.return=oe,fe=le;else for(;fe!==null;){oe=fe;var re=oe.sibling,he=oe.return;if(Eg(oe),oe===X){fe=null;break}if(re!==null){re.return=he,fe=re;break}fe=he}}}var ge=b.alternate;if(ge!==null){var ye=ge.child;if(ye!==null){ge.child=null;do{var lt=ye.sibling;ye.sibling=null,ye=lt}while(ye!==null)}}fe=b}}if((b.subtreeFlags&2064)!==0&&C!==null)C.return=b,fe=C;else e:for(;fe!==null;){if(b=fe,(b.flags&2048)!==0)switch(b.tag){case 0:case 11:case 15:ho(9,b,b.return)}var U=b.sibling;if(U!==null){U.return=b.return,fe=U;break e}fe=b.return}}var z=r.current;for(fe=z;fe!==null;){C=fe;var W=C.child;if((C.subtreeFlags&2064)!==0&&W!==null)W.return=C,fe=W;else e:for(C=z;fe!==null;){if(L=fe,(L.flags&2048)!==0)try{switch(L.tag){case 0:case 11:case 15:qa(9,L)}}catch(we){ot(L,L.return,we)}if(L===C){fe=null;break e}var ue=L.sibling;if(ue!==null){ue.return=L.return,fe=ue;break e}fe=L.return}}if(ze=v,Nr(),Fn&&typeof Fn.onPostCommitFiberRoot=="function")try{Fn.onPostCommitFiberRoot(oa,r)}catch{}p=!0}return p}finally{Ve=u,yn.transition=o}}return!1}function $g(r,o,u){o=Zs(u,o),o=sg(r,o,1),r=Lr(r,o,1),o=Ht(),r!==null&&(ji(r,1,o),Yt(r,o))}function ot(r,o,u){if(r.tag===3)$g(r,r,u);else for(;o!==null;){if(o.tag===3){$g(o,r,u);break}else if(o.tag===1){var p=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(Dr===null||!Dr.has(p))){r=Zs(u,r),r=ig(o,r,1),o=Lr(o,r,1),r=Ht(),o!==null&&(ji(o,1,r),Yt(o,r));break}}o=o.return}}function Bx(r,o,u){var p=r.pingCache;p!==null&&p.delete(o),o=Ht(),r.pingedLanes|=r.suspendedLanes&u,Et===r&&(Rt&u)===u&&(wt===4||wt===3&&(Rt&130023424)===Rt&&500>at()-Gu?us(r,0):Wu|=u),Yt(r,o)}function Bg(r,o){o===0&&((r.mode&1)===0?o=1:(o=la,la<<=1,(la&130023424)===0&&(la=4194304)));var u=Ht();r=cr(r,o),r!==null&&(ji(r,o,u),Yt(r,u))}function Hx(r){var o=r.memoizedState,u=0;o!==null&&(u=o.retryLane),Bg(r,u)}function Ux(r,o){var u=0;switch(r.tag){case 13:var p=r.stateNode,v=r.memoizedState;v!==null&&(u=v.retryLane);break;case 19:p=r.stateNode;break;default:throw Error(t(314))}p!==null&&p.delete(o),Bg(r,u)}var Hg;Hg=function(r,o,u){if(r!==null)if(r.memoizedProps!==o.pendingProps||Wt.current)qt=!0;else{if((r.lanes&u)===0&&(o.flags&128)===0)return qt=!1,Rx(r,o,u);qt=(r.flags&131072)!==0}else qt=!1,Je&&(o.flags&1048576)!==0&&xp(o,Ra,o.index);switch(o.lanes=0,o.tag){case 2:var p=o.type;Wa(r,o),r=o.pendingProps;var v=Ws(o,It.current);Qs(o,u),v=Au(null,o,p,r,v,u);var b=Eu();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Gt(p)?(b=!0,ka(o)):b=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,mu(o),v.updater=Ua,o.stateNode=v,v._reactInternals=o,Ru(o,p,r,u),o=Mu(null,o,p,!0,b,u)):(o.tag=0,Je&&b&&ou(o),Bt(null,o,v,u),o=o.child),o;case 16:p=o.elementType;e:{switch(Wa(r,o),r=o.pendingProps,v=p._init,p=v(p._payload),o.type=p,v=o.tag=Wx(p),r=kn(p,r),v){case 0:o=Lu(null,o,p,r,u);break e;case 1:o=pg(null,o,p,r,u);break e;case 11:o=cg(null,o,p,r,u);break e;case 14:o=ug(null,o,p,kn(p.type,r),u);break e}throw Error(t(306,p,""))}return o;case 0:return p=o.type,v=o.pendingProps,v=o.elementType===p?v:kn(p,v),Lu(r,o,p,v,u);case 1:return p=o.type,v=o.pendingProps,v=o.elementType===p?v:kn(p,v),pg(r,o,p,v,u);case 3:e:{if(gg(o),r===null)throw Error(t(387));p=o.pendingProps,b=o.memoizedState,v=b.element,Rp(r,o),Oa(o,p,null,u);var C=o.memoizedState;if(p=C.element,b.isDehydrated)if(b={element:p,isDehydrated:!1,cache:C.cache,pendingSuspenseBoundaries:C.pendingSuspenseBoundaries,transitions:C.transitions},o.updateQueue.baseState=b,o.memoizedState=b,o.flags&256){v=Zs(Error(t(423)),o),o=mg(r,o,p,u,v);break e}else if(p!==v){v=Zs(Error(t(424)),o),o=mg(r,o,p,u,v);break e}else for(rn=Pr(o.stateNode.containerInfo.firstChild),nn=o,Je=!0,Cn=null,u=Pp(o,null,p,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Xs(),p===v){o=dr(r,o,u);break e}Bt(r,o,p,u)}o=o.child}return o;case 5:return Lp(o),r===null&&cu(o),p=o.type,v=o.pendingProps,b=r!==null?r.memoizedProps:null,C=v.children,eu(p,v)?C=null:b!==null&&eu(p,b)&&(o.flags|=32),fg(r,o),Bt(r,o,C,u),o.child;case 6:return r===null&&cu(o),null;case 13:return vg(r,o,u);case 4:return vu(o,o.stateNode.containerInfo),p=o.pendingProps,r===null?o.child=Ys(o,null,p,u):Bt(r,o,p,u),o.child;case 11:return p=o.type,v=o.pendingProps,v=o.elementType===p?v:kn(p,v),cg(r,o,p,v,u);case 7:return Bt(r,o,o.pendingProps,u),o.child;case 8:return Bt(r,o,o.pendingProps.children,u),o.child;case 12:return Bt(r,o,o.pendingProps.children,u),o.child;case 10:e:{if(p=o.type._context,v=o.pendingProps,b=o.memoizedProps,C=v.value,Xe(La,p._currentValue),p._currentValue=C,b!==null)if(_n(b.value,C)){if(b.children===v.children&&!Wt.current){o=dr(r,o,u);break e}}else for(b=o.child,b!==null&&(b.return=o);b!==null;){var L=b.dependencies;if(L!==null){C=b.child;for(var O=L.firstContext;O!==null;){if(O.context===p){if(b.tag===1){O=ur(-1,u&-u),O.tag=2;var X=b.updateQueue;if(X!==null){X=X.shared;var oe=X.pending;oe===null?O.next=O:(O.next=oe.next,oe.next=O),X.pending=O}}b.lanes|=u,O=b.alternate,O!==null&&(O.lanes|=u),pu(b.return,u,o),L.lanes|=u;break}O=O.next}}else if(b.tag===10)C=b.type===o.type?null:b.child;else if(b.tag===18){if(C=b.return,C===null)throw Error(t(341));C.lanes|=u,L=C.alternate,L!==null&&(L.lanes|=u),pu(C,u,o),C=b.sibling}else C=b.child;if(C!==null)C.return=b;else for(C=b;C!==null;){if(C===o){C=null;break}if(b=C.sibling,b!==null){b.return=C.return,C=b;break}C=C.return}b=C}Bt(r,o,v.children,u),o=o.child}return o;case 9:return v=o.type,p=o.pendingProps.children,Qs(o,u),v=mn(v),p=p(v),o.flags|=1,Bt(r,o,p,u),o.child;case 14:return p=o.type,v=kn(p,o.pendingProps),v=kn(p.type,v),ug(r,o,p,v,u);case 15:return dg(r,o,o.type,o.pendingProps,u);case 17:return p=o.type,v=o.pendingProps,v=o.elementType===p?v:kn(p,v),Wa(r,o),o.tag=1,Gt(p)?(r=!0,ka(o)):r=!1,Qs(o,u),ng(o,p,v),Ru(o,p,v,u),Mu(null,o,p,!0,r,u);case 19:return wg(r,o,u);case 22:return hg(r,o,u)}throw Error(t(156,o.tag))};function Ug(r,o){return Sf(r,o)}function Vx(r,o,u,p){this.tag=r,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wn(r,o,u,p){return new Vx(r,o,u,p)}function ed(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Wx(r){if(typeof r=="function")return ed(r)?1:0;if(r!=null){if(r=r.$$typeof,r===Z)return 11;if(r===ee)return 14}return 2}function zr(r,o){var u=r.alternate;return u===null?(u=wn(r.tag,o,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=o,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&14680064,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,o=r.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u}function nl(r,o,u,p,v,b){var C=2;if(p=r,typeof r=="function")ed(r)&&(C=1);else if(typeof r=="string")C=5;else e:switch(r){case N:return hs(u.children,v,b,o);case D:C=8,v|=8;break;case V:return r=wn(12,u,o,v|2),r.elementType=V,r.lanes=b,r;case K:return r=wn(13,u,o,v),r.elementType=K,r.lanes=b,r;case J:return r=wn(19,u,o,v),r.elementType=J,r.lanes=b,r;case $:return rl(u,v,b,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case j:C=10;break e;case G:C=9;break e;case Z:C=11;break e;case ee:C=14;break e;case B:C=16,p=null;break e}throw Error(t(130,r==null?r:typeof r,""))}return o=wn(C,u,o,v),o.elementType=r,o.type=p,o.lanes=b,o}function hs(r,o,u,p){return r=wn(7,r,p,o),r.lanes=u,r}function rl(r,o,u,p){return r=wn(22,r,p,o),r.elementType=$,r.lanes=u,r.stateNode={isHidden:!1},r}function td(r,o,u){return r=wn(6,r,null,o),r.lanes=u,r}function nd(r,o,u){return o=wn(4,r.children!==null?r.children:[],r.key,o),o.lanes=u,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function Gx(r,o,u,p,v){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Tc(0),this.expirationTimes=Tc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tc(0),this.identifierPrefix=p,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function rd(r,o,u,p,v,b,C,L,O){return r=new Gx(r,o,u,L,O),o===1?(o=1,b===!0&&(o|=8)):o=0,b=wn(3,null,null,o),r.current=b,b.stateNode=r,b.memoizedState={element:p,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},mu(b),r}function qx(r,o,u){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:I,key:p==null?null:""+p,children:r,containerInfo:o,implementation:u}}function Vg(r){if(!r)return Rr;r=r._reactInternals;e:{if(es(r)!==r||r.tag!==1)throw Error(t(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(Gt(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(t(171))}if(r.tag===1){var u=r.type;if(Gt(u))return yp(r,u,o)}return o}function Wg(r,o,u,p,v,b,C,L,O){return r=rd(u,p,!0,r,v,b,C,L,O),r.context=Vg(null),u=r.current,p=Ht(),v=Fr(u),b=ur(p,v),b.callback=o??null,Lr(u,b,v),r.current.lanes=v,ji(r,v,p),Yt(r,p),r}function sl(r,o,u,p){var v=o.current,b=Ht(),C=Fr(v);return u=Vg(u),o.context===null?o.context=u:o.pendingContext=u,o=ur(b,C),o.payload={element:r},p=p===void 0?null:p,p!==null&&(o.callback=p),r=Lr(v,o,C),r!==null&&(Rn(r,v,C,b),Da(r,v,C)),C}function il(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function Gg(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<o?u:o}}function sd(r,o){Gg(r,o),(r=r.alternate)&&Gg(r,o)}function Xx(){return null}var qg=typeof reportError=="function"?reportError:function(r){console.error(r)};function id(r){this._internalRoot=r}ol.prototype.render=id.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(t(409));sl(r,o,null,null)},ol.prototype.unmount=id.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;cs(function(){sl(null,r,null,null)}),o[ir]=null}};function ol(r){this._internalRoot=r}ol.prototype.unstable_scheduleHydration=function(r){if(r){var o=Rf();r={blockedOn:null,target:r,priority:o};for(var u=0;u<_r.length&&o!==0&&o<_r[u].priority;u++);_r.splice(u,0,r),u===0&&Lf(r)}};function od(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function al(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Xg(){}function Yx(r,o,u,p,v){if(v){if(typeof p=="function"){var b=p;p=function(){var X=il(C);b.call(X)}}var C=Wg(o,p,r,0,null,!1,!1,"",Xg);return r._reactRootContainer=C,r[ir]=C.current,Ji(r.nodeType===8?r.parentNode:r),cs(),C}for(;v=r.lastChild;)r.removeChild(v);if(typeof p=="function"){var L=p;p=function(){var X=il(O);L.call(X)}}var O=rd(r,0,!1,null,null,!1,!1,"",Xg);return r._reactRootContainer=O,r[ir]=O.current,Ji(r.nodeType===8?r.parentNode:r),cs(function(){sl(o,O,u,p)}),O}function ll(r,o,u,p,v){var b=u._reactRootContainer;if(b){var C=b;if(typeof v=="function"){var L=v;v=function(){var O=il(C);L.call(O)}}sl(o,C,r,v)}else C=Yx(u,o,r,v,p);return il(C)}Pf=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var u=Fi(o.pendingLanes);u!==0&&(Rc(o,u|1),Yt(o,at()),(ze&6)===0&&(ni=at()+500,Nr()))}break;case 13:cs(function(){var p=cr(r,1);if(p!==null){var v=Ht();Rn(p,r,1,v)}}),sd(r,1)}},Nc=function(r){if(r.tag===13){var o=cr(r,134217728);if(o!==null){var u=Ht();Rn(o,r,134217728,u)}sd(r,134217728)}},Tf=function(r){if(r.tag===13){var o=Fr(r),u=cr(r,o);if(u!==null){var p=Ht();Rn(u,r,o,p)}sd(r,o)}},Rf=function(){return Ve},Nf=function(r,o){var u=Ve;try{return Ve=r,o()}finally{Ve=u}},Ac=function(r,o,u){switch(o){case"input":if(ft(r,u),o=u.name,u.type==="radio"&&o!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<u.length;o++){var p=u[o];if(p!==r&&p.form===r.form){var v=_a(p);if(!v)throw Error(t(90));Pe(p),ft(p,v)}}}break;case"textarea":ea(r,u);break;case"select":o=u.value,o!=null&&Pt(r,!!u.multiple,o,!1)}},gf=Qu,mf=cs;var Kx={usingClientEntryPoint:!1,Events:[to,Us,_a,ff,pf,Qu]},mo={findFiberByHostInstance:ts,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Qx={bundleType:mo.bundleType,version:mo.version,rendererPackageName:mo.rendererPackageName,rendererConfig:mo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=bf(r),r===null?null:r.stateNode},findFiberByHostInstance:mo.findFiberByHostInstance||Xx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cl.isDisabled&&cl.supportsFiber)try{oa=cl.inject(Qx),Fn=cl}catch{}}return Qt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Kx,Qt.createPortal=function(r,o){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!od(o))throw Error(t(200));return qx(r,o,null,u)},Qt.createRoot=function(r,o){if(!od(r))throw Error(t(299));var u=!1,p="",v=qg;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=rd(r,1,!1,null,null,u,!1,p,v),r[ir]=o.current,Ji(r.nodeType===8?r.parentNode:r),new id(o)},Qt.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(t(188)):(r=Object.keys(r).join(","),Error(t(268,r)));return r=bf(o),r=r===null?null:r.stateNode,r},Qt.flushSync=function(r){return cs(r)},Qt.hydrate=function(r,o,u){if(!al(o))throw Error(t(200));return ll(null,r,o,!0,u)},Qt.hydrateRoot=function(r,o,u){if(!od(r))throw Error(t(405));var p=u!=null&&u.hydratedSources||null,v=!1,b="",C=qg;if(u!=null&&(u.unstable_strictMode===!0&&(v=!0),u.identifierPrefix!==void 0&&(b=u.identifierPrefix),u.onRecoverableError!==void 0&&(C=u.onRecoverableError)),o=Wg(o,null,r,1,u??null,v,!1,b,C),r[ir]=o.current,Ji(r),p)for(r=0;r<p.length;r++)u=p[r],v=u._getVersion,v=v(u._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[u,v]:o.mutableSourceEagerHydrationData.push(u,v);return new ol(o)},Qt.render=function(r,o,u){if(!al(o))throw Error(t(200));return ll(null,r,o,!1,u)},Qt.unmountComponentAtNode=function(r){if(!al(r))throw Error(t(40));return r._reactRootContainer?(cs(function(){ll(null,null,r,!1,function(){r._reactRootContainer=null,r[ir]=null})}),!0):!1},Qt.unstable_batchedUpdates=Qu,Qt.unstable_renderSubtreeIntoContainer=function(r,o,u,p){if(!al(u))throw Error(t(200));if(r==null||r._reactInternals===void 0)throw Error(t(38));return ll(r,o,u,!1,p)},Qt.version="18.3.1-next-f1338f8080-20240426",Qt}var sm;function Nv(){if(sm)return ud.exports;sm=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),ud.exports=iS(),ud.exports}var im;function oS(){if(im)return ul;im=1;var s=Nv();return ul.createRoot=s.createRoot,ul.hydrateRoot=s.hydrateRoot,ul}var aS=oS();function Iv(s){var e,t,n="";if(typeof s=="string"||typeof s=="number")n+=s;else if(typeof s=="object")if(Array.isArray(s)){var i=s.length;for(e=0;e<i;e++)s[e]&&(t=Iv(s[e]))&&(n&&(n+=" "),n+=t)}else for(t in s)s[t]&&(n&&(n+=" "),n+=t);return n}function Ci(){for(var s,e,t=0,n="",i=arguments.length;t<i;t++)(s=arguments[t])&&(e=Iv(s))&&(n&&(n+=" "),n+=e);return n}const yh="-",lS=s=>{const e=uS(s),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=s;return{getClassGroupId:l=>{const c=l.split(yh);return c[0]===""&&c.length!==1&&c.shift(),Lv(c,e)||cS(l)},getConflictingClassGroupIds:(l,c)=>{const d=t[l]||[];return c&&n[l]?[...d,...n[l]]:d}}},Lv=(s,e)=>{if(s.length===0)return e.classGroupId;const t=s[0],n=e.nextPart.get(t),i=n?Lv(s.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const a=s.join(yh);return e.validators.find(({validator:l})=>l(a))?.classGroupId},om=/^\[(.+)\]$/,cS=s=>{if(om.test(s)){const e=om.exec(s)[1],t=e?.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},uS=s=>{const{theme:e,classGroups:t}=s,n={nextPart:new Map,validators:[]};for(const i in t)Bd(t[i],n,i,e);return n},Bd=(s,e,t,n)=>{s.forEach(i=>{if(typeof i=="string"){const a=i===""?e:am(e,i);a.classGroupId=t;return}if(typeof i=="function"){if(dS(i)){Bd(i(n),e,t,n);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([a,l])=>{Bd(l,am(e,a),t,n)})})},am=(s,e)=>{let t=s;return e.split(yh).forEach(n=>{t.nextPart.has(n)||t.nextPart.set(n,{nextPart:new Map,validators:[]}),t=t.nextPart.get(n)}),t},dS=s=>s.isThemeGetter,hS=s=>{if(s<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,n=new Map;const i=(a,l)=>{t.set(a,l),e++,e>s&&(e=0,n=t,t=new Map)};return{get(a){let l=t.get(a);if(l!==void 0)return l;if((l=n.get(a))!==void 0)return i(a,l),l},set(a,l){t.has(a)?t.set(a,l):i(a,l)}}},Hd="!",Ud=":",fS=Ud.length,pS=s=>{const{prefix:e,experimentalParseClassName:t}=s;let n=i=>{const a=[];let l=0,c=0,d=0,h;for(let x=0;x<i.length;x++){let w=i[x];if(l===0&&c===0){if(w===Ud){a.push(i.slice(d,x)),d=x+fS;continue}if(w==="/"){h=x;continue}}w==="["?l++:w==="]"?l--:w==="("?c++:w===")"&&c--}const f=a.length===0?i:i.substring(d),g=gS(f),m=g!==f,y=h&&h>d?h-d:void 0;return{modifiers:a,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:y}};if(e){const i=e+Ud,a=n;n=l=>l.startsWith(i)?a(l.substring(i.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:l,maybePostfixModifierPosition:void 0}}if(t){const i=n;n=a=>t({className:a,parseClassName:i})}return n},gS=s=>s.endsWith(Hd)?s.substring(0,s.length-1):s.startsWith(Hd)?s.substring(1):s,mS=s=>{const e=Object.fromEntries(s.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const i=[];let a=[];return n.forEach(l=>{l[0]==="["||e[l]?(i.push(...a.sort(),l),a=[]):a.push(l)}),i.push(...a.sort()),i}},vS=s=>({cache:hS(s.cacheSize),parseClassName:pS(s),sortModifiers:mS(s),...lS(s)}),yS=/\s+/,wS=(s,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:a}=e,l=[],c=s.trim().split(yS);let d="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:g,modifiers:m,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:w}=t(f);if(g){d=f+(d.length>0?" "+d:d);continue}let S=!!w,E=n(S?x.substring(0,w):x);if(!E){if(!S){d=f+(d.length>0?" "+d:d);continue}if(E=n(x),!E){d=f+(d.length>0?" "+d:d);continue}S=!1}const P=a(m).join(":"),k=y?P+Hd:P,T=k+E;if(l.includes(T))continue;l.push(T);const R=i(E,S);for(let I=0;I<R.length;++I){const N=R[I];l.push(k+N)}d=f+(d.length>0?" "+d:d)}return d};function bS(){let s=0,e,t,n="";for(;s<arguments.length;)(e=arguments[s++])&&(t=Mv(e))&&(n&&(n+=" "),n+=t);return n}const Mv=s=>{if(typeof s=="string")return s;let e,t="";for(let n=0;n<s.length;n++)s[n]&&(e=Mv(s[n]))&&(t&&(t+=" "),t+=e);return t};function xS(s,...e){let t,n,i,a=l;function l(d){const h=e.reduce((f,g)=>g(f),s());return t=vS(h),n=t.cache.get,i=t.cache.set,a=c,c(d)}function c(d){const h=n(d);if(h)return h;const f=wS(d,t);return i(d,f),f}return function(){return a(bS.apply(null,arguments))}}const bt=s=>{const e=t=>t[s]||[];return e.isThemeGetter=!0,e},Dv=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ov=/^\((?:(\w[\w-]*):)?(.+)\)$/i,SS=/^\d+\/\d+$/,AS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ES=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,_S=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,CS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,si=s=>SS.test(s),Ie=s=>!!s&&!Number.isNaN(Number(s)),Br=s=>!!s&&Number.isInteger(Number(s)),fd=s=>s.endsWith("%")&&Ie(s.slice(0,-1)),fr=s=>AS.test(s),PS=()=>!0,TS=s=>ES.test(s)&&!_S.test(s),Fv=()=>!1,RS=s=>CS.test(s),NS=s=>kS.test(s),IS=s=>!me(s)&&!ve(s),LS=s=>ki(s,$v,Fv),me=s=>Dv.test(s),fs=s=>ki(s,Bv,TS),pd=s=>ki(s,jS,Ie),lm=s=>ki(s,jv,Fv),MS=s=>ki(s,zv,NS),dl=s=>ki(s,Hv,RS),ve=s=>Ov.test(s),yo=s=>Pi(s,Bv),DS=s=>Pi(s,zS),cm=s=>Pi(s,jv),OS=s=>Pi(s,$v),FS=s=>Pi(s,zv),hl=s=>Pi(s,Hv,!0),ki=(s,e,t)=>{const n=Dv.exec(s);return n?n[1]?e(n[1]):t(n[2]):!1},Pi=(s,e,t=!1)=>{const n=Ov.exec(s);return n?n[1]?e(n[1]):t:!1},jv=s=>s==="position"||s==="percentage",zv=s=>s==="image"||s==="url",$v=s=>s==="length"||s==="size"||s==="bg-size",Bv=s=>s==="length",jS=s=>s==="number",zS=s=>s==="family-name",Hv=s=>s==="shadow",$S=()=>{const s=bt("color"),e=bt("font"),t=bt("text"),n=bt("font-weight"),i=bt("tracking"),a=bt("leading"),l=bt("breakpoint"),c=bt("container"),d=bt("spacing"),h=bt("radius"),f=bt("shadow"),g=bt("inset-shadow"),m=bt("text-shadow"),y=bt("drop-shadow"),x=bt("blur"),w=bt("perspective"),S=bt("aspect"),E=bt("ease"),P=bt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...T(),ve,me],I=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],D=()=>[ve,me,d],V=()=>[si,"full","auto",...D()],j=()=>[Br,"none","subgrid",ve,me],G=()=>["auto",{span:["full",Br,ve,me]},Br,ve,me],Z=()=>[Br,"auto",ve,me],K=()=>["auto","min","max","fr",ve,me],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ee=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...D()],$=()=>[si,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],M=()=>[s,ve,me],Q=()=>[...T(),cm,lm,{position:[ve,me]}],ne=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",OS,LS,{size:[ve,me]}],Y=()=>[fd,yo,fs],q=()=>["","none","full",h,ve,me],te=()=>["",Ie,yo,fs],se=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>[Ie,fd,cm,lm],ae=()=>["","none",x,ve,me],de=()=>["none",Ie,ve,me],ce=()=>["none",Ie,ve,me],Se=()=>[Ie,ve,me],Pe=()=>[si,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fr],breakpoint:[fr],color:[PS],container:[fr],"drop-shadow":[fr],ease:["in","out","in-out"],font:[IS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fr],shadow:[fr],spacing:["px",Ie],text:[fr],"text-shadow":[fr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",si,me,ve,S]}],container:["container"],columns:[{columns:[Ie,me,ve,c]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[Br,"auto",ve,me]}],basis:[{basis:[si,"full","auto",c,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ie,si,"auto","initial","none",me]}],grow:[{grow:["",Ie,ve,me]}],shrink:[{shrink:["",Ie,ve,me]}],order:[{order:[Br,"first","last","none",ve,me]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:G()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:G()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...ee(),"normal"]}],"justify-self":[{"justify-self":["auto",...ee()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...ee(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ee(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...ee(),"baseline"]}],"place-self":[{"place-self":["auto",...ee()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],w:[{w:[c,"screen",...$()]}],"min-w":[{"min-w":[c,"screen","none",...$()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",t,yo,fs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,ve,pd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fd,me]}],"font-family":[{font:[DS,me,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,ve,me]}],"line-clamp":[{"line-clamp":[Ie,"none",ve,pd]}],leading:[{leading:[a,...D()]}],"list-image":[{"list-image":["none",ve,me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ve,me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ie,"from-font","auto",ve,fs]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Ie,"auto",ve,me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ve,me]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ve,me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:ne()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Br,ve,me],radial:["",ve,me],conic:[Br,ve,me]},FS,MS]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:q()}],"rounded-s":[{"rounded-s":q()}],"rounded-e":[{"rounded-e":q()}],"rounded-t":[{"rounded-t":q()}],"rounded-r":[{"rounded-r":q()}],"rounded-b":[{"rounded-b":q()}],"rounded-l":[{"rounded-l":q()}],"rounded-ss":[{"rounded-ss":q()}],"rounded-se":[{"rounded-se":q()}],"rounded-ee":[{"rounded-ee":q()}],"rounded-es":[{"rounded-es":q()}],"rounded-tl":[{"rounded-tl":q()}],"rounded-tr":[{"rounded-tr":q()}],"rounded-br":[{"rounded-br":q()}],"rounded-bl":[{"rounded-bl":q()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ie,ve,me]}],"outline-w":[{outline:["",Ie,yo,fs]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",f,hl,dl]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",g,hl,dl]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Ie,fs]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",m,hl,dl]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Ie,ve,me]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ie]}],"mask-image-linear-from-pos":[{"mask-linear-from":H()}],"mask-image-linear-to-pos":[{"mask-linear-to":H()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":H()}],"mask-image-t-to-pos":[{"mask-t-to":H()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":H()}],"mask-image-r-to-pos":[{"mask-r-to":H()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":H()}],"mask-image-b-to-pos":[{"mask-b-to":H()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":H()}],"mask-image-l-to-pos":[{"mask-l-to":H()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":H()}],"mask-image-x-to-pos":[{"mask-x-to":H()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":H()}],"mask-image-y-to-pos":[{"mask-y-to":H()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[ve,me]}],"mask-image-radial-from-pos":[{"mask-radial-from":H()}],"mask-image-radial-to-pos":[{"mask-radial-to":H()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Ie]}],"mask-image-conic-from-pos":[{"mask-conic-from":H()}],"mask-image-conic-to-pos":[{"mask-conic-to":H()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ve,me]}],filter:[{filter:["","none",ve,me]}],blur:[{blur:ae()}],brightness:[{brightness:[Ie,ve,me]}],contrast:[{contrast:[Ie,ve,me]}],"drop-shadow":[{"drop-shadow":["","none",y,hl,dl]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Ie,ve,me]}],"hue-rotate":[{"hue-rotate":[Ie,ve,me]}],invert:[{invert:["",Ie,ve,me]}],saturate:[{saturate:[Ie,ve,me]}],sepia:[{sepia:["",Ie,ve,me]}],"backdrop-filter":[{"backdrop-filter":["","none",ve,me]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[Ie,ve,me]}],"backdrop-contrast":[{"backdrop-contrast":[Ie,ve,me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ie,ve,me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ie,ve,me]}],"backdrop-invert":[{"backdrop-invert":["",Ie,ve,me]}],"backdrop-opacity":[{"backdrop-opacity":[Ie,ve,me]}],"backdrop-saturate":[{"backdrop-saturate":[Ie,ve,me]}],"backdrop-sepia":[{"backdrop-sepia":["",Ie,ve,me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ve,me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ie,"initial",ve,me]}],ease:[{ease:["linear","initial",E,ve,me]}],delay:[{delay:[Ie,ve,me]}],animate:[{animate:["none",P,ve,me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,ve,me]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":["scale-3d"],skew:[{skew:Se()}],"skew-x":[{"skew-x":Se()}],"skew-y":[{"skew-y":Se()}],transform:[{transform:[ve,me,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pe()}],"translate-x":[{"translate-x":Pe()}],"translate-y":[{"translate-y":Pe()}],"translate-z":[{"translate-z":Pe()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ve,me]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ve,me]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Ie,yo,fs,pd]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},BS=xS($S);function vt(...s){return BS(Ci(s))}var HS=Object.defineProperty,US=Object.defineProperties,VS=Object.getOwnPropertyDescriptors,Ml=Object.getOwnPropertySymbols,Uv=Object.prototype.hasOwnProperty,Vv=Object.prototype.propertyIsEnumerable,um=(s,e,t)=>e in s?HS(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Fe=(s,e)=>{for(var t in e||(e={}))Uv.call(e,t)&&um(s,t,e[t]);if(Ml)for(var t of Ml(e))Vv.call(e,t)&&um(s,t,e[t]);return s},Ft=(s,e)=>US(s,VS(e)),it=(s,e)=>{var t={};for(var n in s)Uv.call(s,n)&&e.indexOf(n)<0&&(t[n]=s[n]);if(s!=null&&Ml)for(var n of Ml(s))e.indexOf(n)<0&&Vv.call(s,n)&&(t[n]=s[n]);return t};function dm(s,e){if(typeof s=="function")return s(e);s!=null&&(s.current=e)}function Wv(...s){return e=>{let t=!1;const n=s.map(i=>{const a=dm(i,e);return!t&&typeof a=="function"&&(t=!0),a});if(t)return()=>{for(let i=0;i<n.length;i++){const a=n[i];typeof a=="function"?a():dm(s[i],null)}}}}function st(...s){return A.useCallback(Wv(...s),s)}function xs(s){const e=WS(s),t=A.forwardRef((n,i)=>{const{children:a,...l}=n,c=A.Children.toArray(a),d=c.find(qS);if(d){const h=d.props.children,f=c.map(g=>g===d?A.Children.count(h)>1?A.Children.only(null):A.isValidElement(h)?h.props.children:null:g);return _.jsx(e,{...l,ref:i,children:A.isValidElement(h)?A.cloneElement(h,void 0,f):null})}return _.jsx(e,{...l,ref:i,children:a})});return t.displayName=`${s}.Slot`,t}var Gv=xs("Slot");function WS(s){const e=A.forwardRef((t,n)=>{const{children:i,...a}=t;if(A.isValidElement(i)){const l=YS(i),c=XS(a,i.props);return i.type!==A.Fragment&&(c.ref=n?Wv(n,l):l),A.cloneElement(i,c)}return A.Children.count(i)>1?A.Children.only(null):null});return e.displayName=`${s}.SlotClone`,e}var GS=Symbol("radix.slottable");function qS(s){return A.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===GS}function XS(s,e){const t={...e};for(const n in e){const i=s[n],a=e[n];/^on[A-Z]/.test(n)?i&&a?t[n]=(...c)=>{const d=a(...c);return i(...c),d}:i&&(t[n]=i):n==="style"?t[n]={...i,...a}:n==="className"&&(t[n]=[i,a].filter(Boolean).join(" "))}return{...s,...t}}function YS(s){let e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?s.ref:(e=Object.getOwnPropertyDescriptor(s,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?s.props.ref:s.props.ref||s.ref)}const hm=s=>typeof s=="boolean"?`${s}`:s===0?"0":s,fm=Ci,qv=(s,e)=>t=>{var n;if(e?.variants==null)return fm(s,t?.class,t?.className);const{variants:i,defaultVariants:a}=e,l=Object.keys(i).map(h=>{const f=t?.[h],g=a?.[h];if(f===null)return null;const m=hm(f)||hm(g);return i[h][m]}),c=t&&Object.entries(t).reduce((h,f)=>{let[g,m]=f;return m===void 0||(h[g]=m),h},{}),d=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((h,f)=>{let{class:g,className:m,...y}=f;return Object.entries(y).every(x=>{let[w,S]=x;return Array.isArray(S)?S.includes({...a,...c}[w]):{...a,...c}[w]===S})?[...h,g,m]:h},[]);return fm(s,l,d,t?.class,t?.className)};var KS=qv("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}}),en=A.forwardRef((s,e)=>{var t=s,{className:n,variant:i,size:a,asChild:l=!1}=t,c=it(t,["className","variant","size","asChild"]);const d=l?Gv:"button";return _.jsx(d,Fe({ref:e,"data-slot":"button",className:vt(KS({variant:i,size:a,className:n}))},c))});en.displayName="Button";/**
41
+ * @license lucide-react v0.514.0 - ISC
42
+ *
43
+ * This source code is licensed under the ISC license.
44
+ * See the LICENSE file in the root directory of this source tree.
45
+ */const QS=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),JS=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),pm=s=>{const e=JS(s);return e.charAt(0).toUpperCase()+e.slice(1)},Xv=(...s)=>s.filter((e,t,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===t).join(" ").trim(),ZS=s=>{for(const e in s)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
46
+ * @license lucide-react v0.514.0 - ISC
47
+ *
48
+ * This source code is licensed under the ISC license.
49
+ * See the LICENSE file in the root directory of this source tree.
50
+ */var eA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
51
+ * @license lucide-react v0.514.0 - ISC
52
+ *
53
+ * This source code is licensed under the ISC license.
54
+ * See the LICENSE file in the root directory of this source tree.
55
+ */const tA=A.forwardRef(({color:s="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:n,className:i="",children:a,iconNode:l,...c},d)=>A.createElement("svg",{ref:d,...eA,width:e,height:e,stroke:s,strokeWidth:n?Number(t)*24/Number(e):t,className:Xv("lucide",i),...!a&&!ZS(c)&&{"aria-hidden":"true"},...c},[...l.map(([h,f])=>A.createElement(h,f)),...Array.isArray(a)?a:[a]]));/**
56
+ * @license lucide-react v0.514.0 - ISC
57
+ *
58
+ * This source code is licensed under the ISC license.
59
+ * See the LICENSE file in the root directory of this source tree.
60
+ */const St=(s,e)=>{const t=A.forwardRef(({className:n,...i},a)=>A.createElement(tA,{ref:a,iconNode:e,className:Xv(`lucide-${QS(pm(s))}`,`lucide-${s}`,n),...i}));return t.displayName=pm(s),t};/**
61
+ * @license lucide-react v0.514.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const nA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],rA=St("check",nA);/**
66
+ * @license lucide-react v0.514.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */const sA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],wh=St("chevron-down",sA);/**
71
+ * @license lucide-react v0.514.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const iA=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],oA=St("chevron-left",iA);/**
76
+ * @license lucide-react v0.514.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const aA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Yv=St("chevron-right",aA);/**
81
+ * @license lucide-react v0.514.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const lA=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],cA=St("chevron-up",lA);/**
86
+ * @license lucide-react v0.514.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const uA=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]];St("circle-check-big",uA);/**
91
+ * @license lucide-react v0.514.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const dA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],hA=St("clock",dA);/**
96
+ * @license lucide-react v0.514.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const fA=[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]];St("cog",fA);/**
101
+ * @license lucide-react v0.514.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const pA=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],gA=St("download",pA);/**
106
+ * @license lucide-react v0.514.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const mA=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]];St("eye",mA);/**
111
+ * @license lucide-react v0.514.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const vA=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]];St("file-text",vA);/**
116
+ * @license lucide-react v0.514.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const yA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],wA=St("panel-left-close",yA);/**
121
+ * @license lucide-react v0.514.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const bA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],xA=St("panel-left-open",bA);/**
126
+ * @license lucide-react v0.514.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const SA=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],AA=St("rotate-ccw",SA);/**
131
+ * @license lucide-react v0.514.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const EA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]];St("search",EA);/**
136
+ * @license lucide-react v0.514.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const _A=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],CA=St("settings",_A);/**
141
+ * @license lucide-react v0.514.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const kA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]];St("zap",kA);/**
146
+ * @license lucide-react v0.514.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const PA=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],TA=St("zoom-in",PA);/**
151
+ * @license lucide-react v0.514.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const RA=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],NA=St("zoom-out",RA);function IA(s,e){const t=A.createContext(e),n=a=>{const{children:l,...c}=a,d=A.useMemo(()=>c,Object.values(c));return _.jsx(t.Provider,{value:d,children:l})};n.displayName=s+"Provider";function i(a){const l=A.useContext(t);if(l)return l;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${s}\``)}return[n,i]}function zo(s,e=[]){let t=[];function n(a,l){const c=A.createContext(l),d=t.length;t=[...t,l];const h=g=>{const{scope:m,children:y,...x}=g,w=m?.[s]?.[d]||c,S=A.useMemo(()=>x,Object.values(x));return _.jsx(w.Provider,{value:S,children:y})};h.displayName=a+"Provider";function f(g,m){const y=m?.[s]?.[d]||c,x=A.useContext(y);if(x)return x;if(l!==void 0)return l;throw new Error(`\`${g}\` must be used within \`${a}\``)}return[h,f]}const i=()=>{const a=t.map(l=>A.createContext(l));return function(c){const d=c?.[s]||a;return A.useMemo(()=>({[`__scope${s}`]:{...c,[s]:d}}),[c,d])}};return i.scopeName=s,[n,LA(i,...e)]}function LA(...s){const e=s[0];if(s.length===1)return e;const t=()=>{const n=s.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const l=n.reduce((c,{useScope:d,scopeName:h})=>{const g=d(a)[`__scope${h}`];return{...c,...g}},{});return A.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return t.scopeName=e.scopeName,t}function Ss(s){const e=A.useRef(s);return A.useEffect(()=>{e.current=s}),A.useMemo(()=>(...t)=>e.current?.(...t),[])}var $t=globalThis?.document?A.useLayoutEffect:()=>{},$o=Nv();const MA=gh($o);var DA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ge=DA.reduce((s,e)=>{const t=xs(`Primitive.${e}`),n=A.forwardRef((i,a)=>{const{asChild:l,...c}=i,d=l?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),_.jsx(d,{...c,ref:a})});return n.displayName=`Primitive.${e}`,{...s,[e]:n}},{});function OA(s,e){s&&$o.flushSync(()=>s.dispatchEvent(e))}function FA(s){const e=s+"CollectionProvider",[t,n]=zo(e),[i,a]=t(e,{collectionRef:{current:null},itemMap:new Map}),l=w=>{const{scope:S,children:E}=w,P=Oe.useRef(null),k=Oe.useRef(new Map).current;return _.jsx(i,{scope:S,itemMap:k,collectionRef:P,children:E})};l.displayName=e;const c=s+"CollectionSlot",d=xs(c),h=Oe.forwardRef((w,S)=>{const{scope:E,children:P}=w,k=a(c,E),T=st(S,k.collectionRef);return _.jsx(d,{ref:T,children:P})});h.displayName=c;const f=s+"CollectionItemSlot",g="data-radix-collection-item",m=xs(f),y=Oe.forwardRef((w,S)=>{const{scope:E,children:P,...k}=w,T=Oe.useRef(null),R=st(S,T),I=a(f,E);return Oe.useEffect(()=>(I.itemMap.set(T,{ref:T,...k}),()=>void I.itemMap.delete(T))),_.jsx(m,{[g]:"",ref:R,children:P})});y.displayName=f;function x(w){const S=a(s+"CollectionConsumer",w);return Oe.useCallback(()=>{const P=S.collectionRef.current;if(!P)return[];const k=Array.from(P.querySelectorAll(`[${g}]`));return Array.from(S.itemMap.values()).sort((I,N)=>k.indexOf(I.ref.current)-k.indexOf(N.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:l,Slot:h,ItemSlot:y},x,n]}function Ue(s,e,{checkForDefaultPrevented:t=!0}={}){return function(i){if(s?.(i),t===!1||!i.defaultPrevented)return e?.(i)}}var jA=vh[" useInsertionEffect ".trim().toString()]||$t;function Vd({prop:s,defaultProp:e,onChange:t=()=>{},caller:n}){const[i,a,l]=zA({defaultProp:e,onChange:t}),c=s!==void 0,d=c?s:i;{const f=A.useRef(s!==void 0);A.useEffect(()=>{const g=f.current;g!==c&&console.warn(`${n} is changing from ${g?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,n])}const h=A.useCallback(f=>{if(c){const g=$A(f)?f(s):f;g!==s&&l.current?.(g)}else a(f)},[c,s,a,l]);return[d,h]}function zA({defaultProp:s,onChange:e}){const[t,n]=A.useState(s),i=A.useRef(t),a=A.useRef(e);return jA(()=>{a.current=e},[e]),A.useEffect(()=>{i.current!==t&&(a.current?.(t),i.current=t)},[t,i]),[t,n,a]}function $A(s){return typeof s=="function"}function BA(s,e){return A.useReducer((t,n)=>e[t][n]??t,s)}var Bo=s=>{const{present:e,children:t}=s,n=HA(e),i=typeof t=="function"?t({present:n.isPresent}):A.Children.only(t),a=st(n.ref,UA(i));return typeof t=="function"||n.isPresent?A.cloneElement(i,{ref:a}):null};Bo.displayName="Presence";function HA(s){const[e,t]=A.useState(),n=A.useRef(null),i=A.useRef(s),a=A.useRef("none"),l=s?"mounted":"unmounted",[c,d]=BA(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return A.useEffect(()=>{const h=fl(n.current);a.current=c==="mounted"?h:"none"},[c]),$t(()=>{const h=n.current,f=i.current;if(f!==s){const m=a.current,y=fl(h);s?d("MOUNT"):y==="none"||h?.display==="none"?d("UNMOUNT"):d(f&&m!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=s}},[s,d]),$t(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,g=y=>{const w=fl(n.current).includes(y.animationName);if(y.target===e&&w&&(d("ANIMATION_END"),!i.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},m=y=>{y.target===e&&(a.current=fl(n.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",g),e.addEventListener("animationend",g),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",g),e.removeEventListener("animationend",g)}}else d("ANIMATION_END")},[e,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:A.useCallback(h=>{n.current=h?getComputedStyle(h):null,t(h)},[])}}function fl(s){return s?.animationName||"none"}function UA(s){let e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?s.ref:(e=Object.getOwnPropertyDescriptor(s,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?s.props.ref:s.props.ref||s.ref)}var VA=vh[" useId ".trim().toString()]||(()=>{}),WA=0;function Wl(s){const[e,t]=A.useState(VA());return $t(()=>{t(n=>n??String(WA++))},[s]),s||(e?`radix-${e}`:"")}var GA=A.createContext(void 0);function qA(s){const e=A.useContext(GA);return s||e||"ltr"}const XA=Oe.createContext(null);XA.displayName="HookFormContext";A.createContext({});A.createContext({});function YA(s,e=globalThis?.document){const t=Ss(s);A.useEffect(()=>{const n=i=>{i.key==="Escape"&&t(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[t,e])}var KA="DismissableLayer",Wd="dismissableLayer.update",QA="dismissableLayer.pointerDownOutside",JA="dismissableLayer.focusOutside",gm,Kv=A.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Gl=A.forwardRef((s,e)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...d}=s,h=A.useContext(Kv),[f,g]=A.useState(null),m=f?.ownerDocument??globalThis?.document,[,y]=A.useState({}),x=st(e,N=>g(N)),w=Array.from(h.layers),[S]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),E=w.indexOf(S),P=f?w.indexOf(f):-1,k=h.layersWithOutsidePointerEventsDisabled.size>0,T=P>=E,R=tE(N=>{const D=N.target,V=[...h.branches].some(j=>j.contains(D));!T||V||(i?.(N),l?.(N),N.defaultPrevented||c?.())},m),I=nE(N=>{const D=N.target;[...h.branches].some(j=>j.contains(D))||(a?.(N),l?.(N),N.defaultPrevented||c?.())},m);return YA(N=>{P===h.layers.size-1&&(n?.(N),!N.defaultPrevented&&c&&(N.preventDefault(),c()))},m),A.useEffect(()=>{if(f)return t&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(gm=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),mm(),()=>{t&&h.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=gm)}},[f,m,t,h]),A.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),mm())},[f,h]),A.useEffect(()=>{const N=()=>y({});return document.addEventListener(Wd,N),()=>document.removeEventListener(Wd,N)},[]),_.jsx(Ge.div,{...d,ref:x,style:{pointerEvents:k?T?"auto":"none":void 0,...s.style},onFocusCapture:Ue(s.onFocusCapture,I.onFocusCapture),onBlurCapture:Ue(s.onBlurCapture,I.onBlurCapture),onPointerDownCapture:Ue(s.onPointerDownCapture,R.onPointerDownCapture)})});Gl.displayName=KA;var ZA="DismissableLayerBranch",eE=A.forwardRef((s,e)=>{const t=A.useContext(Kv),n=A.useRef(null),i=st(e,n);return A.useEffect(()=>{const a=n.current;if(a)return t.branches.add(a),()=>{t.branches.delete(a)}},[t.branches]),_.jsx(Ge.div,{...s,ref:i})});eE.displayName=ZA;function tE(s,e=globalThis?.document){const t=Ss(s),n=A.useRef(!1),i=A.useRef(()=>{});return A.useEffect(()=>{const a=c=>{if(c.target&&!n.current){let d=function(){Qv(QA,t,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=d,e.addEventListener("click",i.current,{once:!0})):d()}else e.removeEventListener("click",i.current);n.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",a),e.removeEventListener("click",i.current)}},[e,t]),{onPointerDownCapture:()=>n.current=!0}}function nE(s,e=globalThis?.document){const t=Ss(s),n=A.useRef(!1);return A.useEffect(()=>{const i=a=>{a.target&&!n.current&&Qv(JA,t,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,t]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function mm(){const s=new CustomEvent(Wd);document.dispatchEvent(s)}function Qv(s,e,t,{discrete:n}){const i=t.originalEvent.target,a=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:t});e&&i.addEventListener(s,e,{once:!0}),n?OA(i,a):i.dispatchEvent(a)}var gd="focusScope.autoFocusOnMount",md="focusScope.autoFocusOnUnmount",vm={bubbles:!1,cancelable:!0},rE="FocusScope",ql=A.forwardRef((s,e)=>{const{loop:t=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...l}=s,[c,d]=A.useState(null),h=Ss(i),f=Ss(a),g=A.useRef(null),m=st(e,w=>d(w)),y=A.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;A.useEffect(()=>{if(n){let w=function(k){if(y.paused||!c)return;const T=k.target;c.contains(T)?g.current=T:Hr(g.current,{select:!0})},S=function(k){if(y.paused||!c)return;const T=k.relatedTarget;T!==null&&(c.contains(T)||Hr(g.current,{select:!0}))},E=function(k){if(document.activeElement===document.body)for(const R of k)R.removedNodes.length>0&&Hr(c)};document.addEventListener("focusin",w),document.addEventListener("focusout",S);const P=new MutationObserver(E);return c&&P.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",S),P.disconnect()}}},[n,c,y.paused]),A.useEffect(()=>{if(c){wm.add(y);const w=document.activeElement;if(!c.contains(w)){const E=new CustomEvent(gd,vm);c.addEventListener(gd,h),c.dispatchEvent(E),E.defaultPrevented||(sE(cE(Jv(c)),{select:!0}),document.activeElement===w&&Hr(c))}return()=>{c.removeEventListener(gd,h),setTimeout(()=>{const E=new CustomEvent(md,vm);c.addEventListener(md,f),c.dispatchEvent(E),E.defaultPrevented||Hr(w??document.body,{select:!0}),c.removeEventListener(md,f),wm.remove(y)},0)}}},[c,h,f,y]);const x=A.useCallback(w=>{if(!t&&!n||y.paused)return;const S=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,E=document.activeElement;if(S&&E){const P=w.currentTarget,[k,T]=iE(P);k&&T?!w.shiftKey&&E===T?(w.preventDefault(),t&&Hr(k,{select:!0})):w.shiftKey&&E===k&&(w.preventDefault(),t&&Hr(T,{select:!0})):E===P&&w.preventDefault()}},[t,n,y.paused]);return _.jsx(Ge.div,{tabIndex:-1,...l,ref:m,onKeyDown:x})});ql.displayName=rE;function sE(s,{select:e=!1}={}){const t=document.activeElement;for(const n of s)if(Hr(n,{select:e}),document.activeElement!==t)return}function iE(s){const e=Jv(s),t=ym(e,s),n=ym(e.reverse(),s);return[t,n]}function Jv(s){const e=[],t=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function ym(s,e){for(const t of s)if(!oE(t,{upTo:e}))return t}function oE(s,{upTo:e}){if(getComputedStyle(s).visibility==="hidden")return!0;for(;s;){if(e!==void 0&&s===e)return!1;if(getComputedStyle(s).display==="none")return!0;s=s.parentElement}return!1}function aE(s){return s instanceof HTMLInputElement&&"select"in s}function Hr(s,{select:e=!1}={}){if(s&&s.focus){const t=document.activeElement;s.focus({preventScroll:!0}),s!==t&&aE(s)&&e&&s.select()}}var wm=lE();function lE(){let s=[];return{add(e){const t=s[0];e!==t&&t?.pause(),s=bm(s,e),s.unshift(e)},remove(e){s=bm(s,e),s[0]?.resume()}}}function bm(s,e){const t=[...s],n=t.indexOf(e);return n!==-1&&t.splice(n,1),t}function cE(s){return s.filter(e=>e.tagName!=="A")}var uE="Portal",bh=A.forwardRef((s,e)=>{const{container:t,...n}=s,[i,a]=A.useState(!1);$t(()=>a(!0),[]);const l=t||i&&globalThis?.document?.body;return l?MA.createPortal(_.jsx(Ge.div,{...n,ref:e}),l):null});bh.displayName=uE;var vd=0;function xh(){A.useEffect(()=>{const s=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",s[0]??xm()),document.body.insertAdjacentElement("beforeend",s[1]??xm()),vd++,()=>{vd===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),vd--}},[])}function xm(){const s=document.createElement("span");return s.setAttribute("data-radix-focus-guard",""),s.tabIndex=0,s.style.outline="none",s.style.opacity="0",s.style.position="fixed",s.style.pointerEvents="none",s}var Yn=function(){return Yn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Yn.apply(this,arguments)};function Zv(s,e){var t={};for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&e.indexOf(n)<0&&(t[n]=s[n]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(s);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(s,n[i])&&(t[n[i]]=s[n[i]]);return t}function dE(s,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return s.concat(a||Array.prototype.slice.call(e))}var kl="right-scroll-bar-position",Pl="width-before-scroll-bar",hE="with-scroll-bars-hidden",fE="--removed-body-scroll-bar-size";function yd(s,e){return typeof s=="function"?s(e):s&&(s.current=e),s}function pE(s,e){var t=A.useState(function(){return{value:s,callback:e,facade:{get current(){return t.value},set current(n){var i=t.value;i!==n&&(t.value=n,t.callback(n,i))}}}})[0];return t.callback=e,t.facade}var gE=typeof window<"u"?A.useLayoutEffect:A.useEffect,Sm=new WeakMap;function mE(s,e){var t=pE(null,function(n){return s.forEach(function(i){return yd(i,n)})});return gE(function(){var n=Sm.get(t);if(n){var i=new Set(n),a=new Set(s),l=t.current;i.forEach(function(c){a.has(c)||yd(c,null)}),a.forEach(function(c){i.has(c)||yd(c,l)})}Sm.set(t,s)},[s]),t}function vE(s){return s}function yE(s,e){e===void 0&&(e=vE);var t=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:s},useMedium:function(a){var l=e(a,n);return t.push(l),function(){t=t.filter(function(c){return c!==l})}},assignSyncMedium:function(a){for(n=!0;t.length;){var l=t;t=[],l.forEach(a)}t={push:function(c){return a(c)},filter:function(){return t}}},assignMedium:function(a){n=!0;var l=[];if(t.length){var c=t;t=[],c.forEach(a),l=t}var d=function(){var f=l;l=[],f.forEach(a)},h=function(){return Promise.resolve().then(d)};h(),t={push:function(f){l.push(f),h()},filter:function(f){return l=l.filter(f),t}}}};return i}function wE(s){s===void 0&&(s={});var e=yE(null);return e.options=Yn({async:!0,ssr:!1},s),e}var ey=function(s){var e=s.sideCar,t=Zv(s,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return A.createElement(n,Yn({},t))};ey.isSideCarExport=!0;function bE(s,e){return s.useMedium(e),ey}var ty=wE(),wd=function(){},Xl=A.forwardRef(function(s,e){var t=A.useRef(null),n=A.useState({onScrollCapture:wd,onWheelCapture:wd,onTouchMoveCapture:wd}),i=n[0],a=n[1],l=s.forwardProps,c=s.children,d=s.className,h=s.removeScrollBar,f=s.enabled,g=s.shards,m=s.sideCar,y=s.noRelative,x=s.noIsolation,w=s.inert,S=s.allowPinchZoom,E=s.as,P=E===void 0?"div":E,k=s.gapMode,T=Zv(s,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=m,I=mE([t,e]),N=Yn(Yn({},T),i);return A.createElement(A.Fragment,null,f&&A.createElement(R,{sideCar:ty,removeScrollBar:h,shards:g,noRelative:y,noIsolation:x,inert:w,setCallbacks:a,allowPinchZoom:!!S,lockRef:t,gapMode:k}),l?A.cloneElement(A.Children.only(c),Yn(Yn({},N),{ref:I})):A.createElement(P,Yn({},N,{className:d,ref:I}),c))});Xl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Xl.classNames={fullWidth:Pl,zeroRight:kl};var xE=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function SE(){if(!document)return null;var s=document.createElement("style");s.type="text/css";var e=xE();return e&&s.setAttribute("nonce",e),s}function AE(s,e){s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}function EE(s){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(s)}var _E=function(){var s=0,e=null;return{add:function(t){s==0&&(e=SE())&&(AE(e,t),EE(e)),s++},remove:function(){s--,!s&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},CE=function(){var s=_E();return function(e,t){A.useEffect(function(){return s.add(e),function(){s.remove()}},[e&&t])}},ny=function(){var s=CE(),e=function(t){var n=t.styles,i=t.dynamic;return s(n,i),null};return e},kE={left:0,top:0,right:0,gap:0},bd=function(s){return parseInt(s||"",10)||0},PE=function(s){var e=window.getComputedStyle(document.body),t=e[s==="padding"?"paddingLeft":"marginLeft"],n=e[s==="padding"?"paddingTop":"marginTop"],i=e[s==="padding"?"paddingRight":"marginRight"];return[bd(t),bd(n),bd(i)]},TE=function(s){if(s===void 0&&(s="margin"),typeof window>"u")return kE;var e=PE(s),t=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-t+e[2]-e[0])}},RE=ny(),gi="data-scroll-locked",NE=function(s,e,t,n){var i=s.left,a=s.top,l=s.right,c=s.gap;return t===void 0&&(t="margin"),`
156
+ .`.concat(hE,` {
157
+ overflow: hidden `).concat(n,`;
158
+ padding-right: `).concat(c,"px ").concat(n,`;
159
+ }
160
+ body[`).concat(gi,`] {
161
+ overflow: hidden `).concat(n,`;
162
+ overscroll-behavior: contain;
163
+ `).concat([e&&"position: relative ".concat(n,";"),t==="margin"&&`
164
+ padding-left: `.concat(i,`px;
165
+ padding-top: `).concat(a,`px;
166
+ padding-right: `).concat(l,`px;
167
+ margin-left:0;
168
+ margin-top:0;
169
+ margin-right: `).concat(c,"px ").concat(n,`;
170
+ `),t==="padding"&&"padding-right: ".concat(c,"px ").concat(n,";")].filter(Boolean).join(""),`
171
+ }
172
+
173
+ .`).concat(kl,` {
174
+ right: `).concat(c,"px ").concat(n,`;
175
+ }
176
+
177
+ .`).concat(Pl,` {
178
+ margin-right: `).concat(c,"px ").concat(n,`;
179
+ }
180
+
181
+ .`).concat(kl," .").concat(kl,` {
182
+ right: 0 `).concat(n,`;
183
+ }
184
+
185
+ .`).concat(Pl," .").concat(Pl,` {
186
+ margin-right: 0 `).concat(n,`;
187
+ }
188
+
189
+ body[`).concat(gi,`] {
190
+ `).concat(fE,": ").concat(c,`px;
191
+ }
192
+ `)},Am=function(){var s=parseInt(document.body.getAttribute(gi)||"0",10);return isFinite(s)?s:0},IE=function(){A.useEffect(function(){return document.body.setAttribute(gi,(Am()+1).toString()),function(){var s=Am()-1;s<=0?document.body.removeAttribute(gi):document.body.setAttribute(gi,s.toString())}},[])},LE=function(s){var e=s.noRelative,t=s.noImportant,n=s.gapMode,i=n===void 0?"margin":n;IE();var a=A.useMemo(function(){return TE(i)},[i]);return A.createElement(RE,{styles:NE(a,!e,i,t?"":"!important")})},Gd=!1;if(typeof window<"u")try{var pl=Object.defineProperty({},"passive",{get:function(){return Gd=!0,!0}});window.addEventListener("test",pl,pl),window.removeEventListener("test",pl,pl)}catch{Gd=!1}var ii=Gd?{passive:!1}:!1,ME=function(s){return s.tagName==="TEXTAREA"},ry=function(s,e){if(!(s instanceof Element))return!1;var t=window.getComputedStyle(s);return t[e]!=="hidden"&&!(t.overflowY===t.overflowX&&!ME(s)&&t[e]==="visible")},DE=function(s){return ry(s,"overflowY")},OE=function(s){return ry(s,"overflowX")},Em=function(s,e){var t=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=sy(s,n);if(i){var a=iy(s,n),l=a[1],c=a[2];if(l>c)return!0}n=n.parentNode}while(n&&n!==t.body);return!1},FE=function(s){var e=s.scrollTop,t=s.scrollHeight,n=s.clientHeight;return[e,t,n]},jE=function(s){var e=s.scrollLeft,t=s.scrollWidth,n=s.clientWidth;return[e,t,n]},sy=function(s,e){return s==="v"?DE(e):OE(e)},iy=function(s,e){return s==="v"?FE(e):jE(e)},zE=function(s,e){return s==="h"&&e==="rtl"?-1:1},$E=function(s,e,t,n,i){var a=zE(s,window.getComputedStyle(e).direction),l=a*n,c=t.target,d=e.contains(c),h=!1,f=l>0,g=0,m=0;do{if(!c)break;var y=iy(s,c),x=y[0],w=y[1],S=y[2],E=w-S-a*x;(x||E)&&sy(s,c)&&(g+=E,m+=x);var P=c.parentNode;c=P&&P.nodeType===Node.DOCUMENT_FRAGMENT_NODE?P.host:P}while(!d&&c!==document.body||d&&(e.contains(c)||e===c));return(f&&Math.abs(g)<1||!f&&Math.abs(m)<1)&&(h=!0),h},gl=function(s){return"changedTouches"in s?[s.changedTouches[0].clientX,s.changedTouches[0].clientY]:[0,0]},_m=function(s){return[s.deltaX,s.deltaY]},Cm=function(s){return s&&"current"in s?s.current:s},BE=function(s,e){return s[0]===e[0]&&s[1]===e[1]},HE=function(s){return`
193
+ .block-interactivity-`.concat(s,` {pointer-events: none;}
194
+ .allow-interactivity-`).concat(s,` {pointer-events: all;}
195
+ `)},UE=0,oi=[];function VE(s){var e=A.useRef([]),t=A.useRef([0,0]),n=A.useRef(),i=A.useState(UE++)[0],a=A.useState(ny)[0],l=A.useRef(s);A.useEffect(function(){l.current=s},[s]),A.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(i));var w=dE([s.lockRef.current],(s.shards||[]).map(Cm),!0).filter(Boolean);return w.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[s.inert,s.lockRef.current,s.shards]);var c=A.useCallback(function(w,S){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!l.current.allowPinchZoom;var E=gl(w),P=t.current,k="deltaX"in w?w.deltaX:P[0]-E[0],T="deltaY"in w?w.deltaY:P[1]-E[1],R,I=w.target,N=Math.abs(k)>Math.abs(T)?"h":"v";if("touches"in w&&N==="h"&&I.type==="range")return!1;var D=Em(N,I);if(!D)return!0;if(D?R=N:(R=N==="v"?"h":"v",D=Em(N,I)),!D)return!1;if(!n.current&&"changedTouches"in w&&(k||T)&&(n.current=R),!R)return!0;var V=n.current||R;return $E(V,S,w,V==="h"?k:T)},[]),d=A.useCallback(function(w){var S=w;if(!(!oi.length||oi[oi.length-1]!==a)){var E="deltaY"in S?_m(S):gl(S),P=e.current.filter(function(R){return R.name===S.type&&(R.target===S.target||S.target===R.shadowParent)&&BE(R.delta,E)})[0];if(P&&P.should){S.cancelable&&S.preventDefault();return}if(!P){var k=(l.current.shards||[]).map(Cm).filter(Boolean).filter(function(R){return R.contains(S.target)}),T=k.length>0?c(S,k[0]):!l.current.noIsolation;T&&S.cancelable&&S.preventDefault()}}},[]),h=A.useCallback(function(w,S,E,P){var k={name:w,delta:S,target:E,should:P,shadowParent:WE(E)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(T){return T!==k})},1)},[]),f=A.useCallback(function(w){t.current=gl(w),n.current=void 0},[]),g=A.useCallback(function(w){h(w.type,_m(w),w.target,c(w,s.lockRef.current))},[]),m=A.useCallback(function(w){h(w.type,gl(w),w.target,c(w,s.lockRef.current))},[]);A.useEffect(function(){return oi.push(a),s.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:m}),document.addEventListener("wheel",d,ii),document.addEventListener("touchmove",d,ii),document.addEventListener("touchstart",f,ii),function(){oi=oi.filter(function(w){return w!==a}),document.removeEventListener("wheel",d,ii),document.removeEventListener("touchmove",d,ii),document.removeEventListener("touchstart",f,ii)}},[]);var y=s.removeScrollBar,x=s.inert;return A.createElement(A.Fragment,null,x?A.createElement(a,{styles:HE(i)}):null,y?A.createElement(LE,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function WE(s){for(var e=null;s!==null;)s instanceof ShadowRoot&&(e=s.host,s=s.host),s=s.parentNode;return e}const GE=bE(ty,VE);var Yl=A.forwardRef(function(s,e){return A.createElement(Xl,Yn({},s,{ref:e,sideCar:GE}))});Yl.classNames=Xl.classNames;var qE=function(s){if(typeof document>"u")return null;var e=Array.isArray(s)?s[0]:s;return e.ownerDocument.body},ai=new WeakMap,ml=new WeakMap,vl={},xd=0,oy=function(s){return s&&(s.host||oy(s.parentNode))},XE=function(s,e){return e.map(function(t){if(s.contains(t))return t;var n=oy(t);return n&&s.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",s,". Doing nothing"),null)}).filter(function(t){return!!t})},YE=function(s,e,t,n){var i=XE(e,Array.isArray(s)?s:[s]);vl[t]||(vl[t]=new WeakMap);var a=vl[t],l=[],c=new Set,d=new Set(i),h=function(g){!g||c.has(g)||(c.add(g),h(g.parentNode))};i.forEach(h);var f=function(g){!g||d.has(g)||Array.prototype.forEach.call(g.children,function(m){if(c.has(m))f(m);else try{var y=m.getAttribute(n),x=y!==null&&y!=="false",w=(ai.get(m)||0)+1,S=(a.get(m)||0)+1;ai.set(m,w),a.set(m,S),l.push(m),w===1&&x&&ml.set(m,!0),S===1&&m.setAttribute(t,"true"),x||m.setAttribute(n,"true")}catch(E){console.error("aria-hidden: cannot operate on ",m,E)}})};return f(e),c.clear(),xd++,function(){l.forEach(function(g){var m=ai.get(g)-1,y=a.get(g)-1;ai.set(g,m),a.set(g,y),m||(ml.has(g)||g.removeAttribute(n),ml.delete(g)),y||g.removeAttribute(t)}),xd--,xd||(ai=new WeakMap,ai=new WeakMap,ml=new WeakMap,vl={})}},Sh=function(s,e,t){t===void 0&&(t="data-aria-hidden");var n=Array.from(Array.isArray(s)?s:[s]),i=qE(s);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),YE(n,i,t,"aria-hidden")):function(){return null}},ay="Dialog",[ly,jN]=zo(ay),[zN,er]=ly(ay),cy="DialogTrigger",KE=A.forwardRef((s,e)=>{const{__scopeDialog:t,...n}=s,i=er(cy,t),a=st(e,i.triggerRef);return _.jsx(Ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Eh(i.open),...n,ref:a,onClick:Ue(s.onClick,i.onOpenToggle)})});KE.displayName=cy;var QE="DialogPortal",[$N,uy]=ly(QE,{forceMount:void 0}),Dl="DialogOverlay",dy=A.forwardRef((s,e)=>{const t=uy(Dl,s.__scopeDialog),{forceMount:n=t.forceMount,...i}=s,a=er(Dl,s.__scopeDialog);return a.modal?_.jsx(Bo,{present:n||a.open,children:_.jsx(ZE,{...i,ref:e})}):null});dy.displayName=Dl;var JE=xs("DialogOverlay.RemoveScroll"),ZE=A.forwardRef((s,e)=>{const{__scopeDialog:t,...n}=s,i=er(Dl,t);return _.jsx(Yl,{as:JE,allowPinchZoom:!0,shards:[i.contentRef],children:_.jsx(Ge.div,{"data-state":Eh(i.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),As="DialogContent",hy=A.forwardRef((s,e)=>{const t=uy(As,s.__scopeDialog),{forceMount:n=t.forceMount,...i}=s,a=er(As,s.__scopeDialog);return _.jsx(Bo,{present:n||a.open,children:a.modal?_.jsx(e1,{...i,ref:e}):_.jsx(t1,{...i,ref:e})})});hy.displayName=As;var e1=A.forwardRef((s,e)=>{const t=er(As,s.__scopeDialog),n=A.useRef(null),i=st(e,t.contentRef,n);return A.useEffect(()=>{const a=n.current;if(a)return Sh(a)},[]),_.jsx(fy,{...s,ref:i,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ue(s.onCloseAutoFocus,a=>{a.preventDefault(),t.triggerRef.current?.focus()}),onPointerDownOutside:Ue(s.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&a.preventDefault()}),onFocusOutside:Ue(s.onFocusOutside,a=>a.preventDefault())})}),t1=A.forwardRef((s,e)=>{const t=er(As,s.__scopeDialog),n=A.useRef(!1),i=A.useRef(!1);return _.jsx(fy,{...s,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{s.onCloseAutoFocus?.(a),a.defaultPrevented||(n.current||t.triggerRef.current?.focus(),a.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:a=>{s.onInteractOutside?.(a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=a.target;t.triggerRef.current?.contains(l)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),fy=A.forwardRef((s,e)=>{const{__scopeDialog:t,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:a,...l}=s,c=er(As,t),d=A.useRef(null),h=st(e,d);return xh(),_.jsxs(_.Fragment,{children:[_.jsx(ql,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:a,children:_.jsx(Gl,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Eh(c.open),...l,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),_.jsxs(_.Fragment,{children:[_.jsx(i1,{titleId:c.titleId}),_.jsx(a1,{contentRef:d,descriptionId:c.descriptionId})]})]})}),Ah="DialogTitle",n1=A.forwardRef((s,e)=>{const{__scopeDialog:t,...n}=s,i=er(Ah,t);return _.jsx(Ge.h2,{id:i.titleId,...n,ref:e})});n1.displayName=Ah;var py="DialogDescription",r1=A.forwardRef((s,e)=>{const{__scopeDialog:t,...n}=s,i=er(py,t);return _.jsx(Ge.p,{id:i.descriptionId,...n,ref:e})});r1.displayName=py;var gy="DialogClose",s1=A.forwardRef((s,e)=>{const{__scopeDialog:t,...n}=s,i=er(gy,t);return _.jsx(Ge.button,{type:"button",...n,ref:e,onClick:Ue(s.onClick,()=>i.onOpenChange(!1))})});s1.displayName=gy;function Eh(s){return s?"open":"closed"}var my="DialogTitleWarning",[BN,vy]=IA(my,{contentName:As,titleName:Ah,docsSlug:"dialog"}),i1=({titleId:s})=>{const e=vy(my),t=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
196
+
197
+ If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
198
+
199
+ For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return A.useEffect(()=>{s&&(document.getElementById(s)||console.error(t))},[t,s]),null},o1="DialogDescriptionWarning",a1=({contentRef:s,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${vy(o1).contentName}}.`;return A.useEffect(()=>{const i=s.current?.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(n))},[n,s,e]),null},l1=dy,c1=hy;function u1(s){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css",e.appendChild(t),t.styleSheet?t.styleSheet.cssText=s:t.appendChild(document.createTextNode(s))}const d1=Oe.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),Kl=()=>{const s=Oe.useContext(d1);if(!s)throw new Error("useDrawerContext must be used within a Drawer.Root");return s};u1(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
200
+ [data-state=closed]
201
+ ){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function h1(s,e){typeof s=="function"?s(e):s!=null&&(s.current=e)}function f1(...s){return e=>s.forEach(t=>h1(t,e))}function yy(...s){return A.useCallback(f1(...s),s)}const km=s=>{switch(s){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return s}};function Sd(s,e){if(!s)return()=>{};const t=s.style.cssText;return Object.assign(s.style,e),()=>{s.style.cssText=t}}function p1(...s){return(...e)=>{for(const t of s)typeof t=="function"&&t(...e)}}const Ad={DURATION:.5,EASE:[.32,.72,0,1]},g1=8,m1=26,v1=()=>()=>{};function y1(){const{direction:s,isOpen:e,shouldScaleBackground:t,setBackgroundColorOnScale:n,noBodyStyles:i}=Kl(),a=Oe.useRef(null),l=A.useMemo(()=>document.body.style.backgroundColor,[]);function c(){return(window.innerWidth-m1)/window.innerWidth}Oe.useEffect(()=>{if(e&&t){a.current&&clearTimeout(a.current);const d=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!d)return;p1(n&&!i?Sd(document.body,{background:"black"}):v1,Sd(d,{transformOrigin:km(s)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Ad.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ad.EASE.join(",")})`}));const h=Sd(d,{borderRadius:`${g1}px`,overflow:"hidden",...km(s)?{transform:`scale(${c()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${c()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{h(),a.current=window.setTimeout(()=>{l?document.body.style.background=l:document.body.style.removeProperty("background")},Ad.DURATION*1e3)}}},[e,t,l])}const w1=Oe.forwardRef(function({...s},e){const{overlayRef:t,snapPoints:n,onRelease:i,shouldFade:a,isOpen:l,modal:c,shouldAnimate:d}=Kl(),h=yy(e,t),f=n&&n.length>0;if(!c)return null;const g=Oe.useCallback(m=>i(m),[i]);return Oe.createElement(l1,{onMouseUp:g,ref:h,"data-vaul-overlay":"","data-vaul-snap-points":l&&f?"true":"false","data-vaul-snap-points-overlay":l&&a?"true":"false","data-vaul-animate":d?.current?"true":"false",...s})});w1.displayName="Drawer.Overlay";const b1=Oe.forwardRef(function({onPointerDownOutside:s,style:e,onOpenAutoFocus:t,...n},i){const{drawerRef:a,onPress:l,onRelease:c,onDrag:d,keyboardIsOpen:h,snapPointsOffset:f,activeSnapPointIndex:g,modal:m,isOpen:y,direction:x,snapPoints:w,container:S,handleOnly:E,shouldAnimate:P,autoFocus:k}=Kl(),[T,R]=Oe.useState(!1),I=yy(i,a),N=Oe.useRef(null),D=Oe.useRef(null),V=Oe.useRef(!1),j=w&&w.length>0;y1();const G=(K,J,ee=0)=>{if(V.current)return!0;const B=Math.abs(K.y),$=Math.abs(K.x),M=$>B,Q=["bottom","right"].includes(J)?1:-1;if(J==="left"||J==="right"){if(!(K.x*Q<0)&&$>=0&&$<=ee)return M}else if(!(K.y*Q<0)&&B>=0&&B<=ee)return!M;return V.current=!0,!0};Oe.useEffect(()=>{j&&window.requestAnimationFrame(()=>{R(!0)})},[]);function Z(K){N.current=null,V.current=!1,c(K)}return Oe.createElement(c1,{"data-vaul-drawer-direction":x,"data-vaul-drawer":"","data-vaul-delayed-snap-points":T?"true":"false","data-vaul-snap-points":y&&j?"true":"false","data-vaul-custom-container":S?"true":"false","data-vaul-animate":P?.current?"true":"false",...n,ref:I,style:f&&f.length>0?{"--snap-point-height":`${f[g??0]}px`,...e}:e,onPointerDown:K=>{E||(n.onPointerDown==null||n.onPointerDown.call(n,K),N.current={x:K.pageX,y:K.pageY},l(K))},onOpenAutoFocus:K=>{t?.(K),k||K.preventDefault()},onPointerDownOutside:K=>{if(s?.(K),!m||K.defaultPrevented){K.preventDefault();return}h.current&&(h.current=!1)},onFocusOutside:K=>{if(!m){K.preventDefault();return}},onPointerMove:K=>{if(D.current=K,E||(n.onPointerMove==null||n.onPointerMove.call(n,K),!N.current))return;const J=K.pageY-N.current.y,ee=K.pageX-N.current.x,B=K.pointerType==="touch"?10:2;G({x:ee,y:J},x,B)?d(K):(Math.abs(ee)>B||Math.abs(J)>B)&&(N.current=null)},onPointerUp:K=>{n.onPointerUp==null||n.onPointerUp.call(n,K),N.current=null,V.current=!1,c(K)},onPointerOut:K=>{n.onPointerOut==null||n.onPointerOut.call(n,K),Z(D.current)},onContextMenu:K=>{n.onContextMenu==null||n.onContextMenu.call(n,K),D.current&&Z(D.current)}})});b1.displayName="Drawer.Content";const x1=250,S1=120,A1=Oe.forwardRef(function({preventCycle:s=!1,children:e,...t},n){const{closeDrawer:i,isDragging:a,snapPoints:l,activeSnapPoint:c,setActiveSnapPoint:d,dismissible:h,handleOnly:f,isOpen:g,onPress:m,onDrag:y}=Kl(),x=Oe.useRef(null),w=Oe.useRef(!1);function S(){if(w.current){k();return}window.setTimeout(()=>{E()},S1)}function E(){if(a||s||w.current){k();return}if(k(),!l||l.length===0){h||i();return}if(c===l[l.length-1]&&h){i();return}const R=l.findIndex(N=>N===c);if(R===-1)return;const I=l[R+1];d(I)}function P(){x.current=window.setTimeout(()=>{w.current=!0},x1)}function k(){x.current&&window.clearTimeout(x.current),w.current=!1}return Oe.createElement("div",{onClick:S,onPointerCancel:k,onPointerDown:T=>{f&&m(T),P()},onPointerMove:T=>{f&&y(T)},ref:n,"data-vaul-drawer-visible":g?"true":"false","data-vaul-handle":"","aria-hidden":"true",...t},Oe.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},e))});A1.displayName="Drawer.Handle";const E1=["top","right","bottom","left"],qr=Math.min,un=Math.max,Ol=Math.round,yl=Math.floor,Jn=s=>({x:s,y:s}),_1={left:"right",right:"left",bottom:"top",top:"bottom"},C1={start:"end",end:"start"};function qd(s,e,t){return un(s,qr(e,t))}function vr(s,e){return typeof s=="function"?s(e):s}function yr(s){return s.split("-")[0]}function Ti(s){return s.split("-")[1]}function _h(s){return s==="x"?"y":"x"}function Ch(s){return s==="y"?"height":"width"}const k1=new Set(["top","bottom"]);function Qn(s){return k1.has(yr(s))?"y":"x"}function kh(s){return _h(Qn(s))}function P1(s,e,t){t===void 0&&(t=!1);const n=Ti(s),i=kh(s),a=Ch(i);let l=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(l=Fl(l)),[l,Fl(l)]}function T1(s){const e=Fl(s);return[Xd(s),e,Xd(e)]}function Xd(s){return s.replace(/start|end/g,e=>C1[e])}const Pm=["left","right"],Tm=["right","left"],R1=["top","bottom"],N1=["bottom","top"];function I1(s,e,t){switch(s){case"top":case"bottom":return t?e?Tm:Pm:e?Pm:Tm;case"left":case"right":return e?R1:N1;default:return[]}}function L1(s,e,t,n){const i=Ti(s);let a=I1(yr(s),t==="start",n);return i&&(a=a.map(l=>l+"-"+i),e&&(a=a.concat(a.map(Xd)))),a}function Fl(s){return s.replace(/left|right|bottom|top/g,e=>_1[e])}function M1(s){return{top:0,right:0,bottom:0,left:0,...s}}function wy(s){return typeof s!="number"?M1(s):{top:s,right:s,bottom:s,left:s}}function jl(s){const{x:e,y:t,width:n,height:i}=s;return{width:n,height:i,top:t,left:e,right:e+n,bottom:t+i,x:e,y:t}}function Rm(s,e,t){let{reference:n,floating:i}=s;const a=Qn(e),l=kh(e),c=Ch(l),d=yr(e),h=a==="y",f=n.x+n.width/2-i.width/2,g=n.y+n.height/2-i.height/2,m=n[c]/2-i[c]/2;let y;switch(d){case"top":y={x:f,y:n.y-i.height};break;case"bottom":y={x:f,y:n.y+n.height};break;case"right":y={x:n.x+n.width,y:g};break;case"left":y={x:n.x-i.width,y:g};break;default:y={x:n.x,y:n.y}}switch(Ti(e)){case"start":y[l]-=m*(t&&h?-1:1);break;case"end":y[l]+=m*(t&&h?-1:1);break}return y}const D1=async(s,e,t)=>{const{placement:n="bottom",strategy:i="absolute",middleware:a=[],platform:l}=t,c=a.filter(Boolean),d=await(l.isRTL==null?void 0:l.isRTL(e));let h=await l.getElementRects({reference:s,floating:e,strategy:i}),{x:f,y:g}=Rm(h,n,d),m=n,y={},x=0;for(let w=0;w<c.length;w++){const{name:S,fn:E}=c[w],{x:P,y:k,data:T,reset:R}=await E({x:f,y:g,initialPlacement:n,placement:m,strategy:i,middlewareData:y,rects:h,platform:l,elements:{reference:s,floating:e}});f=P??f,g=k??g,y={...y,[S]:{...y[S],...T}},R&&x<=50&&(x++,typeof R=="object"&&(R.placement&&(m=R.placement),R.rects&&(h=R.rects===!0?await l.getElementRects({reference:s,floating:e,strategy:i}):R.rects),{x:f,y:g}=Rm(h,m,d)),w=-1)}return{x:f,y:g,placement:m,strategy:i,middlewareData:y}};async function No(s,e){var t;e===void 0&&(e={});const{x:n,y:i,platform:a,rects:l,elements:c,strategy:d}=s,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:g="floating",altBoundary:m=!1,padding:y=0}=vr(e,s),x=wy(y),S=c[m?g==="floating"?"reference":"floating":g],E=jl(await a.getClippingRect({element:(t=await(a.isElement==null?void 0:a.isElement(S)))==null||t?S:S.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:d})),P=g==="floating"?{x:n,y:i,width:l.floating.width,height:l.floating.height}:l.reference,k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),T=await(a.isElement==null?void 0:a.isElement(k))?await(a.getScale==null?void 0:a.getScale(k))||{x:1,y:1}:{x:1,y:1},R=jl(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:P,offsetParent:k,strategy:d}):P);return{top:(E.top-R.top+x.top)/T.y,bottom:(R.bottom-E.bottom+x.bottom)/T.y,left:(E.left-R.left+x.left)/T.x,right:(R.right-E.right+x.right)/T.x}}const O1=s=>({name:"arrow",options:s,async fn(e){const{x:t,y:n,placement:i,rects:a,platform:l,elements:c,middlewareData:d}=e,{element:h,padding:f=0}=vr(s,e)||{};if(h==null)return{};const g=wy(f),m={x:t,y:n},y=kh(i),x=Ch(y),w=await l.getDimensions(h),S=y==="y",E=S?"top":"left",P=S?"bottom":"right",k=S?"clientHeight":"clientWidth",T=a.reference[x]+a.reference[y]-m[y]-a.floating[x],R=m[y]-a.reference[y],I=await(l.getOffsetParent==null?void 0:l.getOffsetParent(h));let N=I?I[k]:0;(!N||!await(l.isElement==null?void 0:l.isElement(I)))&&(N=c.floating[k]||a.floating[x]);const D=T/2-R/2,V=N/2-w[x]/2-1,j=qr(g[E],V),G=qr(g[P],V),Z=j,K=N-w[x]-G,J=N/2-w[x]/2+D,ee=qd(Z,J,K),B=!d.arrow&&Ti(i)!=null&&J!==ee&&a.reference[x]/2-(J<Z?j:G)-w[x]/2<0,$=B?J<Z?J-Z:J-K:0;return{[y]:m[y]+$,data:{[y]:ee,centerOffset:J-ee-$,...B&&{alignmentOffset:$}},reset:B}}}),F1=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,n;const{placement:i,middlewareData:a,rects:l,initialPlacement:c,platform:d,elements:h}=e,{mainAxis:f=!0,crossAxis:g=!0,fallbackPlacements:m,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:w=!0,...S}=vr(s,e);if((t=a.arrow)!=null&&t.alignmentOffset)return{};const E=yr(i),P=Qn(c),k=yr(c)===c,T=await(d.isRTL==null?void 0:d.isRTL(h.floating)),R=m||(k||!w?[Fl(c)]:T1(c)),I=x!=="none";!m&&I&&R.push(...L1(c,w,x,T));const N=[c,...R],D=await No(e,S),V=[];let j=((n=a.flip)==null?void 0:n.overflows)||[];if(f&&V.push(D[E]),g){const J=P1(i,l,T);V.push(D[J[0]],D[J[1]])}if(j=[...j,{placement:i,overflows:V}],!V.every(J=>J<=0)){var G,Z;const J=(((G=a.flip)==null?void 0:G.index)||0)+1,ee=N[J];if(ee&&(!(g==="alignment"?P!==Qn(ee):!1)||j.every(M=>M.overflows[0]>0&&Qn(M.placement)===P)))return{data:{index:J,overflows:j},reset:{placement:ee}};let B=(Z=j.filter($=>$.overflows[0]<=0).sort(($,M)=>$.overflows[1]-M.overflows[1])[0])==null?void 0:Z.placement;if(!B)switch(y){case"bestFit":{var K;const $=(K=j.filter(M=>{if(I){const Q=Qn(M.placement);return Q===P||Q==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(Q=>Q>0).reduce((Q,ne)=>Q+ne,0)]).sort((M,Q)=>M[1]-Q[1])[0])==null?void 0:K[0];$&&(B=$);break}case"initialPlacement":B=c;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function Nm(s,e){return{top:s.top-e.height,right:s.right-e.width,bottom:s.bottom-e.height,left:s.left-e.width}}function Im(s){return E1.some(e=>s[e]>=0)}const j1=function(s){return s===void 0&&(s={}),{name:"hide",options:s,async fn(e){const{rects:t}=e,{strategy:n="referenceHidden",...i}=vr(s,e);switch(n){case"referenceHidden":{const a=await No(e,{...i,elementContext:"reference"}),l=Nm(a,t.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Im(l)}}}case"escaped":{const a=await No(e,{...i,altBoundary:!0}),l=Nm(a,t.floating);return{data:{escapedOffsets:l,escaped:Im(l)}}}default:return{}}}}},by=new Set(["left","top"]);async function z1(s,e){const{placement:t,platform:n,elements:i}=s,a=await(n.isRTL==null?void 0:n.isRTL(i.floating)),l=yr(t),c=Ti(t),d=Qn(t)==="y",h=by.has(l)?-1:1,f=a&&d?-1:1,g=vr(e,s);let{mainAxis:m,crossAxis:y,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return c&&typeof x=="number"&&(y=c==="end"?x*-1:x),d?{x:y*f,y:m*h}:{x:m*h,y:y*f}}const $1=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,n;const{x:i,y:a,placement:l,middlewareData:c}=e,d=await z1(e,s);return l===((t=c.offset)==null?void 0:t.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:i+d.x,y:a+d.y,data:{...d,placement:l}}}}},B1=function(s){return s===void 0&&(s={}),{name:"shift",options:s,async fn(e){const{x:t,y:n,placement:i}=e,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:S=>{let{x:E,y:P}=S;return{x:E,y:P}}},...d}=vr(s,e),h={x:t,y:n},f=await No(e,d),g=Qn(yr(i)),m=_h(g);let y=h[m],x=h[g];if(a){const S=m==="y"?"top":"left",E=m==="y"?"bottom":"right",P=y+f[S],k=y-f[E];y=qd(P,y,k)}if(l){const S=g==="y"?"top":"left",E=g==="y"?"bottom":"right",P=x+f[S],k=x-f[E];x=qd(P,x,k)}const w=c.fn({...e,[m]:y,[g]:x});return{...w,data:{x:w.x-t,y:w.y-n,enabled:{[m]:a,[g]:l}}}}}},H1=function(s){return s===void 0&&(s={}),{options:s,fn(e){const{x:t,y:n,placement:i,rects:a,middlewareData:l}=e,{offset:c=0,mainAxis:d=!0,crossAxis:h=!0}=vr(s,e),f={x:t,y:n},g=Qn(i),m=_h(g);let y=f[m],x=f[g];const w=vr(c,e),S=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(d){const k=m==="y"?"height":"width",T=a.reference[m]-a.floating[k]+S.mainAxis,R=a.reference[m]+a.reference[k]-S.mainAxis;y<T?y=T:y>R&&(y=R)}if(h){var E,P;const k=m==="y"?"width":"height",T=by.has(yr(i)),R=a.reference[g]-a.floating[k]+(T&&((E=l.offset)==null?void 0:E[g])||0)+(T?0:S.crossAxis),I=a.reference[g]+a.reference[k]+(T?0:((P=l.offset)==null?void 0:P[g])||0)-(T?S.crossAxis:0);x<R?x=R:x>I&&(x=I)}return{[m]:y,[g]:x}}}},U1=function(s){return s===void 0&&(s={}),{name:"size",options:s,async fn(e){var t,n;const{placement:i,rects:a,platform:l,elements:c}=e,{apply:d=()=>{},...h}=vr(s,e),f=await No(e,h),g=yr(i),m=Ti(i),y=Qn(i)==="y",{width:x,height:w}=a.floating;let S,E;g==="top"||g==="bottom"?(S=g,E=m===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(E=g,S=m==="end"?"top":"bottom");const P=w-f.top-f.bottom,k=x-f.left-f.right,T=qr(w-f[S],P),R=qr(x-f[E],k),I=!e.middlewareData.shift;let N=T,D=R;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(D=k),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(N=P),I&&!m){const j=un(f.left,0),G=un(f.right,0),Z=un(f.top,0),K=un(f.bottom,0);y?D=x-2*(j!==0||G!==0?j+G:un(f.left,f.right)):N=w-2*(Z!==0||K!==0?Z+K:un(f.top,f.bottom))}await d({...e,availableWidth:D,availableHeight:N});const V=await l.getDimensions(c.floating);return x!==V.width||w!==V.height?{reset:{rects:!0}}:{}}}};function Ql(){return typeof window<"u"}function Ri(s){return xy(s)?(s.nodeName||"").toLowerCase():"#document"}function hn(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function tr(s){var e;return(e=(xy(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function xy(s){return Ql()?s instanceof Node||s instanceof hn(s).Node:!1}function Ln(s){return Ql()?s instanceof Element||s instanceof hn(s).Element:!1}function Zn(s){return Ql()?s instanceof HTMLElement||s instanceof hn(s).HTMLElement:!1}function Lm(s){return!Ql()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof hn(s).ShadowRoot}const V1=new Set(["inline","contents"]);function Ho(s){const{overflow:e,overflowX:t,overflowY:n,display:i}=Mn(s);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!V1.has(i)}const W1=new Set(["table","td","th"]);function G1(s){return W1.has(Ri(s))}const q1=[":popover-open",":modal"];function Jl(s){return q1.some(e=>{try{return s.matches(e)}catch{return!1}})}const X1=["transform","translate","scale","rotate","perspective"],Y1=["transform","translate","scale","rotate","perspective","filter"],K1=["paint","layout","strict","content"];function Ph(s){const e=Th(),t=Ln(s)?Mn(s):s;return X1.some(n=>t[n]?t[n]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Y1.some(n=>(t.willChange||"").includes(n))||K1.some(n=>(t.contain||"").includes(n))}function Q1(s){let e=Xr(s);for(;Zn(e)&&!Si(e);){if(Ph(e))return e;if(Jl(e))return null;e=Xr(e)}return null}function Th(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const J1=new Set(["html","body","#document"]);function Si(s){return J1.has(Ri(s))}function Mn(s){return hn(s).getComputedStyle(s)}function Zl(s){return Ln(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function Xr(s){if(Ri(s)==="html")return s;const e=s.assignedSlot||s.parentNode||Lm(s)&&s.host||tr(s);return Lm(e)?e.host:e}function Sy(s){const e=Xr(s);return Si(e)?s.ownerDocument?s.ownerDocument.body:s.body:Zn(e)&&Ho(e)?e:Sy(e)}function Io(s,e,t){var n;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=Sy(s),a=i===((n=s.ownerDocument)==null?void 0:n.body),l=hn(i);if(a){const c=Yd(l);return e.concat(l,l.visualViewport||[],Ho(i)?i:[],c&&t?Io(c):[])}return e.concat(i,Io(i,[],t))}function Yd(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function Ay(s){const e=Mn(s);let t=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=Zn(s),a=i?s.offsetWidth:t,l=i?s.offsetHeight:n,c=Ol(t)!==a||Ol(n)!==l;return c&&(t=a,n=l),{width:t,height:n,$:c}}function Rh(s){return Ln(s)?s:s.contextElement}function mi(s){const e=Rh(s);if(!Zn(e))return Jn(1);const t=e.getBoundingClientRect(),{width:n,height:i,$:a}=Ay(e);let l=(a?Ol(t.width):t.width)/n,c=(a?Ol(t.height):t.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const Z1=Jn(0);function Ey(s){const e=hn(s);return!Th()||!e.visualViewport?Z1:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function e_(s,e,t){return e===void 0&&(e=!1),!t||e&&t!==hn(s)?!1:e}function Es(s,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=s.getBoundingClientRect(),a=Rh(s);let l=Jn(1);e&&(n?Ln(n)&&(l=mi(n)):l=mi(s));const c=e_(a,t,n)?Ey(a):Jn(0);let d=(i.left+c.x)/l.x,h=(i.top+c.y)/l.y,f=i.width/l.x,g=i.height/l.y;if(a){const m=hn(a),y=n&&Ln(n)?hn(n):n;let x=m,w=Yd(x);for(;w&&n&&y!==x;){const S=mi(w),E=w.getBoundingClientRect(),P=Mn(w),k=E.left+(w.clientLeft+parseFloat(P.paddingLeft))*S.x,T=E.top+(w.clientTop+parseFloat(P.paddingTop))*S.y;d*=S.x,h*=S.y,f*=S.x,g*=S.y,d+=k,h+=T,x=hn(w),w=Yd(x)}}return jl({width:f,height:g,x:d,y:h})}function Nh(s,e){const t=Zl(s).scrollLeft;return e?e.left+t:Es(tr(s)).left+t}function _y(s,e,t){t===void 0&&(t=!1);const n=s.getBoundingClientRect(),i=n.left+e.scrollLeft-(t?0:Nh(s,n)),a=n.top+e.scrollTop;return{x:i,y:a}}function t_(s){let{elements:e,rect:t,offsetParent:n,strategy:i}=s;const a=i==="fixed",l=tr(n),c=e?Jl(e.floating):!1;if(n===l||c&&a)return t;let d={scrollLeft:0,scrollTop:0},h=Jn(1);const f=Jn(0),g=Zn(n);if((g||!g&&!a)&&((Ri(n)!=="body"||Ho(l))&&(d=Zl(n)),Zn(n))){const y=Es(n);h=mi(n),f.x=y.x+n.clientLeft,f.y=y.y+n.clientTop}const m=l&&!g&&!a?_y(l,d,!0):Jn(0);return{width:t.width*h.x,height:t.height*h.y,x:t.x*h.x-d.scrollLeft*h.x+f.x+m.x,y:t.y*h.y-d.scrollTop*h.y+f.y+m.y}}function n_(s){return Array.from(s.getClientRects())}function r_(s){const e=tr(s),t=Zl(s),n=s.ownerDocument.body,i=un(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),a=un(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let l=-t.scrollLeft+Nh(s);const c=-t.scrollTop;return Mn(n).direction==="rtl"&&(l+=un(e.clientWidth,n.clientWidth)-i),{width:i,height:a,x:l,y:c}}function s_(s,e){const t=hn(s),n=tr(s),i=t.visualViewport;let a=n.clientWidth,l=n.clientHeight,c=0,d=0;if(i){a=i.width,l=i.height;const h=Th();(!h||h&&e==="fixed")&&(c=i.offsetLeft,d=i.offsetTop)}return{width:a,height:l,x:c,y:d}}const i_=new Set(["absolute","fixed"]);function o_(s,e){const t=Es(s,!0,e==="fixed"),n=t.top+s.clientTop,i=t.left+s.clientLeft,a=Zn(s)?mi(s):Jn(1),l=s.clientWidth*a.x,c=s.clientHeight*a.y,d=i*a.x,h=n*a.y;return{width:l,height:c,x:d,y:h}}function Mm(s,e,t){let n;if(e==="viewport")n=s_(s,t);else if(e==="document")n=r_(tr(s));else if(Ln(e))n=o_(e,t);else{const i=Ey(s);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return jl(n)}function Cy(s,e){const t=Xr(s);return t===e||!Ln(t)||Si(t)?!1:Mn(t).position==="fixed"||Cy(t,e)}function a_(s,e){const t=e.get(s);if(t)return t;let n=Io(s,[],!1).filter(c=>Ln(c)&&Ri(c)!=="body"),i=null;const a=Mn(s).position==="fixed";let l=a?Xr(s):s;for(;Ln(l)&&!Si(l);){const c=Mn(l),d=Ph(l);!d&&c.position==="fixed"&&(i=null),(a?!d&&!i:!d&&c.position==="static"&&!!i&&i_.has(i.position)||Ho(l)&&!d&&Cy(s,l))?n=n.filter(f=>f!==l):i=c,l=Xr(l)}return e.set(s,n),n}function l_(s){let{element:e,boundary:t,rootBoundary:n,strategy:i}=s;const l=[...t==="clippingAncestors"?Jl(e)?[]:a_(e,this._c):[].concat(t),n],c=l[0],d=l.reduce((h,f)=>{const g=Mm(e,f,i);return h.top=un(g.top,h.top),h.right=qr(g.right,h.right),h.bottom=qr(g.bottom,h.bottom),h.left=un(g.left,h.left),h},Mm(e,c,i));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function c_(s){const{width:e,height:t}=Ay(s);return{width:e,height:t}}function u_(s,e,t){const n=Zn(e),i=tr(e),a=t==="fixed",l=Es(s,!0,a,e);let c={scrollLeft:0,scrollTop:0};const d=Jn(0);function h(){d.x=Nh(i)}if(n||!n&&!a)if((Ri(e)!=="body"||Ho(i))&&(c=Zl(e)),n){const y=Es(e,!0,a,e);d.x=y.x+e.clientLeft,d.y=y.y+e.clientTop}else i&&h();a&&!n&&i&&h();const f=i&&!n&&!a?_y(i,c):Jn(0),g=l.left+c.scrollLeft-d.x-f.x,m=l.top+c.scrollTop-d.y-f.y;return{x:g,y:m,width:l.width,height:l.height}}function Ed(s){return Mn(s).position==="static"}function Dm(s,e){if(!Zn(s)||Mn(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return tr(s)===t&&(t=t.ownerDocument.body),t}function ky(s,e){const t=hn(s);if(Jl(s))return t;if(!Zn(s)){let i=Xr(s);for(;i&&!Si(i);){if(Ln(i)&&!Ed(i))return i;i=Xr(i)}return t}let n=Dm(s,e);for(;n&&G1(n)&&Ed(n);)n=Dm(n,e);return n&&Si(n)&&Ed(n)&&!Ph(n)?t:n||Q1(s)||t}const d_=async function(s){const e=this.getOffsetParent||ky,t=this.getDimensions,n=await t(s.floating);return{reference:u_(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function h_(s){return Mn(s).direction==="rtl"}const f_={convertOffsetParentRelativeRectToViewportRelativeRect:t_,getDocumentElement:tr,getClippingRect:l_,getOffsetParent:ky,getElementRects:d_,getClientRects:n_,getDimensions:c_,getScale:mi,isElement:Ln,isRTL:h_};function Py(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function p_(s,e){let t=null,n;const i=tr(s);function a(){var c;clearTimeout(n),(c=t)==null||c.disconnect(),t=null}function l(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),a();const h=s.getBoundingClientRect(),{left:f,top:g,width:m,height:y}=h;if(c||e(),!m||!y)return;const x=yl(g),w=yl(i.clientWidth-(f+m)),S=yl(i.clientHeight-(g+y)),E=yl(f),k={rootMargin:-x+"px "+-w+"px "+-S+"px "+-E+"px",threshold:un(0,qr(1,d))||1};let T=!0;function R(I){const N=I[0].intersectionRatio;if(N!==d){if(!T)return l();N?l(!1,N):n=setTimeout(()=>{l(!1,1e-7)},1e3)}N===1&&!Py(h,s.getBoundingClientRect())&&l(),T=!1}try{t=new IntersectionObserver(R,{...k,root:i.ownerDocument})}catch{t=new IntersectionObserver(R,k)}t.observe(s)}return l(!0),a}function g_(s,e,t,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=n,h=Rh(s),f=i||a?[...h?Io(h):[],...Io(e)]:[];f.forEach(E=>{i&&E.addEventListener("scroll",t,{passive:!0}),a&&E.addEventListener("resize",t)});const g=h&&c?p_(h,t):null;let m=-1,y=null;l&&(y=new ResizeObserver(E=>{let[P]=E;P&&P.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var k;(k=y)==null||k.observe(e)})),t()}),h&&!d&&y.observe(h),y.observe(e));let x,w=d?Es(s):null;d&&S();function S(){const E=Es(s);w&&!Py(w,E)&&t(),w=E,x=requestAnimationFrame(S)}return t(),()=>{var E;f.forEach(P=>{i&&P.removeEventListener("scroll",t),a&&P.removeEventListener("resize",t)}),g?.(),(E=y)==null||E.disconnect(),y=null,d&&cancelAnimationFrame(x)}}const m_=$1,v_=B1,y_=F1,w_=U1,b_=j1,Om=O1,x_=H1,S_=(s,e,t)=>{const n=new Map,i={platform:f_,...t},a={...i.platform,_c:n};return D1(s,e,{...i,platform:a})};var A_=typeof document<"u",E_=function(){},Tl=A_?A.useLayoutEffect:E_;function zl(s,e){if(s===e)return!0;if(typeof s!=typeof e)return!1;if(typeof s=="function"&&s.toString()===e.toString())return!0;let t,n,i;if(s&&e&&typeof s=="object"){if(Array.isArray(s)){if(t=s.length,t!==e.length)return!1;for(n=t;n--!==0;)if(!zl(s[n],e[n]))return!1;return!0}if(i=Object.keys(s),t=i.length,t!==Object.keys(e).length)return!1;for(n=t;n--!==0;)if(!{}.hasOwnProperty.call(e,i[n]))return!1;for(n=t;n--!==0;){const a=i[n];if(!(a==="_owner"&&s.$$typeof)&&!zl(s[a],e[a]))return!1}return!0}return s!==s&&e!==e}function Ty(s){return typeof window>"u"?1:(s.ownerDocument.defaultView||window).devicePixelRatio||1}function Fm(s,e){const t=Ty(s);return Math.round(e*t)/t}function _d(s){const e=A.useRef(s);return Tl(()=>{e.current=s}),e}function __(s){s===void 0&&(s={});const{placement:e="bottom",strategy:t="absolute",middleware:n=[],platform:i,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:d,open:h}=s,[f,g]=A.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[m,y]=A.useState(n);zl(m,n)||y(n);const[x,w]=A.useState(null),[S,E]=A.useState(null),P=A.useCallback(M=>{M!==I.current&&(I.current=M,w(M))},[]),k=A.useCallback(M=>{M!==N.current&&(N.current=M,E(M))},[]),T=a||x,R=l||S,I=A.useRef(null),N=A.useRef(null),D=A.useRef(f),V=d!=null,j=_d(d),G=_d(i),Z=_d(h),K=A.useCallback(()=>{if(!I.current||!N.current)return;const M={placement:e,strategy:t,middleware:m};G.current&&(M.platform=G.current),S_(I.current,N.current,M).then(Q=>{const ne={...Q,isPositioned:Z.current!==!1};J.current&&!zl(D.current,ne)&&(D.current=ne,$o.flushSync(()=>{g(ne)}))})},[m,e,t,G,Z]);Tl(()=>{h===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,g(M=>({...M,isPositioned:!1})))},[h]);const J=A.useRef(!1);Tl(()=>(J.current=!0,()=>{J.current=!1}),[]),Tl(()=>{if(T&&(I.current=T),R&&(N.current=R),T&&R){if(j.current)return j.current(T,R,K);K()}},[T,R,K,j,V]);const ee=A.useMemo(()=>({reference:I,floating:N,setReference:P,setFloating:k}),[P,k]),B=A.useMemo(()=>({reference:T,floating:R}),[T,R]),$=A.useMemo(()=>{const M={position:t,left:0,top:0};if(!B.floating)return M;const Q=Fm(B.floating,f.x),ne=Fm(B.floating,f.y);return c?{...M,transform:"translate("+Q+"px, "+ne+"px)",...Ty(B.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:Q,top:ne}},[t,c,B.floating,f.x,f.y]);return A.useMemo(()=>({...f,update:K,refs:ee,elements:B,floatingStyles:$}),[f,K,ee,B,$])}const C_=s=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:s,fn(t){const{element:n,padding:i}=typeof s=="function"?s(t):s;return n&&e(n)?n.current!=null?Om({element:n.current,padding:i}).fn(t):{}:n?Om({element:n,padding:i}).fn(t):{}}}},k_=(s,e)=>({...m_(s),options:[s,e]}),P_=(s,e)=>({...v_(s),options:[s,e]}),T_=(s,e)=>({...x_(s),options:[s,e]}),R_=(s,e)=>({...y_(s),options:[s,e]}),N_=(s,e)=>({...w_(s),options:[s,e]}),I_=(s,e)=>({...b_(s),options:[s,e]}),L_=(s,e)=>({...C_(s),options:[s,e]});var M_="Arrow",Ry=A.forwardRef((s,e)=>{const{children:t,width:n=10,height:i=5,...a}=s;return _.jsx(Ge.svg,{...a,ref:e,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:s.asChild?t:_.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ry.displayName=M_;var D_=Ry;function O_(s){const[e,t]=A.useState(void 0);return $t(()=>{if(s){t({width:s.offsetWidth,height:s.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const a=i[0];let l,c;if("borderBoxSize"in a){const d=a.borderBoxSize,h=Array.isArray(d)?d[0]:d;l=h.inlineSize,c=h.blockSize}else l=s.offsetWidth,c=s.offsetHeight;t({width:l,height:c})});return n.observe(s,{box:"border-box"}),()=>n.unobserve(s)}else t(void 0)},[s]),e}var Ih="Popper",[Ny,ec]=zo(Ih),[F_,Iy]=Ny(Ih),Ly=s=>{const{__scopePopper:e,children:t}=s,[n,i]=A.useState(null);return _.jsx(F_,{scope:e,anchor:n,onAnchorChange:i,children:t})};Ly.displayName=Ih;var My="PopperAnchor",Dy=A.forwardRef((s,e)=>{const{__scopePopper:t,virtualRef:n,...i}=s,a=Iy(My,t),l=A.useRef(null),c=st(e,l);return A.useEffect(()=>{a.onAnchorChange(n?.current||l.current)}),n?null:_.jsx(Ge.div,{...i,ref:c})});Dy.displayName=My;var Lh="PopperContent",[j_,z_]=Ny(Lh),Oy=A.forwardRef((s,e)=>{const{__scopePopper:t,side:n="bottom",sideOffset:i=0,align:a="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:g="partial",hideWhenDetached:m=!1,updatePositionStrategy:y="optimized",onPlaced:x,...w}=s,S=Iy(Lh,t),[E,P]=A.useState(null),k=st(e,H=>P(H)),[T,R]=A.useState(null),I=O_(T),N=I?.width??0,D=I?.height??0,V=n+(a!=="center"?"-"+a:""),j=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},G=Array.isArray(h)?h:[h],Z=G.length>0,K={padding:j,boundary:G.filter(B_),altBoundary:Z},{refs:J,floatingStyles:ee,placement:B,isPositioned:$,middlewareData:M}=__({strategy:"fixed",placement:V,whileElementsMounted:(...H)=>g_(...H,{animationFrame:y==="always"}),elements:{reference:S.anchor},middleware:[k_({mainAxis:i+D,alignmentAxis:l}),d&&P_({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?T_():void 0,...K}),d&&R_({...K}),N_({...K,apply:({elements:H,rects:ae,availableWidth:de,availableHeight:ce})=>{const{width:Se,height:Pe}=ae.reference,be=H.floating.style;be.setProperty("--radix-popper-available-width",`${de}px`),be.setProperty("--radix-popper-available-height",`${ce}px`),be.setProperty("--radix-popper-anchor-width",`${Se}px`),be.setProperty("--radix-popper-anchor-height",`${Pe}px`)}}),T&&L_({element:T,padding:c}),H_({arrowWidth:N,arrowHeight:D}),m&&I_({strategy:"referenceHidden",...K})]}),[Q,ne]=zy(B),F=Ss(x);$t(()=>{$&&F?.()},[$,F]);const Y=M.arrow?.x,q=M.arrow?.y,te=M.arrow?.centerOffset!==0,[se,ie]=A.useState();return $t(()=>{E&&ie(window.getComputedStyle(E).zIndex)},[E]),_.jsx("div",{ref:J.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:$?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(" "),...M.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:s.dir,children:_.jsx(j_,{scope:t,placedSide:Q,onArrowChange:R,arrowX:Y,arrowY:q,shouldHideArrow:te,children:_.jsx(Ge.div,{"data-side":Q,"data-align":ne,...w,ref:k,style:{...w.style,animation:$?void 0:"none"}})})})});Oy.displayName=Lh;var Fy="PopperArrow",$_={top:"bottom",right:"left",bottom:"top",left:"right"},jy=A.forwardRef(function(e,t){const{__scopePopper:n,...i}=e,a=z_(Fy,n),l=$_[a.placedSide];return _.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:_.jsx(D_,{...i,ref:t,style:{...i.style,display:"block"}})})});jy.displayName=Fy;function B_(s){return s!==null}var H_=s=>({name:"transformOrigin",options:s,fn(e){const{placement:t,rects:n,middlewareData:i}=e,l=i.arrow?.centerOffset!==0,c=l?0:s.arrowWidth,d=l?0:s.arrowHeight,[h,f]=zy(t),g={start:"0%",center:"50%",end:"100%"}[f],m=(i.arrow?.x??0)+c/2,y=(i.arrow?.y??0)+d/2;let x="",w="";return h==="bottom"?(x=l?g:`${m}px`,w=`${-d}px`):h==="top"?(x=l?g:`${m}px`,w=`${n.floating.height+d}px`):h==="right"?(x=`${-d}px`,w=l?g:`${y}px`):h==="left"&&(x=`${n.floating.width+d}px`,w=l?g:`${y}px`),{data:{x,y:w}}}});function zy(s){const[e,t="center"]=s.split("-");return[e,t]}var $y=Ly,Mh=Dy,By=Oy,Hy=jy;function U_(s){const e=A.useRef({value:s,previous:s});return A.useMemo(()=>(e.current.value!==s&&(e.current.previous=e.current.value,e.current.value=s),e.current.previous),[s])}var Uy=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),V_="VisuallyHidden",W_=A.forwardRef((s,e)=>_.jsx(Ge.span,{...s,ref:e,style:{...Uy,...s.style}}));W_.displayName=V_;function Wr(s){var e=s,{className:t}=e,n=it(e,["className"]);return _.jsx("div",Fe({"data-slot":"skeleton",className:vt("bg-accent animate-pulse rounded-md",t)},n))}function jm(s,[e,t]){return Math.min(t,Math.max(e,s))}const Dh=A.createContext(null);Dh.displayName="PanelGroupContext";const dn={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandleId:"data-panel-resize-handle-id"},Oh=10,vi=A.useLayoutEffect,zm=vh.useId,G_=typeof zm=="function"?zm:()=>null;let q_=0;function Vy(s=null){const e=G_(),t=A.useRef(s||e||null);return t.current===null&&(t.current=""+q_++),s??t.current}function Wy({children:s,className:e="",collapsedSize:t,collapsible:n,defaultSize:i,forwardedRef:a,id:l,maxSize:c,minSize:d,onCollapse:h,onExpand:f,onResize:g,order:m,style:y,tagName:x="div",...w}){const S=A.useContext(Dh);if(S===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:E,expandPanel:P,getPanelSize:k,getPanelStyle:T,groupId:R,isPanelCollapsed:I,reevaluatePanelConstraints:N,registerPanel:D,resizePanel:V,unregisterPanel:j}=S,G=Vy(l),Z=A.useRef({callbacks:{onCollapse:h,onExpand:f,onResize:g},constraints:{collapsedSize:t,collapsible:n,defaultSize:i,maxSize:c,minSize:d},id:G,idIsFromProps:l!==void 0,order:m});A.useRef({didLogMissingDefaultSizeWarning:!1}),vi(()=>{const{callbacks:J,constraints:ee}=Z.current,B={...ee};Z.current.id=G,Z.current.idIsFromProps=l!==void 0,Z.current.order=m,J.onCollapse=h,J.onExpand=f,J.onResize=g,ee.collapsedSize=t,ee.collapsible=n,ee.defaultSize=i,ee.maxSize=c,ee.minSize=d,(B.collapsedSize!==ee.collapsedSize||B.collapsible!==ee.collapsible||B.maxSize!==ee.maxSize||B.minSize!==ee.minSize)&&N(Z.current,B)}),vi(()=>{const J=Z.current;return D(J),()=>{j(J)}},[m,G,D,j]),A.useImperativeHandle(a,()=>({collapse:()=>{E(Z.current)},expand:J=>{P(Z.current,J)},getId(){return G},getSize(){return k(Z.current)},isCollapsed(){return I(Z.current)},isExpanded(){return!I(Z.current)},resize:J=>{V(Z.current,J)}}),[E,P,k,I,G,V]);const K=T(Z.current,i);return A.createElement(x,{...w,children:s,className:e,id:G,style:{...K,...y},[dn.groupId]:R,[dn.panel]:"",[dn.panelCollapsible]:n||void 0,[dn.panelId]:G,[dn.panelSize]:parseFloat(""+K.flexGrow).toFixed(1)})}const X_=A.forwardRef((s,e)=>A.createElement(Wy,{...s,forwardedRef:e}));Wy.displayName="Panel";X_.displayName="forwardRef(Panel)";function Gy(s){return s.type==="keydown"}function qy(s){return s.type.startsWith("pointer")}function Xy(s){return s.type.startsWith("mouse")}function Y_(s){if(qy(s)){if(s.isPrimary)return{x:s.clientX,y:s.clientY}}else if(Xy(s))return{x:s.clientX,y:s.clientY};return{x:1/0,y:1/0}}function K_(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}const Q_=1,J_=2,Z_=4,eC=8;K_();let tC=new Map;function Cd(s,e){tC.set(s,e)}function nC(){const[s,e]=A.useState(0);return A.useCallback(()=>e(t=>t+1),[])}function $e(s,e){if(!s)throw console.error(e),Error(e)}function _s(s,e,t=Oh){return s.toFixed(t)===e.toFixed(t)?0:s>e?1:-1}function mr(s,e,t=Oh){return _s(s,e,t)===0}function ln(s,e,t){return _s(s,e,t)===0}function rC(s,e,t){if(s.length!==e.length)return!1;for(let n=0;n<s.length;n++){const i=s[n],a=e[n];if(!ln(i,a,t))return!1}return!0}function hi({panelConstraints:s,panelIndex:e,size:t}){const n=s[e];$e(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:i=0,collapsible:a,maxSize:l=100,minSize:c=0}=n;if(_s(t,c)<0)if(a){const d=(i+c)/2;_s(t,d)<0?t=i:t=c}else t=c;return t=Math.min(l,t),t=parseFloat(t.toFixed(Oh)),t}function Ao({delta:s,initialLayout:e,panelConstraints:t,pivotIndices:n,prevLayout:i,trigger:a}){if(ln(s,0))return e;const l=[...e],[c,d]=n;$e(c!=null,"Invalid first pivot index"),$e(d!=null,"Invalid second pivot index");let h=0;if(a==="keyboard"){{const g=s<0?d:c,m=t[g];$e(m,`Panel constraints not found for index ${g}`);const{collapsedSize:y=0,collapsible:x,minSize:w=0}=m;if(x){const S=e[g];if($e(S!=null,`Previous layout not found for panel index ${g}`),ln(S,y)){const E=w-S;_s(E,Math.abs(s))>0&&(s=s<0?0-E:E)}}}{const g=s<0?c:d,m=t[g];$e(m,`No panel constraints found for index ${g}`);const{collapsedSize:y=0,collapsible:x,minSize:w=0}=m;if(x){const S=e[g];if($e(S!=null,`Previous layout not found for panel index ${g}`),ln(S,w)){const E=S-y;_s(E,Math.abs(s))>0&&(s=s<0?0-E:E)}}}}{const g=s<0?1:-1;let m=s<0?d:c,y=0;for(;;){const w=e[m];$e(w!=null,`Previous layout not found for panel index ${m}`);const E=hi({panelConstraints:t,panelIndex:m,size:100})-w;if(y+=E,m+=g,m<0||m>=t.length)break}const x=Math.min(Math.abs(s),Math.abs(y));s=s<0?0-x:x}{let m=s<0?c:d;for(;m>=0&&m<t.length;){const y=Math.abs(s)-Math.abs(h),x=e[m];$e(x!=null,`Previous layout not found for panel index ${m}`);const w=x-y,S=hi({panelConstraints:t,panelIndex:m,size:w});if(!ln(x,S)&&(h+=x-S,l[m]=S,h.toPrecision(3).localeCompare(Math.abs(s).toPrecision(3),void 0,{numeric:!0})>=0))break;s<0?m--:m++}}if(rC(i,l))return i;{const g=s<0?d:c,m=e[g];$e(m!=null,`Previous layout not found for panel index ${g}`);const y=m+h,x=hi({panelConstraints:t,panelIndex:g,size:y});if(l[g]=x,!ln(x,y)){let w=y-x,E=s<0?d:c;for(;E>=0&&E<t.length;){const P=l[E];$e(P!=null,`Previous layout not found for panel index ${E}`);const k=P+w,T=hi({panelConstraints:t,panelIndex:E,size:k});if(ln(P,T)||(w-=T-P,l[E]=T),ln(w,0))break;s>0?E--:E++}}}const f=l.reduce((g,m)=>m+g,0);return ln(f,100)?l:i}function sC({layout:s,panelsArray:e,pivotIndices:t}){let n=0,i=100,a=0,l=0;const c=t[0];$e(c!=null,"No pivot index found"),e.forEach((g,m)=>{const{constraints:y}=g,{maxSize:x=100,minSize:w=0}=y;m===c?(n=w,i=x):(a+=w,l+=x)});const d=Math.min(i,100-a),h=Math.max(n,100-l),f=s[c];return{valueMax:d,valueMin:h,valueNow:f}}function $l(s,e=document){return Array.from(e.querySelectorAll(`[${dn.resizeHandleId}][data-panel-group-id="${s}"]`))}function iC(s,e,t=document){const i=$l(s,t).findIndex(a=>a.getAttribute(dn.resizeHandleId)===e);return i??null}function Yy(s,e,t){const n=iC(s,e,t);return n!=null?[n,n+1]:[-1,-1]}function oC(s){return s instanceof HTMLElement?!0:typeof s=="object"&&s!==null&&"tagName"in s&&"getAttribute"in s}function Ky(s,e=document){if(oC(e)&&e.dataset.panelGroupId==s)return e;const t=e.querySelector(`[data-panel-group][data-panel-group-id="${s}"]`);return t||null}function Fh(s,e=document){const t=e.querySelector(`[${dn.resizeHandleId}="${s}"]`);return t||null}function aC(s,e,t,n=document){var i,a,l,c;const d=Fh(e,n),h=$l(s,n),f=d?h.indexOf(d):-1,g=(i=(a=t[f])===null||a===void 0?void 0:a.id)!==null&&i!==void 0?i:null,m=(l=(c=t[f+1])===null||c===void 0?void 0:c.id)!==null&&l!==void 0?l:null;return[g,m]}function lC({committedValuesRef:s,eagerValuesRef:e,groupId:t,layout:n,panelDataArray:i,panelGroupElement:a,setLayout:l}){A.useRef({didWarnAboutMissingResizeHandle:!1}),vi(()=>{if(!a)return;const c=$l(t,a);for(let d=0;d<i.length-1;d++){const{valueMax:h,valueMin:f,valueNow:g}=sC({layout:n,panelsArray:i,pivotIndices:[d,d+1]}),m=c[d];if(m!=null){const y=i[d];$e(y,`No panel data found for index "${d}"`),m.setAttribute("aria-controls",y.id),m.setAttribute("aria-valuemax",""+Math.round(h)),m.setAttribute("aria-valuemin",""+Math.round(f)),m.setAttribute("aria-valuenow",g!=null?""+Math.round(g):"")}}return()=>{c.forEach((d,h)=>{d.removeAttribute("aria-controls"),d.removeAttribute("aria-valuemax"),d.removeAttribute("aria-valuemin"),d.removeAttribute("aria-valuenow")})}},[t,n,i,a]),A.useEffect(()=>{if(!a)return;const c=e.current;$e(c,"Eager values not found");const{panelDataArray:d}=c,h=Ky(t,a);$e(h!=null,`No group found for id "${t}"`);const f=$l(t,a);$e(f,`No resize handles found for group id "${t}"`);const g=f.map(m=>{const y=m.getAttribute(dn.resizeHandleId);$e(y,"Resize handle element has no handle id attribute");const[x,w]=aC(t,y,d,a);if(x==null||w==null)return()=>{};const S=E=>{if(!E.defaultPrevented)switch(E.key){case"Enter":{E.preventDefault();const P=d.findIndex(k=>k.id===x);if(P>=0){const k=d[P];$e(k,`No panel data found for index ${P}`);const T=n[P],{collapsedSize:R=0,collapsible:I,minSize:N=0}=k.constraints;if(T!=null&&I){const D=Ao({delta:ln(T,R)?N-R:R-T,initialLayout:n,panelConstraints:d.map(V=>V.constraints),pivotIndices:Yy(t,y,a),prevLayout:n,trigger:"keyboard"});n!==D&&l(D)}}break}}};return m.addEventListener("keydown",S),()=>{m.removeEventListener("keydown",S)}});return()=>{g.forEach(m=>m())}},[a,s,e,t,n,i,l])}function $m(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!==e[t])return!1;return!0}function Qy(s,e){const t=s==="horizontal",{x:n,y:i}=Y_(e);return t?n:i}function cC(s,e,t,n,i){const a=t==="horizontal",l=Fh(e,i);$e(l,`No resize handle element found for id "${e}"`);const c=l.getAttribute(dn.groupId);$e(c,"Resize handle element has no group id attribute");let{initialCursorPosition:d}=n;const h=Qy(t,s),f=Ky(c,i);$e(f,`No group element found for id "${c}"`);const g=f.getBoundingClientRect(),m=a?g.width:g.height;return(h-d)/m*100}function uC(s,e,t,n,i,a){if(Gy(s)){const l=t==="horizontal";let c=0;s.shiftKey?c=100:i!=null?c=i:c=10;let d=0;switch(s.key){case"ArrowDown":d=l?0:c;break;case"ArrowLeft":d=l?-c:0;break;case"ArrowRight":d=l?c:0;break;case"ArrowUp":d=l?0:-c;break;case"End":d=100;break;case"Home":d=-100;break}return d}else return n==null?0:cC(s,e,t,n,a)}function dC({panelDataArray:s}){const e=Array(s.length),t=s.map(a=>a.constraints);let n=0,i=100;for(let a=0;a<s.length;a++){const l=t[a];$e(l,`Panel constraints not found for index ${a}`);const{defaultSize:c}=l;c!=null&&(n++,e[a]=c,i-=c)}for(let a=0;a<s.length;a++){const l=t[a];$e(l,`Panel constraints not found for index ${a}`);const{defaultSize:c}=l;if(c!=null)continue;const d=s.length-n,h=i/d;n++,e[a]=h,i-=h}return e}function li(s,e,t){e.forEach((n,i)=>{const a=s[i];$e(a,`Panel data not found for index ${i}`);const{callbacks:l,constraints:c,id:d}=a,{collapsedSize:h=0,collapsible:f}=c,g=t[d];if(g==null||n!==g){t[d]=n;const{onCollapse:m,onExpand:y,onResize:x}=l;x&&x(n,g),f&&(m||y)&&(y&&(g==null||mr(g,h))&&!mr(n,h)&&y(),m&&(g==null||!mr(g,h))&&mr(n,h)&&m())}})}function wl(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!=e[t])return!1;return!0}function hC({defaultSize:s,dragState:e,layout:t,panelData:n,panelIndex:i,precision:a=3}){const l=t[i];let c;return l==null?c=s!=null?s.toPrecision(a):"1":n.length===1?c="1":c=l.toPrecision(a),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function fC(s,e=10){let t=null;return(...i)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{s(...i)},e)}}function Bm(s){try{if(typeof localStorage<"u")s.getItem=e=>localStorage.getItem(e),s.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),s.getItem=()=>null,s.setItem=()=>{}}}function Jy(s){return`react-resizable-panels:${s}`}function Zy(s){return s.map(e=>{const{constraints:t,id:n,idIsFromProps:i,order:a}=e;return i?n:a?`${a}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(",")}function ew(s,e){try{const t=Jy(s),n=e.getItem(t);if(n){const i=JSON.parse(n);if(typeof i=="object"&&i!=null)return i}}catch{}return null}function pC(s,e,t){var n,i;const a=(n=ew(s,t))!==null&&n!==void 0?n:{},l=Zy(e);return(i=a[l])!==null&&i!==void 0?i:null}function gC(s,e,t,n,i){var a;const l=Jy(s),c=Zy(e),d=(a=ew(s,i))!==null&&a!==void 0?a:{};d[c]={expandToSizes:Object.fromEntries(t.entries()),layout:n};try{i.setItem(l,JSON.stringify(d))}catch(h){console.error(h)}}function Hm({layout:s,panelConstraints:e}){const t=[...s],n=t.reduce((a,l)=>a+l,0);if(t.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${t.map(a=>`${a}%`).join(", ")}`);if(!ln(n,100)&&t.length>0)for(let a=0;a<e.length;a++){const l=t[a];$e(l!=null,`No layout data found for index ${a}`);const c=100/n*l;t[a]=c}let i=0;for(let a=0;a<e.length;a++){const l=t[a];$e(l!=null,`No layout data found for index ${a}`);const c=hi({panelConstraints:e,panelIndex:a,size:l});l!=c&&(i+=l-c,t[a]=c)}if(!ln(i,0))for(let a=0;a<e.length;a++){const l=t[a];$e(l!=null,`No layout data found for index ${a}`);const c=l+i,d=hi({panelConstraints:e,panelIndex:a,size:c});if(l!==d&&(i-=d-l,t[a]=d,ln(i,0)))break}return t}const mC=100,Eo={getItem:s=>(Bm(Eo),Eo.getItem(s)),setItem:(s,e)=>{Bm(Eo),Eo.setItem(s,e)}},Um={};function tw({autoSaveId:s=null,children:e,className:t="",direction:n,forwardedRef:i,id:a=null,onLayout:l=null,keyboardResizeBy:c=null,storage:d=Eo,style:h,tagName:f="div",...g}){const m=Vy(a),y=A.useRef(null),[x,w]=A.useState(null),[S,E]=A.useState([]),P=nC(),k=A.useRef({}),T=A.useRef(new Map),R=A.useRef(0),I=A.useRef({autoSaveId:s,direction:n,dragState:x,id:m,keyboardResizeBy:c,onLayout:l,storage:d}),N=A.useRef({layout:S,panelDataArray:[],panelDataArrayChanged:!1});A.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),A.useImperativeHandle(i,()=>({getId:()=>I.current.id,getLayout:()=>{const{layout:q}=N.current;return q},setLayout:q=>{const{onLayout:te}=I.current,{layout:se,panelDataArray:ie}=N.current,H=Hm({layout:q,panelConstraints:ie.map(ae=>ae.constraints)});$m(se,H)||(E(H),N.current.layout=H,te&&te(H),li(ie,H,k.current))}}),[]),vi(()=>{I.current.autoSaveId=s,I.current.direction=n,I.current.dragState=x,I.current.id=m,I.current.onLayout=l,I.current.storage=d}),lC({committedValuesRef:I,eagerValuesRef:N,groupId:m,layout:S,panelDataArray:N.current.panelDataArray,setLayout:E,panelGroupElement:y.current}),A.useEffect(()=>{const{panelDataArray:q}=N.current;if(s){if(S.length===0||S.length!==q.length)return;let te=Um[s];te==null&&(te=fC(gC,mC),Um[s]=te);const se=[...q],ie=new Map(T.current);te(s,se,ie,S,d)}},[s,S,d]),A.useEffect(()=>{});const D=A.useCallback(q=>{const{onLayout:te}=I.current,{layout:se,panelDataArray:ie}=N.current;if(q.constraints.collapsible){const H=ie.map(Se=>Se.constraints),{collapsedSize:ae=0,panelSize:de,pivotIndices:ce}=ps(ie,q,se);if($e(de!=null,`Panel size not found for panel "${q.id}"`),!mr(de,ae)){T.current.set(q.id,de);const Pe=ci(ie,q)===ie.length-1?de-ae:ae-de,be=Ao({delta:Pe,initialLayout:se,panelConstraints:H,pivotIndices:ce,prevLayout:se,trigger:"imperative-api"});wl(se,be)||(E(be),N.current.layout=be,te&&te(be),li(ie,be,k.current))}}},[]),V=A.useCallback((q,te)=>{const{onLayout:se}=I.current,{layout:ie,panelDataArray:H}=N.current;if(q.constraints.collapsible){const ae=H.map(Ce=>Ce.constraints),{collapsedSize:de=0,panelSize:ce=0,minSize:Se=0,pivotIndices:Pe}=ps(H,q,ie),be=te??Se;if(mr(ce,de)){const Ce=T.current.get(q.id),He=Ce!=null&&Ce>=be?Ce:be,ft=ci(H,q)===H.length-1?ce-He:He-ce,Qe=Ao({delta:ft,initialLayout:ie,panelConstraints:ae,pivotIndices:Pe,prevLayout:ie,trigger:"imperative-api"});wl(ie,Qe)||(E(Qe),N.current.layout=Qe,se&&se(Qe),li(H,Qe,k.current))}}},[]),j=A.useCallback(q=>{const{layout:te,panelDataArray:se}=N.current,{panelSize:ie}=ps(se,q,te);return $e(ie!=null,`Panel size not found for panel "${q.id}"`),ie},[]),G=A.useCallback((q,te)=>{const{panelDataArray:se}=N.current,ie=ci(se,q);return hC({defaultSize:te,dragState:x,layout:S,panelData:se,panelIndex:ie})},[x,S]),Z=A.useCallback(q=>{const{layout:te,panelDataArray:se}=N.current,{collapsedSize:ie=0,collapsible:H,panelSize:ae}=ps(se,q,te);return $e(ae!=null,`Panel size not found for panel "${q.id}"`),H===!0&&mr(ae,ie)},[]),K=A.useCallback(q=>{const{layout:te,panelDataArray:se}=N.current,{collapsedSize:ie=0,collapsible:H,panelSize:ae}=ps(se,q,te);return $e(ae!=null,`Panel size not found for panel "${q.id}"`),!H||_s(ae,ie)>0},[]),J=A.useCallback(q=>{const{panelDataArray:te}=N.current;te.push(q),te.sort((se,ie)=>{const H=se.order,ae=ie.order;return H==null&&ae==null?0:H==null?-1:ae==null?1:H-ae}),N.current.panelDataArrayChanged=!0,P()},[P]);vi(()=>{if(N.current.panelDataArrayChanged){N.current.panelDataArrayChanged=!1;const{autoSaveId:q,onLayout:te,storage:se}=I.current,{layout:ie,panelDataArray:H}=N.current;let ae=null;if(q){const ce=pC(q,H,se);ce&&(T.current=new Map(Object.entries(ce.expandToSizes)),ae=ce.layout)}ae==null&&(ae=dC({panelDataArray:H}));const de=Hm({layout:ae,panelConstraints:H.map(ce=>ce.constraints)});$m(ie,de)||(E(de),N.current.layout=de,te&&te(de),li(H,de,k.current))}}),vi(()=>{const q=N.current;return()=>{q.layout=[]}},[]);const ee=A.useCallback(q=>{let te=!1;const se=y.current;return se&&window.getComputedStyle(se,null).getPropertyValue("direction")==="rtl"&&(te=!0),function(H){H.preventDefault();const ae=y.current;if(!ae)return()=>null;const{direction:de,dragState:ce,id:Se,keyboardResizeBy:Pe,onLayout:be}=I.current,{layout:Ce,panelDataArray:He}=N.current,{initialLayout:je}=ce??{},ft=Yy(Se,q,ae);let Qe=uC(H,q,de,ce,Pe,ae);const fn=de==="horizontal";fn&&te&&(Qe=-Qe);const nr=He.map(Ls=>Ls.constraints),Pt=Ao({delta:Qe,initialLayout:je??Ce,panelConstraints:nr,pivotIndices:ft,prevLayout:Ce,trigger:Gy(H)?"keyboard":"mouse-or-touch"}),xr=!wl(Ce,Pt);(qy(H)||Xy(H))&&R.current!=Qe&&(R.current=Qe,!xr&&Qe!==0?fn?Cd(q,Qe<0?Q_:J_):Cd(q,Qe<0?Z_:eC):Cd(q,0)),xr&&(E(Pt),N.current.layout=Pt,be&&be(Pt),li(He,Pt,k.current))}},[]),B=A.useCallback((q,te)=>{const{onLayout:se}=I.current,{layout:ie,panelDataArray:H}=N.current,ae=H.map(Ce=>Ce.constraints),{panelSize:de,pivotIndices:ce}=ps(H,q,ie);$e(de!=null,`Panel size not found for panel "${q.id}"`);const Pe=ci(H,q)===H.length-1?de-te:te-de,be=Ao({delta:Pe,initialLayout:ie,panelConstraints:ae,pivotIndices:ce,prevLayout:ie,trigger:"imperative-api"});wl(ie,be)||(E(be),N.current.layout=be,se&&se(be),li(H,be,k.current))},[]),$=A.useCallback((q,te)=>{const{layout:se,panelDataArray:ie}=N.current,{collapsedSize:H=0,collapsible:ae}=te,{collapsedSize:de=0,collapsible:ce,maxSize:Se=100,minSize:Pe=0}=q.constraints,{panelSize:be}=ps(ie,q,se);be!=null&&(ae&&ce&&mr(be,H)?mr(H,de)||B(q,de):be<Pe?B(q,Pe):be>Se&&B(q,Se))},[B]),M=A.useCallback((q,te)=>{const{direction:se}=I.current,{layout:ie}=N.current;if(!y.current)return;const H=Fh(q,y.current);$e(H,`Drag handle element not found for id "${q}"`);const ae=Qy(se,te);w({dragHandleId:q,dragHandleRect:H.getBoundingClientRect(),initialCursorPosition:ae,initialLayout:ie})},[]),Q=A.useCallback(()=>{w(null)},[]),ne=A.useCallback(q=>{const{panelDataArray:te}=N.current,se=ci(te,q);se>=0&&(te.splice(se,1),delete k.current[q.id],N.current.panelDataArrayChanged=!0,P())},[P]),F=A.useMemo(()=>({collapsePanel:D,direction:n,dragState:x,expandPanel:V,getPanelSize:j,getPanelStyle:G,groupId:m,isPanelCollapsed:Z,isPanelExpanded:K,reevaluatePanelConstraints:$,registerPanel:J,registerResizeHandle:ee,resizePanel:B,startDragging:M,stopDragging:Q,unregisterPanel:ne,panelGroupElement:y.current}),[D,x,n,V,j,G,m,Z,K,$,J,ee,B,M,Q,ne]),Y={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return A.createElement(Dh.Provider,{value:F},A.createElement(f,{...g,children:e,className:t,id:a,ref:y,style:{...Y,...h},[dn.group]:"",[dn.groupDirection]:n,[dn.groupId]:m}))}const vC=A.forwardRef((s,e)=>A.createElement(tw,{...s,forwardedRef:e}));tw.displayName="PanelGroup";vC.displayName="forwardRef(PanelGroup)";function ci(s,e){return s.findIndex(t=>t===e||t.id===e.id)}function ps(s,e,t){const n=ci(s,e),a=n===s.length-1?[n-1,n]:[n,n+1],l=t[n];return{...e.constraints,panelSize:l,pivotIndices:a}}var tc="Popover",[nw,HN]=zo(tc,[ec]),Uo=ec(),[yC,Kr]=nw(tc),rw=s=>{const{__scopePopover:e,children:t,open:n,defaultOpen:i,onOpenChange:a,modal:l=!1}=s,c=Uo(e),d=A.useRef(null),[h,f]=A.useState(!1),[g,m]=Vd({prop:n,defaultProp:i??!1,onChange:a,caller:tc});return _.jsx($y,{...c,children:_.jsx(yC,{scope:e,contentId:Wl(),triggerRef:d,open:g,onOpenChange:m,onOpenToggle:A.useCallback(()=>m(y=>!y),[m]),hasCustomAnchor:h,onCustomAnchorAdd:A.useCallback(()=>f(!0),[]),onCustomAnchorRemove:A.useCallback(()=>f(!1),[]),modal:l,children:t})})};rw.displayName=tc;var sw="PopoverAnchor",wC=A.forwardRef((s,e)=>{const{__scopePopover:t,...n}=s,i=Kr(sw,t),a=Uo(t),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=i;return A.useEffect(()=>(l(),()=>c()),[l,c]),_.jsx(Mh,{...a,...n,ref:e})});wC.displayName=sw;var iw="PopoverTrigger",ow=A.forwardRef((s,e)=>{const{__scopePopover:t,...n}=s,i=Kr(iw,t),a=Uo(t),l=st(e,i.triggerRef),c=_.jsx(Ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":dw(i.open),...n,ref:l,onClick:Ue(s.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:_.jsx(Mh,{asChild:!0,...a,children:c})});ow.displayName=iw;var jh="PopoverPortal",[bC,xC]=nw(jh,{forceMount:void 0}),aw=s=>{const{__scopePopover:e,forceMount:t,children:n,container:i}=s,a=Kr(jh,e);return _.jsx(bC,{scope:e,forceMount:t,children:_.jsx(Bo,{present:t||a.open,children:_.jsx(bh,{asChild:!0,container:i,children:n})})})};aw.displayName=jh;var Ai="PopoverContent",lw=A.forwardRef((s,e)=>{const t=xC(Ai,s.__scopePopover),{forceMount:n=t.forceMount,...i}=s,a=Kr(Ai,s.__scopePopover);return _.jsx(Bo,{present:n||a.open,children:a.modal?_.jsx(AC,{...i,ref:e}):_.jsx(EC,{...i,ref:e})})});lw.displayName=Ai;var SC=xs("PopoverContent.RemoveScroll"),AC=A.forwardRef((s,e)=>{const t=Kr(Ai,s.__scopePopover),n=A.useRef(null),i=st(e,n),a=A.useRef(!1);return A.useEffect(()=>{const l=n.current;if(l)return Sh(l)},[]),_.jsx(Yl,{as:SC,allowPinchZoom:!0,children:_.jsx(cw,{...s,ref:i,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ue(s.onCloseAutoFocus,l=>{l.preventDefault(),a.current||t.triggerRef.current?.focus()}),onPointerDownOutside:Ue(s.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,h=c.button===2||d;a.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:Ue(s.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),EC=A.forwardRef((s,e)=>{const t=Kr(Ai,s.__scopePopover),n=A.useRef(!1),i=A.useRef(!1);return _.jsx(cw,{...s,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{s.onCloseAutoFocus?.(a),a.defaultPrevented||(n.current||t.triggerRef.current?.focus(),a.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:a=>{s.onInteractOutside?.(a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=a.target;t.triggerRef.current?.contains(l)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),cw=A.forwardRef((s,e)=>{const{__scopePopover:t,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,...g}=s,m=Kr(Ai,t),y=Uo(t);return xh(),_.jsx(ql,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:a,children:_.jsx(Gl,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>m.onOpenChange(!1),children:_.jsx(By,{"data-state":dw(m.open),role:"dialog",id:m.contentId,...y,...g,ref:e,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),uw="PopoverClose",_C=A.forwardRef((s,e)=>{const{__scopePopover:t,...n}=s,i=Kr(uw,t);return _.jsx(Ge.button,{type:"button",...n,ref:e,onClick:Ue(s.onClick,()=>i.onOpenChange(!1))})});_C.displayName=uw;var CC="PopoverArrow",kC=A.forwardRef((s,e)=>{const{__scopePopover:t,...n}=s,i=Uo(t);return _.jsx(Hy,{...i,...n,ref:e})});kC.displayName=CC;function dw(s){return s?"open":"closed"}var PC=rw,TC=ow,RC=aw,NC=lw;function IC(s){var e=it(s,[]);return _.jsx(PC,Fe({"data-slot":"popover"},e))}function LC(s){var e=it(s,[]);return _.jsx(TC,Fe({"data-slot":"popover-trigger"},e))}function MC(s){var e=s,{className:t,align:n="center",sideOffset:i=4}=e,a=it(e,["className","align","sideOffset"]);return _.jsx(RC,{children:_.jsx(NC,Fe({"data-slot":"popover-content",align:n,sideOffset:i,className:vt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t)},a))})}var DC=[" ","Enter","ArrowUp","ArrowDown"],OC=[" ","Enter"],Cs="Select",[nc,rc,FC]=FA(Cs),[Ni,UN]=zo(Cs,[FC,ec]),sc=ec(),[jC,Qr]=Ni(Cs),[zC,$C]=Ni(Cs),hw=s=>{const{__scopeSelect:e,children:t,open:n,defaultOpen:i,onOpenChange:a,value:l,defaultValue:c,onValueChange:d,dir:h,name:f,autoComplete:g,disabled:m,required:y,form:x}=s,w=sc(e),[S,E]=A.useState(null),[P,k]=A.useState(null),[T,R]=A.useState(!1),I=qA(h),[N,D]=Vd({prop:n,defaultProp:i??!1,onChange:a,caller:Cs}),[V,j]=Vd({prop:l,defaultProp:c,onChange:d,caller:Cs}),G=A.useRef(null),Z=S?x||!!S.closest("form"):!0,[K,J]=A.useState(new Set),ee=Array.from(K).map(B=>B.props.value).join(";");return _.jsx($y,{...w,children:_.jsxs(jC,{required:y,scope:e,trigger:S,onTriggerChange:E,valueNode:P,onValueNodeChange:k,valueNodeHasChildren:T,onValueNodeHasChildrenChange:R,contentId:Wl(),value:V,onValueChange:j,open:N,onOpenChange:D,dir:I,triggerPointerDownPosRef:G,disabled:m,children:[_.jsx(nc.Provider,{scope:e,children:_.jsx(zC,{scope:s.__scopeSelect,onNativeOptionAdd:A.useCallback(B=>{J($=>new Set($).add(B))},[]),onNativeOptionRemove:A.useCallback(B=>{J($=>{const M=new Set($);return M.delete(B),M})},[]),children:t})}),Z?_.jsxs(Mw,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:g,value:V,onChange:B=>j(B.target.value),disabled:m,form:x,children:[V===void 0?_.jsx("option",{value:""}):null,Array.from(K)]},ee):null]})})};hw.displayName=Cs;var fw="SelectTrigger",pw=A.forwardRef((s,e)=>{const{__scopeSelect:t,disabled:n=!1,...i}=s,a=sc(t),l=Qr(fw,t),c=l.disabled||n,d=st(e,l.onTriggerChange),h=rc(t),f=A.useRef("touch"),[g,m,y]=Ow(w=>{const S=h().filter(k=>!k.disabled),E=S.find(k=>k.value===l.value),P=Fw(S,w,E);P!==void 0&&l.onValueChange(P.value)}),x=w=>{c||(l.onOpenChange(!0),y()),w&&(l.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return _.jsx(Mh,{asChild:!0,...a,children:_.jsx(Ge.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Dw(l.value)?"":void 0,...i,ref:d,onClick:Ue(i.onClick,w=>{w.currentTarget.focus(),f.current!=="mouse"&&x(w)}),onPointerDown:Ue(i.onPointerDown,w=>{f.current=w.pointerType;const S=w.target;S.hasPointerCapture(w.pointerId)&&S.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(x(w),w.preventDefault())}),onKeyDown:Ue(i.onKeyDown,w=>{const S=g.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&m(w.key),!(S&&w.key===" ")&&DC.includes(w.key)&&(x(),w.preventDefault())})})})});pw.displayName=fw;var gw="SelectValue",mw=A.forwardRef((s,e)=>{const{__scopeSelect:t,className:n,style:i,children:a,placeholder:l="",...c}=s,d=Qr(gw,t),{onValueNodeHasChildrenChange:h}=d,f=a!==void 0,g=st(e,d.onValueNodeChange);return $t(()=>{h(f)},[h,f]),_.jsx(Ge.span,{...c,ref:g,style:{pointerEvents:"none"},children:Dw(d.value)?_.jsx(_.Fragment,{children:l}):a})});mw.displayName=gw;var BC="SelectIcon",vw=A.forwardRef((s,e)=>{const{__scopeSelect:t,children:n,...i}=s;return _.jsx(Ge.span,{"aria-hidden":!0,...i,ref:e,children:n||"▼"})});vw.displayName=BC;var HC="SelectPortal",yw=s=>_.jsx(bh,{asChild:!0,...s});yw.displayName=HC;var ks="SelectContent",ww=A.forwardRef((s,e)=>{const t=Qr(ks,s.__scopeSelect),[n,i]=A.useState();if($t(()=>{i(new DocumentFragment)},[]),!t.open){const a=n;return a?$o.createPortal(_.jsx(bw,{scope:s.__scopeSelect,children:_.jsx(nc.Slot,{scope:s.__scopeSelect,children:_.jsx("div",{children:s.children})})}),a):null}return _.jsx(xw,{...s,ref:e})});ww.displayName=ks;var Nn=10,[bw,Jr]=Ni(ks),UC="SelectContentImpl",VC=xs("SelectContent.RemoveScroll"),xw=A.forwardRef((s,e)=>{const{__scopeSelect:t,position:n="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:l,side:c,sideOffset:d,align:h,alignOffset:f,arrowPadding:g,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:w,avoidCollisions:S,...E}=s,P=Qr(ks,t),[k,T]=A.useState(null),[R,I]=A.useState(null),N=st(e,H=>T(H)),[D,V]=A.useState(null),[j,G]=A.useState(null),Z=rc(t),[K,J]=A.useState(!1),ee=A.useRef(!1);A.useEffect(()=>{if(k)return Sh(k)},[k]),xh();const B=A.useCallback(H=>{const[ae,...de]=Z().map(Pe=>Pe.ref.current),[ce]=de.slice(-1),Se=document.activeElement;for(const Pe of H)if(Pe===Se||(Pe?.scrollIntoView({block:"nearest"}),Pe===ae&&R&&(R.scrollTop=0),Pe===ce&&R&&(R.scrollTop=R.scrollHeight),Pe?.focus(),document.activeElement!==Se))return},[Z,R]),$=A.useCallback(()=>B([D,k]),[B,D,k]);A.useEffect(()=>{K&&$()},[K,$]);const{onOpenChange:M,triggerPointerDownPosRef:Q}=P;A.useEffect(()=>{if(k){let H={x:0,y:0};const ae=ce=>{H={x:Math.abs(Math.round(ce.pageX)-(Q.current?.x??0)),y:Math.abs(Math.round(ce.pageY)-(Q.current?.y??0))}},de=ce=>{H.x<=10&&H.y<=10?ce.preventDefault():k.contains(ce.target)||M(!1),document.removeEventListener("pointermove",ae),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",ae),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ae),document.removeEventListener("pointerup",de,{capture:!0})}}},[k,M,Q]),A.useEffect(()=>{const H=()=>M(!1);return window.addEventListener("blur",H),window.addEventListener("resize",H),()=>{window.removeEventListener("blur",H),window.removeEventListener("resize",H)}},[M]);const[ne,F]=Ow(H=>{const ae=Z().filter(Se=>!Se.disabled),de=ae.find(Se=>Se.ref.current===document.activeElement),ce=Fw(ae,H,de);ce&&setTimeout(()=>ce.ref.current.focus())}),Y=A.useCallback((H,ae,de)=>{const ce=!ee.current&&!de;(P.value!==void 0&&P.value===ae||ce)&&(V(H),ce&&(ee.current=!0))},[P.value]),q=A.useCallback(()=>k?.focus(),[k]),te=A.useCallback((H,ae,de)=>{const ce=!ee.current&&!de;(P.value!==void 0&&P.value===ae||ce)&&G(H)},[P.value]),se=n==="popper"?Kd:Sw,ie=se===Kd?{side:c,sideOffset:d,align:h,alignOffset:f,arrowPadding:g,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:w,avoidCollisions:S}:{};return _.jsx(bw,{scope:t,content:k,viewport:R,onViewportChange:I,itemRefCallback:Y,selectedItem:D,onItemLeave:q,itemTextRefCallback:te,focusSelectedItem:$,selectedItemText:j,position:n,isPositioned:K,searchRef:ne,children:_.jsx(Yl,{as:VC,allowPinchZoom:!0,children:_.jsx(ql,{asChild:!0,trapped:P.open,onMountAutoFocus:H=>{H.preventDefault()},onUnmountAutoFocus:Ue(i,H=>{P.trigger?.focus({preventScroll:!0}),H.preventDefault()}),children:_.jsx(Gl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:H=>H.preventDefault(),onDismiss:()=>P.onOpenChange(!1),children:_.jsx(se,{role:"listbox",id:P.contentId,"data-state":P.open?"open":"closed",dir:P.dir,onContextMenu:H=>H.preventDefault(),...E,...ie,onPlaced:()=>J(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:Ue(E.onKeyDown,H=>{const ae=H.ctrlKey||H.altKey||H.metaKey;if(H.key==="Tab"&&H.preventDefault(),!ae&&H.key.length===1&&F(H.key),["ArrowUp","ArrowDown","Home","End"].includes(H.key)){let ce=Z().filter(Se=>!Se.disabled).map(Se=>Se.ref.current);if(["ArrowUp","End"].includes(H.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(H.key)){const Se=H.target,Pe=ce.indexOf(Se);ce=ce.slice(Pe+1)}setTimeout(()=>B(ce)),H.preventDefault()}})})})})})})});xw.displayName=UC;var WC="SelectItemAlignedPosition",Sw=A.forwardRef((s,e)=>{const{__scopeSelect:t,onPlaced:n,...i}=s,a=Qr(ks,t),l=Jr(ks,t),[c,d]=A.useState(null),[h,f]=A.useState(null),g=st(e,N=>f(N)),m=rc(t),y=A.useRef(!1),x=A.useRef(!0),{viewport:w,selectedItem:S,selectedItemText:E,focusSelectedItem:P}=l,k=A.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&h&&w&&S&&E){const N=a.trigger.getBoundingClientRect(),D=h.getBoundingClientRect(),V=a.valueNode.getBoundingClientRect(),j=E.getBoundingClientRect();if(a.dir!=="rtl"){const Se=j.left-D.left,Pe=V.left-Se,be=N.left-Pe,Ce=N.width+be,He=Math.max(Ce,D.width),je=window.innerWidth-Nn,ft=jm(Pe,[Nn,Math.max(Nn,je-He)]);c.style.minWidth=Ce+"px",c.style.left=ft+"px"}else{const Se=D.right-j.right,Pe=window.innerWidth-V.right-Se,be=window.innerWidth-N.right-Pe,Ce=N.width+be,He=Math.max(Ce,D.width),je=window.innerWidth-Nn,ft=jm(Pe,[Nn,Math.max(Nn,je-He)]);c.style.minWidth=Ce+"px",c.style.right=ft+"px"}const G=m(),Z=window.innerHeight-Nn*2,K=w.scrollHeight,J=window.getComputedStyle(h),ee=parseInt(J.borderTopWidth,10),B=parseInt(J.paddingTop,10),$=parseInt(J.borderBottomWidth,10),M=parseInt(J.paddingBottom,10),Q=ee+B+K+M+$,ne=Math.min(S.offsetHeight*5,Q),F=window.getComputedStyle(w),Y=parseInt(F.paddingTop,10),q=parseInt(F.paddingBottom,10),te=N.top+N.height/2-Nn,se=Z-te,ie=S.offsetHeight/2,H=S.offsetTop+ie,ae=ee+B+H,de=Q-ae;if(ae<=te){const Se=G.length>0&&S===G[G.length-1].ref.current;c.style.bottom="0px";const Pe=h.clientHeight-w.offsetTop-w.offsetHeight,be=Math.max(se,ie+(Se?q:0)+Pe+$),Ce=ae+be;c.style.height=Ce+"px"}else{const Se=G.length>0&&S===G[0].ref.current;c.style.top="0px";const be=Math.max(te,ee+w.offsetTop+(Se?Y:0)+ie)+de;c.style.height=be+"px",w.scrollTop=ae-te+w.offsetTop}c.style.margin=`${Nn}px 0`,c.style.minHeight=ne+"px",c.style.maxHeight=Z+"px",n?.(),requestAnimationFrame(()=>y.current=!0)}},[m,a.trigger,a.valueNode,c,h,w,S,E,a.dir,n]);$t(()=>k(),[k]);const[T,R]=A.useState();$t(()=>{h&&R(window.getComputedStyle(h).zIndex)},[h]);const I=A.useCallback(N=>{N&&x.current===!0&&(k(),P?.(),x.current=!1)},[k,P]);return _.jsx(qC,{scope:t,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:I,children:_.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:_.jsx(Ge.div,{...i,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Sw.displayName=WC;var GC="SelectPopperPosition",Kd=A.forwardRef((s,e)=>{const{__scopeSelect:t,align:n="start",collisionPadding:i=Nn,...a}=s,l=sc(t);return _.jsx(By,{...l,...a,ref:e,align:n,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Kd.displayName=GC;var[qC,zh]=Ni(ks,{}),Qd="SelectViewport",Aw=A.forwardRef((s,e)=>{const{__scopeSelect:t,nonce:n,...i}=s,a=Jr(Qd,t),l=zh(Qd,t),c=st(e,a.onViewportChange),d=A.useRef(0);return _.jsxs(_.Fragment,{children:[_.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),_.jsx(nc.Slot,{scope:t,children:_.jsx(Ge.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Ue(i.onScroll,h=>{const f=h.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:m}=l;if(m?.current&&g){const y=Math.abs(d.current-f.scrollTop);if(y>0){const x=window.innerHeight-Nn*2,w=parseFloat(g.style.minHeight),S=parseFloat(g.style.height),E=Math.max(w,S);if(E<x){const P=E+y,k=Math.min(x,P),T=P-k;g.style.height=k+"px",g.style.bottom==="0px"&&(f.scrollTop=T>0?T:0,g.style.justifyContent="flex-end")}}}d.current=f.scrollTop})})})]})});Aw.displayName=Qd;var Ew="SelectGroup",[XC,YC]=Ni(Ew),KC=A.forwardRef((s,e)=>{const{__scopeSelect:t,...n}=s,i=Wl();return _.jsx(XC,{scope:t,id:i,children:_.jsx(Ge.div,{role:"group","aria-labelledby":i,...n,ref:e})})});KC.displayName=Ew;var _w="SelectLabel",QC=A.forwardRef((s,e)=>{const{__scopeSelect:t,...n}=s,i=YC(_w,t);return _.jsx(Ge.div,{id:i.id,...n,ref:e})});QC.displayName=_w;var Bl="SelectItem",[JC,Cw]=Ni(Bl),kw=A.forwardRef((s,e)=>{const{__scopeSelect:t,value:n,disabled:i=!1,textValue:a,...l}=s,c=Qr(Bl,t),d=Jr(Bl,t),h=c.value===n,[f,g]=A.useState(a??""),[m,y]=A.useState(!1),x=st(e,P=>d.itemRefCallback?.(P,n,i)),w=Wl(),S=A.useRef("touch"),E=()=>{i||(c.onValueChange(n),c.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return _.jsx(JC,{scope:t,value:n,disabled:i,textId:w,isSelected:h,onItemTextChange:A.useCallback(P=>{g(k=>k||(P?.textContent??"").trim())},[]),children:_.jsx(nc.ItemSlot,{scope:t,value:n,disabled:i,textValue:f,children:_.jsx(Ge.div,{role:"option","aria-labelledby":w,"data-highlighted":m?"":void 0,"aria-selected":h&&m,"data-state":h?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...l,ref:x,onFocus:Ue(l.onFocus,()=>y(!0)),onBlur:Ue(l.onBlur,()=>y(!1)),onClick:Ue(l.onClick,()=>{S.current!=="mouse"&&E()}),onPointerUp:Ue(l.onPointerUp,()=>{S.current==="mouse"&&E()}),onPointerDown:Ue(l.onPointerDown,P=>{S.current=P.pointerType}),onPointerMove:Ue(l.onPointerMove,P=>{S.current=P.pointerType,i?d.onItemLeave?.():S.current==="mouse"&&P.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ue(l.onPointerLeave,P=>{P.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Ue(l.onKeyDown,P=>{d.searchRef?.current!==""&&P.key===" "||(OC.includes(P.key)&&E(),P.key===" "&&P.preventDefault())})})})})});kw.displayName=Bl;var _o="SelectItemText",Pw=A.forwardRef((s,e)=>{const{__scopeSelect:t,className:n,style:i,...a}=s,l=Qr(_o,t),c=Jr(_o,t),d=Cw(_o,t),h=$C(_o,t),[f,g]=A.useState(null),m=st(e,E=>g(E),d.onItemTextChange,E=>c.itemTextRefCallback?.(E,d.value,d.disabled)),y=f?.textContent,x=A.useMemo(()=>_.jsx("option",{value:d.value,disabled:d.disabled,children:y},d.value),[d.disabled,d.value,y]),{onNativeOptionAdd:w,onNativeOptionRemove:S}=h;return $t(()=>(w(x),()=>S(x)),[w,S,x]),_.jsxs(_.Fragment,{children:[_.jsx(Ge.span,{id:d.textId,...a,ref:m}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?$o.createPortal(a.children,l.valueNode):null]})});Pw.displayName=_o;var Tw="SelectItemIndicator",Rw=A.forwardRef((s,e)=>{const{__scopeSelect:t,...n}=s;return Cw(Tw,t).isSelected?_.jsx(Ge.span,{"aria-hidden":!0,...n,ref:e}):null});Rw.displayName=Tw;var Jd="SelectScrollUpButton",Nw=A.forwardRef((s,e)=>{const t=Jr(Jd,s.__scopeSelect),n=zh(Jd,s.__scopeSelect),[i,a]=A.useState(!1),l=st(e,n.onScrollButtonChange);return $t(()=>{if(t.viewport&&t.isPositioned){let c=function(){const h=d.scrollTop>0;a(h)};const d=t.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[t.viewport,t.isPositioned]),i?_.jsx(Lw,{...s,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=t;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});Nw.displayName=Jd;var Zd="SelectScrollDownButton",Iw=A.forwardRef((s,e)=>{const t=Jr(Zd,s.__scopeSelect),n=zh(Zd,s.__scopeSelect),[i,a]=A.useState(!1),l=st(e,n.onScrollButtonChange);return $t(()=>{if(t.viewport&&t.isPositioned){let c=function(){const h=d.scrollHeight-d.clientHeight,f=Math.ceil(d.scrollTop)<h;a(f)};const d=t.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[t.viewport,t.isPositioned]),i?_.jsx(Lw,{...s,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=t;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});Iw.displayName=Zd;var Lw=A.forwardRef((s,e)=>{const{__scopeSelect:t,onAutoScroll:n,...i}=s,a=Jr("SelectScrollButton",t),l=A.useRef(null),c=rc(t),d=A.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return A.useEffect(()=>()=>d(),[d]),$t(()=>{c().find(f=>f.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),_.jsx(Ge.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Ue(i.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(n,50))}),onPointerMove:Ue(i.onPointerMove,()=>{a.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(n,50))}),onPointerLeave:Ue(i.onPointerLeave,()=>{d()})})}),ZC="SelectSeparator",ek=A.forwardRef((s,e)=>{const{__scopeSelect:t,...n}=s;return _.jsx(Ge.div,{"aria-hidden":!0,...n,ref:e})});ek.displayName=ZC;var eh="SelectArrow",tk=A.forwardRef((s,e)=>{const{__scopeSelect:t,...n}=s,i=sc(t),a=Qr(eh,t),l=Jr(eh,t);return a.open&&l.position==="popper"?_.jsx(Hy,{...i,...n,ref:e}):null});tk.displayName=eh;var nk="SelectBubbleInput",Mw=A.forwardRef(({__scopeSelect:s,value:e,...t},n)=>{const i=A.useRef(null),a=st(n,i),l=U_(e);return A.useEffect(()=>{const c=i.current;if(!c)return;const d=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==e&&f){const g=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(g)}},[l,e]),_.jsx(Ge.select,{...t,style:{...Uy,...t.style},ref:a,defaultValue:e})});Mw.displayName=nk;function Dw(s){return s===""||s===void 0}function Ow(s){const e=Ss(s),t=A.useRef(""),n=A.useRef(0),i=A.useCallback(l=>{const c=t.current+l;e(c),function d(h){t.current=h,window.clearTimeout(n.current),h!==""&&(n.current=window.setTimeout(()=>d(""),1e3))}(c)},[e]),a=A.useCallback(()=>{t.current="",window.clearTimeout(n.current)},[]);return A.useEffect(()=>()=>window.clearTimeout(n.current),[]),[t,i,a]}function Fw(s,e,t){const i=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,a=t?s.indexOf(t):-1;let l=rk(s,Math.max(a,0));i.length===1&&(l=l.filter(h=>h!==t));const d=l.find(h=>h.textValue.toLowerCase().startsWith(i.toLowerCase()));return d!==t?d:void 0}function rk(s,e){return s.map((t,n)=>s[(e+n)%s.length])}var sk=hw,ik=pw,ok=mw,ak=vw,lk=yw,ck=ww,uk=Aw,dk=kw,hk=Pw,fk=Rw,pk=Nw,gk=Iw;function jw(s){var e=it(s,[]);return _.jsx(sk,Fe({"data-slot":"select"},e))}function zw(s){var e=it(s,[]);return _.jsx(ok,Fe({"data-slot":"select-value"},e))}function $w(s){var e=s,{className:t,size:n="default",children:i}=e,a=it(e,["className","size","children"]);return _.jsxs(ik,Ft(Fe({"data-slot":"select-trigger","data-size":n,className:vt("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t)},a),{children:[i,_.jsx(ak,{asChild:!0,children:_.jsx(wh,{className:"size-4 opacity-50"})})]}))}function Bw(s){var e=s,{className:t,children:n,position:i="popper"}=e,a=it(e,["className","children","position"]);return _.jsx(lk,{children:_.jsxs(ck,Ft(Fe({"data-slot":"select-content",className:vt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",i==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:i},a),{children:[_.jsx(mk,{}),_.jsx(uk,{className:vt("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:n}),_.jsx(vk,{})]}))})}function th(s){var e=s,{className:t,children:n}=e,i=it(e,["className","children"]);return _.jsxs(dk,Ft(Fe({"data-slot":"select-item",className:vt("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t)},i),{children:[_.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:_.jsx(fk,{children:_.jsx(rA,{className:"size-4"})})}),_.jsx(hk,{children:n})]}))}function mk(s){var e=s,{className:t}=e,n=it(e,["className"]);return _.jsx(pk,Ft(Fe({"data-slot":"select-scroll-up-button",className:vt("flex cursor-default items-center justify-center py-1",t)},n),{children:_.jsx(cA,{className:"size-4"})}))}function vk(s){var e=s,{className:t}=e,n=it(e,["className"]);return _.jsx(gk,Ft(Fe({"data-slot":"select-scroll-down-button",className:vt("flex cursor-default items-center justify-center py-1",t)},n),{children:_.jsx(wh,{className:"size-4"})}))}function kd(s){var e=s,{className:t}=e,n=it(e,["className"]);return _.jsx("textarea",Fe({"data-slot":"textarea",className:vt("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t)},n))}const Vm=s=>{let e;const t=new Set,n=(h,f)=>{const g=typeof h=="function"?h(e):h;if(!Object.is(g,e)){const m=e;e=f??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(y=>y(e,m))}},i=()=>e,c={setState:n,getState:i,getInitialState:()=>d,subscribe:h=>(t.add(h),()=>t.delete(h))},d=e=s(n,i,c);return c},yk=s=>s?Vm(s):Vm,wk=s=>s;function bk(s,e=wk){const t=Oe.useSyncExternalStore(s.subscribe,()=>e(s.getState()),()=>e(s.getInitialState()));return Oe.useDebugValue(t),t}const Wm=s=>{const e=yk(s),t=n=>bk(e,n);return Object.assign(t,e),t},xk=s=>s?Wm(s):Wm;var Hw=A.forwardRef((s,e)=>{var t=s,{className:n}=t,i=it(t,["className"]);return _.jsx("div",{className:"relative w-full overflow-auto",children:_.jsx("table",Fe({ref:e,className:vt("w-full caption-bottom text-sm",n)},i))})});Hw.displayName="Table";var Uw=A.forwardRef((s,e)=>{var t=s,{className:n}=t,i=it(t,["className"]);return _.jsx("thead",Fe({ref:e,className:vt("[&_tr]:border-b",n)},i))});Uw.displayName="TableHeader";var Vw=A.forwardRef((s,e)=>{var t=s,{className:n}=t,i=it(t,["className"]);return _.jsx("tbody",Fe({ref:e,className:vt("[&_tr:last-child]:border-0",n)},i))});Vw.displayName="TableBody";var Sk=A.forwardRef((s,e)=>{var t=s,{className:n}=t,i=it(t,["className"]);return _.jsx("tfoot",Fe({ref:e,className:vt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",n)},i))});Sk.displayName="TableFooter";var nh=A.forwardRef((s,e)=>{var t=s,{className:n}=t,i=it(t,["className"]);return _.jsx("tr",Fe({ref:e,className:vt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",n)},i))});nh.displayName="TableRow";var Rl=A.forwardRef((s,e)=>{var t=s,{className:n}=t,i=it(t,["className"]);return _.jsx("th",Fe({ref:e,className:vt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",n)},i))});Rl.displayName="TableHead";var Nl=A.forwardRef((s,e)=>{var t=s,{className:n}=t,i=it(t,["className"]);return _.jsx("td",Fe({ref:e,className:vt("p-4 align-middle [&:has([role=checkbox])]:pr-0",n)},i))});Nl.displayName="TableCell";var Ak=A.forwardRef((s,e)=>{var t=s,{className:n}=t,i=it(t,["className"]);return _.jsx("caption",Fe({ref:e,className:vt("mt-4 text-sm text-muted-foreground",n)},i))});Ak.displayName="TableCaption";function $h(s){var e=s,{className:t,type:n}=e,i=it(e,["className","type"]);return _.jsx("input",Fe({type:n,"data-slot":"input",className:vt("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t)},i))}function Ek(s){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css",e.appendChild(t),t.styleSheet?t.styleSheet.cssText=s:t.appendChild(document.createTextNode(s))}Array(12).fill(0);let rh=1;class _k{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;const{message:n,...i}=e,a=typeof e?.id=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:rh++,l=this.toasts.find(d=>d.id===a),c=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),l?this.toasts=this.toasts.map(d=>d.id===a?(this.publish({...d,...e,id:a,title:n}),{...d,...e,id:a,dismissible:c,title:n}):d):this.addToast({title:n,...i,dismissible:c,id:a}),a},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));const i=Promise.resolve(e instanceof Function?e():e);let a=n!==void 0,l;const c=i.then(async h=>{if(l=["resolve",h],Oe.isValidElement(h))a=!1,this.create({id:n,type:"default",message:h});else if(kk(h)&&!h.ok){a=!1;const g=typeof t.error=="function"?await t.error(`HTTP error! status: ${h.status}`):t.error,m=typeof t.description=="function"?await t.description(`HTTP error! status: ${h.status}`):t.description,x=typeof g=="object"&&!Oe.isValidElement(g)?g:{message:g};this.create({id:n,type:"error",description:m,...x})}else if(h instanceof Error){a=!1;const g=typeof t.error=="function"?await t.error(h):t.error,m=typeof t.description=="function"?await t.description(h):t.description,x=typeof g=="object"&&!Oe.isValidElement(g)?g:{message:g};this.create({id:n,type:"error",description:m,...x})}else if(t.success!==void 0){a=!1;const g=typeof t.success=="function"?await t.success(h):t.success,m=typeof t.description=="function"?await t.description(h):t.description,x=typeof g=="object"&&!Oe.isValidElement(g)?g:{message:g};this.create({id:n,type:"success",description:m,...x})}}).catch(async h=>{if(l=["reject",h],t.error!==void 0){a=!1;const f=typeof t.error=="function"?await t.error(h):t.error,g=typeof t.description=="function"?await t.description(h):t.description,y=typeof f=="object"&&!Oe.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:g,...y})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),d=()=>new Promise((h,f)=>c.then(()=>l[0]==="reject"?f(l[1]):h(l[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:d}:Object.assign(n,{unwrap:d})},this.custom=(e,t)=>{const n=t?.id||rh++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Sn=new _k,Ck=(s,e)=>{const t=e?.id||rh++;return Sn.addToast({title:s,...e,id:t}),t},kk=s=>s&&typeof s=="object"&&"ok"in s&&typeof s.ok=="boolean"&&"status"in s&&typeof s.status=="number",Pk=Ck,Tk=()=>Sn.toasts,Rk=()=>Sn.getActiveToasts();Object.assign(Pk,{success:Sn.success,info:Sn.info,warning:Sn.warning,error:Sn.error,custom:Sn.custom,message:Sn.message,promise:Sn.promise,dismiss:Sn.dismiss,loading:Sn.loading},{getHistory:Tk,getToasts:Rk});Ek("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");var Nk=async(s,e)=>{let t=typeof e=="function"?await e(s):e;if(t)return s.scheme==="bearer"?`Bearer ${t}`:s.scheme==="basic"?`Basic ${btoa(t)}`:t},Ik={bodySerializer:s=>JSON.stringify(s,(e,t)=>typeof t=="bigint"?t.toString():t)},Lk=s=>{switch(s){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},Mk=s=>{switch(s){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},Dk=s=>{switch(s){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},Ww=({allowReserved:s,explode:e,name:t,style:n,value:i})=>{if(!e){let c=(s?i:i.map(d=>encodeURIComponent(d))).join(Mk(n));switch(n){case"label":return`.${c}`;case"matrix":return`;${t}=${c}`;case"simple":return c;default:return`${t}=${c}`}}let a=Lk(n),l=i.map(c=>n==="label"||n==="simple"?s?c:encodeURIComponent(c):ic({allowReserved:s,name:t,value:c})).join(a);return n==="label"||n==="matrix"?a+l:l},ic=({allowReserved:s,name:e,value:t})=>{if(t==null)return"";if(typeof t=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${s?t:encodeURIComponent(t)}`},Gw=({allowReserved:s,explode:e,name:t,style:n,value:i})=>{if(i instanceof Date)return`${t}=${i.toISOString()}`;if(n!=="deepObject"&&!e){let c=[];Object.entries(i).forEach(([h,f])=>{c=[...c,h,s?f:encodeURIComponent(f)]});let d=c.join(",");switch(n){case"form":return`${t}=${d}`;case"label":return`.${d}`;case"matrix":return`;${t}=${d}`;default:return d}}let a=Dk(n),l=Object.entries(i).map(([c,d])=>ic({allowReserved:s,name:n==="deepObject"?`${t}[${c}]`:c,value:d})).join(a);return n==="label"||n==="matrix"?a+l:l},Ok=/\{[^{}]+\}/g,Fk=({path:s,url:e})=>{let t=e,n=e.match(Ok);if(n)for(let i of n){let a=!1,l=i.substring(1,i.length-1),c="simple";l.endsWith("*")&&(a=!0,l=l.substring(0,l.length-1)),l.startsWith(".")?(l=l.substring(1),c="label"):l.startsWith(";")&&(l=l.substring(1),c="matrix");let d=s[l];if(d==null)continue;if(Array.isArray(d)){t=t.replace(i,Ww({explode:a,name:l,style:c,value:d}));continue}if(typeof d=="object"){t=t.replace(i,Gw({explode:a,name:l,style:c,value:d}));continue}if(c==="matrix"){t=t.replace(i,`;${ic({name:l,value:d})}`);continue}let h=encodeURIComponent(c==="label"?`.${d}`:d);t=t.replace(i,h)}return t},qw=({allowReserved:s,array:e,object:t}={})=>n=>{let i=[];if(n&&typeof n=="object")for(let a in n){let l=n[a];if(l!=null)if(Array.isArray(l)){let c=Ww({allowReserved:s,explode:!0,name:a,style:"form",value:l,...e});c&&i.push(c)}else if(typeof l=="object"){let c=Gw({allowReserved:s,explode:!0,name:a,style:"deepObject",value:l,...t});c&&i.push(c)}else{let c=ic({allowReserved:s,name:a,value:l});c&&i.push(c)}}return i.join("&")},jk=s=>{if(!s)return"stream";let e=s.split(";")[0]?.trim();if(e){if(e.startsWith("application/json")||e.endsWith("+json"))return"json";if(e==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(t=>e.startsWith(t)))return"blob";if(e.startsWith("text/"))return"text"}},zk=async({security:s,...e})=>{for(let t of s){let n=await Nk(t,e.auth);if(!n)continue;let i=t.name??"Authorization";switch(t.in){case"query":e.query||(e.query={}),e.query[i]=n;break;case"cookie":e.headers.append("Cookie",`${i}=${n}`);break;case"header":default:e.headers.set(i,n);break}return}},Gm=s=>$k({baseUrl:s.baseUrl,path:s.path,query:s.query,querySerializer:typeof s.querySerializer=="function"?s.querySerializer:qw(s.querySerializer),url:s.url}),$k=({baseUrl:s,path:e,query:t,querySerializer:n,url:i})=>{let a=i.startsWith("/")?i:`/${i}`,l=(s??"")+a;e&&(l=Fk({path:e,url:l}));let c=t?n(t):"";return c.startsWith("?")&&(c=c.substring(1)),c&&(l+=`?${c}`),l},qm=(s,e)=>{let t={...s,...e};return t.baseUrl?.endsWith("/")&&(t.baseUrl=t.baseUrl.substring(0,t.baseUrl.length-1)),t.headers=Xw(s.headers,e.headers),t},Xw=(...s)=>{let e=new Headers;for(let t of s){if(!t||typeof t!="object")continue;let n=t instanceof Headers?t.entries():Object.entries(t);for(let[i,a]of n)if(a===null)e.delete(i);else if(Array.isArray(a))for(let l of a)e.append(i,l);else a!==void 0&&e.set(i,typeof a=="object"?JSON.stringify(a):a)}return e},Pd=class{constructor(){this._fns=[]}clear(){this._fns=[]}getInterceptorIndex(e){return typeof e=="number"?this._fns[e]?e:-1:this._fns.indexOf(e)}exists(e){let t=this.getInterceptorIndex(e);return!!this._fns[t]}eject(e){let t=this.getInterceptorIndex(e);this._fns[t]&&(this._fns[t]=null)}update(e,t){let n=this.getInterceptorIndex(e);return this._fns[n]?(this._fns[n]=t,e):!1}use(e){return this._fns=[...this._fns,e],this._fns.length-1}},Bk=()=>({error:new Pd,request:new Pd,response:new Pd}),Hk=qw({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),Uk={"Content-Type":"application/json"},Yw=(s={})=>({...Ik,headers:Uk,parseAs:"auto",querySerializer:Hk,...s}),Vk=(s={})=>{let e=qm(Yw(),s),t=()=>({...e}),n=l=>(e=qm(e,l),t()),i=Bk(),a=async l=>{let c={...e,...l,fetch:l.fetch??e.fetch??globalThis.fetch,headers:Xw(e.headers,l.headers)};c.security&&await zk({...c,security:c.security}),c.body&&c.bodySerializer&&(c.body=c.bodySerializer(c.body)),(c.body===void 0||c.body==="")&&c.headers.delete("Content-Type");let d=Gm(c),h={redirect:"follow",...c},f=new Request(d,h);for(let S of i.request._fns)S&&(f=await S(f,c));let g=c.fetch,m=await g(f);for(let S of i.response._fns)S&&(m=await S(m,f,c));let y={request:f,response:m};if(m.ok){if(m.status===204||m.headers.get("Content-Length")==="0")return{data:{},...y};let S=(c.parseAs==="auto"?jk(m.headers.get("Content-Type")):c.parseAs)??"json";if(S==="stream")return{data:m.body,...y};let E=await m[S]();return S==="json"&&(c.responseValidator&&await c.responseValidator(E),c.responseTransformer&&(E=await c.responseTransformer(E))),{data:E,...y}}let x=await m.text();try{x=JSON.parse(x)}catch{}let w=x;for(let S of i.error._fns)S&&(w=await S(x,m,f,c));if(w=w||{},c.throwOnError)throw w;return{error:w,...y}};return{buildUrl:Gm,connect:l=>a({...l,method:"CONNECT"}),delete:l=>a({...l,method:"DELETE"}),get:l=>a({...l,method:"GET"}),getConfig:t,head:l=>a({...l,method:"HEAD"}),interceptors:i,options:l=>a({...l,method:"OPTIONS"}),patch:l=>a({...l,method:"PATCH"}),post:l=>a({...l,method:"POST"}),put:l=>a({...l,method:"PUT"}),request:a,setConfig:n,trace:l=>a({...l,method:"TRACE"})}};const Wk=Vk(Yw());Wk.setConfig({baseUrl:"https://api.cloud.llamaindex.ai/",headers:{"X-SDK-Name":"llamaindex-ts"}});var Gk={bodySerializer:s=>JSON.stringify(s,(e,t)=>typeof t=="bigint"?t.toString():t)},qk=({onRequest:s,onSseError:e,onSseEvent:t,responseTransformer:n,responseValidator:i,sseDefaultRetryDelay:a,sseMaxRetryAttempts:l,sseMaxRetryDelay:c,sseSleepFn:d,url:h,...f})=>{let g;const m=d??(w=>new Promise(S=>setTimeout(S,w)));return{stream:async function*(){let w=a??3e3,S=0;const E=f.signal??new AbortController().signal;for(;!E.aborted;){S++;const P=f.headers instanceof Headers?f.headers:new Headers(f.headers);g!==void 0&&P.set("Last-Event-ID",g);try{const k={redirect:"follow",...f,body:f.serializedBody,headers:P,signal:E};let T=new Request(h,k);s&&(T=await s(h,k));const I=await(f.fetch??globalThis.fetch)(T);if(!I.ok)throw new Error(`SSE failed: ${I.status} ${I.statusText}`);if(!I.body)throw new Error("No body in SSE response");const N=I.body.pipeThrough(new TextDecoderStream).getReader();let D="";const V=()=>{try{N.cancel()}catch{}};E.addEventListener("abort",V);try{for(;;){const{done:j,value:G}=await N.read();if(j)break;D+=G;const Z=D.split(`
202
+
203
+ `);D=Z.pop()??"";for(const K of Z){const J=K.split(`
204
+ `),ee=[];let B;for(const Q of J)if(Q.startsWith("data:"))ee.push(Q.replace(/^data:\s*/,""));else if(Q.startsWith("event:"))B=Q.replace(/^event:\s*/,"");else if(Q.startsWith("id:"))g=Q.replace(/^id:\s*/,"");else if(Q.startsWith("retry:")){const ne=Number.parseInt(Q.replace(/^retry:\s*/,""),10);Number.isNaN(ne)||(w=ne)}let $,M=!1;if(ee.length){const Q=ee.join(`
205
+ `);try{$=JSON.parse(Q),M=!0}catch{$=Q}}M&&(i&&await i($),n&&($=await n($))),t?.({data:$,event:B,id:g,retry:w}),ee.length&&(yield $)}}}finally{E.removeEventListener("abort",V),N.releaseLock()}break}catch(k){if(e?.(k),l!==void 0&&S>=l)break;const T=Math.min(w*2**(S-1),c??3e4);await m(T)}}}()}},Xk=s=>{switch(s){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},Yk=s=>{switch(s){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},Kk=s=>{switch(s){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},Kw=({allowReserved:s,explode:e,name:t,style:n,value:i})=>{if(!e){const c=(s?i:i.map(d=>encodeURIComponent(d))).join(Yk(n));switch(n){case"label":return`.${c}`;case"matrix":return`;${t}=${c}`;case"simple":return c;default:return`${t}=${c}`}}const a=Xk(n),l=i.map(c=>n==="label"||n==="simple"?s?c:encodeURIComponent(c):oc({allowReserved:s,name:t,value:c})).join(a);return n==="label"||n==="matrix"?a+l:l},oc=({allowReserved:s,name:e,value:t})=>{if(t==null)return"";if(typeof t=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${s?t:encodeURIComponent(t)}`},Qw=({allowReserved:s,explode:e,name:t,style:n,value:i,valueOnly:a})=>{if(i instanceof Date)return a?i.toISOString():`${t}=${i.toISOString()}`;if(n!=="deepObject"&&!e){let d=[];Object.entries(i).forEach(([f,g])=>{d=[...d,f,s?g:encodeURIComponent(g)]});const h=d.join(",");switch(n){case"form":return`${t}=${h}`;case"label":return`.${h}`;case"matrix":return`;${t}=${h}`;default:return h}}const l=Kk(n),c=Object.entries(i).map(([d,h])=>oc({allowReserved:s,name:n==="deepObject"?`${t}[${d}]`:d,value:h})).join(l);return n==="label"||n==="matrix"?l+c:c},Qk=/\{[^{}]+\}/g,Jk=({path:s,url:e})=>{let t=e;const n=e.match(Qk);if(n)for(const i of n){let a=!1,l=i.substring(1,i.length-1),c="simple";l.endsWith("*")&&(a=!0,l=l.substring(0,l.length-1)),l.startsWith(".")?(l=l.substring(1),c="label"):l.startsWith(";")&&(l=l.substring(1),c="matrix");const d=s[l];if(d==null)continue;if(Array.isArray(d)){t=t.replace(i,Kw({explode:a,name:l,style:c,value:d}));continue}if(typeof d=="object"){t=t.replace(i,Qw({explode:a,name:l,style:c,value:d,valueOnly:!0}));continue}if(c==="matrix"){t=t.replace(i,`;${oc({name:l,value:d})}`);continue}const h=encodeURIComponent(c==="label"?`.${d}`:d);t=t.replace(i,h)}return t},Zk=({baseUrl:s,path:e,query:t,querySerializer:n,url:i})=>{const a=i.startsWith("/")?i:`/${i}`;let l=(s??"")+a;e&&(l=Jk({path:e,url:l}));let c=t?n(t):"";return c.startsWith("?")&&(c=c.substring(1)),c&&(l+=`?${c}`),l};function eP(s){const e=s.body!==void 0;if(e&&s.bodySerializer)return"serializedBody"in s?s.serializedBody!==void 0&&s.serializedBody!==""?s.serializedBody:null:s.body!==""?s.body:null;if(e)return s.body}var tP=async(s,e)=>{const t=typeof e=="function"?await e(s):e;if(t)return s.scheme==="bearer"?`Bearer ${t}`:s.scheme==="basic"?`Basic ${btoa(t)}`:t},Jw=({allowReserved:s,array:e,object:t}={})=>i=>{const a=[];if(i&&typeof i=="object")for(const l in i){const c=i[l];if(c!=null)if(Array.isArray(c)){const d=Kw({allowReserved:s,explode:!0,name:l,style:"form",value:c,...e});d&&a.push(d)}else if(typeof c=="object"){const d=Qw({allowReserved:s,explode:!0,name:l,style:"deepObject",value:c,...t});d&&a.push(d)}else{const d=oc({allowReserved:s,name:l,value:c});d&&a.push(d)}}return a.join("&")},nP=s=>{if(!s)return"stream";const e=s.split(";")[0]?.trim();if(e){if(e.startsWith("application/json")||e.endsWith("+json"))return"json";if(e==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(t=>e.startsWith(t)))return"blob";if(e.startsWith("text/"))return"text"}},rP=(s,e)=>e?!!(s.headers.has(e)||s.query?.[e]||s.headers.get("Cookie")?.includes(`${e}=`)):!1,sP=async({security:s,...e})=>{for(const t of s){if(rP(e,t.name))continue;const n=await tP(t,e.auth);if(!n)continue;const i=t.name??"Authorization";switch(t.in){case"query":e.query||(e.query={}),e.query[i]=n;break;case"cookie":e.headers.append("Cookie",`${i}=${n}`);break;case"header":default:e.headers.set(i,n);break}}},Xm=s=>Zk({baseUrl:s.baseUrl,path:s.path,query:s.query,querySerializer:typeof s.querySerializer=="function"?s.querySerializer:Jw(s.querySerializer),url:s.url}),Ym=(s,e)=>{const t={...s,...e};return t.baseUrl?.endsWith("/")&&(t.baseUrl=t.baseUrl.substring(0,t.baseUrl.length-1)),t.headers=Zw(s.headers,e.headers),t},iP=s=>{const e=[];return s.forEach((t,n)=>{e.push([n,t])}),e},Zw=(...s)=>{const e=new Headers;for(const t of s){if(!t)continue;const n=t instanceof Headers?iP(t):Object.entries(t);for(const[i,a]of n)if(a===null)e.delete(i);else if(Array.isArray(a))for(const l of a)e.append(i,l);else a!==void 0&&e.set(i,typeof a=="object"?JSON.stringify(a):a)}return e},Td=class{constructor(){this.fns=[]}clear(){this.fns=[]}eject(s){const e=this.getInterceptorIndex(s);this.fns[e]&&(this.fns[e]=null)}exists(s){const e=this.getInterceptorIndex(s);return!!this.fns[e]}getInterceptorIndex(s){return typeof s=="number"?this.fns[s]?s:-1:this.fns.indexOf(s)}update(s,e){const t=this.getInterceptorIndex(s);return this.fns[t]?(this.fns[t]=e,s):!1}use(s){return this.fns.push(s),this.fns.length-1}},oP=()=>({error:new Td,request:new Td,response:new Td}),aP=Jw({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),lP={"Content-Type":"application/json"},e0=(s={})=>({...Gk,headers:lP,parseAs:"auto",querySerializer:aP,...s}),t0=(s={})=>{let e=Ym(e0(),s);const t=()=>({...e}),n=h=>(e=Ym(e,h),t()),i=oP(),a=async h=>{const f={...e,...h,fetch:h.fetch??e.fetch??globalThis.fetch,headers:Zw(e.headers,h.headers),serializedBody:void 0};f.security&&await sP({...f,security:f.security}),f.requestValidator&&await f.requestValidator(f),f.body!==void 0&&f.bodySerializer&&(f.serializedBody=f.bodySerializer(f.body)),(f.body===void 0||f.serializedBody==="")&&f.headers.delete("Content-Type");const g=Xm(f);return{opts:f,url:g}},l=async h=>{const{opts:f,url:g}=await a(h),m={redirect:"follow",...f,body:eP(f)};let y=new Request(g,m);for(const R of i.request.fns)R&&(y=await R(y,f));const x=f.fetch;let w=await x(y);for(const R of i.response.fns)R&&(w=await R(w,y,f));const S={request:y,response:w};if(w.ok){const R=(f.parseAs==="auto"?nP(w.headers.get("Content-Type")):f.parseAs)??"json";if(w.status===204||w.headers.get("Content-Length")==="0"){let N;switch(R){case"arrayBuffer":case"blob":case"text":N=await w[R]();break;case"formData":N=new FormData;break;case"stream":N=w.body;break;case"json":default:N={};break}return f.responseStyle==="data"?N:{data:N,...S}}let I;switch(R){case"arrayBuffer":case"blob":case"formData":case"json":case"text":I=await w[R]();break;case"stream":return f.responseStyle==="data"?w.body:{data:w.body,...S}}return R==="json"&&(f.responseValidator&&await f.responseValidator(I),f.responseTransformer&&(I=await f.responseTransformer(I))),f.responseStyle==="data"?I:{data:I,...S}}const E=await w.text();let P;try{P=JSON.parse(E)}catch{}const k=P??E;let T=k;for(const R of i.error.fns)R&&(T=await R(k,w,y,f));if(T=T||{},f.throwOnError)throw T;return f.responseStyle==="data"?void 0:{error:T,...S}},c=h=>f=>l({...f,method:h}),d=h=>async f=>{const{opts:g,url:m}=await a(f);return qk({...g,body:g.body,headers:g.headers,method:h,onRequest:async(y,x)=>{let w=new Request(y,x);for(const S of i.request.fns)S&&(w=await S(w,g));return w},url:m})};return{buildUrl:Xm,connect:c("CONNECT"),delete:c("DELETE"),get:c("GET"),getConfig:t,head:c("HEAD"),interceptors:i,options:c("OPTIONS"),patch:c("PATCH"),post:c("POST"),put:c("PUT"),request:l,setConfig:n,sse:{connect:d("CONNECT"),delete:d("DELETE"),get:d("GET"),head:d("HEAD"),options:d("OPTIONS"),patch:d("PATCH"),post:d("POST"),put:d("PUT"),trace:d("TRACE")},trace:c("TRACE")}},ac=t0(e0()),cP=s=>(s.client??ac).post({url:"/workflows/{name}/run-nowait",...s,headers:{"Content-Type":"application/json",...s.headers}}),uP=s=>(s.client??ac).get({url:"/events/{handler_id}",...s}),dP=s=>(s.client??ac).post({url:"/events/{handler_id}",...s,headers:{"Content-Type":"application/json",...s.headers}}),hP=s=>(s?.client??ac).get({url:"/handlers",...s});/**
206
+ * @llamaindex/workflows-client
207
+ *
208
+ * TypeScript client for LlamaIndex Workflows server.
209
+ *
210
+ * @license MIT
211
+ */var fP=async(s,e)=>{let t=typeof e=="function"?await e(s):e;if(t)return s.scheme==="bearer"?`Bearer ${t}`:s.scheme==="basic"?`Basic ${btoa(t)}`:t},pP={bodySerializer:s=>JSON.stringify(s,(e,t)=>typeof t=="bigint"?t.toString():t)},gP=s=>{switch(s){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},mP=s=>{switch(s){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},vP=s=>{switch(s){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},n0=({allowReserved:s,explode:e,name:t,style:n,value:i})=>{if(!e){let c=(s?i:i.map(d=>encodeURIComponent(d))).join(mP(n));switch(n){case"label":return`.${c}`;case"matrix":return`;${t}=${c}`;case"simple":return c;default:return`${t}=${c}`}}let a=gP(n),l=i.map(c=>n==="label"||n==="simple"?s?c:encodeURIComponent(c):lc({allowReserved:s,name:t,value:c})).join(a);return n==="label"||n==="matrix"?a+l:l},lc=({allowReserved:s,name:e,value:t})=>{if(t==null)return"";if(typeof t=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${s?t:encodeURIComponent(t)}`},r0=({allowReserved:s,explode:e,name:t,style:n,value:i})=>{if(i instanceof Date)return`${t}=${i.toISOString()}`;if(n!=="deepObject"&&!e){let c=[];Object.entries(i).forEach(([h,f])=>{c=[...c,h,s?f:encodeURIComponent(f)]});let d=c.join(",");switch(n){case"form":return`${t}=${d}`;case"label":return`.${d}`;case"matrix":return`;${t}=${d}`;default:return d}}let a=vP(n),l=Object.entries(i).map(([c,d])=>lc({allowReserved:s,name:n==="deepObject"?`${t}[${c}]`:c,value:d})).join(a);return n==="label"||n==="matrix"?a+l:l},yP=/\{[^{}]+\}/g,wP=({path:s,url:e})=>{let t=e,n=e.match(yP);if(n)for(let i of n){let a=!1,l=i.substring(1,i.length-1),c="simple";l.endsWith("*")&&(a=!0,l=l.substring(0,l.length-1)),l.startsWith(".")?(l=l.substring(1),c="label"):l.startsWith(";")&&(l=l.substring(1),c="matrix");let d=s[l];if(d==null)continue;if(Array.isArray(d)){t=t.replace(i,n0({explode:a,name:l,style:c,value:d}));continue}if(typeof d=="object"){t=t.replace(i,r0({explode:a,name:l,style:c,value:d}));continue}if(c==="matrix"){t=t.replace(i,`;${lc({name:l,value:d})}`);continue}let h=encodeURIComponent(c==="label"?`.${d}`:d);t=t.replace(i,h)}return t},s0=({allowReserved:s,array:e,object:t}={})=>n=>{let i=[];if(n&&typeof n=="object")for(let a in n){let l=n[a];if(l!=null)if(Array.isArray(l)){let c=n0({allowReserved:s,explode:!0,name:a,style:"form",value:l,...e});c&&i.push(c)}else if(typeof l=="object"){let c=r0({allowReserved:s,explode:!0,name:a,style:"deepObject",value:l,...t});c&&i.push(c)}else{let c=lc({allowReserved:s,name:a,value:l});c&&i.push(c)}}return i.join("&")},bP=s=>{if(!s)return"stream";let e=s.split(";")[0]?.trim();if(e){if(e.startsWith("application/json")||e.endsWith("+json"))return"json";if(e==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(t=>e.startsWith(t)))return"blob";if(e.startsWith("text/"))return"text"}},xP=async({security:s,...e})=>{for(let t of s){let n=await fP(t,e.auth);if(!n)continue;let i=t.name??"Authorization";switch(t.in){case"query":e.query||(e.query={}),e.query[i]=n;break;case"cookie":e.headers.append("Cookie",`${i}=${n}`);break;case"header":default:e.headers.set(i,n);break}return}},Km=s=>SP({baseUrl:s.baseUrl,path:s.path,query:s.query,querySerializer:typeof s.querySerializer=="function"?s.querySerializer:s0(s.querySerializer),url:s.url}),SP=({baseUrl:s,path:e,query:t,querySerializer:n,url:i})=>{let a=i.startsWith("/")?i:`/${i}`,l=(s??"")+a;e&&(l=wP({path:e,url:l}));let c=t?n(t):"";return c.startsWith("?")&&(c=c.substring(1)),c&&(l+=`?${c}`),l},Qm=(s,e)=>{let t={...s,...e};return t.baseUrl?.endsWith("/")&&(t.baseUrl=t.baseUrl.substring(0,t.baseUrl.length-1)),t.headers=i0(s.headers,e.headers),t},i0=(...s)=>{let e=new Headers;for(let t of s){if(!t||typeof t!="object")continue;let n=t instanceof Headers?t.entries():Object.entries(t);for(let[i,a]of n)if(a===null)e.delete(i);else if(Array.isArray(a))for(let l of a)e.append(i,l);else a!==void 0&&e.set(i,typeof a=="object"?JSON.stringify(a):a)}return e},Rd=class{constructor(){this._fns=[]}clear(){this._fns=[]}getInterceptorIndex(s){return typeof s=="number"?this._fns[s]?s:-1:this._fns.indexOf(s)}exists(s){let e=this.getInterceptorIndex(s);return!!this._fns[e]}eject(s){let e=this.getInterceptorIndex(s);this._fns[e]&&(this._fns[e]=null)}update(s,e){let t=this.getInterceptorIndex(s);return this._fns[t]?(this._fns[t]=e,s):!1}use(s){return this._fns=[...this._fns,s],this._fns.length-1}},AP=()=>({error:new Rd,request:new Rd,response:new Rd}),EP=s0({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),_P={"Content-Type":"application/json"},o0=(s={})=>({...pP,headers:_P,parseAs:"auto",querySerializer:EP,...s}),CP=(s={})=>{let e=Qm(o0(),s),t=()=>({...e}),n=l=>(e=Qm(e,l),t()),i=AP(),a=async l=>{let c={...e,...l,fetch:l.fetch??e.fetch??globalThis.fetch,headers:i0(e.headers,l.headers)};c.security&&await xP({...c,security:c.security}),c.body&&c.bodySerializer&&(c.body=c.bodySerializer(c.body)),(c.body===void 0||c.body==="")&&c.headers.delete("Content-Type");let d=Km(c),h={redirect:"follow",...c},f=new Request(d,h);for(let S of i.request._fns)S&&(f=await S(f,c));let g=c.fetch,m=await g(f);for(let S of i.response._fns)S&&(m=await S(m,f,c));let y={request:f,response:m};if(m.ok){if(m.status===204||m.headers.get("Content-Length")==="0")return{data:{},...y};let S=(c.parseAs==="auto"?bP(m.headers.get("Content-Type")):c.parseAs)??"json";if(S==="stream")return{data:m.body,...y};let E=await m[S]();return S==="json"&&(c.responseValidator&&await c.responseValidator(E),c.responseTransformer&&(E=await c.responseTransformer(E))),{data:E,...y}}let x=await m.text();try{x=JSON.parse(x)}catch{}let w=x;for(let S of i.error._fns)S&&(w=await S(x,m,f,c));if(w=w||{},c.throwOnError)throw w;return{error:w,...y}};return{buildUrl:Km,connect:l=>a({...l,method:"CONNECT"}),delete:l=>a({...l,method:"DELETE"}),get:l=>a({...l,method:"GET"}),getConfig:t,head:l=>a({...l,method:"HEAD"}),interceptors:i,options:l=>a({...l,method:"OPTIONS"}),patch:l=>a({...l,method:"PATCH"}),post:l=>a({...l,method:"POST"}),put:l=>a({...l,method:"PUT"}),request:a,setConfig:n,trace:l=>a({...l,method:"TRACE"})}};CP(o0());var a0=A.createContext(null);function kP({children:s,clients:e}){const t=A.useMemo(()=>({clients:e}),[e]);return _.jsx(a0.Provider,{value:t,children:s})}function PP(){const s=A.useContext(a0);if(!s)throw new Error("useApiContext must be used within an ApiProvider. Please wrap your component tree with <ApiProvider>.");return s}function cc(){const{clients:s}=PP();if(!s.workflowsClient)throw new Error("No workflows client configured. Please ensure workflowsClient is configured in ApiProvider.");return s.workflowsClient}var TP=class{constructor(){this.activeStreams=new Map}subscribe(s,e,t,n){const i=this.activeStreams.get(s);return i?this.subscribeToExistingStream(s,i,e,n):this.createNewStream(s,e,t,n)}getStreamEvents(s){const e=this.activeStreams.get(s);return e?[...e.events]:[]}isStreamActive(s){return this.activeStreams.has(s)}getSubscriberCount(s){const e=this.activeStreams.get(s);return e?e.subscribers.size:0}closeStream(s){const e=this.activeStreams.get(s);e&&(e.controller.abort(),this.cleanupStream(s))}closeAllStreams(){for(const s of this.activeStreams.keys())this.closeStream(s)}subscribeToExistingStream(s,e,t,n){var i,a,l,c,d;e.subscribers.add(t);try{(i=t.onStart)==null||i.call(t);for(const g of e.events)(a=t.onData)==null||a.call(t,g);e.isCompleted&&(e.error?(l=t.onError)==null||l.call(t,e.error):(c=t.onFinish)==null||c.call(t,e.events),(d=t.onComplete)==null||d.call(t))}catch(g){console.error("Error sending historical events to subscriber:",g)}const h=()=>{this.unsubscribe(s,t)};n&&(n.aborted?this.unsubscribe(s,t):n.addEventListener("abort",h));const f=()=>{n&&n.removeEventListener("abort",h),this.unsubscribe(s,t)};return{promise:e.promise,unsubscribe:f}}createNewStream(s,e,t,n){const i=new AbortController,a=new Set([e]),l=[],c={controller:i,promise:Promise.resolve([]),subscribers:a,events:l,isCompleted:!1,error:null};this.activeStreams.set(s,c);const d=()=>{this.unsubscribe(s,e)};if(n){if(n.aborted)return this.unsubscribe(s,e),{promise:Promise.resolve([]),unsubscribe:()=>{}};n.addEventListener("abort",d)}const h={onStart:()=>{c.subscribers.forEach(m=>{var y;try{(y=m.onStart)==null||y.call(m)}catch(x){console.error("Error in subscriber onStart:",x)}})},onData:m=>{l.push(m),c.subscribers.forEach(y=>{var x;try{(x=y.onData)==null||x.call(y,m)}catch(w){console.error("Error in subscriber onData:",w)}})},onError:m=>{c.error=m,c.isCompleted=!0,c.subscribers.forEach(y=>{var x,w;try{(x=y.onError)==null||x.call(y,m),(w=y.onComplete)==null||w.call(y)}catch(S){console.error("Error in subscriber onError:",S)}}),this.cleanupStream(s)},onFinish:m=>{c.isCompleted=!0,c.subscribers.forEach(y=>{var x,w;try{(x=y.onFinish)==null||x.call(y,m),(w=y.onComplete)==null||w.call(y)}catch(S){console.error("Error in subscriber onFinish:",S)}}),this.cleanupStream(s)}},f=this.executeStream(t,h,i.signal);return c.promise=f,{promise:f,unsubscribe:()=>{n&&n.removeEventListener("abort",d),this.unsubscribe(s,e)}}}async executeStream(s,e,t){var n;try{return await s(e,t)}catch(i){const a=i instanceof Error?i:new Error(String(i));throw(n=e.onError)==null||n.call(e,a),a}}unsubscribe(s,e){const t=this.activeStreams.get(s);if(t&&(t.subscribers.delete(e),t.subscribers.size===0)){try{t.controller.abort()}catch{}this.cleanupStream(s)}}cleanupStream(s){this.activeStreams.delete(s)}},sh=new TP;async function RP(s){var e,t;return((t=(e=(await hP({client:s.client})).data)==null?void 0:e.handlers)!=null?t:[]).filter(a=>a.status==="running").map(a=>{var l;return{handler_id:(l=a.handler_id)!=null?l:"",status:a.status}})}async function NP(s){var e;const t=await cP({client:s.client,path:{name:s.workflowName},body:{start_event:s.eventData}});if(!t.data)throw new Error("Handler creation failed");return{handler_id:(e=t.data.handler_id)!=null?e:"",status:"running",workflowName:s.workflowName}}async function IP(s,e){const t=`handler:${s.handlerId}`,n=async(l,c)=>{var d,h;const g=(await uP({client:s.client,path:{handler_id:s.handlerId},query:{sse:!1},parseAs:"stream"})).response;if(!g.ok)throw new Error(`HTTP error! status: ${g.status}`);const m=(d=g.body)==null?void 0:d.getReader();if(!m)throw new Error("No reader available");const y=new TextDecoder,x=[];let w=[];try{for(;;){if(c.aborted)throw new Error("Stream aborted");const{done:S,value:E}=await m.read();if(S)break;let P=y.decode(E,{stream:!0});w.length>0&&(P=`${w.join("")}${P}`,w=[]);const{events:k,failedLines:T}=LP(P);if(w.push(...T),!k.length)continue;x.push(...k),k.forEach(I=>{var N;return(N=l.onData)==null?void 0:N.call(l,I)});const R=k.find(I=>I.type==="workflow.events.StopEvent");if(R){e?.onStopEvent&&e.onStopEvent(R);break}}return(h=l.onFinish)==null||h.call(l,x),x}finally{m.releaseLock()}},i={onStart:e?.onStart,onData:e?.onData,onError:e?.onError,onFinish:e?.onFinish},{promise:a}=sh.subscribe(t,i,n,s.signal);return a}async function Jm(s){const e=DP(s.event);return(await dP({client:s.client,path:{handler_id:s.handlerId},body:{event:JSON.stringify(e),step:s.step}})).data}function LP(s){if(typeof s!="string")return{events:[],failedLines:[]};const t=s.trim().split(`
212
+ `).filter(a=>a.trim()!=="").map(a=>MP(a)).filter(Boolean),n=t.map(a=>a?.event).filter(Boolean),i=t.filter(a=>!a?.event).map(a=>a?.line||"").filter(Boolean);return{events:n,failedLines:i}}function MP(s){try{const e=JSON.parse(s);return OP(e)?{line:s,event:{type:e.qualified_name,data:e.value}}:null}catch(e){return console.error(`Failed to parse chunk in line: ${s}`,e),{line:s,event:null}}}function DP(s){var e;return{__is_pydantic:!0,value:(e=s.data)!=null?e:{},qualified_name:s.type}}function OP(s){return s&&typeof s=="object"&&"__is_pydantic"in s&&"value"in s&&"qualified_name"in s&&typeof s.qualified_name=="string"}var FP=s=>xk()((e,t)=>({handlers:{},events:{},clearCompleted:()=>e({handlers:Object.fromEntries(Object.entries(t().handlers).filter(([,n])=>n.status!=="complete"&&n.status!=="failed"))}),createHandler:async(n,i)=>{var a;const c={handler_id:(a=(await NP({client:s,eventData:i,workflowName:n})).handler_id)!=null?a:"",status:"running",workflowName:n};e(d=>({handlers:Ft(Fe({},d.handlers),{[c.handler_id]:c}),events:Ft(Fe({},d.events),{[c.handler_id]:[]})}));try{t().subscribe(c.handler_id)}catch(d){console.error(`Failed to auto-subscribe to handler ${c.handler_id}:`,d)}return c},clearEvents:n=>e(i=>({events:Ft(Fe({},i.events),{[n]:[]})})),sync:async()=>{try{const n=await RP({client:s}),i=Object.fromEntries(n.map(a=>[a.handler_id,a]));e({handlers:i}),n.forEach(a=>{a.status==="running"&&!t().isSubscribed(a.handler_id)&&t().subscribe(a.handler_id)})}catch(n){console.error("Failed to sync with server:",n)}},subscribe:n=>{const i=t().handlers[n];if(!i){console.warn(`Handler ${n} not found for subscription`);return}if(t().isSubscribed(n))return;const a={onData:l=>{e(c=>({events:Ft(Fe({},c.events),{[n]:[...c.events[n]||[],l]})}))},onFinish:()=>{e(l=>({handlers:Ft(Fe({},l.handlers),{[n]:Ft(Fe({},l.handlers[n]),{status:"complete",updatedAt:new Date})})}))},onError:l=>{l.name==="AbortError"||l.name==="TypeError"&&l.message.includes("network error")||e(c=>({handlers:Ft(Fe({},c.handlers),{[n]:Ft(Fe({},c.handlers[n]),{status:"failed",updatedAt:new Date})})}))}};IP({client:s,handlerId:i.handler_id},a).catch(l=>{l.name==="AbortError"||l.name==="TypeError"&&l.message.includes("network error")||e(c=>({handlers:Ft(Fe({},c.handlers),{[n]:Ft(Fe({},c.handlers[n]),{status:"failed",updatedAt:new Date})})}))})},unsubscribe:n=>{if(!t().handlers[n])return;const a=`handler:${n}`;sh.closeStream(a)},isSubscribed:n=>{if(!t().handlers[n])return!1;const a=`handler:${n}`;return sh.isStreamActive(a)}})),Nd=null;function Ur(s){const e=cc(),t=A.useMemo(()=>(Nd||(Nd=FP(e)),Nd),[e]);return s?t(s):t()}function jP(){const[s,e]=A.useState(!1),[t,n]=A.useState(null),i=Ur(l=>l.createHandler);return{runWorkflow:A.useCallback(async(l,c)=>{e(!0),n(null);try{const d=await i(l,c);return e(!1),d}catch(d){const h=d instanceof Error?d:new Error(String(d));throw n(h),e(!1),h}},[i]),isCreating:s,error:t}}function zP(s,e){return s.filter(t=>t.workflowName?t.workflowName===e:t.status==="running")}function $P(s){const[e,t]=A.useState(!0),[n,i]=A.useState(null),a=Ur(),l=a.handlers,c=a.clearCompleted,d=a.sync;return A.useEffect(()=>{async function f(){t(!0),i(null);try{await d()}catch(g){i(g instanceof Error?g.message:"Failed to sync with server")}finally{t(!1)}}f()},[d]),{handlers:A.useMemo(()=>zP(Object.values(l),s),[l,s]),clearCompleted:c,loading:e,error:n}}function l0(s,e=!0){const t=cc(),n=Ur(y=>y.handlers[s]||null),i=Ur(y=>y.events),a=Ur(y=>y.subscribe),l=Ur(y=>y.unsubscribe),c=Ur(y=>y.isSubscribed),d=Ur(y=>y.clearEvents),h=A.useMemo(()=>i[s]||[],[i,s]);A.useEffect(()=>{if(!(!n||!e)&&n.status==="running")return a(s),()=>{n.status!=="running"&&l(s)}},[s,n,e,a,l]);const f=A.useCallback(()=>{l(s)},[s,l]),g=A.useCallback(()=>{d(s)},[s,d]),m=A.useCallback(async y=>{await Jm({client:t,handlerId:s,event:y})},[s,t,Jm]);return{handler:n,events:h,isStreaming:c(s),stopStreaming:f,clearEvents:g,sendEvent:m}}var BP=qv("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function HP(s){var e=s,{className:t,variant:n,asChild:i=!1}=e,a=it(e,["className","variant","asChild"]);const l=i?Gv:"span";return _.jsx(l,Fe({"data-slot":"badge",className:vt(BP({variant:n}),t)},a))}const UP="modulepreload",VP=function(s){return"/"+s},Zm={},Bh=function(e,t,n){let i=Promise.resolve();if(t&&t.length>0){let d=function(h){return Promise.all(h.map(f=>Promise.resolve(f).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");i=d(t.map(h=>{if(h=VP(h),h in Zm)return;Zm[h]=!0;const f=h.endsWith(".css"),g=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const m=document.createElement("link");if(m.rel=f?"stylesheet":UP,f||(m.as="script"),m.crossOrigin="",m.href=h,c&&m.setAttribute("nonce",c),document.head.appendChild(m),f)return new Promise((y,x)=>{m.addEventListener("load",y),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${h}`)))})}))}function a(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return i.then(l=>{for(const c of l||[])c.status==="rejected"&&a(c.reason);return e().catch(a)})};function WP({boundingBoxes:s,zoom:e,containerWidth:t,containerHeight:n,onBoundingBoxClick:i}){return t===0||n===0?null:_.jsx("svg",{style:{position:"absolute",top:0,left:0,width:t*e,height:n*e,pointerEvents:"none"},viewBox:`0 0 ${t} ${n}`,children:s.map(a=>_.jsxs("g",{children:[_.jsx("rect",{x:a.x,y:a.y,width:a.width,height:a.height,fill:a.color||"rgba(255, 0, 0, 0.2)",stroke:a.color||"red",strokeWidth:2/e,style:{pointerEvents:"auto",cursor:i?"pointer":"default"},onClick:()=>i?.(a)}),a.label&&_.jsx("text",{x:a.x,y:a.y-5,fill:a.color||"red",fontSize:12/e,fontWeight:"bold",children:a.label})]},a.id))})}var GP=({currentPage:s,totalPages:e,scale:t,onPageChange:n,onScaleChange:i,onDownload:a,onReset:l})=>{const[c,d]=A.useState(s.toString()),[h,f]=A.useState(!1);A.useEffect(()=>{h||d(s.toString())},[s,h]);const g=T=>{d(T),f(!0)},m=()=>{const T=parseInt(c);T>=1&&T<=e?n(T):d(s.toString()),f(!1)},y=T=>{T.key==="Enter"&&m()},x=()=>{f(!0)},w=()=>{s>1&&n(s-1)},S=()=>{s<e&&n(s+1)},E=()=>{i(Math.min(t+.25,3))},P=()=>{i(Math.max(t-.25,.5))},k=()=>{i(1),l?.()};return _.jsx("div",{className:"absolute bottom-6 left-1/2 transform -translate-x-1/2 z-50",children:_.jsxs("div",{className:"bg-white/95 backdrop-blur-sm border rounded-lg shadow-lg px-4 py-2 flex items-center gap-3",children:[_.jsxs("div",{className:"flex items-center gap-1",children:[_.jsx(en,{variant:"ghost",size:"sm",onClick:w,disabled:s<=1,className:"h-8 w-8 p-0",children:_.jsx(oA,{className:"h-4 w-4"})}),_.jsxs("div",{className:"flex items-center justify-center gap-1",children:[_.jsx($h,{type:"number",value:c,onChange:T=>g(T.target.value),onFocus:x,onBlur:m,onKeyDown:y,className:"h-7 w-7 px-1 text-center text-sm rounded-sm [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:m-0 [-moz-appearance:textfield]",min:1,max:e}),_.jsx("span",{className:"text-sm text-muted-foreground",children:"/"}),_.jsx("span",{className:"flex items-center text-sm text-muted-foreground h-7",children:e})]}),_.jsx(en,{variant:"ghost",size:"sm",onClick:S,disabled:s>=e,className:"h-8 w-8 p-0",children:_.jsx(Yv,{className:"h-4 w-4"})})]}),_.jsx("div",{className:"w-px h-6 bg-border"}),_.jsxs("div",{className:"flex items-center gap-1",children:[_.jsx(en,{variant:"ghost",size:"sm",onClick:P,disabled:t<=.5,className:"h-8 w-8 p-0",title:"Zoom Out",children:_.jsx(NA,{className:"h-4 w-4"})}),_.jsxs("span",{className:"text-sm text-muted-foreground text-center",children:[Math.round(t*100),"%"]}),_.jsx(en,{variant:"ghost",size:"sm",onClick:E,disabled:t>=3,className:"h-8 w-8 p-0",title:"Zoom In",children:_.jsx(TA,{className:"h-4 w-4"})}),_.jsx(en,{variant:"ghost",size:"sm",onClick:k,className:"h-8 w-8 p-0",title:"Reset Zoom",children:_.jsx(AA,{className:"h-4 w-4"})})]}),a&&_.jsx("div",{className:"w-px h-6 bg-border"}),a&&_.jsx(en,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",title:"Download PDF",children:_.jsx(gA,{className:"h-4 w-4"})})]})})};A.memo(({url:s,highlight:e})=>{if(typeof window>"u")return null;const t=A.lazy(()=>Bh(()=>Promise.resolve().then(()=>MN),void 0).then(n=>({default:n.PdfPreviewImpl})));return _.jsx(A.Suspense,{fallback:_.jsxs("div",{className:"flex items-center justify-center p-8",children:[_.jsx(hA,{className:"h-6 w-6 animate-pulse text-gray-400"}),_.jsx("span",{className:"ml-2 text-gray-600",children:"Loading PDF viewer..."})]}),children:_.jsx(t,{url:s,highlight:e})})});function qP({selectedWorkflow:s,onRunStart:e,activeHandlerId:t}){const[n,i]=A.useState(null),[a,l]=A.useState({}),[c,d]=A.useState(!1),[h,f]=A.useState(null),[g,m]=A.useState(null),[y,x]=A.useState(!1),w=cc(),{runWorkflow:S,isCreating:E,error:P}=jP(),{handler:k,events:T}=l0(t??"",!!t);A.useEffect(()=>{s?R():(i(null),l({}))},[s,w]),A.useEffect(()=>{m(null),x(!1)},[t]),A.useEffect(()=>{if(!t||!k)return;const j=k.status==="complete"||k.status==="failed",G=T.some(Z=>Z.type.endsWith(".StopEvent"));(j||G)&&!g&&!y&&I()},[k,T,t,g,y]);const R=async()=>{if(s)try{d(!0),f(null);const j=await fetch(`${w.getConfig().baseUrl}/workflows/${encodeURIComponent(s)}/schema`);if(!j.ok)throw new Error(`HTTP ${j.status}: ${j.statusText}`);const G=await j.json();i(G.start||null),l({})}catch(j){f(j instanceof Error?j.message:"Failed to fetch schema"),i(null)}finally{d(!1)}},I=async()=>{if(t)try{x(!0);const j=await fetch(`${w.getConfig().baseUrl}/results/${t}`);if(j.ok){const G=await j.json();m(G.result||G)}}catch(j){console.error("Failed to fetch final result:",j)}finally{x(!1)}},N=(j,G)=>{l(Z=>({...Z,[j]:G}))},D=async()=>{if(s)try{const j=await S(s,a);e(j.handler_id)}catch(j){console.error("Failed to run workflow:",j)}},V=(j,G)=>{const Z=n?.required?.includes(j)||!1,K=G.title||j,J=G.type||"string",ee=G.description||"",B=`field-${j}`;return J==="string"?_.jsxs("div",{className:"space-y-2",children:[_.jsxs("label",{htmlFor:B,className:"text-sm font-medium",children:[K,Z&&_.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),_.jsx(kd,{id:B,value:a[j]||"",onChange:$=>N(j,$.target.value),placeholder:ee||`Enter ${K.toLowerCase()}`,rows:3}),ee&&_.jsx("p",{className:"text-xs text-muted-foreground",children:ee})]},j):J==="number"||J==="integer"?_.jsxs("div",{className:"space-y-2",children:[_.jsxs("label",{htmlFor:B,className:"text-sm font-medium",children:[K,Z&&_.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),_.jsx($h,{id:B,type:"number",value:a[j]||"",onChange:$=>N(j,parseFloat($.target.value)||""),placeholder:ee||`Enter ${K.toLowerCase()}`,step:J==="integer"?"1":"any"}),ee&&_.jsx("p",{className:"text-xs text-muted-foreground",children:ee})]},j):J==="boolean"?_.jsxs("div",{className:"space-y-2",children:[_.jsxs("label",{htmlFor:B,className:"text-sm font-medium",children:[K,Z&&_.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),_.jsxs(jw,{onValueChange:$=>N(j,$==="true"),children:[_.jsx($w,{children:_.jsx(zw,{placeholder:"Select..."})}),_.jsxs(Bw,{children:[_.jsx(th,{value:"true",children:"True"}),_.jsx(th,{value:"false",children:"False"})]})]}),ee&&_.jsx("p",{className:"text-xs text-muted-foreground",children:ee})]},j):_.jsxs("div",{className:"space-y-2",children:[_.jsxs("label",{htmlFor:B,className:"text-sm font-medium",children:[K," (JSON)",Z&&_.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),_.jsx(kd,{id:B,value:a[j]?JSON.stringify(a[j],null,2):"",onChange:$=>{try{const M=JSON.parse($.target.value);N(j,M)}catch{N(j,$.target.value)}},placeholder:ee||`Enter ${K.toLowerCase()} (JSON format)`,className:"font-mono",rows:3}),ee&&_.jsx("p",{className:"text-xs text-muted-foreground",children:ee})]},j)};return s?_.jsxs("div",{className:"h-full flex flex-col",children:[_.jsx("div",{className:"p-4 border-b border-border",children:_.jsxs("h2",{className:"font-semibold text-sm",children:["Configure: ",s]})}),_.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[c&&_.jsxs("div",{className:"space-y-4",children:[_.jsx(Wr,{className:"h-4 w-32"}),_.jsx(Wr,{className:"h-20 w-full"}),_.jsx(Wr,{className:"h-4 w-32"}),_.jsx(Wr,{className:"h-20 w-full"})]}),h&&_.jsxs("div",{className:"text-destructive text-sm p-3 bg-destructive/10 border border-destructive/20 rounded",children:["Error loading schema: ",h]}),P&&_.jsxs("div",{className:"text-destructive text-sm p-3 bg-destructive/10 border border-destructive/20 rounded",children:["Error running workflow:"," ",typeof P=="string"?P:P.message||"Unknown error"]}),!c&&!h&&_.jsx(_.Fragment,{children:_.jsx("div",{className:"space-y-4",children:n?.properties&&Object.keys(n.properties).length>0?Object.entries(n.properties).map(([j,G])=>V(j,G)):_.jsxs("div",{className:"space-y-2",children:[_.jsx("label",{htmlFor:"raw-input",className:"text-sm font-medium",children:"Input (JSON)"}),_.jsx(kd,{id:"raw-input",value:JSON.stringify(a,null,2),onChange:j=>{try{const G=JSON.parse(j.target.value);l(G)}catch{}},placeholder:'{"key": "value"}',className:"font-mono",rows:8})]})})})]}),(g||y)&&_.jsxs("div",{className:"p-4 border-t border-border",children:[_.jsx("h4",{className:"font-medium text-sm mb-2",children:"Final Result"}),y?_.jsx("div",{className:"bg-muted p-3 rounded",children:_.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading result..."})}):_.jsx("div",{className:"bg-green-100/50 border border-green-200 dark:bg-green-900/20 dark:border-green-800 rounded p-3",children:_.jsx("pre",{className:"text-sm text-green-800 dark:text-green-300 whitespace-pre-wrap break-words",children:JSON.stringify(g,null,2)})})]}),!c&&!h&&_.jsx("div",{className:"p-4 border-t border-border",children:_.jsx(en,{onClick:D,disabled:E,className:"w-full",children:E?"Starting...":"Run Workflow"})})]}):_.jsxs("div",{className:"h-full flex flex-col",children:[_.jsx("div",{className:"p-4 border-b border-border",children:_.jsx("h2",{className:"font-semibold text-sm",children:"Workflow Configuration"})}),_.jsx("div",{className:"flex-1 flex items-center justify-center",children:_.jsx("p",{className:"text-muted-foreground text-center",children:"Select a workflow to configure and run"})})]})}function XP({activeHandlerId:s,onHandlerSelect:e}){const{handlers:t,loading:n,error:i}=$P(""),[a,l]=A.useState([]);A.useEffect(()=>{t&&l(f=>{const g=new Set(t.map(y=>y.handler_id)),m=f.filter(y=>!g.has(y.handler_id));return[...t,...m]})},[t]);const c=(f,g)=>{l(m=>m.some(x=>x.handler_id===f)?m:[{handler_id:f,status:"running",workflow_name:g},...m])};A.useEffect(()=>(window.__addLocalHandler=c,()=>{delete window.__addLocalHandler}),[]);const d=f=>{const g=f.workflow_name||"Unknown",m=f.handler_id.slice(-8);return`${g} - ${m}`},h=f=>{switch(f?.toLowerCase()){case"completed":case"success":return"text-green-700 bg-green-100 dark:text-green-300 dark:bg-green-900/30";case"failed":case"error":return"text-destructive bg-destructive/10";case"running":case"in_progress":return"text-blue-700 bg-blue-100 dark:text-blue-300 dark:bg-blue-900/30";default:return"text-muted-foreground bg-muted"}};return _.jsxs("div",{className:"h-full flex flex-col",children:[_.jsx("div",{className:"p-4 border-b border-border",children:_.jsx("div",{className:"flex items-center justify-between",children:_.jsx("h2",{className:"font-semibold text-sm",children:"Recent Runs"})})}),_.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i&&_.jsxs("div",{className:"m-4 text-destructive text-sm p-3 bg-destructive/10 border border-destructive/20 rounded",children:["Error: ",i?String(i):"Unknown error"]}),n&&_.jsxs("div",{className:"p-4 space-y-2",children:[_.jsx(Wr,{className:"h-12 w-full"}),_.jsx(Wr,{className:"h-12 w-full"}),_.jsx(Wr,{className:"h-12 w-full"})]}),!n&&_.jsx("div",{className:"p-2",children:a.length===0?_.jsx("div",{className:"text-muted-foreground text-sm p-4 text-center",children:"No runs yet. Start a workflow to see runs here."}):a.map(f=>_.jsx("button",{onClick:()=>e(f.handler_id),className:`w-full text-left p-3 rounded mb-2 transition-colors ${s===f.handler_id?"bg-primary text-primary-foreground":"bg-background hover:bg-accent hover:text-accent-foreground"}`,children:_.jsxs("div",{className:"flex justify-between items-start",children:[_.jsxs("div",{className:"flex-1 min-w-0",children:[_.jsx("p",{className:"font-medium text-sm truncate",children:d(f)}),_.jsx("p",{className:"text-xs opacity-75 font-mono",children:f.handler_id})]}),_.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${s===f.handler_id?"bg-primary-foreground/20 text-primary-foreground":h(f.status)}`,children:f.status})]})},f.handler_id))})]})]})}function YP({handlerId:s}){const{handler:e,events:t}=l0(s??"",!!s),[n,i]=A.useState(!0),[a,l]=A.useState(new Set),c=h=>{const f=new Set(a);f.has(h)?f.delete(h):f.add(h),l(f)},d=h=>!h||typeof h!="object"?String(h||""):n?JSON.stringify(h):JSON.stringify(h,null,2);return s?_.jsxs("div",{className:"h-full flex flex-col",children:[_.jsxs("div",{className:"p-4 border-b border-border",children:[_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsx("h2",{className:"font-semibold text-sm",children:"Run Details"}),_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx(en,{variant:"ghost",size:"sm",onClick:()=>i(!n),children:n?"Formatted":"Compact"}),e&&_.jsx(HP,{variant:e.status==="complete"?"default":"secondary",children:e.status})]})]}),e&&_.jsx("p",{className:"text-xs text-muted-foreground font-mono mt-1",children:e.handler_id})]}),_.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:_.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[_.jsx("div",{className:"p-4 pb-2",children:_.jsxs("h4",{className:"font-medium text-sm",children:["Event Stream (",t.length," events)"]})}),_.jsx("div",{className:"flex-1 overflow-auto",children:t.length===0?_.jsx("div",{className:"flex-1 flex items-center justify-center",children:_.jsx("p",{className:"text-muted-foreground text-sm",children:"No events yet..."})}):_.jsxs(Hw,{children:[_.jsx(Uw,{className:"sticky top-0 bg-background",children:_.jsxs(nh,{children:[_.jsx(Rl,{className:"w-12",children:"#"}),_.jsx(Rl,{children:"Event"}),_.jsx(Rl,{className:"w-12"})]})}),_.jsx(Vw,{children:t.map((h,f)=>_.jsxs(nh,{className:"group",children:[_.jsx(Nl,{className:"text-xs text-muted-foreground align-top",children:f+1}),_.jsx(Nl,{className:"py-3",children:_.jsxs("div",{className:"space-y-2",children:[_.jsx("div",{children:_.jsx("code",{className:"text-sm font-mono",children:h.type})}),_.jsx("div",{className:`text-xs font-mono bg-muted/50 p-2 rounded border ${n?"":"whitespace-pre-wrap"}`,children:d(h.data)})]})}),_.jsx(Nl,{className:"align-top",children:_.jsx(en,{variant:"ghost",size:"sm",onClick:()=>c(f),className:"opacity-0 group-hover:opacity-100 transition-opacity",children:a.has(f)?_.jsx(wh,{className:"h-3 w-3"}):_.jsx(Yv,{className:"h-3 w-3"})})})]},f))})]})})]})})]}):_.jsxs("div",{className:"h-full flex flex-col",children:[_.jsx("div",{className:"p-4 border-b border-border",children:_.jsx("h2",{className:"font-semibold text-sm",children:"Run Details"})}),_.jsx("div",{className:"flex-1 flex items-center justify-center",children:_.jsx("p",{className:"text-muted-foreground text-center",children:"Select a run to see details and events"})})]})}function KP(){const e=new URLSearchParams(window.location.search).get("api");return e?e.endsWith("/")?e.slice(0,-1):e:"http://localhost:8000"}function QP(){const[s,e]=A.useState(KP),[t,n]=A.useState(s),[i,a]=A.useState(null),[l,c]=A.useState(null),[d,h]=A.useState([]),[f,g]=A.useState(!0),[m,y]=A.useState(50),[x,w]=A.useState(!1),[S,E]=A.useState(!1),P=cc();A.useEffect(()=>{P.setConfig({baseUrl:s}),k()},[s,P]);const k=async()=>{try{g(!0);const j=await fetch(`${P.getConfig().baseUrl}/workflows`);if(j.ok){const G=await j.json();h(G.workflows||[])}else console.error("Failed to fetch workflows: HTTP",j.status),h([])}catch(j){console.error("Failed to fetch workflows:",j),h([])}finally{g(!1)}},T=()=>{const j=t.endsWith("/")?t.slice(0,-1):t;e(j)},R=()=>{const j="http://localhost:8000";e(j),n(j)},I=j=>{c(j),window.__addLocalHandler&&window.__addLocalHandler(j,i)},N=j=>{j.preventDefault(),w(!0)},D=A.useCallback(j=>{const G=document.querySelector(".main-content-area");if(!G)return;const Z=G.getBoundingClientRect(),K=(j.clientX-Z.left)/Z.width*100,J=Math.max(20,Math.min(80,K));y(J)},[]),V=A.useCallback(()=>{w(!1)},[]);return A.useEffect(()=>{if(x)return document.addEventListener("mousemove",D),document.addEventListener("mouseup",V),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",V),document.body.style.cursor="",document.body.style.userSelect=""}},[x,D,V]),_.jsxs("div",{className:`h-screen flex flex-col bg-background ${x?"resize-active":""}`,children:[_.jsxs("div",{className:"flex items-center justify-between h-12 px-4 bg-card border-b border-border",children:[_.jsxs("div",{className:"flex items-center gap-4",children:[_.jsx(en,{variant:"ghost",size:"sm",onClick:()=>E(!S),title:S?"Show sidebar":"Hide sidebar",children:S?_.jsx(xA,{className:"h-4 w-4"}):_.jsx(wA,{className:"h-4 w-4"})}),_.jsx("h1",{className:"text-md font-semibold",children:"Workflow Debugger"}),_.jsxs(jw,{value:i||"",onValueChange:a,children:[_.jsx($w,{className:"w-48",children:_.jsx(zw,{placeholder:"Select workflow..."})}),_.jsx(Bw,{children:f?_.jsx("div",{className:"p-2",children:_.jsx(Wr,{className:"h-4 w-32"})}):d.length===0?_.jsx("div",{className:"p-2 text-sm text-muted-foreground",children:"No workflows found. Check server connection."}):d.map(j=>_.jsx(th,{value:j,children:j},j))})]})]}),_.jsxs(IC,{children:[_.jsx(LC,{asChild:!0,children:_.jsx(en,{variant:"ghost",size:"sm",children:_.jsx(CA,{className:"h-4 w-4"})})}),_.jsx(MC,{className:"w-80",children:_.jsx("div",{className:"space-y-4",children:_.jsxs("div",{className:"space-y-2",children:[_.jsx("h4",{className:"font-medium text-sm",children:"API Configuration"}),_.jsx($h,{value:t,onChange:j=>n(j.target.value),placeholder:"http://localhost:8000"}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx(en,{onClick:T,variant:"outline",size:"sm",disabled:t===s,children:"Save"}),_.jsx(en,{onClick:R,variant:"outline",size:"sm",children:"Reset"})]}),_.jsxs("p",{className:"text-xs text-muted-foreground",children:["Current: ",s]})]})})})]})]}),_.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!S&&_.jsx("div",{className:"w-80 border-r border-border bg-card overflow-hidden transition-all duration-200",children:_.jsx(XP,{activeHandlerId:l,onHandlerSelect:c})}),_.jsxs("div",{className:"flex-1 flex overflow-hidden main-content-area",children:[_.jsx("div",{className:"border-r border-border overflow-auto",style:{width:`${m}%`},children:_.jsx(qP,{selectedWorkflow:i,onRunStart:I,activeHandlerId:l})}),_.jsx("div",{className:`w-2 hover:bg-gray-500/20 hover:shadow-lg cursor-col-resize flex-shrink-0 transition-all duration-200 relative group border-l border-r border-border ${x?"shadow-xl":""}`,onMouseDown:N,title:"Drag to resize panels"}),_.jsx("div",{className:"overflow-auto",style:{width:`${100-m}%`},children:_.jsx(YP,{handlerId:l})})]})]})]})}class JP extends Oe.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("ErrorBoundary caught an error:",e,t)}resetError=()=>{this.setState({hasError:!1,error:void 0})};render(){if(this.state.hasError&&this.state.error){if(this.props.fallback){const e=this.props.fallback;return _.jsx(e,{error:this.state.error,resetError:this.resetError})}return _.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:_.jsxs("div",{className:"max-w-md p-6 bg-card border border-border rounded-lg shadow-sm",children:[_.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:"Something went wrong"}),_.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"The workflow debugger encountered an error. This might happen if the workflow server is unreachable."}),_.jsxs("details",{className:"mb-4",children:[_.jsx("summary",{className:"text-sm font-medium cursor-pointer hover:text-foreground",children:"Error Details"}),_.jsx("pre",{className:"mt-2 text-xs bg-muted p-3 rounded border overflow-auto",children:this.state.error.message})]}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{onClick:this.resetError,className:"px-3 py-2 text-sm bg-primary text-primary-foreground rounded hover:bg-primary/90 transition-colors",children:"Try Again"}),_.jsx("button",{onClick:()=>window.location.reload(),className:"px-3 py-2 text-sm bg-secondary text-secondary-foreground rounded hover:bg-secondary/90 transition-colors",children:"Reload Page"})]})]})})}return this.props.children}}function ZP(){const e=t0({baseUrl:"http://localhost:8000"});return _.jsx(JP,{children:_.jsx(kP,{clients:{workflowsClient:e},children:_.jsx(QP,{})})})}function c0(){const s=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",s)}c0();window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",c0);aS.createRoot(document.getElementById("root")).render(_.jsx(A.StrictMode,{children:_.jsx(ZP,{})}));const Ut=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),ih=[.001,0,0,.001,0,0],Id=1.35,on={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Kn={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},eT="pdfjs_internal_editor_",Re={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101},De={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},u0={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Ot={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},To={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},ct={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,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},ui={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Vo={ERRORS:0,WARNINGS:1,INFOS:5},Lo={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,rawFillPath:94},bl={moveTo:0,lineTo:1,curveTo:2,closePath:3},d0={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let uc=Vo.WARNINGS;function tT(s){Number.isInteger(s)&&(uc=s)}function nT(){return uc}function dc(s){uc>=Vo.INFOS&&console.log(`Info: ${s}`)}function Ne(s){uc>=Vo.WARNINGS&&console.log(`Warning: ${s}`)}function We(s){throw new Error(s)}function mt(s,e){s||We(e)}function rT(s){switch(s?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Hh(s,e=null,t=null){if(!s)return null;if(t&&typeof s=="string"&&(t.addDefaultProtocol&&s.startsWith("www.")&&s.match(/\./g)?.length>=2&&(s=`http://${s}`),t.tryConvertEncoding))try{s=lT(s)}catch{}const n=e?URL.parse(s,e):URL.parse(s);return rT(n)?n:null}function Uh(s,e,t=!1){const n=URL.parse(s);return n?(n.hash=e,n.href):t&&Hh(s,"http://example.com")?s.split("#",1)[0]+`${e?`#${e}`:""}`:""}function Me(s,e,t,n=!1){return Object.defineProperty(s,e,{value:t,enumerable:!n,configurable:!0,writable:!1}),t}const Ns=function(){function e(t,n){this.message=t,this.name=n}return e.prototype=new Error,e.constructor=e,e}();class ev extends Ns{constructor(e,t){super(e,"PasswordException"),this.code=t}}class Ld extends Ns{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class Hl extends Ns{constructor(e){super(e,"InvalidPDFException")}}class Mo extends Ns{constructor(e,t,n){super(e,"ResponseException"),this.status=t,this.missing=n}}class sT extends Ns{constructor(e){super(e,"FormatError")}}class wr extends Ns{constructor(e){super(e,"AbortException")}}function h0(s){(typeof s!="object"||s?.length===void 0)&&We("Invalid argument for bytesToString");const e=s.length,t=8192;if(e<t)return String.fromCharCode.apply(null,s);const n=[];for(let i=0;i<e;i+=t){const a=Math.min(i+t,e),l=s.subarray(i,a);n.push(String.fromCharCode.apply(null,l))}return n.join("")}function Wo(s){typeof s!="string"&&We("Invalid argument for stringToBytes");const e=s.length,t=new Uint8Array(e);for(let n=0;n<e;++n)t[n]=s.charCodeAt(n)&255;return t}function iT(s){return String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255)}function oT(){const s=new Uint8Array(4);return s[0]=1,new Uint32Array(s.buffer,0,1)[0]===1}function aT(){try{return new Function(""),!0}catch{return!1}}class kt{static get isLittleEndian(){return Me(this,"isLittleEndian",oT())}static get isEvalSupported(){return Me(this,"isEvalSupported",aT())}static get isOffscreenCanvasSupported(){return Me(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Me(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:t}=navigator;return Me(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCSSRoundSupported(){return Me(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const Md=Array.from(Array(256).keys(),s=>s.toString(16).padStart(2,"0"));class xe{static makeHexColor(e,t,n){return`#${Md[e]}${Md[t]}${Md[n]}`}static scaleMinMax(e,t){let n;e[0]?(e[0]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[3],t[3]*=e[3]):(n=t[0],t[0]=t[1],t[1]=n,n=t[2],t[2]=t[3],t[3]=n,e[1]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t,n=0){const i=e[n],a=e[n+1];e[n]=i*t[0]+a*t[2]+t[4],e[n+1]=i*t[1]+a*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){const i=t[0],a=t[1],l=t[2],c=t[3],d=t[4],h=t[5];for(let f=0;f<6;f+=2){const g=e[n+f],m=e[n+f+1];e[n+f]=g*i+m*l+d,e[n+f+1]=g*a+m*c+h}}static applyInverseTransform(e,t){const n=e[0],i=e[1],a=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-i*t[2]+t[2]*t[5]-t[4]*t[3])/a,e[1]=(-n*t[1]+i*t[0]+t[4]*t[1]-t[5]*t[0])/a}static axialAlignedBoundingBox(e,t,n){const i=t[0],a=t[1],l=t[2],c=t[3],d=t[4],h=t[5],f=e[0],g=e[1],m=e[2],y=e[3];let x=i*f+d,w=x,S=i*m+d,E=S,P=c*g+h,k=P,T=c*y+h,R=T;if(a!==0||l!==0){const I=a*f,N=a*m,D=l*g,V=l*y;x+=D,E+=D,S+=V,w+=V,P+=I,R+=I,T+=N,k+=N}n[0]=Math.min(n[0],x,S,w,E),n[1]=Math.min(n[1],P,T,k,R),n[2]=Math.max(n[2],x,S,w,E),n[3]=Math.max(n[3],P,T,k,R)}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){const n=e[0],i=e[1],a=e[2],l=e[3],c=n**2+i**2,d=n*a+i*l,h=a**2+l**2,f=(c+h)/2,g=Math.sqrt(f**2-(c*h-d**2));t[0]=Math.sqrt(f+g||1),t[1]=Math.sqrt(f-g||1)}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),i=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>i)return null;const a=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),l=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return a>l?null:[n,a,i,l]}static pointBoundingBox(e,t,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)}static rectBoundingBox(e,t,n,i,a){a[0]=Math.min(a[0],e,n),a[1]=Math.min(a[1],t,i),a[2]=Math.max(a[2],e,n),a[3]=Math.max(a[3],t,i)}static#e(e,t,n,i,a,l,c,d,h,f){if(h<=0||h>=1)return;const g=1-h,m=h*h,y=m*h,x=g*(g*(g*e+3*h*t)+3*m*n)+y*i,w=g*(g*(g*a+3*h*l)+3*m*c)+y*d;f[0]=Math.min(f[0],x),f[1]=Math.min(f[1],w),f[2]=Math.max(f[2],x),f[3]=Math.max(f[3],w)}static#t(e,t,n,i,a,l,c,d,h,f,g,m){if(Math.abs(h)<1e-12){Math.abs(f)>=1e-12&&this.#e(e,t,n,i,a,l,c,d,-g/f,m);return}const y=f**2-4*g*h;if(y<0)return;const x=Math.sqrt(y),w=2*h;this.#e(e,t,n,i,a,l,c,d,(-f+x)/w,m),this.#e(e,t,n,i,a,l,c,d,(-f-x)/w,m)}static bezierBoundingBox(e,t,n,i,a,l,c,d,h){h[0]=Math.min(h[0],e,c),h[1]=Math.min(h[1],t,d),h[2]=Math.max(h[2],e,c),h[3]=Math.max(h[3],t,d),this.#t(e,n,a,c,t,i,l,d,3*(-e+3*(n-a)+c),6*(e-2*n+a),3*(n-e),h),this.#t(e,n,a,c,t,i,l,d,3*(-t+3*(i-l)+d),6*(t-2*i+l),3*(i-t),h)}}function lT(s){return decodeURIComponent(escape(s))}let Dd=null,tv=null;function f0(s){return Dd||(Dd=/([\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,tv=new Map([["ſt","ſt"]])),s.replaceAll(Dd,(e,t,n)=>t?t.normalize("NFKC"):tv.get(n))}function Vh(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const s=new Uint8Array(32);return crypto.getRandomValues(s),h0(s)}const Wh="pdfjs_internal_id_";function cT(s,e,t){if(!Array.isArray(t)||t.length<2)return!1;const[n,i,...a]=t;if(!s(n)&&!Number.isInteger(n)||!e(i))return!1;const l=a.length;let c=!0;switch(i.name){case"XYZ":if(l<2||l>3)return!1;break;case"Fit":case"FitB":return l===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(l>1)return!1;break;case"FitR":if(l!==4)return!1;c=!1;break;default:return!1}for(const d of a)if(!(typeof d=="number"||c&&d===null))return!1;return!0}function jt(s,e,t){return Math.min(Math.max(s,e),t)}function p0(s){return Uint8Array.prototype.toBase64?s.toBase64():btoa(h0(s))}function uT(s){return Uint8Array.fromBase64?Uint8Array.fromBase64(s):Wo(atob(s))}typeof Promise.try!="function"&&(Promise.try=function(s,...e){return new Promise(t=>{t(s(...e))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(s){return s.reduce((e,t)=>e+t,0)});const pr="http://www.w3.org/2000/svg";class Ps{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function Ii(s,e="text"){if(Co(s,document.baseURI)){const t=await fetch(s);if(!t.ok)throw new Error(t.statusText);switch(e){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json()}return t.text()}return new Promise((t,n)=>{const i=new XMLHttpRequest;i.open("GET",s,!0),i.responseType=e,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(e){case"arraybuffer":case"blob":case"json":t(i.response);return}t(i.responseText);return}n(new Error(i.statusText))}},i.send(null)})}class Go{constructor({viewBox:e,userUnit:t,scale:n,rotation:i,offsetX:a=0,offsetY:l=0,dontFlip:c=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=i,this.offsetX=a,this.offsetY=l,n*=t;const d=(e[2]+e[0])/2,h=(e[3]+e[1])/2;let f,g,m,y;switch(i%=360,i<0&&(i+=360),i){case 180:f=-1,g=0,m=0,y=1;break;case 90:f=0,g=1,m=1,y=0;break;case 270:f=0,g=-1,m=-1,y=0;break;case 0:f=1,g=0,m=0,y=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}c&&(m=-m,y=-y);let x,w,S,E;f===0?(x=Math.abs(h-e[1])*n+a,w=Math.abs(d-e[0])*n+l,S=(e[3]-e[1])*n,E=(e[2]-e[0])*n):(x=Math.abs(d-e[0])*n+a,w=Math.abs(h-e[1])*n+l,S=(e[2]-e[0])*n,E=(e[3]-e[1])*n),this.transform=[f*n,g*n,m*n,y*n,x-f*n*d-m*n*h,w-g*n*d-y*n*h],this.width=S,this.height=E}get rawDims(){const e=this.viewBox;return Me(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:n=this.offsetX,offsetY:i=this.offsetY,dontFlip:a=!1}={}){return new Go({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:i,dontFlip:a})}convertToViewportPoint(e,t){const n=[e,t];return xe.applyTransform(n,this.transform),n}convertToViewportRectangle(e){const t=[e[0],e[1]];xe.applyTransform(t,this.transform);const n=[e[2],e[3]];return xe.applyTransform(n,this.transform),[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){const n=[e,t];return xe.applyInverseTransform(n,this.transform),n}}class hc extends Ns{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function qo(s){const e=s.length;let t=0;for(;t<e&&s[t].trim()==="";)t++;return s.substring(t,t+5).toLowerCase()==="data:"}function fc(s){return typeof s=="string"&&/\.pdf$/i.test(s)}function g0(s){return[s]=s.split(/[#?]/,1),s.substring(s.lastIndexOf("/")+1)}function m0(s,e="document.pdf"){if(typeof s!="string")return e;if(qo(s))return Ne('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const t=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=t.exec(s);let a=n.exec(i[1])||n.exec(i[2])||n.exec(i[3]);if(a&&(a=a[0],a.includes("%")))try{a=n.exec(decodeURIComponent(a))[0]}catch{}return a||e}class nv{started=Object.create(null);times=[];time(e){e in this.started&&Ne(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Ne(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:n}of this.times)t=Math.max(n.length,t);for(const{name:n,start:i,end:a}of this.times)e.push(`${n.padEnd(t)} ${a-i}ms
213
+ `);return e.join("")}}function Co(s,e){const t=e?URL.parse(s,e):URL.parse(s);return t?.protocol==="http:"||t?.protocol==="https:"}function An(s){s.preventDefault()}function dt(s){s.preventDefault(),s.stopPropagation()}function dT(s){console.log("Deprecated API usage: "+s)}class Gh{static#e;static toDateObject(e){if(!e||typeof e!="string")return null;this.#e||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const t=this.#e.exec(e);if(!t)return null;const n=parseInt(t[1],10);let i=parseInt(t[2],10);i=i>=1&&i<=12?i-1:0;let a=parseInt(t[3],10);a=a>=1&&a<=31?a:1;let l=parseInt(t[4],10);l=l>=0&&l<=23?l:0;let c=parseInt(t[5],10);c=c>=0&&c<=59?c:0;let d=parseInt(t[6],10);d=d>=0&&d<=59?d:0;const h=t[7]||"Z";let f=parseInt(t[8],10);f=f>=0&&f<=23?f:0;let g=parseInt(t[9],10)||0;return g=g>=0&&g<=59?g:0,h==="-"?(l+=f,c+=g):h==="+"&&(l-=f,c-=g),new Date(Date.UTC(n,i,a,l,c,d))}}function v0(s,{scale:e=1,rotation:t=0}){const{width:n,height:i}=s.attributes.style,a=[0,0,parseInt(n),parseInt(i)];return new Go({viewBox:a,userUnit:1,scale:e,rotation:t})}function qh(s){if(s.startsWith("#")){const e=parseInt(s.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return s.startsWith("rgb(")?s.slice(4,-1).split(",").map(e=>parseInt(e)):s.startsWith("rgba(")?s.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(Ne(`Not a valid color format: "${s}"`),[0,0,0])}function hT(s){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const t of s.keys()){e.style.color=t;const n=window.getComputedStyle(e).color;s.set(t,qh(n))}e.remove()}function rt(s){const{a:e,b:t,c:n,d:i,e:a,f:l}=s.getTransform();return[e,t,n,i,a,l]}function Vn(s){const{a:e,b:t,c:n,d:i,e:a,f:l}=s.getTransform().invertSelf();return[e,t,n,i,a,l]}function Yr(s,e,t=!1,n=!0){if(e instanceof Go){const{pageWidth:i,pageHeight:a}=e.rawDims,{style:l}=s,c=kt.isCSSRoundSupported,d=`var(--total-scale-factor) * ${i}px`,h=`var(--total-scale-factor) * ${a}px`,f=c?`round(down, ${d}, var(--scale-round-x))`:`calc(${d})`,g=c?`round(down, ${h}, var(--scale-round-y))`:`calc(${h})`;!t||e.rotation%180===0?(l.width=f,l.height=g):(l.width=g,l.height=f)}n&&s.setAttribute("data-main-rotation",e.rotation)}class Dn{constructor(){const{pixelRatio:e}=Dn;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,t,n,i,a=-1){let l=1/0,c=1/0,d=1/0;n=Dn.capPixels(n,a),n>0&&(l=Math.sqrt(n/(e*t))),i!==-1&&(c=i/e,d=i/t);const h=Math.min(l,c,d);return this.sx>h||this.sy>h?(this.sx=h,this.sy=h,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){const n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,n):n}return e}}const Ul=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class Ro{#e=null;#t=null;#n;#r=null;#i=null;#s=null;static#l=null;constructor(e){this.#n=e,Ro.#l||=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",signature:"pdfjs-editor-remove-signature-button"})}render(){const e=this.#e=document.createElement("div");e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=this.#n._uiManager._signal;e.addEventListener("contextmenu",An,{signal:t}),e.addEventListener("pointerdown",Ro.#a,{signal:t});const n=this.#r=document.createElement("div");n.className="buttons",e.append(n);const i=this.#n.toolbarPosition;if(i){const{style:a}=e,l=this.#n._uiManager.direction==="ltr"?1-i[0]:i[0];a.insetInlineEnd=`${100*l}%`,a.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return this.#u(),e}get div(){return this.#e}static#a(e){e.stopPropagation()}#d(e){this.#n._focusEventsAllowed=!1,dt(e)}#c(e){this.#n._focusEventsAllowed=!0,dt(e)}#h(e){const t=this.#n._uiManager._signal;e.addEventListener("focusin",this.#d.bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",this.#c.bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",An,{signal:t})}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden"),this.#i?.shown()}#u(){const{editorType:e,_uiManager:t}=this.#n,n=document.createElement("button");n.className="delete",n.tabIndex=0,n.setAttribute("data-l10n-id",Ro.#l[e]),this.#h(n),n.addEventListener("click",i=>{t.delete()},{signal:t._signal}),this.#r.append(n)}get#f(){const e=document.createElement("div");return e.className="divider",e}async addAltText(e){const t=await e.render();this.#h(t),this.#r.prepend(t,this.#f),this.#i=e}addColorPicker(e){this.#t=e;const t=e.renderButton();this.#h(t),this.#r.prepend(t,this.#f)}async addEditSignatureButton(e){const t=this.#s=await e.renderEditButton(this.#n);this.#h(t),this.#r.prepend(t,this.#f)}updateEditSignatureButton(e){this.#s&&(this.#s.title=e)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}}class fT{#e=null;#t=null;#n;constructor(e){this.#n=e}#r(){const e=this.#t=document.createElement("div");e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",An,{signal:this.#n._signal});const t=this.#e=document.createElement("div");return t.className="buttons",e.append(t),this.#s(),e}#i(e,t){let n=0,i=0;for(const a of e){const l=a.y+a.height;if(l<n)continue;const c=a.x+(t?a.width:0);if(l>n){i=c,n=l;continue}t?c>i&&(i=c):c<i&&(i=c)}return[t?1-i:i,n]}show(e,t,n){const[i,a]=this.#i(t,n),{style:l}=this.#t||=this.#r();e.append(this.#t),l.insetInlineEnd=`${100*i}%`,l.top=`calc(${100*a}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#s(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const t=document.createElement("span");e.append(t),t.className="visuallyHidden",t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const n=this.#n._signal;e.addEventListener("contextmenu",An,{signal:n}),e.addEventListener("click",()=>{this.#n.highlightSelection("floating_button")},{signal:n}),this.#e.append(e)}}function y0(s,e,t){for(const n of t)e.addEventListener(n,s[n].bind(s))}class pT{#e=0;get id(){return`${eT}${this.#e++}`}}class Xh{#e=Vh();#t=0;#n=null;static get _isSVGFittingCanvas(){const e='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>',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=e;const a=i.decode().then(()=>(n.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return Me(this,"_isSVGFittingCanvas",a)}async#r(e,t){this.#n||=new Map;let n=this.#n.get(e);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let i;if(typeof t=="string"?(n.url=t,i=await Ii(t,"blob")):t instanceof File?i=n.file=t:t instanceof Blob&&(i=t),i.type==="image/svg+xml"){const a=Xh._isSVGFittingCanvas,l=new FileReader,c=new Image,d=new Promise((h,f)=>{c.onload=()=>{n.bitmap=c,n.isSvg=!0,h()},l.onload=async()=>{const g=n.svgUrl=l.result;c.src=await a?`${g}#svgView(preserveAspectRatio(none))`:g},c.onerror=l.onerror=f});l.readAsDataURL(i),await d}else n.bitmap=await createImageBitmap(i);n.refCounter=1}catch(i){Ne(i),n=null}return this.#n.set(e,n),n&&this.#n.set(n.id,n),n}async getFromFile(e){const{lastModified:t,name:n,size:i,type:a}=e;return this.#r(`${t}_${n}_${i}_${a}`,e)}async getFromUrl(e){return this.#r(e,e)}async getFromBlob(e,t){const n=await t;return this.#r(e,n)}async getFromId(e){this.#n||=new Map;const t=this.#n.get(e);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:n}=t;return delete t.blobPromise,this.getFromBlob(t.id,n)}return this.getFromUrl(t.url)}getFromCanvas(e,t){this.#n||=new Map;let n=this.#n.get(e);if(n?.bitmap)return n.refCounter+=1,n;const i=new OffscreenCanvas(t.width,t.height);return i.getContext("2d").drawImage(t,0,0),n={bitmap:i.transferToImageBitmap(),id:`image_${this.#e}_${this.#t++}`,refCounter:1,isSvg:!1},this.#n.set(e,n),this.#n.set(n.id,n),n}getSvgUrl(e){const t=this.#n.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#n||=new Map;const t=this.#n.get(e);if(!t||(t.refCounter-=1,t.refCounter!==0))return;const{bitmap:n}=t;if(!t.url&&!t.file){const i=new OffscreenCanvas(n.width,n.height);i.getContext("bitmaprenderer").transferFromImageBitmap(n),t.blobPromise=i.convertToBlob()}n.close?.(),t.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#e}_`)}}class gT{#e=[];#t=!1;#n;#r=-1;constructor(e=128){this.#n=e}add({cmd:e,undo:t,post:n,mustExec:i,type:a=NaN,overwriteIfSameType:l=!1,keepUndo:c=!1}){if(i&&e(),this.#t)return;const d={cmd:e,undo:t,post:n,type:a};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(d);return}if(l&&this.#e[this.#r].type===a){c&&(d.undo=this.#e[this.#r].undo),this.#e[this.#r]=d;return}const h=this.#r+1;h===this.#n?this.#e.splice(0,1):(this.#r=h,h<this.#e.length&&this.#e.splice(h)),this.#e.push(d)}undo(){if(this.#r===-1)return;this.#t=!0;const{undo:e,post:t}=this.#e[this.#r];e(),t?.(),this.#t=!1,this.#r-=1}redo(){if(this.#r<this.#e.length-1){this.#r+=1,this.#t=!0;const{cmd:e,post:t}=this.#e[this.#r];e(),t?.(),this.#t=!1}}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}cleanType(e){if(this.#r!==-1){for(let t=this.#r;t>=0;t--)if(this.#e[t].type!==e){this.#e.splice(t+1,this.#r-t),this.#r=t;return}this.#e.length=0,this.#r=-1}}destroy(){this.#e=null}}class Xo{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=kt.platform;for(const[n,i,a={}]of e)for(const l of n){const c=l.startsWith("mac+");t&&c?(this.callbacks.set(l.slice(4),{callback:i,options:a}),this.allKeys.add(l.split("+").at(-1))):!t&&!c&&(this.callbacks.set(l,{callback:i,options:a}),this.allKeys.add(l.split("+").at(-1)))}}#e(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 t=this.buffer.join("+");return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;const n=this.callbacks.get(this.#e(t));if(!n)return;const{callback:i,options:{bubbles:a=!1,args:l=[],checker:c=null}}=n;c&&!c(e,t)||(i.bind(e,...l,t)(),a||dt(t))}}class Yh{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return hT(e),Me(this,"_colors",e)}convert(e){const t=qh(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[n,i]of this._colors)if(i.every((a,l)=>a===t[l]))return Yh._colorsMapping.get(n);return t}getHexCode(e){const t=this._colors.get(e);return t?xe.makeHexColor(...t):e}}class br{#e=new AbortController;#t=null;#n=new Map;#r=new Map;#i=null;#s=null;#l=null;#a=new gT;#d=null;#c=null;#h=0;#u=new Set;#f=null;#o=null;#p=new Set;_editorUndoBar=null;#m=!1;#g=!1;#v=!1;#y=null;#w=null;#x=null;#A=null;#_=!1;#k=null;#T=new pT;#S=!1;#P=!1;#C=null;#N=null;#I=null;#L=null;#$=null;#E=Re.NONE;#b=new Set;#F=null;#j=null;#U=null;#V=null;#W={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#B=[0,0];#M=null;#D=null;#H=null;#O=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const e=br.prototype,t=l=>l.#D.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&l.hasSomethingToControl(),n=(l,{target:c})=>{if(c instanceof HTMLInputElement){const{type:d}=c;return d!=="text"&&d!=="number"}return!0},i=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return Me(this,"_keyboardManager",new Xo([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],e.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:n}],[["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:n}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(l,{target:c})=>!(c instanceof HTMLButtonElement)&&l.#D.contains(c)&&!l.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(l,{target:c})=>!(c instanceof HTMLButtonElement)&&l.#D.contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-a,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[a,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-a],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,a],checker:t}]]))}constructor(e,t,n,i,a,l,c,d,h,f,g,m,y,x){const w=this._signal=this.#e.signal;this.#D=e,this.#H=t,this.#i=n,this.#j=i,this._eventBus=a,a._on("editingaction",this.onEditingAction.bind(this),{signal:w}),a._on("pagechanging",this.onPageChanging.bind(this),{signal:w}),a._on("scalechanging",this.onScaleChanging.bind(this),{signal:w}),a._on("rotationchanging",this.onRotationChanging.bind(this),{signal:w}),a._on("setpreference",this.onSetPreference.bind(this),{signal:w}),a._on("switchannotationeditorparams",S=>this.updateParams(S.type,S.value),{signal:w}),this.#re(),this.#ae(),this.#K(),this.#s=l.annotationStorage,this.#y=l.filterFactory,this.#U=c,this.#A=d||null,this.#m=h,this.#g=f,this.#v=g,this.#$=m||null,this.viewParameters={realScale:Ps.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=y||null,this._supportsPinchToZoom=x!==!1}destroy(){this.#O?.resolve(),this.#O=null,this.#e?.abort(),this.#e=null,this._signal=null;for(const e of this.#r.values())e.destroy();this.#r.clear(),this.#n.clear(),this.#p.clear(),this.#L?.clear(),this.#t=null,this.#b.clear(),this.#a.destroy(),this.#i?.destroy(),this.#j?.destroy(),this.#k?.hide(),this.#k=null,this.#I?.destroy(),this.#I=null,this.#w&&(clearTimeout(this.#w),this.#w=null),this.#M&&(clearTimeout(this.#M),this.#M=null),this._editorUndoBar?.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#$}get useNewAltTextFlow(){return this.#g}get useNewAltTextWhenAddingImage(){return this.#v}get hcmFilter(){return Me(this,"hcmFilter",this.#U?this.#y.addHCMFilter(this.#U.foreground,this.#U.background):"none")}get direction(){return Me(this,"direction",getComputedStyle(this.#D).direction)}get highlightColors(){return Me(this,"highlightColors",this.#A?new Map(this.#A.split(",").map(e=>e.split("=").map(t=>t.trim()))):null)}get highlightColorNames(){return Me(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),this.#c=e}setMainHighlightColorPicker(e){this.#I=e}editAltText(e,t=!1){this.#i?.editAltText(this,e,t)}getSignature(e){this.#j?.getSignature({uiManager:this,editor:e})}get signatureManager(){return this.#j}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case"enableNewAltTextWhenAddingImage":this.#v=t;break}}onPageChanging({pageNumber:e}){this.#h=e-1}focusMainContainer(){this.#D.focus()}findParent(e,t){for(const n of this.#r.values()){const{x:i,y:a,width:l,height:c}=n.div.getBoundingClientRect();if(e>=i&&e<=i+l&&t>=a&&t<=a+c)return n}return null}disableUserSelect(e=!1){this.#H.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#p.add(e)}removeShouldRescale(e){this.#p.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*Ps.PDF_TO_CSS_UNITS;for(const t of this.#p)t.onScaleChanging();this.#c?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#q({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#Y(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const n of this.#r.values())if(n.hasTextLayer(e))return n;return null}highlightSelection(e=""){const t=document.getSelection();if(!t||t.isCollapsed)return;const{anchorNode:n,anchorOffset:i,focusNode:a,focusOffset:l}=t,c=t.toString(),h=this.#q(t).closest(".textLayer"),f=this.getSelectionBoxes(h);if(!f)return;t.empty();const g=this.#Y(h),m=this.#E===Re.NONE,y=()=>{g?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:f,anchorNode:n,anchorOffset:i,focusNode:a,focusOffset:l,text:c}),m&&this.showAllEditors("highlight",!0,!0)};if(m){this.switchToMode(Re.HIGHLIGHT,y);return}y()}#te(){const e=document.getSelection();if(!e||e.isCollapsed)return;const n=this.#q(e).closest(".textLayer"),i=this.getSelectionBoxes(n);i&&(this.#k||=new fT(this),this.#k.show(n,i,this.direction==="ltr"))}addToAnnotationStorage(e){!e.isEmpty()&&this.#s&&!this.#s.has(e.id)&&this.#s.setValue(e.id,e)}#ne(){const e=document.getSelection();if(!e||e.isCollapsed){this.#F&&(this.#k?.hide(),this.#F=null,this.#R({hasSelectedText:!1}));return}const{anchorNode:t}=e;if(t===this.#F)return;const i=this.#q(e).closest(".textLayer");if(!i){this.#F&&(this.#k?.hide(),this.#F=null,this.#R({hasSelectedText:!1}));return}if(this.#k?.hide(),this.#F=t,this.#R({hasSelectedText:!0}),!(this.#E!==Re.HIGHLIGHT&&this.#E!==Re.NONE)&&(this.#E===Re.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#_=this.isShiftKeyDown,!this.isShiftKeyDown)){const a=this.#E===Re.HIGHLIGHT?this.#Y(i):null;a?.toggleDrawing();const l=new AbortController,c=this.combinedSignal(l),d=h=>{h.type==="pointerup"&&h.button!==0||(l.abort(),a?.toggleDrawing(!0),h.type==="pointerup"&&this.#X("main_toolbar"))};window.addEventListener("pointerup",d,{signal:c}),window.addEventListener("blur",d,{signal:c})}}#X(e=""){this.#E===Re.HIGHLIGHT?this.highlightSelection(e):this.#m&&this.#te()}#re(){document.addEventListener("selectionchange",this.#ne.bind(this),{signal:this._signal})}#se(){if(this.#x)return;this.#x=new AbortController;const e=this.combinedSignal(this.#x);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#ie(){this.#x?.abort(),this.#x=null}blur(){if(this.isShiftKeyDown=!1,this.#_&&(this.#_=!1,this.#X("main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of this.#b)if(t.div.contains(e)){this.#N=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#N)return;const[e,t]=this.#N;this.#N=null,t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}#K(){if(this.#C)return;this.#C=new AbortController;const e=this.combinedSignal(this.#C);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#oe(){this.#C?.abort(),this.#C=null}#Q(){if(this.#d)return;this.#d=new AbortController;const e=this.combinedSignal(this.#d);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})}#J(){this.#d?.abort(),this.#d=null}#ae(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#K(),this.#Q()}removeEditListeners(){this.#oe(),this.#J()}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const n of this.#o)if(n.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const n of this.#o)if(n.isHandlingMimeForPasting(t.type)){n.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;const t=[];for(const n of this.#b){const i=n.serialize(!0);i&&t.push(i)}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:t}=e;for(const a of t.items)for(const l of this.#o)if(l.isHandlingMimeForPasting(a.type)){l.paste(a,this.currentLayer);return}let n=t.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(a){Ne(`paste: "${a.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const i=this.currentLayer;try{const a=[];for(const d of n){const h=await i.deserialize(d);if(!h)return;a.push(h)}const l=()=>{for(const d of a)this.#Z(d);this.#ee(a)},c=()=>{for(const d of a)d.remove()};this.addCommands({cmd:l,undo:c,mustExec:!0})}catch(a){Ne(`paste: "${a.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),this.#E!==Re.NONE&&!this.isEditorHandlingKeyboard&&br._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,this.#_&&(this.#_=!1,this.#X("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}}#R(e){Object.entries(e).some(([n,i])=>this.#W[n]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#W,e)}),this.#E===Re.HIGHLIGHT&&e.hasSelectedEditor===!1&&this.#z([[De.HIGHLIGHT_FREE,!0]]))}#z(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#se(),this.#Q(),this.#R({isEditing:this.#E!==Re.NONE,isEmpty:this.#G(),hasSomethingToUndo:this.#a.hasSomethingToUndo(),hasSomethingToRedo:this.#a.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ie(),this.#J(),this.#R({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#o){this.#o=e;for(const t of this.#o)this.#z(t.defaultPropertiesToUpdate)}}getId(){return this.#T.id}get currentLayer(){return this.#r.get(this.#h)}getLayer(e){return this.#r.get(e)}get currentPageIndex(){return this.#h}addLayer(e){this.#r.set(e.pageIndex,e),this.#S?e.enable():e.disable()}removeLayer(e){this.#r.delete(e.pageIndex)}async updateMode(e,t=null,n=!1){if(this.#E!==e&&!(this.#O&&(await this.#O.promise,!this.#O))){if(this.#O=Promise.withResolvers(),this.#c?.commitOrRemove(),this.#E=e,e===Re.NONE){this.setEditingState(!1),this.#ce(),this._editorUndoBar?.hide(),this.#O.resolve();return}e===Re.SIGNATURE&&await this.#j?.loadSignatures(),this.setEditingState(!0),await this.#le(),this.unselectAll();for(const i of this.#r.values())i.updateMode(e);if(!t){n&&this.addNewEditorFromKeyboard(),this.#O.resolve();return}for(const i of this.#n.values())i.annotationElementId===t||i.id===t?(this.setSelected(i),i.enterInEditMode()):i.unselect();this.#O.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==this.#E&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,t){if(this.#o){switch(e){case De.CREATE:this.currentLayer.addNewEditor(t);return;case De.HIGHLIGHT_DEFAULT_COLOR:this.#I?.updateColor(t);break;case De.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#V||=new Map).set(e,t),this.showAllEditors("highlight",t);break}for(const n of this.#b)n.updateParams(e,t);for(const n of this.#o)n.updateDefaultParams(e,t)}}showAllEditors(e,t,n=!1){for(const a of this.#n.values())a.editorType===e&&a.show(t);(this.#V?.get(De.HIGHLIGHT_SHOW_ALL)??!0)!==t&&this.#z([[De.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(this.#P!==e){this.#P=e;for(const t of this.#r.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}async#le(){if(!this.#S){this.#S=!0;const e=[];for(const t of this.#r.values())e.push(t.enable());await Promise.all(e);for(const t of this.#n.values())t.enable()}}#ce(){if(this.unselectAll(),this.#S){this.#S=!1;for(const e of this.#r.values())e.disable();for(const e of this.#n.values())e.disable()}}getEditors(e){const t=[];for(const n of this.#n.values())n.pageIndex===e&&t.push(n);return t}getEditor(e){return this.#n.get(e)}addEditor(e){this.#n.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#w&&clearTimeout(this.#w),this.#w=setTimeout(()=>{this.focusMainContainer(),this.#w=null},0)),this.#n.delete(e.id),e.annotationElementId&&this.#L?.delete(e.annotationElementId),this.unselect(e),(!e.annotationElementId||!this.#u.has(e.annotationElementId))&&this.#s?.remove(e.id)}addDeletedAnnotationElement(e){this.#u.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#u.has(e)}removeDeletedAnnotationElement(e){this.#u.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#Z(e){const t=this.#r.get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#t!==e&&(this.#t=e,e&&this.#z(e.propertiesToUpdate))}get#ue(){let e=null;for(e of this.#b);return e}updateUI(e){this.#ue===e&&this.#z(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#z(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#b.has(e)){this.#b.delete(e),e.unselect(),this.#R({hasSelectedEditor:this.hasSelection});return}this.#b.add(e),e.select(),this.#z(e.propertiesToUpdate),this.#R({hasSelectedEditor:!0})}setSelected(e){this.#c?.commitOrRemove();for(const t of this.#b)t!==e&&t.unselect();this.#b.clear(),this.#b.add(e),e.select(),this.#z(e.propertiesToUpdate),this.#R({hasSelectedEditor:!0})}isSelected(e){return this.#b.has(e)}get firstSelectedEditor(){return this.#b.values().next().value}unselect(e){e.unselect(),this.#b.delete(e),this.#R({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#b.size!==0}get isEnterHandled(){return this.#b.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#a.undo(),this.#R({hasSomethingToUndo:this.#a.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#G()}),this._editorUndoBar?.hide()}redo(){this.#a.redo(),this.#R({hasSomethingToUndo:!0,hasSomethingToRedo:this.#a.hasSomethingToRedo(),isEmpty:this.#G()})}addCommands(e){this.#a.add(e),this.#R({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#G()})}cleanUndoStack(e){this.#a.cleanType(e)}#G(){if(this.#n.size===0)return!0;if(this.#n.size===1)for(const e of this.#n.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();const e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const t=e?[e]:[...this.#b],n=()=>{this._editorUndoBar?.show(i,t.length===1?t[0].editorType:t.length);for(const a of t)a.remove()},i=()=>{for(const a of t)this.#Z(a)};this.addCommands({cmd:n,undo:i,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#ee(e){for(const t of this.#b)t.unselect();this.#b.clear();for(const t of e)t.isEmpty()||(this.#b.add(t),t.select());this.#R({hasSelectedEditor:this.hasSelection})}selectAll(){for(const e of this.#b)e.commit();this.#ee(this.#n.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#E!==Re.NONE))&&!this.#c?.commitOrRemove()&&this.hasSelection){for(const e of this.#b)e.unselect();this.#b.clear(),this.#R({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#B[0]+=e,this.#B[1]+=t;const[i,a]=this.#B,l=[...this.#b],c=1e3;this.#M&&clearTimeout(this.#M),this.#M=setTimeout(()=>{this.#M=null,this.#B[0]=this.#B[1]=0,this.addCommands({cmd:()=>{for(const d of l)this.#n.has(d.id)&&(d.translateInPage(i,a),d.translationDone())},undo:()=>{for(const d of l)this.#n.has(d.id)&&(d.translateInPage(-i,-a),d.translationDone())},mustExec:!1})},c);for(const d of l)d.translateInPage(e,t),d.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#f=new Map;for(const e of this.#b)this.#f.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#f)return!1;this.disableUserSelect(!1);const e=this.#f;this.#f=null;let t=!1;for(const[{x:i,y:a,pageIndex:l},c]of e)c.newX=i,c.newY=a,c.newPageIndex=l,t||=i!==c.savedX||a!==c.savedY||l!==c.savedPageIndex;if(!t)return!1;const n=(i,a,l,c)=>{if(this.#n.has(i.id)){const d=this.#r.get(c);d?i._setParentAndPosition(d,a,l):(i.pageIndex=c,i.x=a,i.y=l)}};return this.addCommands({cmd:()=>{for(const[i,{newX:a,newY:l,newPageIndex:c}]of e)n(i,a,l,c)},undo:()=>{for(const[i,{savedX:a,savedY:l,savedPageIndex:c}]of e)n(i,a,l,c)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#f)for(const n of this.#f.keys())n.drag(e,t)}rebuild(e){if(e.parent===null){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#b.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#t===e}getActive(){return this.#t}getMode(){return this.#E}get imageManager(){return Me(this,"imageManager",new Xh)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let h=0,f=t.rangeCount;h<f;h++)if(!e.contains(t.getRangeAt(h).commonAncestorContainer))return null;const{x:n,y:i,width:a,height:l}=e.getBoundingClientRect();let c;switch(e.getAttribute("data-main-rotation")){case"90":c=(h,f,g,m)=>({x:(f-i)/l,y:1-(h+g-n)/a,width:m/l,height:g/a});break;case"180":c=(h,f,g,m)=>({x:1-(h+g-n)/a,y:1-(f+m-i)/l,width:g/a,height:m/l});break;case"270":c=(h,f,g,m)=>({x:1-(f+m-i)/l,y:(h-n)/a,width:m/l,height:g/a});break;default:c=(h,f,g,m)=>({x:(h-n)/a,y:(f-i)/l,width:g/a,height:m/l});break}const d=[];for(let h=0,f=t.rangeCount;h<f;h++){const g=t.getRangeAt(h);if(!g.collapsed)for(const{x:m,y,width:x,height:w}of g.getClientRects())x===0||w===0||d.push(c(m,y,x,w))}return d.length===0?null:d}addChangedExistingAnnotation({annotationElementId:e,id:t}){(this.#l||=new Map).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){this.#l?.delete(e)}renderAnnotationElement(e){const t=this.#l?.get(e.data.id);if(!t)return;const n=this.#s.getRawValue(t);n&&(this.#E===Re.NONE&&!n.hasBeenModified||n.renderAnnotationElement(e))}setMissingCanvas(e,t,n){const i=this.#L?.get(e);i&&(i.setCanvas(t,n),this.#L.delete(e))}addMissingCanvas(e,t){(this.#L||=new Map).set(e,t)}}class qn{#e=null;#t=!1;#n=null;#r=null;#i=null;#s=null;#l=!1;#a=null;#d=null;#c=null;#h=null;#u=!1;static#f=null;static _l10n=null;constructor(e){this.#d=e,this.#u=e._uiManager.useNewAltTextFlow,qn.#f||=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(e){qn._l10n??=e}async render(){const e=this.#n=document.createElement("button");e.className="altText",e.tabIndex="0";const t=this.#r=document.createElement("span");e.append(t),this.#u?(e.classList.add("new"),e.setAttribute("data-l10n-id",qn.#f.missing),t.setAttribute("data-l10n-id",qn.#f["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const n=this.#d._uiManager._signal;e.addEventListener("contextmenu",An,{signal:n}),e.addEventListener("pointerdown",a=>a.stopPropagation(),{signal:n});const i=a=>{a.preventDefault(),this.#d._uiManager.editAltText(this.#d),this.#u&&this.#d._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#o}})};return e.addEventListener("click",i,{capture:!0,signal:n}),e.addEventListener("keydown",a=>{a.target===e&&a.key==="Enter"&&(this.#l=!0,i(a))},{signal:n}),await this.#p(),e}get#o(){return this.#e&&"added"||this.#e===null&&this.guessedText&&"review"||"missing"}finish(){this.#n&&(this.#n.focus({focusVisible:this.#l}),this.#l=!1)}isEmpty(){return this.#u?this.#e===null:!this.#e&&!this.#t}hasData(){return this.#u?this.#e!==null||!!this.#c:this.isEmpty()}get guessedText(){return this.#c}async setGuessedText(e){this.#e===null&&(this.#c=e,this.#h=await qn._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),this.#p())}toggleAltTextBadge(e=!1){if(!this.#u||this.#e){this.#a?.remove(),this.#a=null;return}if(!this.#a){const t=this.#a=document.createElement("div");t.className="noAltTextBadge",this.#d.div.append(t)}this.#a.classList.toggle("hidden",!e)}serialize(e){let t=this.#e;return!e&&this.#c===t&&(t=this.#h),{altText:t,decorative:this.#t,guessedText:this.#c,textWithDisclaimer:this.#h}}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:e,decorative:t,guessedText:n,textWithDisclaimer:i,cancel:a=!1}){n&&(this.#c=n,this.#h=i),!(this.#e===e&&this.#t===t)&&(a||(this.#e=e,this.#t=t),this.#p())}toggle(e=!1){this.#n&&(!e&&this.#s&&(clearTimeout(this.#s),this.#s=null),this.#n.disabled=!e)}shown(){this.#d._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#o}})}destroy(){this.#n?.remove(),this.#n=null,this.#r=null,this.#i=null,this.#a?.remove(),this.#a=null}async#p(){const e=this.#n;if(!e)return;if(this.#u){if(e.classList.toggle("done",!!this.#e),e.setAttribute("data-l10n-id",qn.#f[this.#o]),this.#r?.setAttribute("data-l10n-id",qn.#f[`${this.#o}-label`]),!this.#e){this.#i?.remove();return}}else{if(!this.#e&&!this.#t){e.classList.remove("done"),this.#i?.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=this.#i;if(!t){this.#i=t=document.createElement("span"),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${this.#d.id}`;const i=100,a=this.#d._uiManager._signal;a.addEventListener("abort",()=>{clearTimeout(this.#s),this.#s=null},{once:!0}),e.addEventListener("mouseenter",()=>{this.#s=setTimeout(()=>{this.#s=null,this.#i.classList.add("show"),this.#d._reportTelemetry({action:"alt_text_tooltip"})},i)},{signal:a}),e.addEventListener("mouseleave",()=>{this.#s&&(clearTimeout(this.#s),this.#s=null),this.#i?.classList.remove("show")},{signal:a})}this.#t?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=this.#e),t.parentNode||e.append(t),this.#d.getElementForAltText()?.setAttribute("aria-describedby",t.id)}}class Yo{#e;#t=!1;#n=null;#r;#i;#s;#l;#a=null;#d;#c=null;#h;#u=null;constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:n=null,onPinchStart:i=null,onPinching:a=null,onPinchEnd:l=null,signal:c}){this.#e=e,this.#n=n,this.#r=t,this.#i=i,this.#s=a,this.#l=l,this.#h=new AbortController,this.#d=AbortSignal.any([c,this.#h.signal]),e.addEventListener("touchstart",this.#f.bind(this),{passive:!1,signal:this.#d})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Dn.pixelRatio}#f(e){if(this.#r?.())return;if(e.touches.length===1){if(this.#a)return;const i=this.#a=new AbortController,a=AbortSignal.any([this.#d,i.signal]),l=this.#e,c={capture:!0,signal:a,passive:!1},d=h=>{h.pointerType==="touch"&&(this.#a?.abort(),this.#a=null)};l.addEventListener("pointerdown",h=>{h.pointerType==="touch"&&(dt(h),d(h))},c),l.addEventListener("pointerup",d,c),l.addEventListener("pointercancel",d,c);return}if(!this.#u){this.#u=new AbortController;const i=AbortSignal.any([this.#d,this.#u.signal]),a=this.#e,l={signal:i,capture:!1,passive:!1};a.addEventListener("touchmove",this.#o.bind(this),l);const c=this.#p.bind(this);a.addEventListener("touchend",c,l),a.addEventListener("touchcancel",c,l),l.capture=!0,a.addEventListener("pointerdown",dt,l),a.addEventListener("pointermove",dt,l),a.addEventListener("pointercancel",dt,l),a.addEventListener("pointerup",dt,l),this.#i?.()}if(dt(e),e.touches.length!==2||this.#n?.()){this.#c=null;return}let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]),this.#c={touch0X:t.screenX,touch0Y:t.screenY,touch1X:n.screenX,touch1Y:n.screenY}}#o(e){if(!this.#c||e.touches.length!==2)return;dt(e);let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]);const{screenX:i,screenY:a}=t,{screenX:l,screenY:c}=n,d=this.#c,{touch0X:h,touch0Y:f,touch1X:g,touch1Y:m}=d,y=g-h,x=m-f,w=l-i,S=c-a,E=Math.hypot(w,S)||1,P=Math.hypot(y,x)||1;if(!this.#t&&Math.abs(P-E)<=Yo.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(d.touch0X=i,d.touch0Y=a,d.touch1X=l,d.touch1Y=c,!this.#t){this.#t=!0;return}const k=[(i+l)/2,(a+c)/2];this.#s?.(k,P,E)}#p(e){e.touches.length>=2||(this.#u&&(this.#u.abort(),this.#u=null,this.#l?.()),this.#c&&(dt(e),this.#c=null,this.#t=!1))}destroy(){this.#h?.abort(),this.#h=null,this.#a?.abort(),this.#a=null}}class _e{#e=null;#t=null;#n=null;#r=!1;#i=null;#s="";#l=!1;#a=null;#d=null;#c=null;#h=null;#u="";#f=!1;#o=null;#p=!1;#m=!1;#g=!1;#v=null;#y=0;#w=0;#x=null;#A=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#_=!1;#k=_e._zIndex++;static _borderLineWidth=-1;static _colorManager=new Yh;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const e=_e.prototype._resizeWithKeyboard,t=br.TRANSLATE_SMALL,n=br.TRANSLATE_BIG;return Me(this,"_resizerKeyboardManager",new Xo([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,n]}],[["Escape","mac+Escape"],_e.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;const{rotation:t,rawDims:{pageWidth:n,pageHeight:i,pageX:a,pageY:l}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,i],this.pageTranslation=[a,l];const[c,d]=this.parentDimensions;this.x=e.x/c,this.y=e.y/d,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get isDrawer(){return!1}static get _defaultLineColor(){return Me(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new mT({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t){if(_e._l10n??=e,_e._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"}),_e._borderLineWidth!==-1)return;const n=getComputedStyle(document.documentElement);_e._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){We("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#_}set _isDraggable(e){this.#_=e,this.div?.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#k}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):this.#H(),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#f?this.#f=!1:this.parent.setSelected(this))}focusout(e){!this._focusEventsAllowed||!this.isAttachedToDOM||e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,i){const[a,l]=this.parentDimensions;[n,i]=this.screenToPageTranslation(n,i),this.x=(e+n)/a,this.y=(t+i)/l,this.fixAndSetPosition()}_moveAfterPaste(e,t){const[n,i]=this.parentDimensions;this.setAt(e*n,t*i,this.width*n,this.height*i),this._onTranslated()}#T([e,t],n,i){[n,i]=this.screenToPageTranslation(n,i),this.x+=n/e,this.y+=i/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,t){this.#T(this.parentDimensions,e,t)}translateInPage(e,t){this.#o||=[this.x,this.y,this.width,this.height],this.#T(this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){this.#o||=[this.x,this.y,this.width,this.height];const{div:n,parentDimensions:[i,a]}=this;if(this.x+=e/i,this.y+=t/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:g,y:m}=this.div.getBoundingClientRect();this.parent.findNewParent(this,g,m)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:l,y:c}=this;const[d,h]=this.getBaseTranslation();l+=d,c+=h;const{style:f}=n;f.left=`${(100*l).toFixed(2)}%`,f.top=`${(100*c).toFixed(2)}%`,this._onTranslating(l,c),n.scrollIntoView({block:"nearest"})}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!this.#o&&(this.#o[0]!==this.x||this.#o[1]!==this.y)}get _hasBeenResized(){return!!this.#o&&(this.#o[2]!==this.width||this.#o[3]!==this.height)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:n}=_e,i=n/e,a=n/t;switch(this.rotation){case 90:return[-i,a];case 180:return[i,a];case 270:return[i,-a];default:return[-i,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:t},pageDimensions:[n,i]}=this;let{x:a,y:l,width:c,height:d}=this;if(c*=n,d*=i,a*=n,l*=i,this._mustFixPosition)switch(e){case 0:a=jt(a,0,n-c),l=jt(l,0,i-d);break;case 90:a=jt(a,0,n-d),l=jt(l,c,i);break;case 180:a=jt(a,c,n),l=jt(l,d,i);break;case 270:a=jt(a,d,n),l=jt(l,0,i-c);break}this.x=a/=n,this.y=l/=i;const[h,f]=this.getBaseTranslation();a+=h,l+=f,t.left=`${(100*a).toFixed(2)}%`,t.top=`${(100*l).toFixed(2)}%`,this.moveInDOM()}static#S(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(e,t){return _e.#S(e,t,this.parentRotation)}pageTranslationToScreen(e,t){return _e.#S(e,t,360-this.parentRotation)}#P(e){switch(e){case 90:{const[t,n]=this.pageDimensions;return[0,-t/n,n/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,n]=this.pageDimensions;return[0,t/n,-n/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(e,t){const[n,i]=this.parentDimensions,{style:a}=this.div;a.width=`${(100*e/n).toFixed(2)}%`,this.#l||(a.height=`${(100*t/i).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:t,width:n}=e,i=n.endsWith("%"),a=!this.#l&&t.endsWith("%");if(i&&a)return;const[l,c]=this.parentDimensions;i||(e.width=`${(100*parseFloat(n)/l).toFixed(2)}%`),!this.#l&&!a&&(e.height=`${(100*parseFloat(t)/c).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#C(){if(this.#a)return;this.#a=document.createElement("div"),this.#a.classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const n of e){const i=document.createElement("div");this.#a.append(i),i.classList.add("resizer",n),i.setAttribute("data-resizer-name",n),i.addEventListener("pointerdown",this.#N.bind(this,n),{signal:t}),i.addEventListener("contextmenu",An,{signal:t}),i.tabIndex=-1}this.div.prepend(this.#a)}#N(e,t){t.preventDefault();const{isMac:n}=kt.platform;if(t.button!==0||t.ctrlKey&&n)return;this.#n?.toggle(!1);const i=this._isDraggable;this._isDraggable=!1,this.#d=[t.screenX,t.screenY];const a=new AbortController,l=this._uiManager.combinedSignal(a);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#$.bind(this,e),{passive:!0,capture:!0,signal:l}),window.addEventListener("touchmove",dt,{passive:!1,signal:l}),window.addEventListener("contextmenu",An,{signal:l}),this.#c={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const c=this.parent.div.style.cursor,d=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const h=()=>{a.abort(),this.parent.togglePointerEvents(!0),this.#n?.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=c,this.div.style.cursor=d,this.#L()};window.addEventListener("pointerup",h,{signal:l}),window.addEventListener("blur",h,{signal:l})}#I(e,t,n,i){this.width=n,this.height=i,this.x=e,this.y=t;const[a,l]=this.parentDimensions;this.setDims(a*n,l*i),this.fixAndSetPosition(),this._onResized()}_onResized(){}#L(){if(!this.#c)return;const{savedX:e,savedY:t,savedWidth:n,savedHeight:i}=this.#c;this.#c=null;const a=this.x,l=this.y,c=this.width,d=this.height;a===e&&l===t&&c===n&&d===i||this.addCommands({cmd:this.#I.bind(this,a,l,c,d),undo:this.#I.bind(this,e,t,n,i),mustExec:!0})}static _round(e){return Math.round(e*1e4)/1e4}#$(e,t){const[n,i]=this.parentDimensions,a=this.x,l=this.y,c=this.width,d=this.height,h=_e.MIN_SIZE/n,f=_e.MIN_SIZE/i,g=this.#P(this.rotation),m=(B,$)=>[g[0]*B+g[2]*$,g[1]*B+g[3]*$],y=this.#P(360-this.rotation),x=(B,$)=>[y[0]*B+y[2]*$,y[1]*B+y[3]*$];let w,S,E=!1,P=!1;switch(e){case"topLeft":E=!0,w=(B,$)=>[0,0],S=(B,$)=>[B,$];break;case"topMiddle":w=(B,$)=>[B/2,0],S=(B,$)=>[B/2,$];break;case"topRight":E=!0,w=(B,$)=>[B,0],S=(B,$)=>[0,$];break;case"middleRight":P=!0,w=(B,$)=>[B,$/2],S=(B,$)=>[0,$/2];break;case"bottomRight":E=!0,w=(B,$)=>[B,$],S=(B,$)=>[0,0];break;case"bottomMiddle":w=(B,$)=>[B/2,$],S=(B,$)=>[B/2,0];break;case"bottomLeft":E=!0,w=(B,$)=>[0,$],S=(B,$)=>[B,0];break;case"middleLeft":P=!0,w=(B,$)=>[0,$/2],S=(B,$)=>[B,$/2];break}const k=w(c,d),T=S(c,d);let R=m(...T);const I=_e._round(a+R[0]),N=_e._round(l+R[1]);let D=1,V=1,j,G;if(t.fromKeyboard)({deltaX:j,deltaY:G}=t);else{const{screenX:B,screenY:$}=t,[M,Q]=this.#d;[j,G]=this.screenToPageTranslation(B-M,$-Q),this.#d[0]=B,this.#d[1]=$}if([j,G]=x(j/n,G/i),E){const B=Math.hypot(c,d);D=V=Math.max(Math.min(Math.hypot(T[0]-k[0]-j,T[1]-k[1]-G)/B,1/c,1/d),h/c,f/d)}else P?D=jt(Math.abs(T[0]-k[0]-j),h,1)/c:V=jt(Math.abs(T[1]-k[1]-G),f,1)/d;const Z=_e._round(c*D),K=_e._round(d*V);R=m(...S(Z,K));const J=I-R[0],ee=N-R[1];this.#o||=[this.x,this.y,this.width,this.height],this.width=Z,this.height=K,this.x=J,this.y=ee,this.setDims(n*Z,i*K),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#n?.finish()}async addEditToolbar(){return this._editToolbar||this.#m?this._editToolbar:(this._editToolbar=new Ro(this),this.div.append(this._editToolbar.render()),this.#n&&await this._editToolbar.addAltText(this.#n),this._editToolbar)}removeEditToolbar(){this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,this.#n?.destroy())}addContainer(e){const t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#n||(qn.initialize(_e._l10n),this.#n=new qn(this),this.#e&&(this.#n.data=this.#e,this.#e=null),await this.addEditToolbar())}get altTextData(){return this.#n?.data}set altTextData(e){this.#n&&(this.#n.data=e)}get guessedAltText(){return this.#n?.guessedText}async setGuessedAltText(e){await this.#n?.setGuessedText(e)}serializeAltText(e){return this.#n?.serialize(e)}hasAltText(){return!!this.#n&&!this.#n.isEmpty()}hasAltTextData(){return this.#n?.hasData()??!1}render(){const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=this.#r?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),this.#V();const[t,n]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*n/t).toFixed(2)}%`,e.style.maxHeight=`${(100*t/n).toFixed(2)}%`);const[i,a]=this.getInitialTranslation();return this.translate(i,a),y0(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#A||=new Yo({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#E.bind(this),onPinching:this.#b.bind(this),onPinchEnd:this.#F.bind(this),signal:this._uiManager._signal})),this._uiManager._editorUndoBar?.hide(),e}#E(){this.#c={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#n?.toggle(!1),this.parent.togglePointerEvents(!1)}#b(e,t,n){let a=.7*(n/t)+1-.7;if(a===1)return;const l=this.#P(this.rotation),c=(I,N)=>[l[0]*I+l[2]*N,l[1]*I+l[3]*N],[d,h]=this.parentDimensions,f=this.x,g=this.y,m=this.width,y=this.height,x=_e.MIN_SIZE/d,w=_e.MIN_SIZE/h;a=Math.max(Math.min(a,1/m,1/y),x/m,w/y);const S=_e._round(m*a),E=_e._round(y*a);if(S===m&&E===y)return;this.#o||=[f,g,m,y];const P=c(m/2,y/2),k=_e._round(f+P[0]),T=_e._round(g+P[1]),R=c(S/2,E/2);this.x=k-R[0],this.y=T-R[1],this.width=S,this.height=E,this.setDims(d*S,h*E),this.fixAndSetPosition(),this._onResizing()}#F(){this.#n?.toggle(!0),this.parent.togglePointerEvents(!0),this.#L()}pointerdown(e){const{isMac:t}=kt.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(this.#f=!0,this._isDraggable){this.#U(e);return}this.#j(e)}#j(e){const{isMac:t}=kt.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}#U(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();let n=!1;const i=new AbortController,a=this._uiManager.combinedSignal(i),l={capture:!0,passive:!1,signal:a},c=h=>{i.abort(),this.#i=null,this.#f=!1,this._uiManager.endDragSession()||this.#j(h),n&&this._onStopDragging()};t&&(this.#y=e.clientX,this.#w=e.clientY,this.#i=e.pointerId,this.#s=e.pointerType,window.addEventListener("pointermove",h=>{n||(n=!0,this._onStartDragging());const{clientX:f,clientY:g,pointerId:m}=h;if(m!==this.#i){dt(h);return}const[y,x]=this.screenToPageTranslation(f-this.#y,g-this.#w);this.#y=f,this.#w=g,this._uiManager.dragSelectedEditors(y,x)},l),window.addEventListener("touchmove",dt,l),window.addEventListener("pointerdown",h=>{h.pointerType===this.#s&&(this.#A||h.isPrimary)&&c(h),dt(h)},l));const d=h=>{if(!this.#i||this.#i===h.pointerId){c(h);return}dt(h)};window.addEventListener("pointerup",d,{signal:a}),window.addEventListener("blur",d,{signal:a})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#v&&clearTimeout(this.#v),this.#v=setTimeout(()=>{this.#v=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,n=this.rotation){const i=this.parentScale,[a,l]=this.pageDimensions,[c,d]=this.pageTranslation,h=e/i,f=t/i,g=this.x*a,m=this.y*l,y=this.width*a,x=this.height*l;switch(n){case 0:return[g+h+c,l-m-f-x+d,g+h+y+c,l-m-f+d];case 90:return[g+f+c,l-m+h+d,g+f+x+c,l-m+h+y+d];case 180:return[g-h-y+c,l-m+f+d,g-h+c,l-m+f+x+d];case 270:return[g-f-x+c,l-m-h-y+d,g-f+c,l-m-h+d];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[n,i,a,l]=e,c=a-n,d=l-i;switch(this.rotation){case 0:return[n,t-l,c,d];case 90:return[n,t-i,d,c];case 180:return[a,t-i,c,d];case 270:return[a,t-l,d,c];default:throw new Error("Invalid rotation")}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),this.#m=!0,!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),this.#m=!1,!0):!1}isInEditMode(){return this.#m}shouldGetKeyboardEvents(){return this.#g}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:t,bottom:n,right:i}=this.getClientDimensions(),{innerHeight:a,innerWidth:l}=window;return t<l&&i>0&&e<a&&n>0}#V(){if(this.#h||!this.div)return;this.#h=new AbortController;const e=this._uiManager.combinedSignal(this.#h);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}rebuild(){this.#V()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(e=!1,t=null){We("An editor must be serializable")}static async deserialize(e,t,n){const i=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:n});i.rotation=e.rotation,i.#e=e.accessibilityData,i._isCopy=e.isCopy||!1;const[a,l]=i.pageDimensions,[c,d,h,f]=i.getRectInCurrentCoords(e.rect,l);return i.x=c/a,i.y=d/l,i.width=h/a,i.height=f/l,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#h?.abort(),this.#h=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#v&&(clearTimeout(this.#v),this.#v=null),this.#H(),this.removeEditToolbar(),this.#x){for(const e of this.#x.values())clearTimeout(e);this.#x=null}this.parent=null,this.#A?.destroy(),this.#A=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#C(),this.#a.classList.remove("hidden"))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),this.#c={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const t=this.#a.children;if(!this.#t){this.#t=Array.from(t);const l=this.#W.bind(this),c=this.#B.bind(this),d=this._uiManager._signal;for(const h of this.#t){const f=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",l,{signal:d}),h.addEventListener("blur",c,{signal:d}),h.addEventListener("focus",this.#M.bind(this,f),{signal:d}),h.setAttribute("data-l10n-id",_e._l10nResizer[f])}}const n=this.#t[0];let i=0;for(const l of t){if(l===n)break;i++}const a=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(a!==i){if(a<i)for(let c=0;c<i-a;c++)this.#a.append(this.#a.firstChild);else if(a>i)for(let c=0;c<a-i;c++)this.#a.firstChild.before(this.#a.lastChild);let l=0;for(const c of t){const h=this.#t[l++].getAttribute("data-resizer-name");c.setAttribute("data-l10n-id",_e._l10nResizer[h])}}this.#D(0),this.#g=!0,this.#a.firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}#W(e){_e._resizerKeyboardManager.exec(this,e)}#B(e){this.#g&&e.relatedTarget?.parentNode!==this.#a&&this.#H()}#M(e){this.#u=this.#g?e:""}#D(e){if(this.#t)for(const t of this.#t)t.tabIndex=e}_resizeWithKeyboard(e,t){this.#g&&this.#$(this.#u,{deltaX:e,deltaY:t,fromKeyboard:!0})}#H(){this.#g=!1,this.#D(-1),this.#L()}_stopResizingWithKeyboard(){this.#H(),this.div.focus()}select(){if(!(this.isSelected&&this._editToolbar)){if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),this.#n?.toggleAltTextBadge(!1)}}unselect(){this.isSelected&&(this.isSelected=!1,this.#a?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#n?.toggleAltTextBadge(!0))}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id})}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#p}set isEditing(e){this.#p=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){this.#l=!0;const n=e/t,{style:i}=this.div;i.aspectRatio=n,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,t=!1){if(t){this.#x||=new Map;const{action:n}=e;let i=this.#x.get(n);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(e),this.#x.delete(n),this.#x.size===0&&(this.#x=null)},_e._telemetryTimeout),this.#x.set(n,i);return}e.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#r=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#r=!0}renderAnnotationElement(e){let t=e.container.querySelector(".annotationContent");if(!t)t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);else if(t.nodeName==="CANVAS"){const n=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),n.before(t)}return t}resetAnnotationElement(e){const{firstChild:t}=e.container;t?.nodeName==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}}class mT extends _e{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const rv=3285377520,bn=4294901760,Wn=65535;class w0{constructor(e){this.h1=e?e&4294967295:rv,this.h2=e?e&4294967295:rv}update(e){let t,n;if(typeof e=="string"){t=new Uint8Array(e.length*2),n=0;for(let w=0,S=e.length;w<S;w++){const E=e.charCodeAt(w);E<=255?t[n++]=E:(t[n++]=E>>>8,t[n++]=E&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),n=t.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const i=n>>2,a=n-i*4,l=new Uint32Array(t.buffer,0,i);let c=0,d=0,h=this.h1,f=this.h2;const g=3432918353,m=461845907,y=g&Wn,x=m&Wn;for(let w=0;w<i;w++)w&1?(c=l[w],c=c*g&bn|c*y&Wn,c=c<<15|c>>>17,c=c*m&bn|c*x&Wn,h^=c,h=h<<13|h>>>19,h=h*5+3864292196):(d=l[w],d=d*g&bn|d*y&Wn,d=d<<15|d>>>17,d=d*m&bn|d*x&Wn,f^=d,f=f<<13|f>>>19,f=f*5+3864292196);switch(c=0,a){case 3:c^=t[i*4+2]<<16;case 2:c^=t[i*4+1]<<8;case 1:c^=t[i*4],c=c*g&bn|c*y&Wn,c=c<<15|c>>>17,c=c*m&bn|c*x&Wn,i&1?h^=c:f^=c}this.h1=h,this.h2=f}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&bn|e*36045&Wn,t=t*4283543511&bn|((t<<16|e>>>16)*2950163797&bn)>>>16,e^=t>>>1,e=e*444984403&bn|e*60499&Wn,t=t*3301882366&bn|((t<<16|e>>>16)*3120437893&bn)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const oh=Object.freeze({map:null,hash:"",transfer:void 0});class Kh{#e=!1;#t=null;#n=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const n=this.#n.get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return this.#n.get(e)}remove(e){if(this.#n.delete(e),this.#n.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const t of this.#n.values())if(t instanceof _e)return;this.onAnnotationEditor(null)}}setValue(e,t){const n=this.#n.get(e);let i=!1;if(n!==void 0)for(const[a,l]of Object.entries(t))n[a]!==l&&(i=!0,n[a]=l);else i=!0,this.#n.set(e,t);i&&this.#r(),t instanceof _e&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(t.constructor._type)}has(e){return this.#n.has(e)}get size(){return this.#n.size}#r(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new b0(this)}get serializable(){if(this.#n.size===0)return oh;const e=new Map,t=new w0,n=[],i=Object.create(null);let a=!1;for(const[l,c]of this.#n){const d=c instanceof _e?c.serialize(!1,i):c;d&&(e.set(l,d),t.update(`${l}:${JSON.stringify(d)}`),a||=!!d.bitmap)}if(a)for(const l of e.values())l.bitmap&&n.push(l.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:oh}get editorStats(){let e=null;const t=new Map;for(const n of this.#n.values()){if(!(n instanceof _e))continue;const i=n.telemetryFinalData;if(!i)continue;const{type:a}=i;t.has(a)||t.set(a,Object.getPrototypeOf(n).constructor),e||=Object.create(null);const l=e[a]||=new Map;for(const[c,d]of Object.entries(i)){if(c==="type")continue;let h=l.get(c);h||(h=new Map,l.set(c,h));const f=h.get(d)??0;h.set(d,f+1)}}for(const[n,i]of t)e[n]=i.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){this.#t=null}get modifiedIds(){if(this.#t)return this.#t;const e=[];for(const t of this.#n.values())!(t instanceof _e)||!t.annotationElementId||!t.serialize()||e.push(t.annotationElementId);return this.#t={ids:new Set(e),hash:e.join(",")}}[Symbol.iterator](){return this.#n.entries()}}class b0 extends Kh{#e;constructor(e){super();const{map:t,hash:n,transfer:i}=e.serializable,a=structuredClone(t,i?{transfer:i}:null);this.#e={map:a,hash:n,transfer:i}}get print(){We("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}get modifiedIds(){return Me(this,"modifiedIds",{ids:new Set,hash:""})}}class vT{#e=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:n}){if(!(!e||this.#e.has(e.loadedName))){if(mt(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:a,style:l}=e,c=new FontFace(i,a,l);this.addNativeFontFace(c);try{await c.load(),this.#e.add(i),n?.(e)}catch{Ne(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(c)}return}We("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const n=e.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(i){throw Ne(`Failed to load font '${n.family}': '${i}'.`),e.disableFontFace=!0,i}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const i=this._queueLoadingCallback(n);this._prepareFontLoadEvent(e,i)})}}get isFontLoadingAPISupported(){const e=!!this._document?.fonts;return Me(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return Me(this,"isSyncFontLoadingSupported",Ut||kt.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(mt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;n.length>0&&n[0].done;){const a=n.shift();setTimeout(a.callback,0)}}const{loadingRequests:n}=this,i={done:!1,complete:t,callback:e};return n.push(i),i}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Me(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){function n(T,R){return T.charCodeAt(R)<<24|T.charCodeAt(R+1)<<16|T.charCodeAt(R+2)<<8|T.charCodeAt(R+3)&255}function i(T,R,I,N){const D=T.substring(0,R),V=T.substring(R+I);return D+N+V}let a,l;const c=this._document.createElement("canvas");c.width=1,c.height=1;const d=c.getContext("2d");let h=0;function f(T,R){if(++h>30){Ne("Load test font never loaded."),R();return}if(d.font="30px "+T,d.fillText(".",0,20),d.getImageData(0,0,1,1).data[3]>0){R();return}setTimeout(f.bind(null,T,R))}const g=`lt${Date.now()}${this.loadTestFontId++}`;let m=this._loadTestFont;m=i(m,976,g.length,g);const x=16,w=1482184792;let S=n(m,x);for(a=0,l=g.length-3;a<l;a+=4)S=S-w+n(g,a)|0;a<g.length&&(S=S-w+n(g+"XXX",a)|0),m=i(m,x,4,iT(S));const E=`url(data:font/opentype;base64,${btoa(m)});`,P=`@font-face {font-family:"${g}";src:${E}}`;this.insertRule(P);const k=this._document.createElement("div");k.style.visibility="hidden",k.style.width=k.style.height="10px",k.style.position="absolute",k.style.top=k.style.left="0px";for(const T of[e.loadedName,g]){const R=this._document.createElement("span");R.textContent="Hi",R.style.fontFamily=T,k.append(R)}this._document.body.append(k),f(g,()=>{k.remove(),t.complete()})}}class yT{constructor(e,t=null){this.compiledGlyphs=Object.create(null);for(const n in e)this[n]=e[n];this._inspectFont=t}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${p0(this.data)});`;let t;if(!this.cssFontInfo)t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${e}}`}return this._inspectFont?.(this,e),t}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];const n=this.loadedName+"_path_"+t;let i;try{i=e.get(n)}catch(l){Ne(`getPathGenerator - ignoring character: "${l}".`)}const a=new Path2D(i||"");return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[t]=a}}function wT(s){if(s instanceof URL)return s.href;if(typeof s=="string"){if(Ut)return s;const e=URL.parse(s,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function bT(s){if(Ut&&typeof Buffer<"u"&&s instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength)return s;if(typeof s=="string")return Wo(s);if(s instanceof ArrayBuffer||ArrayBuffer.isView(s)||typeof s=="object"&&!isNaN(s?.length))return new Uint8Array(s);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function xl(s){if(typeof s!="string")return null;if(s.endsWith("/"))return s;throw new Error(`Invalid factory url: "${s}" must include trailing slash.`)}const ah=s=>typeof s=="object"&&Number.isInteger(s?.num)&&s.num>=0&&Number.isInteger(s?.gen)&&s.gen>=0,xT=s=>typeof s=="object"&&typeof s?.name=="string",x0=cT.bind(null,ah,xT);class ST{#e=new Map;#t=Promise.resolve();postMessage(e,t){const n={data:structuredClone(e,t?{transfer:t}:null)};this.#t.then(()=>{for(const[i]of this.#e)i.call(this,n)})}addEventListener(e,t,n=null){let i=null;if(n?.signal instanceof AbortSignal){const{signal:a}=n;if(a.aborted){Ne("LoopbackPort - cannot use an `aborted` signal.");return}const l=()=>this.removeEventListener(e,t);i=()=>a.removeEventListener("abort",l),a.addEventListener("abort",l)}this.#e.set(t,i)}removeEventListener(e,t){this.#e.get(t)?.(),this.#e.delete(t)}terminate(){for(const[,e]of this.#e)e?.();this.#e.clear()}}const Sl={DATA:1,ERROR:2},gt={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function sv(){}function Jt(s){if(s instanceof wr||s instanceof Hl||s instanceof ev||s instanceof Mo||s instanceof Ld)return s;switch(s instanceof Error||typeof s=="object"&&s!==null||We('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),s.name){case"AbortException":return new wr(s.message);case"InvalidPDFException":return new Hl(s.message);case"PasswordException":return new ev(s.message,s.code);case"ResponseException":return new Mo(s.message,s.status,s.missing);case"UnknownErrorException":return new Ld(s.message,s.details)}return new Ld(s.message,s.toString())}class ko{#e=new AbortController;constructor(e,t,n){this.sourceName=e,this.targetName=t,this.comObj=n,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),n.addEventListener("message",this.#t.bind(this),{signal:this.#e.signal})}#t({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){this.#r(e);return}if(e.callback){const n=e.callbackId,i=this.callbackCapabilities[n];if(!i)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],e.callback===Sl.DATA)i.resolve(e.data);else if(e.callback===Sl.ERROR)i.reject(Jt(e.reason));else throw new Error("Unexpected callback case");return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const n=this.sourceName,i=e.sourceName,a=this.comObj;Promise.try(t,e.data).then(function(l){a.postMessage({sourceName:n,targetName:i,callback:Sl.DATA,callbackId:e.callbackId,data:l})},function(l){a.postMessage({sourceName:n,targetName:i,callback:Sl.ERROR,callbackId:e.callbackId,reason:Jt(l)})});return}if(e.streamId){this.#n(e);return}t(e.data)}on(e,t){const n=this.actionHandler;if(n[e])throw new Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){const i=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[i]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:i,data:t},n)}catch(l){a.reject(l)}return a.promise}sendWithStream(e,t,n,i){const a=this.streamId++,l=this.sourceName,c=this.targetName,d=this.comObj;return new ReadableStream({start:h=>{const f=Promise.withResolvers();return this.streamControllers[a]={controller:h,startCall:f,pullCall:null,cancelCall:null,isClosed:!1},d.postMessage({sourceName:l,targetName:c,action:e,streamId:a,data:t,desiredSize:h.desiredSize},i),f.promise},pull:h=>{const f=Promise.withResolvers();return this.streamControllers[a].pullCall=f,d.postMessage({sourceName:l,targetName:c,stream:gt.PULL,streamId:a,desiredSize:h.desiredSize}),f.promise},cancel:h=>{mt(h instanceof Error,"cancel must have a valid reason");const f=Promise.withResolvers();return this.streamControllers[a].cancelCall=f,this.streamControllers[a].isClosed=!0,d.postMessage({sourceName:l,targetName:c,stream:gt.CANCEL,streamId:a,reason:Jt(h)}),f.promise}},n)}#n(e){const t=e.streamId,n=this.sourceName,i=e.sourceName,a=this.comObj,l=this,c=this.actionHandler[e.action],d={enqueue(h,f=1,g){if(this.isCancelled)return;const m=this.desiredSize;this.desiredSize-=f,m>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),a.postMessage({sourceName:n,targetName:i,stream:gt.ENQUEUE,streamId:t,chunk:h},g)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:n,targetName:i,stream:gt.CLOSE,streamId:t}),delete l.streamSinks[t])},error(h){mt(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,a.postMessage({sourceName:n,targetName:i,stream:gt.ERROR,streamId:t,reason:Jt(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};d.sinkCapability.resolve(),d.ready=d.sinkCapability.promise,this.streamSinks[t]=d,Promise.try(c,e.data,d).then(function(){a.postMessage({sourceName:n,targetName:i,stream:gt.START_COMPLETE,streamId:t,success:!0})},function(h){a.postMessage({sourceName:n,targetName:i,stream:gt.START_COMPLETE,streamId:t,reason:Jt(h)})})}#r(e){const t=e.streamId,n=this.sourceName,i=e.sourceName,a=this.comObj,l=this.streamControllers[t],c=this.streamSinks[t];switch(e.stream){case gt.START_COMPLETE:e.success?l.startCall.resolve():l.startCall.reject(Jt(e.reason));break;case gt.PULL_COMPLETE:e.success?l.pullCall.resolve():l.pullCall.reject(Jt(e.reason));break;case gt.PULL:if(!c){a.postMessage({sourceName:n,targetName:i,stream:gt.PULL_COMPLETE,streamId:t,success:!0});break}c.desiredSize<=0&&e.desiredSize>0&&c.sinkCapability.resolve(),c.desiredSize=e.desiredSize,Promise.try(c.onPull||sv).then(function(){a.postMessage({sourceName:n,targetName:i,stream:gt.PULL_COMPLETE,streamId:t,success:!0})},function(h){a.postMessage({sourceName:n,targetName:i,stream:gt.PULL_COMPLETE,streamId:t,reason:Jt(h)})});break;case gt.ENQUEUE:if(mt(l,"enqueue should have stream controller"),l.isClosed)break;l.controller.enqueue(e.chunk);break;case gt.CLOSE:if(mt(l,"close should have stream controller"),l.isClosed)break;l.isClosed=!0,l.controller.close(),this.#i(l,t);break;case gt.ERROR:mt(l,"error should have stream controller"),l.controller.error(Jt(e.reason)),this.#i(l,t);break;case gt.CANCEL_COMPLETE:e.success?l.cancelCall.resolve():l.cancelCall.reject(Jt(e.reason)),this.#i(l,t);break;case gt.CANCEL:if(!c)break;const d=Jt(e.reason);Promise.try(c.onCancel||sv,d).then(function(){a.postMessage({sourceName:n,targetName:i,stream:gt.CANCEL_COMPLETE,streamId:t,success:!0})},function(h){a.postMessage({sourceName:n,targetName:i,stream:gt.CANCEL_COMPLETE,streamId:t,reason:Jt(h)})}),c.sinkCapability.reject(d),c.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#i(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.#e?.abort(),this.#e=null}}class S0{#e=!1;constructor({enableHWA:e=!1}){this.#e=e}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(e,t);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!this.#e})}}reset(e,t,n){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=n}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){We("Abstract method `_createCanvas` called.")}}class AT extends S0{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const n=this._document.createElement("canvas");return n.width=e,n.height=t,n}}class A0{constructor({baseUrl:e=null,isCompressed:t=!0}){this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(t).then(n=>({cMapData:n,isCompressed:this.isCompressed})).catch(n=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)})}async _fetch(e){We("Abstract method `_fetch` called.")}}class iv extends A0{async _fetch(e){const t=await Ii(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):Wo(t)}}class E0{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,n,i,a){return"none"}destroy(e=!1){}}class ET extends E0{#e;#t;#n;#r;#i;#s;#l=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#r=e,this.#i=t}get#a(){return this.#t||=new Map}get#d(){return this.#s||=new Map}get#c(){if(!this.#n){const e=this.#i.createElement("div"),{style:t}=e;t.visibility="hidden",t.contain="strict",t.width=t.height=0,t.position="absolute",t.top=t.left=0,t.zIndex=-1;const n=this.#i.createElementNS(pr,"svg");n.setAttribute("width",0),n.setAttribute("height",0),this.#n=this.#i.createElementNS(pr,"defs"),e.append(n),n.append(this.#n),this.#i.body.append(e)}return this.#n}#h(e){if(e.length===1){const d=e[0],h=new Array(256);for(let g=0;g<256;g++)h[g]=d[g]/255;const f=h.join(",");return[f,f,f]}const[t,n,i]=e,a=new Array(256),l=new Array(256),c=new Array(256);for(let d=0;d<256;d++)a[d]=t[d]/255,l[d]=n[d]/255,c[d]=i[d]/255;return[a.join(","),l.join(","),c.join(",")]}#u(e){if(this.#e===void 0){this.#e="";const t=this.#i.URL;t!==this.#i.baseURI&&(qo(t)?Ne('#createUrl: ignore "data:"-URL for performance reasons.'):this.#e=Uh(t,""))}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return"none";let t=this.#a.get(e);if(t)return t;const[n,i,a]=this.#h(e),l=e.length===1?n:`${n}${i}${a}`;if(t=this.#a.get(l),t)return this.#a.set(e,t),t;const c=`g_${this.#r}_transfer_map_${this.#l++}`,d=this.#u(c);this.#a.set(e,d),this.#a.set(l,d);const h=this.#p(c);return this.#g(n,i,a,h),d}addHCMFilter(e,t){const n=`${e}-${t}`,i="base";let a=this.#d.get(i);if(a?.key===n||(a?(a.filter?.remove(),a.key=n,a.url="none",a.filter=null):(a={key:n,url:"none",filter:null},this.#d.set(i,a)),!e||!t))return a.url;const l=this.#y(e);e=xe.makeHexColor(...l);const c=this.#y(t);if(t=xe.makeHexColor(...c),this.#c.style.color="",e==="#000000"&&t==="#ffffff"||e===t)return a.url;const d=new Array(256);for(let y=0;y<=255;y++){const x=y/255;d[y]=x<=.03928?x/12.92:((x+.055)/1.055)**2.4}const h=d.join(","),f=`g_${this.#r}_hcm_filter`,g=a.filter=this.#p(f);this.#g(h,h,h,g),this.#o(g);const m=(y,x)=>{const w=l[y]/255,S=c[y]/255,E=new Array(x+1);for(let P=0;P<=x;P++)E[P]=w+P/x*(S-w);return E.join(",")};return this.#g(m(0,5),m(1,5),m(2,5),g),a.url=this.#u(f),a.url}addAlphaFilter(e){let t=this.#a.get(e);if(t)return t;const[n]=this.#h([e]),i=`alpha_${n}`;if(t=this.#a.get(i),t)return this.#a.set(e,t),t;const a=`g_${this.#r}_alpha_map_${this.#l++}`,l=this.#u(a);this.#a.set(e,l),this.#a.set(i,l);const c=this.#p(a);return this.#v(n,c),l}addLuminosityFilter(e){let t=this.#a.get(e||"luminosity");if(t)return t;let n,i;if(e?([n]=this.#h([e]),i=`luminosity_${n}`):i="luminosity",t=this.#a.get(i),t)return this.#a.set(e,t),t;const a=`g_${this.#r}_luminosity_map_${this.#l++}`,l=this.#u(a);this.#a.set(e,l),this.#a.set(i,l);const c=this.#p(a);return this.#f(c),e&&this.#v(n,c),l}addHighlightHCMFilter(e,t,n,i,a){const l=`${t}-${n}-${i}-${a}`;let c=this.#d.get(e);if(c?.key===l||(c?(c.filter?.remove(),c.key=l,c.url="none",c.filter=null):(c={key:l,url:"none",filter:null},this.#d.set(e,c)),!t||!n))return c.url;const[d,h]=[t,n].map(this.#y.bind(this));let f=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),g=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[m,y]=[i,a].map(this.#y.bind(this));g<f&&([f,g,m,y]=[g,f,y,m]),this.#c.style.color="";const x=(E,P,k)=>{const T=new Array(256),R=(g-f)/k,I=E/255,N=(P-E)/(255*k);let D=0;for(let V=0;V<=k;V++){const j=Math.round(f+V*R),G=I+V*N;for(let Z=D;Z<=j;Z++)T[Z]=G;D=j+1}for(let V=D;V<256;V++)T[V]=T[D-1];return T.join(",")},w=`g_${this.#r}_hcm_${e}_filter`,S=c.filter=this.#p(w);return this.#o(S),this.#g(x(m[0],y[0],5),x(m[1],y[1],5),x(m[2],y[2],5),S),c.url=this.#u(w),c.url}destroy(e=!1){e&&this.#s?.size||(this.#n?.parentNode.parentNode.remove(),this.#n=null,this.#t?.clear(),this.#t=null,this.#s?.clear(),this.#s=null,this.#l=0)}#f(e){const t=this.#i.createElementNS(pr,"feColorMatrix");t.setAttribute("type","matrix"),t.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(t)}#o(e){const t=this.#i.createElementNS(pr,"feColorMatrix");t.setAttribute("type","matrix"),t.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(t)}#p(e){const t=this.#i.createElementNS(pr,"filter");return t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("id",e),this.#c.append(t),t}#m(e,t,n){const i=this.#i.createElementNS(pr,t);i.setAttribute("type","discrete"),i.setAttribute("tableValues",n),e.append(i)}#g(e,t,n,i){const a=this.#i.createElementNS(pr,"feComponentTransfer");i.append(a),this.#m(a,"feFuncR",e),this.#m(a,"feFuncG",t),this.#m(a,"feFuncB",n)}#v(e,t){const n=this.#i.createElementNS(pr,"feComponentTransfer");t.append(n),this.#m(n,"feFuncA",e)}#y(e){return this.#c.style.color=e,qh(getComputedStyle(this.#c).getPropertyValue("color"))}}class _0{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetch(t).catch(n=>{throw new Error(`Unable to load font data at: ${t}`)})}async _fetch(e){We("Abstract method `_fetch` called.")}}class ov extends _0{async _fetch(e){const t=await Ii(e,"arraybuffer");return new Uint8Array(t)}}class C0{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetch(t).catch(n=>{throw new Error(`Unable to load wasm data at: ${t}`)})}async _fetch(e){We("Abstract method `_fetch` called.")}}class av extends C0{async _fetch(e){const t=await Ii(e,"arraybuffer");return new Uint8Array(t)}}Ut&&Ne("Please use the `legacy` build in Node.js environments.");async function Qh(s){const t=await process.getBuiltinModule("fs").promises.readFile(s);return new Uint8Array(t)}class _T extends E0{}class CT extends S0{_createCanvas(e,t){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,t)}}class kT extends A0{async _fetch(e){return Qh(e)}}class PT extends _0{async _fetch(e){return Qh(e)}}class TT extends C0{async _fetch(e){return Qh(e)}}const Nt={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function lh(s,e){if(!e)return;const t=e[2]-e[0],n=e[3]-e[1],i=new Path2D;i.rect(e[0],e[1],t,n),s.clip(i)}class Jh{isModifyingCurrentTransform(){return!1}getPattern(){We("Abstract method `getPattern` called.")}}class RT extends Jh{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;this._type==="axial"?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const n of this._colorStops)t.addColorStop(n[0],n[1]);return t}getPattern(e,t,n,i){let a;if(i===Nt.STROKE||i===Nt.FILL){const l=t.current.getClippedPathBoundingBox(i,rt(e))||[0,0,0,0],c=Math.ceil(l[2]-l[0])||1,d=Math.ceil(l[3]-l[1])||1,h=t.cachedCanvases.getCanvas("pattern",c,d),f=h.context;f.clearRect(0,0,f.canvas.width,f.canvas.height),f.beginPath(),f.rect(0,0,f.canvas.width,f.canvas.height),f.translate(-l[0],-l[1]),n=xe.transform(n,[1,0,0,1,l[0],l[1]]),f.transform(...t.baseTransform),this.matrix&&f.transform(...this.matrix),lh(f,this._bbox),f.fillStyle=this._createGradient(f),f.fill(),a=e.createPattern(h.canvas,"no-repeat");const g=new DOMMatrix(n);a.setTransform(g)}else lh(e,this._bbox),a=this._createGradient(e);return a}}function Od(s,e,t,n,i,a,l,c){const d=e.coords,h=e.colors,f=s.data,g=s.width*4;let m;d[t+1]>d[n+1]&&(m=t,t=n,n=m,m=a,a=l,l=m),d[n+1]>d[i+1]&&(m=n,n=i,i=m,m=l,l=c,c=m),d[t+1]>d[n+1]&&(m=t,t=n,n=m,m=a,a=l,l=m);const y=(d[t]+e.offsetX)*e.scaleX,x=(d[t+1]+e.offsetY)*e.scaleY,w=(d[n]+e.offsetX)*e.scaleX,S=(d[n+1]+e.offsetY)*e.scaleY,E=(d[i]+e.offsetX)*e.scaleX,P=(d[i+1]+e.offsetY)*e.scaleY;if(x>=P)return;const k=h[a],T=h[a+1],R=h[a+2],I=h[l],N=h[l+1],D=h[l+2],V=h[c],j=h[c+1],G=h[c+2],Z=Math.round(x),K=Math.round(P);let J,ee,B,$,M,Q,ne,F;for(let Y=Z;Y<=K;Y++){if(Y<S){const H=Y<x?0:(x-Y)/(x-S);J=y-(y-w)*H,ee=k-(k-I)*H,B=T-(T-N)*H,$=R-(R-D)*H}else{let H;Y>P?H=1:S===P?H=0:H=(S-Y)/(S-P),J=w-(w-E)*H,ee=I-(I-V)*H,B=N-(N-j)*H,$=D-(D-G)*H}let q;Y<x?q=0:Y>P?q=1:q=(x-Y)/(x-P),M=y-(y-E)*q,Q=k-(k-V)*q,ne=T-(T-j)*q,F=R-(R-G)*q;const te=Math.round(Math.min(J,M)),se=Math.round(Math.max(J,M));let ie=g*Y+te*4;for(let H=te;H<=se;H++)q=(J-H)/(J-M),q<0?q=0:q>1&&(q=1),f[ie++]=ee-(ee-Q)*q|0,f[ie++]=B-(B-ne)*q|0,f[ie++]=$-($-F)*q|0,f[ie++]=255}}function NT(s,e,t){const n=e.coords,i=e.colors;let a,l;switch(e.type){case"lattice":const c=e.verticesPerRow,d=Math.floor(n.length/c)-1,h=c-1;for(a=0;a<d;a++){let f=a*c;for(let g=0;g<h;g++,f++)Od(s,t,n[f],n[f+1],n[f+c],i[f],i[f+1],i[f+c]),Od(s,t,n[f+c+1],n[f+1],n[f+c],i[f+c+1],i[f+1],i[f+c])}break;case"triangles":for(a=0,l=n.length;a<l;a+=3)Od(s,t,n[a],n[a+1],n[a+2],i[a],i[a+1],i[a+2]);break;default:throw new Error("illegal figure")}}class IT extends Jh{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],this.matrix=null}_createMeshCanvas(e,t,n){const c=Math.floor(this._bounds[0]),d=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-c,f=Math.ceil(this._bounds[3])-d,g=Math.min(Math.ceil(Math.abs(h*e[0]*1.1)),3e3),m=Math.min(Math.ceil(Math.abs(f*e[1]*1.1)),3e3),y=h/g,x=f/m,w={coords:this._coords,colors:this._colors,offsetX:-c,offsetY:-d,scaleX:1/y,scaleY:1/x},S=g+2*2,E=m+2*2,P=n.getCanvas("mesh",S,E),k=P.context,T=k.createImageData(g,m);if(t){const I=T.data;for(let N=0,D=I.length;N<D;N+=4)I[N]=t[0],I[N+1]=t[1],I[N+2]=t[2],I[N+3]=255}for(const I of this._figures)NT(T,I,w);return k.putImageData(T,2,2),{canvas:P.canvas,offsetX:c-2*y,offsetY:d-2*x,scaleX:y,scaleY:x}}isModifyingCurrentTransform(){return!0}getPattern(e,t,n,i){lh(e,this._bbox);const a=new Float32Array(2);if(i===Nt.SHADING)xe.singularValueDecompose2dScale(rt(e),a);else if(this.matrix){xe.singularValueDecompose2dScale(this.matrix,a);const[c,d]=a;xe.singularValueDecompose2dScale(t.baseTransform,a),a[0]*=c,a[1]*=d}else xe.singularValueDecompose2dScale(t.baseTransform,a);const l=this._createMeshCanvas(a,i===Nt.SHADING?null:this._background,t.cachedCanvases);return i!==Nt.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(l.offsetX,l.offsetY),e.scale(l.scaleX,l.scaleY),e.createPattern(l.canvas,"no-repeat")}}class LT extends Jh{getPattern(){return"hotpink"}}function MT(s){switch(s[0]){case"RadialAxial":return new RT(s);case"Mesh":return new IT(s);case"Dummy":return new LT}throw new Error(`Unknown IR type: ${s[0]}`)}const lv={COLORED:1,UNCOLORED:2};class Zh{static MAX_PATTERN_SIZE=3e3;constructor(e,t,n,i){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.ctx=t,this.canvasGraphicsFactory=n,this.baseTransform=i}createPatternCanvas(e){const{bbox:t,operatorList:n,paintType:i,tilingType:a,color:l,canvasGraphicsFactory:c}=this;let{xstep:d,ystep:h}=this;d=Math.abs(d),h=Math.abs(h),dc("TilingType: "+a);const f=t[0],g=t[1],m=t[2],y=t[3],x=m-f,w=y-g,S=new Float32Array(2);xe.singularValueDecompose2dScale(this.matrix,S);const[E,P]=S;xe.singularValueDecompose2dScale(this.baseTransform,S);const k=E*S[0],T=P*S[1];let R=x,I=w,N=!1,D=!1;const V=Math.ceil(d*k),j=Math.ceil(h*T),G=Math.ceil(x*k),Z=Math.ceil(w*T);V>=G?R=d:N=!0,j>=Z?I=h:D=!0;const K=this.getSizeAndScale(R,this.ctx.canvas.width,k),J=this.getSizeAndScale(I,this.ctx.canvas.height,T),ee=e.cachedCanvases.getCanvas("pattern",K.size,J.size),B=ee.context,$=c.createCanvasGraphics(B);if($.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext($,i,l),B.translate(-K.scale*f,-J.scale*g),$.transform(K.scale,0,0,J.scale,0,0),B.save(),this.clipBbox($,f,g,m,y),$.baseTransform=rt($.ctx),$.executeOperatorList(n),$.endDrawing(),B.restore(),N||D){const M=ee.canvas;N&&(R=d),D&&(I=h);const Q=this.getSizeAndScale(R,this.ctx.canvas.width,k),ne=this.getSizeAndScale(I,this.ctx.canvas.height,T),F=Q.size,Y=ne.size,q=e.cachedCanvases.getCanvas("pattern-workaround",F,Y),te=q.context,se=N?Math.floor(x/d):0,ie=D?Math.floor(w/h):0;for(let H=0;H<=se;H++)for(let ae=0;ae<=ie;ae++)te.drawImage(M,F*H,Y*ae,F,Y,0,0,F,Y);return{canvas:q.canvas,scaleX:Q.scale,scaleY:ne.scale,offsetX:f,offsetY:g}}return{canvas:ee.canvas,scaleX:K.scale,scaleY:J.scale,offsetX:f,offsetY:g}}getSizeAndScale(e,t,n){const i=Math.max(Zh.MAX_PATTERN_SIZE,t);let a=Math.ceil(e*n);return a>=i?a=i:n=a/e,{scale:n,size:a}}clipBbox(e,t,n,i,a){const l=i-t,c=a-n;e.ctx.rect(t,n,l,c),xe.axialAlignedBoundingBox([t,n,i,a],rt(e.ctx),e.current.minMax),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,n){const i=e.ctx,a=e.current;switch(t){case lv.COLORED:const{fillStyle:l,strokeStyle:c}=this.ctx;i.fillStyle=a.fillColor=l,i.strokeStyle=a.strokeColor=c;break;case lv.UNCOLORED:i.fillStyle=i.strokeStyle=n,a.fillColor=a.strokeColor=n;break;default:throw new sT(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,n,i){let a=n;i!==Nt.SHADING&&(a=xe.transform(a,t.baseTransform),this.matrix&&(a=xe.transform(a,this.matrix)));const l=this.createPatternCanvas(t);let c=new DOMMatrix(a);c=c.translate(l.offsetX,l.offsetY),c=c.scale(1/l.scaleX,1/l.scaleY);const d=e.createPattern(l.canvas,"repeat");return d.setTransform(c),d}}function DT({src:s,srcPos:e=0,dest:t,width:n,height:i,nonBlackColor:a=4294967295,inverseDecode:l=!1}){const c=kt.isLittleEndian?4278190080:255,[d,h]=l?[a,c]:[c,a],f=n>>3,g=n&7,m=s.length;t=new Uint32Array(t.buffer);let y=0;for(let x=0;x<i;x++){for(const S=e+f;e<S;e++){const E=e<m?s[e]:255;t[y++]=E&128?h:d,t[y++]=E&64?h:d,t[y++]=E&32?h:d,t[y++]=E&16?h:d,t[y++]=E&8?h:d,t[y++]=E&4?h:d,t[y++]=E&2?h:d,t[y++]=E&1?h:d}if(g===0)continue;const w=e<m?s[e++]:255;for(let S=0;S<g;S++)t[y++]=w&1<<7-S?h:d}return{srcPos:e,destPos:y}}const cv=16,uv=100,OT=15,dv=10,Zt=16,Fd=new DOMMatrix,cn=new Float32Array(2),fi=new Float32Array([1/0,1/0,-1/0,-1/0]);function FT(s,e){if(s._removeMirroring)throw new Error("Context is already forwarding operations.");s.__originalSave=s.save,s.__originalRestore=s.restore,s.__originalRotate=s.rotate,s.__originalScale=s.scale,s.__originalTranslate=s.translate,s.__originalTransform=s.transform,s.__originalSetTransform=s.setTransform,s.__originalResetTransform=s.resetTransform,s.__originalClip=s.clip,s.__originalMoveTo=s.moveTo,s.__originalLineTo=s.lineTo,s.__originalBezierCurveTo=s.bezierCurveTo,s.__originalRect=s.rect,s.__originalClosePath=s.closePath,s.__originalBeginPath=s.beginPath,s._removeMirroring=()=>{s.save=s.__originalSave,s.restore=s.__originalRestore,s.rotate=s.__originalRotate,s.scale=s.__originalScale,s.translate=s.__originalTranslate,s.transform=s.__originalTransform,s.setTransform=s.__originalSetTransform,s.resetTransform=s.__originalResetTransform,s.clip=s.__originalClip,s.moveTo=s.__originalMoveTo,s.lineTo=s.__originalLineTo,s.bezierCurveTo=s.__originalBezierCurveTo,s.rect=s.__originalRect,s.closePath=s.__originalClosePath,s.beginPath=s.__originalBeginPath,delete s._removeMirroring},s.save=function(){e.save(),this.__originalSave()},s.restore=function(){e.restore(),this.__originalRestore()},s.translate=function(t,n){e.translate(t,n),this.__originalTranslate(t,n)},s.scale=function(t,n){e.scale(t,n),this.__originalScale(t,n)},s.transform=function(t,n,i,a,l,c){e.transform(t,n,i,a,l,c),this.__originalTransform(t,n,i,a,l,c)},s.setTransform=function(t,n,i,a,l,c){e.setTransform(t,n,i,a,l,c),this.__originalSetTransform(t,n,i,a,l,c)},s.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},s.rotate=function(t){e.rotate(t),this.__originalRotate(t)},s.clip=function(t){e.clip(t),this.__originalClip(t)},s.moveTo=function(t,n){e.moveTo(t,n),this.__originalMoveTo(t,n)},s.lineTo=function(t,n){e.lineTo(t,n),this.__originalLineTo(t,n)},s.bezierCurveTo=function(t,n,i,a,l,c){e.bezierCurveTo(t,n,i,a,l,c),this.__originalBezierCurveTo(t,n,i,a,l,c)},s.rect=function(t,n,i,a){e.rect(t,n,i,a),this.__originalRect(t,n,i,a)},s.closePath=function(){e.closePath(),this.__originalClosePath()},s.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class jT{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,n){let i;return this.cache[e]!==void 0?(i=this.cache[e],this.canvasFactory.reset(i,t,n)):(i=this.canvasFactory.create(t,n),this.cache[e]=i),i}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function Al(s,e,t,n,i,a,l,c,d,h){const[f,g,m,y,x,w]=rt(s);if(g===0&&m===0){const P=l*f+x,k=Math.round(P),T=c*y+w,R=Math.round(T),I=(l+d)*f+x,N=Math.abs(Math.round(I)-k)||1,D=(c+h)*y+w,V=Math.abs(Math.round(D)-R)||1;return s.setTransform(Math.sign(f),0,0,Math.sign(y),k,R),s.drawImage(e,t,n,i,a,0,0,N,V),s.setTransform(f,g,m,y,x,w),[N,V]}if(f===0&&y===0){const P=c*m+x,k=Math.round(P),T=l*g+w,R=Math.round(T),I=(c+h)*m+x,N=Math.abs(Math.round(I)-k)||1,D=(l+d)*g+w,V=Math.abs(Math.round(D)-R)||1;return s.setTransform(0,Math.sign(g),Math.sign(m),0,k,R),s.drawImage(e,t,n,i,a,0,0,V,N),s.setTransform(f,g,m,y,x,w),[V,N]}s.drawImage(e,t,n,i,a,l,c,d,h);const S=Math.hypot(f,g),E=Math.hypot(m,y);return[S*d,E*h]}class hv{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=ih;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=Ot.FILL;textRise=0;fillColor="#000000";strokeColor="#000000";patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";constructor(e,t){this.clipBox=new Float32Array([0,0,e,t]),this.minMax=fi.slice()}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e}getPathBoundingBox(e=Nt.FILL,t=null){const n=this.minMax.slice();if(e===Nt.STROKE){t||We("Stroke bounding box must include transform."),xe.singularValueDecompose2dScale(t,cn);const i=cn[0]*this.lineWidth/2,a=cn[1]*this.lineWidth/2;n[0]-=i,n[1]-=a,n[2]+=i,n[3]+=a}return n}updateClipFromPath(){const e=xe.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(fi,0)}getClippedPathBoundingBox(e=Nt.FILL,t=null){return xe.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function fv(s,e){if(e instanceof ImageData){s.putImageData(e,0,0);return}const t=e.height,n=e.width,i=t%Zt,a=(t-i)/Zt,l=i===0?a:a+1,c=s.createImageData(n,Zt);let d=0,h;const f=e.data,g=c.data;let m,y,x,w;if(e.kind===To.GRAYSCALE_1BPP){const S=f.byteLength,E=new Uint32Array(g.buffer,0,g.byteLength>>2),P=E.length,k=n+7>>3,T=4294967295,R=kt.isLittleEndian?4278190080:255;for(m=0;m<l;m++){for(x=m<a?Zt:i,h=0,y=0;y<x;y++){const I=S-d;let N=0;const D=I>k?n:I*8-7,V=D&-8;let j=0,G=0;for(;N<V;N+=8)G=f[d++],E[h++]=G&128?T:R,E[h++]=G&64?T:R,E[h++]=G&32?T:R,E[h++]=G&16?T:R,E[h++]=G&8?T:R,E[h++]=G&4?T:R,E[h++]=G&2?T:R,E[h++]=G&1?T:R;for(;N<D;N++)j===0&&(G=f[d++],j=128),E[h++]=G&j?T:R,j>>=1}for(;h<P;)E[h++]=0;s.putImageData(c,0,m*Zt)}}else if(e.kind===To.RGBA_32BPP){for(y=0,w=n*Zt*4,m=0;m<a;m++)g.set(f.subarray(d,d+w)),d+=w,s.putImageData(c,0,y),y+=Zt;m<l&&(w=n*i*4,g.set(f.subarray(d,d+w)),s.putImageData(c,0,y))}else if(e.kind===To.RGB_24BPP)for(x=Zt,w=n*x,m=0;m<l;m++){for(m>=a&&(x=i,w=n*x),h=0,y=w;y--;)g[h++]=f[d++],g[h++]=f[d++],g[h++]=f[d++],g[h++]=255;s.putImageData(c,0,m*Zt)}else throw new Error(`bad image kind: ${e.kind}`)}function pv(s,e){if(e.bitmap){s.drawImage(e.bitmap,0,0);return}const t=e.height,n=e.width,i=t%Zt,a=(t-i)/Zt,l=i===0?a:a+1,c=s.createImageData(n,Zt);let d=0;const h=e.data,f=c.data;for(let g=0;g<l;g++){const m=g<a?Zt:i;({srcPos:d}=DT({src:h,srcPos:d,dest:f,width:n,height:m,nonBlackColor:0})),s.putImageData(c,0,g*Zt)}}function wo(s,e){const t=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of t)s[n]!==void 0&&(e[n]=s[n]);s.setLineDash!==void 0&&(e.setLineDash(s.getLineDash()),e.lineDashOffset=s.lineDashOffset)}function El(s){s.strokeStyle=s.fillStyle="#000000",s.fillRule="nonzero",s.globalAlpha=1,s.lineWidth=1,s.lineCap="butt",s.lineJoin="miter",s.miterLimit=10,s.globalCompositeOperation="source-over",s.font="10px sans-serif",s.setLineDash!==void 0&&(s.setLineDash([]),s.lineDashOffset=0);const{filter:e}=s;e!=="none"&&e!==""&&(s.filter="none")}function gv(s,e){if(e)return!0;xe.singularValueDecompose2dScale(s,cn);const t=Math.fround(Dn.pixelRatio*Ps.PDF_TO_CSS_UNITS);return cn[0]<=t&&cn[1]<=t}const zT=["butt","round","square"],$T=["miter","round","bevel"],BT={},mv={};class yi{constructor(e,t,n,i,a,{optionalContentConfig:l,markedContentStack:c=null},d,h){this.ctx=e,this.current=new hv(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=n,this.canvasFactory=i,this.filterFactory=a,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=c||[],this.optionalContentConfig=l,this.cachedCanvases=new jT(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=d,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return typeof e=="string"?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:i=null}){const a=this.ctx.canvas.width,l=this.ctx.canvas.height,c=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,a,l),this.ctx.fillStyle=c,n){const d=this.cachedCanvases.getCanvas("transparent",a,l);this.compositeCtx=this.ctx,this.transparentCanvas=d.canvas,this.ctx=d.context,this.ctx.save(),this.ctx.transform(...rt(this.compositeCtx))}this.ctx.save(),El(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=rt(this.ctx)}executeOperatorList(e,t,n,i){const a=e.argsArray,l=e.fnArray;let c=t||0;const d=a.length;if(d===c)return c;const h=d-c>dv&&typeof n=="function",f=h?Date.now()+OT:0;let g=0;const m=this.commonObjs,y=this.objs;let x;for(;;){if(i!==void 0&&c===i.nextBreakPoint)return i.breakIt(c,n),c;if(x=l[c],x!==Lo.dependency)this[x].apply(this,a[c]);else for(const w of a[c]){const S=w.startsWith("g_")?m:y;if(!S.has(w))return S.get(w,n),c}if(c++,c===d)return c;if(h&&++g>dv){if(Date.now()>f)return n(),c;g=0}}}#e(){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)}endDrawing(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){const n=e.width??e.displayWidth,i=e.height??e.displayHeight;let a=Math.max(Math.hypot(t[0],t[1]),1),l=Math.max(Math.hypot(t[2],t[3]),1),c=n,d=i,h="prescale1",f,g;for(;a>2&&c>1||l>2&&d>1;){let m=c,y=d;a>2&&c>1&&(m=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c/2),a/=c/m),l>2&&d>1&&(y=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d)/2,l/=d/y),f=this.cachedCanvases.getCanvas(h,m,y),g=f.context,g.clearRect(0,0,m,y),g.drawImage(e,0,0,c,d,0,0,m,y),e=f.canvas,c=m,d=y,h=h==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:c,paintHeight:d}}_createMaskCanvas(e){const t=this.ctx,{width:n,height:i}=e,a=this.current.fillColor,l=this.current.patternFill,c=rt(t);let d,h,f,g;if((e.bitmap||e.data)&&e.count>1){const V=e.bitmap||e.data.buffer;h=JSON.stringify(l?c:[c.slice(0,4),a]),d=this._cachedBitmapsMap.get(V),d||(d=new Map,this._cachedBitmapsMap.set(V,d));const j=d.get(h);if(j&&!l){const G=Math.round(Math.min(c[0],c[2])+c[4]),Z=Math.round(Math.min(c[1],c[3])+c[5]);return{canvas:j,offsetX:G,offsetY:Z}}f=j}f||(g=this.cachedCanvases.getCanvas("maskCanvas",n,i),pv(g.context,e));let m=xe.transform(c,[1/n,0,0,-1/i,0,0]);m=xe.transform(m,[1,0,0,1,0,-i]);const y=fi.slice();xe.axialAlignedBoundingBox([0,0,n,i],m,y);const[x,w,S,E]=y,P=Math.round(S-x)||1,k=Math.round(E-w)||1,T=this.cachedCanvases.getCanvas("fillCanvas",P,k),R=T.context,I=x,N=w;R.translate(-I,-N),R.transform(...m),f||(f=this._scaleImage(g.canvas,Vn(R)),f=f.img,d&&l&&d.set(h,f)),R.imageSmoothingEnabled=gv(rt(R),e.interpolate),Al(R,f,0,0,f.width,f.height,0,0,n,i),R.globalCompositeOperation="source-in";const D=xe.transform(Vn(R),[1,0,0,1,-I,-N]);return R.fillStyle=l?a.getPattern(t,this,D,Nt.FILL):a,R.fillRect(0,0,n,i),d&&!l&&(this.cachedCanvases.delete("fillCanvas"),d.set(h,T.canvas)),{canvas:T.canvas,offsetX:Math.round(I),offsetY:Math.round(N)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=zT[e]}setLineJoin(e){this.ctx.lineJoin=$T[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(e),n.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,n]of e)switch(t){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.ctx.globalAlpha=this.current.fillAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(n,e,t);this.suspendedCtx=this.ctx;const a=this.ctx=i.context;a.setTransform(this.suspendedCtx.getTransform()),wo(this.suspendedCtx,a),FT(a,this.suspendedCtx),this.setGState([["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),wo(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,t,this.ctx,e),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(e,t,n,i){const a=i[0],l=i[1],c=i[2]-a,d=i[3]-l;c===0||d===0||(this.genericComposeSMask(t.context,n,c,d,t.subtype,t.backdrop,t.transferMap,a,l,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,0,0),e.restore())}genericComposeSMask(e,t,n,i,a,l,c,d,h,f,g){let m=e.canvas,y=d-f,x=h-g;if(l)if(y<0||x<0||y+n>m.width||x+i>m.height){const S=this.cachedCanvases.getCanvas("maskExtension",n,i),E=S.context;E.drawImage(m,-y,-x),E.globalCompositeOperation="destination-atop",E.fillStyle=l,E.fillRect(0,0,n,i),E.globalCompositeOperation="source-over",m=S.canvas,y=x=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const S=new Path2D;S.rect(y,x,n,i),e.clip(S),e.globalCompositeOperation="destination-atop",e.fillStyle=l,e.fillRect(y,x,n,i),e.restore()}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),a==="Alpha"&&c?t.filter=this.filterFactory.addAlphaFilter(c):a==="Luminosity"&&(t.filter=this.filterFactory.addLuminosityFilter(c));const w=new Path2D;w.rect(d,h,n,i),t.clip(w),t.globalCompositeOperation="destination-in",t.drawImage(m,y,x,n,i,d,h,n,i),t.restore()}save(){this.inSMaskMode&&wo(this.ctx,this.suspendedCtx),this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){if(this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&wo(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,t,n,i,a,l){this.ctx.transform(e,t,n,i,a,l),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n){let[i]=t;if(!n){i||=t[0]=new Path2D,this[e](i);return}if(!(i instanceof Path2D)){const a=t[0]=new Path2D;for(let l=0,c=i.length;l<c;)switch(i[l++]){case bl.moveTo:a.moveTo(i[l++],i[l++]);break;case bl.lineTo:a.lineTo(i[l++],i[l++]);break;case bl.curveTo:a.bezierCurveTo(i[l++],i[l++],i[l++],i[l++],i[l++],i[l++]);break;case bl.closePath:a.closePath();break;default:Ne(`Unrecognized drawing path operator: ${i[l-1]}`);break}i=a}xe.axialAlignedBoundingBox(n,rt(this.ctx),this.current.minMax),this[e](i)}closePath(){this.ctx.closePath()}stroke(e,t=!0){const n=this.ctx,i=this.current.strokeColor;if(n.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof i=="object"&&i?.getPattern){const a=i.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.strokeStyle=i.getPattern(n,this,Vn(n),Nt.STROKE),a){const l=new Path2D;l.addPath(e,n.getTransform().invertSelf().multiplySelf(a)),e=l}this.rescaleAndStroke(e,!1),n.restore()}else this.rescaleAndStroke(e,!0);t&&this.consumePath(e,this.current.getClippedPathBoundingBox(Nt.STROKE,rt(this.ctx))),n.globalAlpha=this.current.fillAlpha}closeStroke(e){this.stroke(e)}fill(e,t=!0){const n=this.ctx,i=this.current.fillColor,a=this.current.patternFill;let l=!1;if(a){const d=i.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.fillStyle=i.getPattern(n,this,Vn(n),Nt.FILL),d){const h=new Path2D;h.addPath(e,n.getTransform().invertSelf().multiplySelf(d)),e=h}l=!0}const c=this.current.getClippedPathBoundingBox();this.contentVisible&&c!==null&&(this.pendingEOFill?(n.fill(e,"evenodd"),this.pendingEOFill=!1):n.fill(e)),l&&n.restore(),t&&this.consumePath(e,c)}eoFill(e){this.pendingEOFill=!0,this.fill(e)}fillStroke(e){this.fill(e,!1),this.stroke(e,!1),this.consumePath(e)}eoFillStroke(e){this.pendingEOFill=!0,this.fillStroke(e)}closeFillStroke(e){this.fillStroke(e)}closeEOFillStroke(e){this.pendingEOFill=!0,this.fillStroke(e)}endPath(e){this.consumePath(e)}rawFillPath(e){this.ctx.fill(e)}clip(){this.pendingClip=BT}eoClip(){this.pendingClip=mv}beginText(){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(e===void 0)return;const n=new Path2D,i=t.getTransform().invertSelf();for(const{transform:a,x:l,y:c,fontSize:d,path:h}of e)n.addPath(h,new DOMMatrix(a).preMultiplySelf(i).translate(l,c).scale(d,-d));t.clip(n),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){const n=this.commonObjs.get(e),i=this.current;if(!n)throw new Error(`Can't find font for ${e}`);if(i.fontMatrix=n.fontMatrix||ih,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&Ne("Invalid font matrix for font "+e),t<0?(t=-t,i.fontDirection=-1):i.fontDirection=1,this.current.font=n,this.current.fontSize=t,n.isType3Font)return;const a=n.loadedName||"sans-serif",l=n.systemFontInfo?.css||`"${a}", ${n.fallbackName}`;let c="normal";n.black?c="900":n.bold&&(c="bold");const d=n.italic?"italic":"normal";let h=t;t<cv?h=cv:t>uv&&(h=uv),this.current.fontSizeScale=t/h,this.ctx.font=`${d} ${c} ${h}px ${l}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e){const{current:t}=this;t.textMatrix=e,t.textMatrixScale=Math.hypot(e[0],e[1]),t.x=t.lineX=0,t.y=t.lineY=0}nextLine(){this.moveText(0,this.current.leading)}#n(e,t,n){const i=new Path2D;return i.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(t)),i}paintChar(e,t,n,i,a){const l=this.ctx,c=this.current,d=c.font,h=c.textRenderingMode,f=c.fontSize/c.fontSizeScale,g=h&Ot.FILL_STROKE_MASK,m=!!(h&Ot.ADD_TO_PATH_FLAG),y=c.patternFill&&!d.missingFile,x=c.patternStroke&&!d.missingFile;let w;if((d.disableFontFace||m||y||x)&&(w=d.getPathGenerator(this.commonObjs,e)),d.disableFontFace||y||x){l.save(),l.translate(t,n),l.scale(f,-f);let S;if((g===Ot.FILL||g===Ot.FILL_STROKE)&&(i?(S=l.getTransform(),l.setTransform(...i),l.fill(this.#n(w,S,i))):l.fill(w)),g===Ot.STROKE||g===Ot.FILL_STROKE)if(a){S||=l.getTransform(),l.setTransform(...a);const{a:E,b:P,c:k,d:T}=S,R=xe.inverseTransform(a),I=xe.transform([E,P,k,T,0,0],R);xe.singularValueDecompose2dScale(I,cn),l.lineWidth*=Math.max(cn[0],cn[1])/f,l.stroke(this.#n(w,S,a))}else l.lineWidth/=f,l.stroke(w);l.restore()}else(g===Ot.FILL||g===Ot.FILL_STROKE)&&l.fillText(e,t,n),(g===Ot.STROKE||g===Ot.FILL_STROKE)&&l.strokeText(e,t,n);m&&(this.pendingTextPaths||=[]).push({transform:rt(l),x:t,y:n,fontSize:f,path:w})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let n=!1;for(let i=3;i<t.length;i+=4)if(t[i]>0&&t[i]<255){n=!0;break}return Me(this,"isFontSubpixelAAEnabled",n)}showText(e){const t=this.current,n=t.font;if(n.isType3Font)return this.showType3Text(e);const i=t.fontSize;if(i===0)return;const a=this.ctx,l=t.fontSizeScale,c=t.charSpacing,d=t.wordSpacing,h=t.fontDirection,f=t.textHScale*h,g=e.length,m=n.vertical,y=m?1:-1,x=n.defaultVMetrics,w=i*t.fontMatrix[0],S=t.textRenderingMode===Ot.FILL&&!n.disableFontFace&&!t.patternFill;a.save(),t.textMatrix&&a.transform(...t.textMatrix),a.translate(t.x,t.y+t.textRise),h>0?a.scale(f,-1):a.scale(f,1);let E,P;if(t.patternFill){a.save();const N=t.fillColor.getPattern(a,this,Vn(a),Nt.FILL);E=rt(a),a.restore(),a.fillStyle=N}if(t.patternStroke){a.save();const N=t.strokeColor.getPattern(a,this,Vn(a),Nt.STROKE);P=rt(a),a.restore(),a.strokeStyle=N}let k=t.lineWidth;const T=t.textMatrixScale;if(T===0||k===0){const N=t.textRenderingMode&Ot.FILL_STROKE_MASK;(N===Ot.STROKE||N===Ot.FILL_STROKE)&&(k=this.getSinglePixelWidth())}else k/=T;if(l!==1&&(a.scale(l,l),k/=l),a.lineWidth=k,n.isInvalidPDFjsFont){const N=[];let D=0;for(const V of e)N.push(V.unicode),D+=V.width;a.fillText(N.join(""),0,0),t.x+=D*w*f,a.restore(),this.compose();return}let R=0,I;for(I=0;I<g;++I){const N=e[I];if(typeof N=="number"){R+=y*N*i/1e3;continue}let D=!1;const V=(N.isSpace?d:0)+c,j=N.fontChar,G=N.accent;let Z,K,J=N.width;if(m){const B=N.vmetric||x,$=-(N.vmetric?B[1]:J*.5)*w,M=B[2]*w;J=B?-B[0]:J,Z=$/l,K=(R+M)/l}else Z=R/l,K=0;if(n.remeasure&&J>0){const B=a.measureText(j).width*1e3/i*l;if(J<B&&this.isFontSubpixelAAEnabled){const $=J/B;D=!0,a.save(),a.scale($,1),Z/=$}else J!==B&&(Z+=(J-B)/2e3*i/l)}if(this.contentVisible&&(N.isInFont||n.missingFile)){if(S&&!G)a.fillText(j,Z,K);else if(this.paintChar(j,Z,K,E,P),G){const B=Z+i*G.offset.x/l,$=K-i*G.offset.y/l;this.paintChar(G.fontChar,B,$,E,P)}}const ee=m?J*w-V*h:J*w+V*h;R+=ee,D&&a.restore()}m?t.y-=R:t.x+=R*f,a.restore(),this.compose()}showType3Text(e){const t=this.ctx,n=this.current,i=n.font,a=n.fontSize,l=n.fontDirection,c=i.vertical?1:-1,d=n.charSpacing,h=n.wordSpacing,f=n.textHScale*l,g=n.fontMatrix||ih,m=e.length,y=n.textRenderingMode===Ot.INVISIBLE;let x,w,S,E;if(!(y||a===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),n.textMatrix&&t.transform(...n.textMatrix),t.translate(n.x,n.y+n.textRise),t.scale(f,l),x=0;x<m;++x){if(w=e[x],typeof w=="number"){E=c*w*a/1e3,this.ctx.translate(E,0),n.x+=E*f;continue}const P=(w.isSpace?h:0)+d,k=i.charProcOperatorList[w.operatorListId];k?this.contentVisible&&(this.save(),t.scale(a,a),t.transform(...g),this.executeOperatorList(k),this.restore()):Ne(`Type3 character "${w.operatorListId}" is not available.`);const T=[w.width,0];xe.applyTransform(T,g),S=T[0]*a+P,t.translate(S,0),n.x+=S*f}t.restore()}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,n,i,a,l){const c=new Path2D;c.rect(n,i,a-n,l-i),this.ctx.clip(c),this.endPath()}getColorN_Pattern(e){let t;if(e[0]==="TilingPattern"){const n=this.baseTransform||rt(this.ctx),i={createCanvasGraphics:a=>new yi(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new Zh(e,this.ctx,i,n)}else t=this._getPattern(e[1],e[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(e){this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e){this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,t=null){let n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=MT(this.getObject(e)),this.cachedPatterns.set(e,n)),t&&(n.matrix=t),n}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const n=this._getPattern(e);t.fillStyle=n.getPattern(t,this,Vn(t),Nt.SHADING);const i=Vn(t);if(i){const{width:a,height:l}=t.canvas,c=fi.slice();xe.axialAlignedBoundingBox([0,0,a,l],i,c);const[d,h,f,g]=c;this.ctx.fillRect(d,h,f-d,g-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){We("Should not call beginInlineImage")}beginImageData(){We("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=rt(this.ctx),t)){xe.axialAlignedBoundingBox(t,this.baseTransform,this.current.minMax);const[n,i,a,l]=t,c=new Path2D;c.rect(n,i,a-n,l-i),this.ctx.clip(c),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||dc("TODO: Support non-isolated groups."),e.knockout&&Ne("Knockout groups not supported.");const n=rt(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let i=fi.slice();xe.axialAlignedBoundingBox(e.bbox,rt(t),i);const a=[0,0,t.canvas.width,t.canvas.height];i=xe.intersect(i,a)||[0,0,0,0];const l=Math.floor(i[0]),c=Math.floor(i[1]),d=Math.max(Math.ceil(i[2])-l,1),h=Math.max(Math.ceil(i[3])-c,1);this.current.startNewPathAndClipBox([0,0,d,h]);let f="groupAt"+this.groupLevel;e.smask&&(f+="_smask_"+this.smaskCounter++%2);const g=this.cachedCanvases.getCanvas(f,d,h),m=g.context;m.translate(-l,-c),m.transform(...n);let y=new Path2D;const[x,w,S,E]=e.bbox;if(y.rect(x,w,S-x,E-w),e.matrix){const P=new Path2D;P.addPath(y,new DOMMatrix(e.matrix)),y=P}m.clip(y),e.smask?this.smaskStack.push({canvas:g.canvas,context:m,offsetX:l,offsetY:c,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(l,c),t.save()),wo(t,m),this.ctx=m,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const i=rt(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...i);const a=fi.slice();xe.axialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],i,a),this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(a)}}beginAnnotation(e,t,n,i,a){if(this.#e(),El(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const l=t[2]-t[0],c=t[3]-t[1];if(a&&this.annotationCanvasMap){n=n.slice(),n[4]-=t[0],n[5]-=t[1],t=t.slice(),t[0]=t[1]=0,t[2]=l,t[3]=c,xe.singularValueDecompose2dScale(rt(this.ctx),cn);const{viewportScale:d}=this,h=Math.ceil(l*this.outputScaleX*d),f=Math.ceil(c*this.outputScaleY*d);this.annotationCanvas=this.canvasFactory.create(h,f);const{canvas:g,context:m}=this.annotationCanvas;this.annotationCanvasMap.set(e,g),this.annotationCanvas.savedCtx=this.ctx,this.ctx=m,this.ctx.save(),this.ctx.setTransform(cn[0],0,0,-cn[1],0,c*cn[1]),El(this.ctx)}else{El(this.ctx),this.endPath();const d=new Path2D;d.rect(t[0],t[1],l,c),this.ctx.clip(d)}}this.current=new hv(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...i)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;e=this.getObject(e.data,e),e.count=t;const n=this.ctx,i=this._createMaskCanvas(e),a=i.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(a,i.offsetX,i.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,n=0,i=0,a,l){if(!this.contentVisible)return;e=this.getObject(e.data,e);const c=this.ctx;c.save();const d=rt(c);c.transform(t,n,i,a,0,0);const h=this._createMaskCanvas(e);c.setTransform(1,0,0,1,h.offsetX-d[4],h.offsetY-d[5]);for(let f=0,g=l.length;f<g;f+=2){const m=xe.transform(d,[t,n,i,a,l[f],l[f+1]]);c.drawImage(h.canvas,m[4],m[5])}c.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,n=this.current.fillColor,i=this.current.patternFill;for(const a of e){const{data:l,width:c,height:d,transform:h}=a,f=this.cachedCanvases.getCanvas("maskCanvas",c,d),g=f.context;g.save();const m=this.getObject(l,a);pv(g,m),g.globalCompositeOperation="source-in",g.fillStyle=i?n.getPattern(g,this,Vn(t),Nt.FILL):n,g.fillRect(0,0,c,d),g.restore(),t.save(),t.transform(...h),t.scale(1,-1),Al(t,f.canvas,0,0,c,d,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);if(!t){Ne("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t)}paintImageXObjectRepeat(e,t,n,i){if(!this.contentVisible)return;const a=this.getObject(e);if(!a){Ne("Dependent image isn't ready yet");return}const l=a.width,c=a.height,d=[];for(let h=0,f=i.length;h<f;h+=2)d.push({transform:[t,0,0,n,i[h],i[h+1]],x:0,y:0,w:l,h:c});this.paintInlineImageXObjectGroup(a,d)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;const{bitmap:t,width:n,height:i}=e,a=this.cachedCanvases.getCanvas("inlineImage",n,i),l=a.context;return l.filter=this.current.transferMaps,l.drawImage(t,0,0),l.filter="none",a.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,n=e.height,i=this.ctx;this.save();const{filter:a}=i;a!=="none"&&a!==""&&(i.filter="none"),i.scale(1/t,-1/n);let l;if(e.bitmap)l=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)l=e;else{const h=this.cachedCanvases.getCanvas("inlineImage",t,n).context;fv(h,e),l=this.applyTransferMapsToCanvas(h)}const c=this._scaleImage(l,Vn(i));i.imageSmoothingEnabled=gv(rt(i),e.interpolate),Al(i,c.img,0,0,c.paintWidth,c.paintHeight,0,-n,t,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const n=this.ctx;let i;if(e.bitmap)i=e.bitmap;else{const a=e.width,l=e.height,d=this.cachedCanvases.getCanvas("inlineImage",a,l).context;fv(d,e),i=this.applyTransferMapsToCanvas(d)}for(const a of t)n.save(),n.transform(...a.transform),n.scale(1,-1),Al(n,i,a.x,a.y,a.w,a.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){e==="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(e,t){const n=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const i=this.ctx;this.pendingClip&&(n||(this.pendingClip===mv?i.clip(e,"evenodd"):i.clip(e)),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=rt(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),i=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,i)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:t,b:n,c:i,d:a}=this.ctx.getTransform();let l,c;if(n===0&&i===0){const d=Math.abs(t),h=Math.abs(a);if(d===h)if(e===0)l=c=1/d;else{const f=d*e;l=c=f<1?1/f:1}else if(e===0)l=1/d,c=1/h;else{const f=d*e,g=h*e;l=f<1?1/f:1,c=g<1?1/g:1}}else{const d=Math.abs(t*a-n*i),h=Math.hypot(t,n),f=Math.hypot(i,a);if(e===0)l=f/d,c=h/d;else{const g=e*d;l=f>g?f/g:1,c=h>g?h/g:1}}this._cachedScaleForStroking[0]=l,this._cachedScaleForStroking[1]=c}return this._cachedScaleForStroking}rescaleAndStroke(e,t){const{ctx:n,current:{lineWidth:i}}=this,[a,l]=this.getScaleForStroking();if(a===l){n.lineWidth=(i||1)*a,n.stroke(e);return}const c=n.getLineDash();t&&n.save(),n.scale(a,l),Fd.a=1/a,Fd.d=1/l;const d=new Path2D;if(d.addPath(e,Fd),c.length>0){const h=Math.max(a,l);n.setLineDash(c.map(f=>f/h)),n.lineDashOffset/=h}n.lineWidth=i||1,n.stroke(d),t&&n.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}for(const s in Lo)yi.prototype[s]!==void 0&&(yi.prototype[Lo[s]]=yi.prototype[s]);class Gr{static#e=null;static#t="";static get workerPort(){return this.#e}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");this.#e=e}static get workerSrc(){return this.#t}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");this.#t=e}}class HT{#e;#t;constructor({parsedData:e,rawData:t}){this.#e=e,this.#t=t}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}[Symbol.iterator](){return this.#e.entries()}}const di=Symbol("INTERNAL");class UT{#e=!1;#t=!1;#n=!1;#r=!0;constructor(e,{name:t,intent:n,usage:i,rbGroups:a}){this.#e=!!(e&on.DISPLAY),this.#t=!!(e&on.PRINT),this.name=t,this.intent=n,this.usage=i,this.rbGroups=a}get visible(){if(this.#n)return this.#r;if(!this.#r)return!1;const{print:e,view:t}=this.usage;return this.#e?t?.viewState!=="OFF":this.#t?e?.printState!=="OFF":!0}_setVisible(e,t,n=!1){e!==di&&We("Internal method `_setVisible` called."),this.#n=n,this.#r=t}}class VT{#e=null;#t=new Map;#n=null;#r=null;constructor(e,t=on.DISPLAY){if(this.renderingIntent=t,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,this.#r=e.order;for(const n of e.groups)this.#t.set(n.id,new UT(t,n));if(e.baseState==="OFF")for(const n of this.#t.values())n._setVisible(di,!1);for(const n of e.on)this.#t.get(n)._setVisible(di,!0);for(const n of e.off)this.#t.get(n)._setVisible(di,!1);this.#n=this.getHash()}}#i(e){const t=e.length;if(t<2)return!0;const n=e[0];for(let i=1;i<t;i++){const a=e[i];let l;if(Array.isArray(a))l=this.#i(a);else if(this.#t.has(a))l=this.#t.get(a).visible;else return Ne(`Optional content group not found: ${a}`),!0;switch(n){case"And":if(!l)return!1;break;case"Or":if(l)return!0;break;case"Not":return!l;default:return!0}}return n==="And"}isVisible(e){if(this.#t.size===0)return!0;if(!e)return dc("Optional content group not defined."),!0;if(e.type==="OCG")return this.#t.has(e.id)?this.#t.get(e.id).visible:(Ne(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return this.#i(e.expression);if(!e.policy||e.policy==="AnyOn"){for(const t of e.ids){if(!this.#t.has(t))return Ne(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const t of e.ids){if(!this.#t.has(t))return Ne(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const t of e.ids){if(!this.#t.has(t))return Ne(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const t of e.ids){if(!this.#t.has(t))return Ne(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!1}return!0}return Ne(`Unknown optional content policy ${e.policy}.`),!0}return Ne(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,n=!0){const i=this.#t.get(e);if(!i){Ne(`Optional content group not found: ${e}`);return}if(n&&t&&i.rbGroups.length)for(const a of i.rbGroups)for(const l of a)l!==e&&this.#t.get(l)?._setVisible(di,!1,!0);i._setVisible(di,!!t,!0),this.#e=null}setOCGState({state:e,preserveRB:t}){let n;for(const i of e){switch(i){case"ON":case"OFF":case"Toggle":n=i;continue}const a=this.#t.get(i);if(a)switch(n){case"ON":this.setVisibility(i,!0,t);break;case"OFF":this.setVisibility(i,!1,t);break;case"Toggle":this.setVisibility(i,!a.visible,t);break}}this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){return this.#t.size?this.#r?this.#r.slice():[...this.#t.keys()]:null}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;const e=new w0;for(const[t,n]of this.#t)e.update(`${t}:${n.visible}`);return this.#e=e.hexdigest()}[Symbol.iterator](){return this.#t.entries()}}class WT{constructor(e,{disableRange:t=!1,disableStream:n=!1}){mt(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:a,progressiveDone:l,contentDispositionFilename:c}=e;if(this._queuedChunks=[],this._progressiveDone=l,this._contentDispositionFilename=c,a?.length>0){const d=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;this._queuedChunks.push(d)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!n,this._isRangeSupported=!t,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((d,h)=>{this._onReceiveData({begin:d,chunk:h})}),e.addProgressListener((d,h)=>{this._onProgress({loaded:d,total:h})}),e.addProgressiveReadListener(d=>{this._onReceiveData({chunk:d})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:t}){const n=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{const i=this._rangeReaders.some(function(a){return a._begin!==e?!1:(a._enqueue(n),!0)});mt(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){e.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){mt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new GT(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new qT(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}}class GT{constructor(e,t,n=!1,i=null){this._stream=e,this._done=n||!1,this._filename=fc(i)?i:null,this._queuedChunks=t||[],this._loaded=0;for(const a of this._queuedChunks)this._loaded+=a.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.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 e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){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 qT{constructor(e,t,n){this._stream=e,this._begin=t,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const n of this._requests)n.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 e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){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 XT(s){let e=!0,t=n("filename\\*","i").exec(s);if(t){t=t[1];let f=c(t);return f=unescape(f),f=d(f),f=h(f),a(f)}if(t=l(s),t){const f=h(t);return a(f)}if(t=n("filename","i").exec(s),t){t=t[1];let f=c(t);return f=h(f),a(f)}function n(f,g){return new RegExp("(?:^|;)\\s*"+f+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',g)}function i(f,g){if(f){if(!/^[\x00-\xFF]+$/.test(g))return g;try{const m=new TextDecoder(f,{fatal:!0}),y=Wo(g);g=m.decode(y),e=!1}catch{}}return g}function a(f){return e&&/[\x80-\xff]/.test(f)&&(f=i("utf-8",f),e&&(f=i("iso-8859-1",f))),f}function l(f){const g=[];let m;const y=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(m=y.exec(f))!==null;){let[,w,S,E]=m;if(w=parseInt(w,10),w in g){if(w===0)break;continue}g[w]=[S,E]}const x=[];for(let w=0;w<g.length&&w in g;++w){let[S,E]=g[w];E=c(E),S&&(E=unescape(E),w===0&&(E=d(E))),x.push(E)}return x.join("")}function c(f){if(f.startsWith('"')){const g=f.slice(1).split('\\"');for(let m=0;m<g.length;++m){const y=g[m].indexOf('"');y!==-1&&(g[m]=g[m].slice(0,y),g.length=m+1),g[m]=g[m].replaceAll(/\\(.)/g,"$1")}f=g.join('"')}return f}function d(f){const g=f.indexOf("'");if(g===-1)return f;const m=f.slice(0,g),x=f.slice(g+1).replace(/^[^']*'/,"");return i(m,x)}function h(f){return!f.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(f)?f:f.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(g,m,y,x){if(y==="q"||y==="Q")return x=x.replaceAll("_"," "),x=x.replaceAll(/=([0-9a-fA-F]{2})/g,function(w,S){return String.fromCharCode(parseInt(S,16))}),i(m,x);try{x=atob(x)}catch{}return i(m,x)})}return""}function k0(s,e){const t=new Headers;if(!s||!e||typeof e!="object")return t;for(const n in e){const i=e[n];i!==void 0&&t.append(n,i)}return t}function pc(s){return URL.parse(s)?.origin??null}function P0({responseHeaders:s,isHttp:e,rangeChunkSize:t,disableRange:n}){const i={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(s.get("Content-Length"),10);return!Number.isInteger(a)||(i.suggestedLength=a,a<=2*t)||n||!e||s.get("Accept-Ranges")!=="bytes"||(s.get("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function T0(s){const e=s.get("Content-Disposition");if(e){let t=XT(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(fc(t))return t}return null}function Ko(s,e){return new Mo(`Unexpected server response (${s}) while retrieving PDF "${e}".`,s,s===404||s===0&&e.startsWith("file:"))}function R0(s){return s===200||s===206}function N0(s,e,t){return{method:"GET",headers:s,signal:t.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function I0(s){return s instanceof Uint8Array?s.buffer:s instanceof ArrayBuffer?s:(Ne(`getArrayBuffer - unexpected data format: ${s}`),new Uint8Array(s).buffer)}class YT{_responseOrigin=null;constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=k0(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return mt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new KT(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new QT(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class KT{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.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 n=new Headers(e.headers),i=t.url;fetch(i,N0(n,this._withCredentials,this._abortController)).then(a=>{if(e._responseOrigin=pc(a.url),!R0(a.status))throw Ko(a.status,i);this._reader=a.body.getReader(),this._headersCapability.resolve();const l=a.headers,{allowRangeRequests:c,suggestedLength:d}=P0({responseHeaders:l,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=c,this._contentLength=d||this._contentLength,this._filename=T0(l),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new wr("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(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:I0(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class QT{constructor(e,t,n){this._stream=e,this._reader=null,this._loaded=0;const i=e.source;this._withCredentials=i.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!i.disableStream,this._abortController=new AbortController;const a=new Headers(e.headers);a.append("Range",`bytes=${t}-${n-1}`);const l=i.url;fetch(l,N0(a,this._withCredentials,this._abortController)).then(c=>{const d=pc(c.url);if(d!==e._responseOrigin)throw new Error(`Expected range response-origin "${d}" to match "${e._responseOrigin}".`);if(!R0(c.status))throw Ko(c.status,l);this._readCapability.resolve(),this._reader=c.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:I0(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}const jd=200,zd=206;function JT(s){const e=s.response;return typeof e!="string"?e:Wo(e).buffer}class ZT{_responseOrigin=null;constructor({url:e,httpHeaders:t,withCredentials:n}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=k0(this.isHttp,t),this.withCredentials=n||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const t=new XMLHttpRequest,n=this.currXhrId++,i=this.pendingRequests[n]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const[a,l]of this.headers)t.setRequestHeader(a,l);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),i.expectedStatus=zd):i.expectedStatus=jd,t.responseType="arraybuffer",mt(e.onError,"Expected `onError` callback to be provided."),t.onerror=()=>{e.onError(t.status)},t.onreadystatechange=this.onStateChange.bind(this,n),t.onprogress=this.onProgress.bind(this,n),i.onHeadersReceived=e.onHeadersReceived,i.onDone=e.onDone,i.onError=e.onError,i.onProgress=e.onProgress,t.send(null),n}onProgress(e,t){const n=this.pendingRequests[e];n&&n.onProgress?.(t)}onStateChange(e,t){const n=this.pendingRequests[e];if(!n)return;const i=n.xhr;if(i.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),i.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],i.status===0&&this.isHttp){n.onError(i.status);return}const a=i.status||jd;if(!(a===jd&&n.expectedStatus===zd)&&a!==n.expectedStatus){n.onError(i.status);return}const c=JT(i);if(a===zd){const d=i.getResponseHeader("Content-Range"),h=/bytes (\d+)-(\d+)\/(\d+)/.exec(d);h?n.onDone({begin:parseInt(h[1],10),chunk:c}):(Ne('Missing or invalid "Content-Range" header.'),n.onError(0))}else c?n.onDone({begin:0,chunk:c}):n.onError(i.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class eR{constructor(e){this._source=e,this._manager=new ZT(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return mt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new tR(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const n=new nR(this._manager,e,t);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class tR{constructor(e,t){this._manager=e,this._url=t.url,this._fullRequestId=e.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 e=this._fullRequestId,t=this._manager.getRequestXhr(e);this._manager._responseOrigin=pc(t.responseURL);const n=t.getAllResponseHeaders(),i=new Headers(n?n.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(c=>{const[d,...h]=c.split(": ");return[d,h.join(": ")]}):[]),{allowRangeRequests:a,suggestedLength:l}=P0({responseHeaders:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=l||this._contentLength,this._filename=T0(i),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.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(e){this._storedError=Ko(e,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(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.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 e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);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 nR{constructor(e,t,n){this._manager=e,this._url=e.url,this._requestId=e.request({begin:t,end:n,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(){const e=pc(this._manager.getRequestXhr(this._requestId)?.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError??=Ko(e,this._url);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.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 e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){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 rR=/^[a-z][a-z0-9\-+.]+:/i;function sR(s){if(rR.test(s))return new URL(s);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(s))}class iR{constructor(e){this.source=e,this.url=sR(e.url),mt(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return mt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new oR(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new aR(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class oR{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.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 n=process.getBuiltinModule("fs");n.promises.lstat(this._url).then(i=>{this._contentLength=i.size,this._setReadableStream(n.createReadStream(this._url)),this._headersCapability.resolve()},i=>{i.code==="ENOENT"&&(i=Ko(0,this._url.href)),this._storedError=i,this._headersCapability.reject(i)})}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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new wr("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class aR{constructor(e,t,n){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const i=e.source;this._isStreamingSupported=!i.disableStream;const a=process.getBuiltinModule("fs");this._setReadableStream(a.createReadStream(this._url,{start:t,end:n-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const bo=Symbol("INITIAL_DATA");class L0{#e=Object.create(null);#t(e){return this.#e[e]||={...Promise.withResolvers(),data:bo}}get(e,t=null){if(t){const i=this.#t(e);return i.promise.then(()=>t(i.data)),null}const n=this.#e[e];if(!n||n.data===bo)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){const t=this.#e[e];return!!t&&t.data!==bo}delete(e){const t=this.#e[e];return!t||t.data===bo?!1:(delete this.#e[e],!0)}resolve(e,t=null){const n=this.#t(e);n.data=t,n.resolve()}clear(){for(const e in this.#e){const{data:t}=this.#e[e];t?.bitmap?.close()}this.#e=Object.create(null)}*[Symbol.iterator](){for(const e in this.#e){const{data:t}=this.#e[e];t!==bo&&(yield[e,t])}}}const lR=1e5,vv=30;let Do=class xn{#e=Promise.withResolvers();#t=null;#n=!1;#r=!!globalThis.FontInspector?.enabled;#i=null;#s=null;#l=0;#a=0;#d=null;#c=null;#h=0;#u=0;#f=Object.create(null);#o=[];#p=null;#m=[];#g=new WeakMap;#v=null;static#y=new Map;static#w=new Map;static#x=new WeakMap;static#A=null;static#_=new Set;constructor({textContentSource:e,container:t,viewport:n}){if(e instanceof ReadableStream)this.#p=e;else if(typeof e=="object")this.#p=new ReadableStream({start(d){d.enqueue(e),d.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#t=this.#c=t,this.#u=n.scale*Dn.pixelRatio,this.#h=n.rotation,this.#s={div:null,properties:null,ctx:null};const{pageWidth:i,pageHeight:a,pageX:l,pageY:c}=n.rawDims;this.#v=[1,0,0,-1,-l,c+a],this.#a=i,this.#l=a,xn.#N(),Yr(t,n),this.#e.promise.finally(()=>{xn.#_.delete(this),this.#s=null,this.#f=null}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=kt.platform;return Me(this,"fontFamilyMap",new Map([["sans-serif",`${e&&t?"Calibri, ":""}sans-serif`],["monospace",`${e&&t?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{this.#d.read().then(({value:t,done:n})=>{if(n){this.#e.resolve();return}this.#i??=t.lang,Object.assign(this.#f,t.styles),this.#k(t.items),e()},this.#e.reject)};return this.#d=this.#p.getReader(),xn.#_.add(this),e(),this.#e.promise}update({viewport:e,onBefore:t=null}){const n=e.scale*Dn.pixelRatio,i=e.rotation;if(i!==this.#h&&(t?.(),this.#h=i,Yr(this.#c,{rotation:i})),n!==this.#u){t?.(),this.#u=n;const a={div:null,properties:null,ctx:xn.#P(this.#i)};for(const l of this.#m)a.properties=this.#g.get(l),a.div=l,this.#S(a)}}cancel(){const e=new wr("TextLayer task cancelled.");this.#d?.cancel(e).catch(()=>{}),this.#d=null,this.#e.reject(e)}get textDivs(){return this.#m}get textContentItemsStr(){return this.#o}#k(e){if(this.#n)return;this.#s.ctx??=xn.#P(this.#i);const t=this.#m,n=this.#o;for(const i of e){if(t.length>lR){Ne("Ignoring additional textDivs for performance reasons."),this.#n=!0;return}if(i.str===void 0){if(i.type==="beginMarkedContentProps"||i.type==="beginMarkedContent"){const a=this.#t;this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),i.id!==null&&this.#t.setAttribute("id",`${i.id}`),a.append(this.#t)}else i.type==="endMarkedContent"&&(this.#t=this.#t.parentNode);continue}n.push(i.str),this.#T(i)}}#T(e){const t=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};this.#m.push(t);const i=xe.transform(this.#v,e.transform);let a=Math.atan2(i[1],i[0]);const l=this.#f[e.fontName];l.vertical&&(a+=Math.PI/2);let c=this.#r&&l.fontSubstitution||l.fontFamily;c=xn.fontFamilyMap.get(c)||c;const d=Math.hypot(i[2],i[3]),h=d*xn.#I(c,l,this.#i);let f,g;a===0?(f=i[4],g=i[5]-h):(f=i[4]+h*Math.sin(a),g=i[5]-h*Math.cos(a));const m="calc(var(--total-scale-factor) *",y=t.style;this.#t===this.#c?(y.left=`${(100*f/this.#a).toFixed(2)}%`,y.top=`${(100*g/this.#l).toFixed(2)}%`):(y.left=`${m}${f.toFixed(2)}px)`,y.top=`${m}${g.toFixed(2)}px)`),y.fontSize=`${m}${(xn.#A*d).toFixed(2)}px)`,y.fontFamily=c,n.fontSize=d,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,this.#r&&(t.dataset.fontName=l.fontSubstitutionLoadedName||e.fontName),a!==0&&(n.angle=a*(180/Math.PI));let x=!1;if(e.str.length>1)x=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const w=Math.abs(e.transform[0]),S=Math.abs(e.transform[3]);w!==S&&Math.max(w,S)/Math.min(w,S)>1.5&&(x=!0)}if(x&&(n.canvasWidth=l.vertical?e.height:e.width),this.#g.set(t,n),this.#s.div=t,this.#s.properties=n,this.#S(this.#s),n.hasText&&this.#t.append(t),n.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),this.#t.append(w)}}#S(e){const{div:t,properties:n,ctx:i}=e,{style:a}=t;let l="";if(xn.#A>1&&(l=`scale(${1/xn.#A})`),n.canvasWidth!==0&&n.hasText){const{fontFamily:c}=a,{canvasWidth:d,fontSize:h}=n;xn.#C(i,h*this.#u,c);const{width:f}=i.measureText(t.textContent);f>0&&(l=`scaleX(${d*this.#u/f}) ${l}`)}n.angle!==0&&(l=`rotate(${n.angle}deg) ${l}`),l.length>0&&(a.transform=l)}static cleanup(){if(!(this.#_.size>0)){this.#y.clear();for(const{canvas:e}of this.#w.values())e.remove();this.#w.clear()}}static#P(e=null){let t=this.#w.get(e||="");if(!t){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=e,document.body.append(n),t=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#w.set(e,t),this.#x.set(t,{size:0,family:""})}return t}static#C(e,t,n){const i=this.#x.get(e);t===i.size&&n===i.family||(e.font=`${t}px ${n}`,i.size=t,i.family=n)}static#N(){if(this.#A!==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),this.#A=e.getBoundingClientRect().height,e.remove()}static#I(e,t,n){const i=this.#y.get(e);if(i)return i;const a=this.#P(n);a.canvas.width=a.canvas.height=vv,this.#C(a,vv,e);const l=a.measureText(""),c=l.fontBoundingBoxAscent,d=Math.abs(l.fontBoundingBoxDescent);a.canvas.width=a.canvas.height=0;let h=.8;return c?h=c/(c+d):(kt.platform.isFirefox&&Ne("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?h=t.ascent:t.descent&&(h=1+t.descent)),this.#y.set(e,h),h}};class Oo{static textContent(e){const t=[],n={items:t,styles:Object.create(null)};function i(a){if(!a)return;let l=null;const c=a.name;if(c==="#text")l=a.value;else if(Oo.shouldBuildText(c))a?.attributes?.textContent?l=a.attributes.textContent:a.value&&(l=a.value);else return;if(l!==null&&t.push({str:l}),!!a.children)for(const d of a.children)i(d)}return i(e),n}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const cR=100;function ef(s={}){typeof s=="string"||s instanceof URL?s={url:s}:(s instanceof ArrayBuffer||ArrayBuffer.isView(s))&&(s={data:s});const e=new tf,{docId:t}=e,n=s.url?wT(s.url):null,i=s.data?bT(s.data):null,a=s.httpHeaders||null,l=s.withCredentials===!0,c=s.password??null,d=s.range instanceof nf?s.range:null,h=Number.isInteger(s.rangeChunkSize)&&s.rangeChunkSize>0?s.rangeChunkSize:2**16;let f=s.worker instanceof Ei?s.worker:null;const g=s.verbosity,m=typeof s.docBaseUrl=="string"&&!qo(s.docBaseUrl)?s.docBaseUrl:null,y=xl(s.cMapUrl),x=s.cMapPacked!==!1,w=s.CMapReaderFactory||(Ut?kT:iv),S=xl(s.iccUrl),E=xl(s.standardFontDataUrl),P=s.StandardFontDataFactory||(Ut?PT:ov),k=xl(s.wasmUrl),T=s.WasmFactory||(Ut?TT:av),R=s.stopAtErrors!==!0,I=Number.isInteger(s.maxImageSize)&&s.maxImageSize>-1?s.maxImageSize:-1,N=s.isEvalSupported!==!1,D=typeof s.isOffscreenCanvasSupported=="boolean"?s.isOffscreenCanvasSupported:!Ut,V=typeof s.isImageDecoderSupported=="boolean"?s.isImageDecoderSupported:!Ut&&(kt.platform.isFirefox||!globalThis.chrome),j=Number.isInteger(s.canvasMaxAreaInBytes)?s.canvasMaxAreaInBytes:-1,G=typeof s.disableFontFace=="boolean"?s.disableFontFace:Ut,Z=s.fontExtraProperties===!0,K=s.enableXfa===!0,J=s.ownerDocument||globalThis.document,ee=s.disableRange===!0,B=s.disableStream===!0,$=s.disableAutoFetch===!0,M=s.pdfBug===!0,Q=s.CanvasFactory||(Ut?CT:AT),ne=s.FilterFactory||(Ut?_T:ET),F=s.enableHWA===!0,Y=s.useWasm!==!1,q=d?d.length:s.length??NaN,te=typeof s.useSystemFonts=="boolean"?s.useSystemFonts:!Ut&&!G,se=typeof s.useWorkerFetch=="boolean"?s.useWorkerFetch:!!(w===iv&&P===ov&&T===av&&y&&E&&k&&Co(y,document.baseURI)&&Co(E,document.baseURI)&&Co(k,document.baseURI)),ie=null;tT(g);const H={canvasFactory:new Q({ownerDocument:J,enableHWA:F}),filterFactory:new ne({docId:t,ownerDocument:J}),cMapReaderFactory:se?null:new w({baseUrl:y,isCompressed:x}),standardFontDataFactory:se?null:new P({baseUrl:E}),wasmFactory:se?null:new T({baseUrl:k})};f||(f=Ei.create({verbosity:g,port:Gr.workerPort}),e._worker=f);const ae={docId:t,apiVersion:"5.3.31",data:i,password:c,disableAutoFetch:$,rangeChunkSize:h,length:q,docBaseUrl:m,enableXfa:K,evaluatorOptions:{maxImageSize:I,disableFontFace:G,ignoreErrors:R,isEvalSupported:N,isOffscreenCanvasSupported:D,isImageDecoderSupported:V,canvasMaxAreaInBytes:j,fontExtraProperties:Z,useSystemFonts:te,useWasm:Y,useWorkerFetch:se,cMapUrl:y,iccUrl:S,standardFontDataUrl:E,wasmUrl:k}},de={ownerDocument:J,pdfBug:M,styleElement:ie,loadingParams:{disableAutoFetch:$,enableXfa:K}};return f.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(f.destroyed)throw new Error("Worker was destroyed");const ce=f.messageHandler.sendWithPromise("GetDocRequest",ae,i?[i.buffer]:null);let Se;if(d)Se=new WT(d,{disableRange:ee,disableStream:B});else if(!i){if(!n)throw new Error("getDocument - no `url` parameter provided.");const Pe=Co(n)?YT:Ut?iR:eR;Se=new Pe({url:n,length:q,httpHeaders:a,withCredentials:l,rangeChunkSize:h,disableRange:ee,disableStream:B})}return ce.then(Pe=>{if(e.destroyed)throw new Error("Loading aborted");if(f.destroyed)throw new Error("Worker was destroyed");const be=new ko(t,Pe,f.port),Ce=new hR(be,e,Se,de,H);e._transport=Ce,be.send("Ready",null)})}).catch(e._capability.reject),e}class tf{static#e=0;_capability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${tf.#e++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}}let nf=class{#e=Promise.withResolvers();#t=[];#n=[];#r=[];#i=[];constructor(e,t,n=!1,i=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=i}addRangeListener(e){this.#i.push(e)}addProgressListener(e){this.#r.push(e)}addProgressiveReadListener(e){this.#n.push(e)}addProgressiveDoneListener(e){this.#t.push(e)}onDataRange(e,t){for(const n of this.#i)n(e,t)}onDataProgress(e,t){this.#e.promise.then(()=>{for(const n of this.#r)n(e,t)})}onDataProgressiveRead(e){this.#e.promise.then(()=>{for(const t of this.#n)t(e)})}onDataProgressiveDone(){this.#e.promise.then(()=>{for(const e of this.#t)e()})}transportReady(){this.#e.resolve()}requestDataRange(e,t){We("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class uR{constructor(e,t){this._pdfInfo=e,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 Me(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}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:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);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(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}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()}}class dR{#e=!1;constructor(e,t,n,i=!1){this._pageIndex=e,this._pageInfo=t,this._transport=n,this._stats=i?new nv:null,this._pdfBug=i,this.commonObjs=n.commonObjs,this.objs=new L0,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:e,rotation:t=this.rotate,offsetX:n=0,offsetY:i=0,dontFlip:a=!1}={}){return new Go({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:i,dontFlip:a})}getAnnotations({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Me(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:n="display",annotationMode:i=Kn.ENABLE,transform:a=null,background:l=null,optionalContentConfigPromise:c=null,annotationCanvasMap:d=null,pageColors:h=null,printAnnotationStorage:f=null,isEditing:g=!1}){this._stats?.time("Overall");const m=this._transport.getRenderingIntent(n,i,f,g),{renderingIntent:y,cacheKey:x}=m;this.#e=!1,c||=this._transport.getOptionalContentConfig(y);let w=this._intentStates.get(x);w||(w=Object.create(null),this._intentStates.set(x,w)),w.streamReaderCancelTimeout&&(clearTimeout(w.streamReaderCancelTimeout),w.streamReaderCancelTimeout=null);const S=!!(y&on.PRINT);w.displayReadyCapability||(w.displayReadyCapability=Promise.withResolvers(),w.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(m));const E=T=>{w.renderTasks.delete(P),S&&(this.#e=!0),this.#t(),T?(P.capability.reject(T),this._abortOperatorList({intentState:w,reason:T instanceof Error?T:new Error(T)})):P.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},P=new pi({callback:E,params:{canvasContext:e,viewport:t,transform:a,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:d,operatorList:w.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!S,pdfBug:this._pdfBug,pageColors:h});(w.renderTasks||=new Set).add(P);const k=P.task;return Promise.all([w.displayReadyCapability.promise,c]).then(([T,R])=>{if(this.destroyed){E();return}if(this._stats?.time("Rendering"),!(R.renderingIntent&y))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");P.initializeGraphics({transparency:T,optionalContentConfig:R}),P.operatorListChanged()}).catch(E),k}getOperatorList({intent:e="display",annotationMode:t=Kn.ENABLE,printAnnotationStorage:n=null,isEditing:i=!1}={}){function a(){c.operatorList.lastChunk&&(c.opListReadCapability.resolve(c.operatorList),c.renderTasks.delete(d))}const l=this._transport.getRenderingIntent(e,t,n,i,!0);let c=this._intentStates.get(l.cacheKey);c||(c=Object.create(null),this._intentStates.set(l.cacheKey,c));let d;return c.opListReadCapability||(d=Object.create(null),d.operatorListChanged=a,c.opListReadCapability=Promise.withResolvers(),(c.renderTasks||=new Set).add(d),c.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(l)),c.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(i){return i.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>Oo.textContent(n));const t=this.streamTextContent(e);return new Promise(function(n,i){function a(){l.read().then(function({value:d,done:h}){if(h){n(c);return}c.lang??=d.lang,Object.assign(c.styles,d.styles),c.items.push(...d.items),a()},i)}const l=t.getReader(),c={items:[],styles:Object.create(null),lang:null};a()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const n of t.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),this.#e=!1,Promise.all(e)}cleanup(e=!1){this.#e=!0;const t=this.#t();return e&&t&&(this._stats&&=new nv),t}#t(){if(!this.#e||this.destroyed)return!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}_startRenderPage(e,t){const n=this._intentStates.get(t);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let n=0,i=e.length;n<i;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const n of t.renderTasks)n.operatorListChanged();e.lastChunk&&this.#t()}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:n,modifiedIds:i}){const{map:a,transfer:l}=n,d=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:a,modifiedIds:i},l).getReader(),h=this._intentStates.get(t);h.streamReader=d;const f=()=>{d.read().then(({value:g,done:m})=>{if(m){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(g,h),f())},g=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const m of h.renderTasks)m.operatorListChanged();this.#t()}if(h.displayReadyCapability)h.displayReadyCapability.reject(g);else if(h.opListReadCapability)h.opListReadCapability.reject(g);else throw g}})};f()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(t instanceof hc){let i=cR;t.extraDelay>0&&t.extraDelay<1e3&&(i+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},i);return}}if(e.streamReader.cancel(new wr(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[i,a]of this._intentStates)if(a===e){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}}var Vr,In,gr,ys,Vl,ws,bs,Vt,Il,M0,D0,Po,xi,Ll;const et=class et{constructor({name:e=null,port:t=null,verbosity:n=nT()}={}){Hn(this,Vt);Hn(this,Vr,Promise.withResolvers());Hn(this,In,null);Hn(this,gr,null);Hn(this,ys,null);if(this.name=e,this.destroyed=!1,this.verbosity=n,t){if(Ze(et,bs).has(t))throw new Error("Cannot use more than one PDFWorker per port.");Ze(et,bs).set(t,this),Un(this,Vt,M0).call(this,t)}else Un(this,Vt,D0).call(this)}get promise(){return Ze(this,Vr).promise}get port(){return Ze(this,gr)}get messageHandler(){return Ze(this,In)}destroy(){this.destroyed=!0,Ze(this,ys)?.terminate(),Kt(this,ys,null),Ze(et,bs).delete(Ze(this,gr)),Kt(this,gr,null),Ze(this,In)?.destroy(),Kt(this,In,null)}static create(e){const t=Ze(this,bs).get(e?.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new et(e)}static get workerSrc(){if(Gr.workerSrc)return Gr.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Me(this,"_setupFakeWorkerGlobal",(async()=>Ze(this,xi,Ll)?Ze(this,xi,Ll):(await import(this.workerSrc)).WorkerMessageHandler)())}};Vr=new WeakMap,In=new WeakMap,gr=new WeakMap,ys=new WeakMap,Vl=new WeakMap,ws=new WeakMap,bs=new WeakMap,Vt=new WeakSet,Il=function(){Ze(this,Vr).resolve(),Ze(this,In).send("configure",{verbosity:this.verbosity})},M0=function(e){Kt(this,gr,e),Kt(this,In,new ko("main","worker",e)),Ze(this,In).on("ready",()=>{}),Un(this,Vt,Il).call(this)},D0=function(){if(Ze(et,ws)||Ze(et,xi,Ll)){Un(this,Vt,Po).call(this);return}let{workerSrc:e}=et;try{et._isSameOrigin(window.location,e)||(e=et._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),n=new ko("main","worker",t),i=()=>{a.abort(),n.destroy(),t.terminate(),this.destroyed?Ze(this,Vr).reject(new Error("Worker was destroyed")):Un(this,Vt,Po).call(this)},a=new AbortController;t.addEventListener("error",()=>{Ze(this,ys)||i()},{signal:a.signal}),n.on("test",c=>{if(a.abort(),this.destroyed||!c){i();return}Kt(this,In,n),Kt(this,gr,t),Kt(this,ys,t),Un(this,Vt,Il).call(this)}),n.on("ready",c=>{if(a.abort(),this.destroyed){i();return}try{l()}catch{Un(this,Vt,Po).call(this)}});const l=()=>{const c=new Uint8Array;n.send("test",c,[c.buffer])};l();return}catch{dc("The worker has been disabled.")}Un(this,Vt,Po).call(this)},Po=function(){Ze(et,ws)||(Ne("Setting up fake worker."),Kt(et,ws,!0)),et._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){Ze(this,Vr).reject(new Error("Worker was destroyed"));return}const t=new ST;Kt(this,gr,t);const n=`fake${Kg(et,Vl)._++}`,i=new ko(n+"_worker",n,t);e.setup(i,t),Kt(this,In,new ko(n,n+"_worker",t)),Un(this,Vt,Il).call(this)}).catch(e=>{Ze(this,Vr).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})},xi=new WeakSet,Ll=function(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}},Hn(et,xi),Hn(et,Vl,0),Hn(et,ws,!1),Hn(et,bs,new WeakMap),Ut&&(Kt(et,ws,!0),Gr.workerSrc||="./pdf.worker.mjs"),et._isSameOrigin=(e,t)=>{const n=URL.parse(e);if(!n?.origin||n.origin==="null")return!1;const i=new URL(t,n);return n.origin===i.origin},et._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))},et.fromPort=e=>{if(dT("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return et.create(e)};let Ei=et;class hR{#e=new Map;#t=new Map;#n=new Map;#r=new Map;#i=null;constructor(e,t,n,i,a){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new L0,this.fontLoader=new vT({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=a.canvasFactory,this.filterFactory=a.filterFactory,this.cMapReaderFactory=a.cMapReaderFactory,this.standardFontDataFactory=a.standardFontDataFactory,this.wasmFactory=a.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#s(e,t=null){const n=this.#e.get(e);if(n)return n;const i=this.messageHandler.sendWithPromise(e,t);return this.#e.set(e,i),i}get annotationStorage(){return Me(this,"annotationStorage",new Kh)}getRenderingIntent(e,t=Kn.ENABLE,n=null,i=!1,a=!1){let l=on.DISPLAY,c=oh;switch(e){case"any":l=on.ANY;break;case"display":break;case"print":l=on.PRINT;break;default:Ne(`getRenderingIntent - invalid intent: ${e}`)}const d=l&on.PRINT&&n instanceof b0?n:this.annotationStorage;switch(t){case Kn.DISABLE:l+=on.ANNOTATIONS_DISABLE;break;case Kn.ENABLE:break;case Kn.ENABLE_FORMS:l+=on.ANNOTATIONS_FORMS;break;case Kn.ENABLE_STORAGE:l+=on.ANNOTATIONS_STORAGE,c=d.serializable;break;default:Ne(`getRenderingIntent - invalid annotationMode: ${t}`)}i&&(l+=on.IS_EDITING),a&&(l+=on.OPLIST);const{ids:h,hash:f}=d.modifiedIds,g=[l,c.hash,f];return{renderingIntent:l,cacheKey:g.join("_"),annotationStorageSerializable:c,modifiedIds:h}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#i?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const n of this.#t.values())e.push(n._destroy());this.#t.clear(),this.#n.clear(),this.#r.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),Do.cleanup(),this._networkStream?.cancelAllRequests(new wr("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(n,i)=>{mt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=a=>{this._lastProgress={loaded:a.loaded,total:a.total}},i.onPull=()=>{this._fullReader.read().then(function({value:a,done:l}){if(l){i.close();return}mt(a instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{this._fullReader.cancel(a),i.ready.catch(l=>{if(!this.destroyed)throw l})}}),e.on("ReaderHeadersReady",async n=>{await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:a,contentLength:l}=this._fullReader;return(!i||!a)&&(this._lastProgress&&t.onProgress?.(this._lastProgress),this._fullReader.onProgress=c=>{t.onProgress?.({loaded:c.loaded,total:c.total})}),{isStreamingSupported:i,isRangeSupported:a,contentLength:l}}),e.on("GetRangeReader",(n,i)=>{mt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const a=this._networkStream.getRangeReader(n.begin,n.end);if(!a){i.close();return}i.onPull=()=>{a.read().then(function({value:l,done:c}){if(c){i.close();return}mt(l instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(l),1,[l])}).catch(l=>{i.error(l)})},i.onCancel=l=>{a.cancel(l),i.ready.catch(c=>{if(!this.destroyed)throw c})}}),e.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,t._capability.resolve(new uR(n,this))}),e.on("DocException",n=>{t._capability.reject(Jt(n))}),e.on("PasswordRequest",n=>{this.#i=Promise.withResolvers();try{if(!t.onPassword)throw Jt(n);const i=a=>{a instanceof Error?this.#i.reject(a):this.#i.resolve({password:a})};t.onPassword(i,n.code)}catch(i){this.#i.reject(i)}return this.#i.promise}),e.on("DataLoaded",n=>{t.onProgress?.({loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),e.on("StartRenderPage",n=>{if(this.destroyed)return;this.#t.get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),e.on("commonobj",([n,i,a])=>{if(this.destroyed||this.commonObjs.has(n))return null;switch(i){case"Font":if("error"in a){const h=a.error;Ne(`Error during font loading: ${h}`),this.commonObjs.resolve(n,h);break}const l=this._params.pdfBug&&globalThis.FontInspector?.enabled?(h,f)=>globalThis.FontInspector.fontAdded(h,f):null,c=new yT(a,l);this.fontLoader.bind(c).catch(()=>e.sendWithPromise("FontFallback",{id:n})).finally(()=>{!c.fontExtraProperties&&c.data&&(c.data=null),this.commonObjs.resolve(n,c)});break;case"CopyLocalImage":const{imageRef:d}=a;mt(d,"The imageRef must be defined.");for(const h of this.#t.values())for(const[,f]of h.objs)if(f?.ref===d)return f.dataLen?(this.commonObjs.resolve(n,structuredClone(f)),f.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,a);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),e.on("obj",([n,i,a,l])=>{if(this.destroyed)return;const c=this.#t.get(i);if(!c.objs.has(n)){if(c._intentStates.size===0){l?.bitmap?.close();return}switch(a){case"Image":case"Pattern":c.objs.resolve(n,l);break;default:throw new Error(`Got unknown object type ${a}`)}}}),e.on("DocProgress",n=>{this.destroyed||t.onProgress?.({loaded:n.loaded,total:n.total})}),e.on("FetchBinaryData",async n=>{if(this.destroyed)throw new Error("Worker was destroyed.");const i=this[n.type];if(!i)throw new Error(`${n.type} not initialized, see the \`useWorkerFetch\` parameter.`);return i.fetch(n)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&Ne("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},t).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,n=this.#n.get(t);if(n)return n;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then(a=>{if(this.destroyed)throw new Error("Transport destroyed");a.refStr&&this.#r.set(a.refStr,e);const l=new dR(t,a,this,this._params.pdfBug);return this.#t.set(t,l),l});return this.#n.set(t,i),i}getPageIndex(e){return ah(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return this.#s("GetFieldObjects")}hasJSActions(){return this.#s("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}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 this.#s("GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return this.#s("GetOptionalContentConfig").then(t=>new VT(t,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=this.#e.get(e);if(t)return t;const n=this.messageHandler.sendWithPromise(e,null).then(i=>({info:i[0],metadata:i[1]?new HT(i[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(e,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of this.#t.values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),Do.cleanup()}}cachedPageNumber(e){if(!ah(e))return null;const t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return this.#r.get(t)??null}}class fR{#e=null;onContinue=null;onError=null;constructor(e){this.#e=e}get promise(){return this.#e.capability.promise}cancel(e=0){this.#e.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this.#e.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this.#e;return e.form||e.canvas&&t?.size>0}}class pi{#e=null;static#t=new WeakSet;constructor({callback:e,params:t,objs:n,commonObjs:i,annotationCanvasMap:a,operatorList:l,pageIndex:c,canvasFactory:d,filterFactory:h,useRequestAnimationFrame:f=!1,pdfBug:g=!1,pageColors:m=null}){this.callback=e,this.params=t,this.objs=n,this.commonObjs=i,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=l,this._pageIndex=c,this.canvasFactory=d,this.filterFactory=h,this._pdfBug=g,this.pageColors=m,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=f===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new fR(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:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(pi.#t.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.");pi.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:n,viewport:i,transform:a,background:l}=this.params;this.gfx=new yi(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:a,viewport:i,transparency:e,background:l}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&(window.cancelAnimationFrame(this.#e),this.#e=null),pi.#t.delete(this._canvas),e||=new hc(`Rendering cancelled, page ${this._pageIndex+1}`,t),this.callback(e),this.task.onError?.(e)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.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?this.#e=window.requestAnimationFrame(()=>{this.#e=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(),pi.#t.delete(this._canvas),this.callback())))}}const Fo="5.3.31",O0="47ad820d9";function yv(s){return Math.floor(Math.max(0,Math.min(1,s))*255).toString(16).padStart(2,"0")}function xo(s){return Math.max(0,Math.min(255,255*s))}class wv{static CMYK_G([e,t,n,i]){return["G",1-Math.min(1,.3*e+.59*n+.11*t+i)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=xo(e),[e,e,e]}static G_HTML([e]){const t=yv(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return["G",.3*e+.59*t+.11*n]}static RGB_rgb(e){return e.map(xo)}static RGB_HTML(e){return`#${e.map(yv).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,n,i]){return["RGB",1-Math.min(1,e+i),1-Math.min(1,n+i),1-Math.min(1,t+i)]}static CMYK_rgb([e,t,n,i]){return[xo(1-Math.min(1,e+i)),xo(1-Math.min(1,n+i)),xo(1-Math.min(1,t+i))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){const i=1-e,a=1-t,l=1-n,c=Math.min(i,a,l);return["CMYK",i,a,l,c]}}class pR{create(e,t,n=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),n||(i.setAttribute("width",`${e}px`),i.setAttribute("height",`${t}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${e} ${t}`),i}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){We("Abstract method `_createSVG` called.")}}class jo extends pR{_createSVG(e){return document.createElementNS(pr,e)}}class rf{static setupStorage(e,t,n,i,a){const l=i.getValue(t,{value:null});switch(n.name){case"textarea":if(l.value!==null&&(e.textContent=l.value),a==="print")break;e.addEventListener("input",c=>{i.setValue(t,{value:c.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(l.value===n.attributes.xfaOn?e.setAttribute("checked",!0):l.value===n.attributes.xfaOff&&e.removeAttribute("checked"),a==="print")break;e.addEventListener("change",c=>{i.setValue(t,{value:c.target.checked?c.target.getAttribute("xfaOn"):c.target.getAttribute("xfaOff")})})}else{if(l.value!==null&&e.setAttribute("value",l.value),a==="print")break;e.addEventListener("input",c=>{i.setValue(t,{value:c.target.value})})}break;case"select":if(l.value!==null){e.setAttribute("value",l.value);for(const c of n.children)c.attributes.value===l.value?c.attributes.selected=!0:c.attributes.hasOwnProperty("selected")&&delete c.attributes.selected}e.addEventListener("input",c=>{const d=c.target.options,h=d.selectedIndex===-1?"":d[d.selectedIndex].value;i.setValue(t,{value:h})});break}}static setAttributes({html:e,element:t,storage:n=null,intent:i,linkService:a}){const{attributes:l}=t,c=e instanceof HTMLAnchorElement;l.type==="radio"&&(l.name=`${l.name}-${i}`);for(const[d,h]of Object.entries(l))if(h!=null)switch(d){case"class":h.length&&e.setAttribute(d,h.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",h);break;case"style":Object.assign(e.style,h);break;case"textContent":e.textContent=h;break;default:(!c||d!=="href"&&d!=="newWindow")&&e.setAttribute(d,h)}c&&a.addLinkAttributes(e,l.href,l.newWindow),n&&l.dataId&&this.setupStorage(e,l.dataId,t,n)}static render(e){const t=e.annotationStorage,n=e.linkService,i=e.xfaHtml,a=e.intent||"display",l=document.createElement(i.name);i.attributes&&this.setAttributes({html:l,element:i,intent:a,linkService:n});const c=a!=="richText",d=e.div;if(d.append(l),e.viewport){const g=`matrix(${e.viewport.transform.join(",")})`;d.style.transform=g}c&&d.setAttribute("class","xfaLayer xfaFont");const h=[];if(i.children.length===0){if(i.value){const g=document.createTextNode(i.value);l.append(g),c&&Oo.shouldBuildText(i.name)&&h.push(g)}return{textDivs:h}}const f=[[i,-1,l]];for(;f.length>0;){const[g,m,y]=f.at(-1);if(m+1===g.children.length){f.pop();continue}const x=g.children[++f.at(-1)[1]];if(x===null)continue;const{name:w}=x;if(w==="#text"){const E=document.createTextNode(x.value);h.push(E),y.append(E);continue}const S=x?.attributes?.xmlns?document.createElementNS(x.attributes.xmlns,w):document.createElement(w);if(y.append(S),x.attributes&&this.setAttributes({html:S,element:x,storage:t,intent:a,linkService:n}),x.children?.length>0)f.push([x,-1,S]);else if(x.value){const E=document.createTextNode(x.value);c&&Oo.shouldBuildText(w)&&h.push(E),S.append(E)}}for(const g of d.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))g.setAttribute("readOnly",!0);return{textDivs:h}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}const Qo=1e3,gR=9,Ts=new WeakSet;class bv{static create(e){switch(e.data.annotationType){case ct.LINK:return new F0(e);case ct.TEXT:return new mR(e);case ct.WIDGET:switch(e.data.fieldType){case"Tx":return new vR(e);case"Btn":return e.data.radioButton?new j0(e):e.data.checkBox?new wR(e):new bR(e);case"Ch":return new xR(e);case"Sig":return new yR(e)}return new Is(e);case ct.POPUP:return new ch(e);case ct.FREETEXT:return new z0(e);case ct.LINE:return new AR(e);case ct.SQUARE:return new ER(e);case ct.CIRCLE:return new _R(e);case ct.POLYLINE:return new $0(e);case ct.CARET:return new kR(e);case ct.INK:return new sf(e);case ct.POLYGON:return new CR(e);case ct.HIGHLIGHT:return new B0(e);case ct.UNDERLINE:return new PR(e);case ct.SQUIGGLY:return new TR(e);case ct.STRIKEOUT:return new RR(e);case ct.STAMP:return new H0(e);case ct.FILEATTACHMENT:return new NR(e);default:return new ht(e)}}}class ht{#e=null;#t=!1;#n=null;constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:i=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(n)),i&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:n}){return!!(e?.str||t?.str||n?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return ht._hasPopupData(this.data)}updateEdited(e){if(!this.container)return;this.#e||={rect:this.data.rect.slice(0)};const{rect:t}=e;t&&this.#r(t),this.#n?.popup.updateEdited(e)}resetEdited(){this.#e&&(this.#r(this.#e.rect),this.#n?.popup.resetEdited(),this.#e=null)}#r(e){const{container:{style:t},data:{rect:n,rotation:i},parent:{viewport:{rawDims:{pageWidth:a,pageHeight:l,pageX:c,pageY:d}}}}=this;n?.splice(0,4,...e),t.left=`${100*(e[0]-c)/a}%`,t.top=`${100*(l-e[3]+d)/l}%`,i===0?(t.width=`${100*(e[2]-e[0])/a}%`,t.height=`${100*(e[3]-e[1])/l}%`):this.setRotation(i)}_createContainer(e){const{data:t,parent:{page:n,viewport:i}}=this,a=document.createElement("section");a.setAttribute("data-annotation-id",t.id),this instanceof Is||(a.tabIndex=Qo);const{style:l}=a;if(l.zIndex=this.parent.zIndex++,t.alternativeText&&(a.title=t.alternativeText),t.noRotate&&a.classList.add("norotate"),!t.rect||this instanceof ch){const{rotation:w}=t;return!t.hasOwnCanvas&&w!==0&&this.setRotation(w,a),a}const{width:c,height:d}=this;if(!e&&t.borderStyle.width>0){l.borderWidth=`${t.borderStyle.width}px`;const w=t.borderStyle.horizontalCornerRadius,S=t.borderStyle.verticalCornerRadius;if(w>0||S>0){const P=`calc(${w}px * var(--total-scale-factor)) / calc(${S}px * var(--total-scale-factor))`;l.borderRadius=P}else if(this instanceof j0){const P=`calc(${c}px * var(--total-scale-factor)) / calc(${d}px * var(--total-scale-factor))`;l.borderRadius=P}switch(t.borderStyle.style){case ui.SOLID:l.borderStyle="solid";break;case ui.DASHED:l.borderStyle="dashed";break;case ui.BEVELED:Ne("Unimplemented border style: beveled");break;case ui.INSET:Ne("Unimplemented border style: inset");break;case ui.UNDERLINE:l.borderBottomStyle="solid";break}const E=t.borderColor||null;E?(this.#t=!0,l.borderColor=xe.makeHexColor(E[0]|0,E[1]|0,E[2]|0)):l.borderWidth=0}const h=xe.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]),{pageWidth:f,pageHeight:g,pageX:m,pageY:y}=i.rawDims;l.left=`${100*(h[0]-m)/f}%`,l.top=`${100*(h[1]-y)/g}%`;const{rotation:x}=t;return t.hasOwnCanvas||x===0?(l.width=`${100*c/f}%`,l.height=`${100*d/g}%`):this.setRotation(x,a),a}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:i}=this.parent.viewport.rawDims;let{width:a,height:l}=this;e%180!==0&&([a,l]=[l,a]),t.style.width=`${100*a/n}%`,t.style.height=`${100*l/i}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(t,n,i)=>{const a=i.detail[t],l=a[0],c=a.slice(1);i.target.style[n]=wv[`${l}_HTML`](c),this.annotationStorage.setValue(this.data.id,{[n]:wv[`${l}_rgb`](c)})};return Me(this,"_commonActions",{display:t=>{const{display:n}=t.detail,i=n%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:n===1||n===2})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:n}=t.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},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=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:t=>{const n=t.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(e,t){const n=this._commonActions;for(const i of Object.keys(t.detail))(e[i]||n[i])?.(t)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const n=this._commonActions;for(const[i,a]of Object.entries(t)){const l=n[i];if(l){const c={detail:{[i]:a},target:e};l(c),delete t[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,n,i,a]=this.data.rect.map(w=>Math.fround(w));if(e.length===8){const[w,S,E,P]=e.subarray(2,6);if(i===w&&a===S&&t===E&&n===P)return}const{style:l}=this.container;let c;if(this.#t){const{borderColor:w,borderWidth:S}=l;l.borderWidth=0,c=["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="${w}" stroke-width="${S}">`],this.container.classList.add("hasBorder")}const d=i-t,h=a-n,{svgFactory:f}=this,g=f.createElement("svg");g.classList.add("quadrilateralsContainer"),g.setAttribute("width",0),g.setAttribute("height",0);const m=f.createElement("defs");g.append(m);const y=f.createElement("clipPath"),x=`clippath_${this.data.id}`;y.setAttribute("id",x),y.setAttribute("clipPathUnits","objectBoundingBox"),m.append(y);for(let w=2,S=e.length;w<S;w+=8){const E=e[w],P=e[w+1],k=e[w+2],T=e[w+3],R=f.createElement("rect"),I=(k-t)/d,N=(a-P)/h,D=(E-k)/d,V=(P-T)/h;R.setAttribute("x",I),R.setAttribute("y",N),R.setAttribute("width",D),R.setAttribute("height",V),y.append(R),c?.push(`<rect vector-effect="non-scaling-stroke" x="${I}" y="${N}" width="${D}" height="${V}"/>`)}this.#t&&(c.push("</g></svg>')"),l.backgroundImage=c.join("")),this.container.append(g),this.container.style.clipPath=`url(#${x})`}_createPopup(){const{data:e}=this,t=this.#n=new ch({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]});this.parent.div.append(t.render())}render(){We("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const n=[];if(this._fieldObjects){const i=this._fieldObjects[e];if(i)for(const{page:a,id:l,exportValues:c}of i){if(a===-1||l===t)continue;const d=typeof c=="string"?c:null,h=document.querySelector(`[data-element-id="${l}"]`);if(h&&!Ts.has(h)){Ne(`_getElementsByName - element not allowed: ${l}`);continue}n.push({id:l,exportValue:d,domElement:h})}return n}for(const i of document.getElementsByName(e)){const{exportValue:a}=i,l=i.getAttribute("data-element-id");l!==t&&Ts.has(i)&&n.push({id:l,exportValue:a,domElement:i})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}}class F0 extends ht{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,n=document.createElement("a");n.setAttribute("data-element-id",e.id);let i=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),i=!0):e.action?(this._bindNamedAction(n,e.action),i=!0):e.attachment?(this.#t(n,e.attachment,e.attachmentDest),i=!0):e.setOCGState?(this.#n(n,e.setOCGState),i=!0):e.dest?(this._bindLink(n,e.dest),i=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),i=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),i=!0):this.isTooltipOnly&&!i&&(this._bindLink(n,""),i=!0)),this.container.classList.add("linkAnnotation"),i&&this.container.append(n),this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||t==="")&&this.#e()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),this.#e()}#t(e,t,n=null){e.href=this.linkService.getAnchorUrl(""),t.description&&(e.title=t.description),e.onclick=()=>(this.downloadManager?.openOrDownloadData(t.content,t.filename,n),!1),this.#e()}#n(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),this.#e()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const i of Object.keys(t.actions)){const a=n.get(i);a&&(e[a]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:i}}),!1))}e.onclick||(e.onclick=()=>!1),this.#e()}_bindResetFormAction(e,t){const n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl("")),this.#e(),!this._fieldObjects){Ne('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(e.onclick=()=>!1);return}e.onclick=()=>{n?.();const{fields:i,refs:a,include:l}=t,c=[];if(i.length!==0||a.length!==0){const f=new Set(a);for(const g of i){const m=this._fieldObjects[g]||[];for(const{id:y}of m)f.add(y)}for(const g of Object.values(this._fieldObjects))for(const m of g)f.has(m.id)===l&&c.push(m)}else for(const f of Object.values(this._fieldObjects))c.push(...f);const d=this.annotationStorage,h=[];for(const f of c){const{id:g}=f;switch(h.push(g),f.type){case"text":{const y=f.defaultValue||"";d.setValue(g,{value:y});break}case"checkbox":case"radiobutton":{const y=f.defaultValue===f.exportValues;d.setValue(g,{value:y});break}case"combobox":case"listbox":{const y=f.defaultValue||"";d.setValue(g,{value:y});break}default:continue}const m=document.querySelector(`[data-element-id="${g}"]`);if(m){if(!Ts.has(m)){Ne(`_bindResetFormAction - element not allowed: ${g}`);continue}}else continue;m.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}}),!1}}}class mR extends ht{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class Is extends ht{render(){return this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&(e.previousSibling?.nodeName==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return kt.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,n,i,a){n.includes("mouse")?e.addEventListener(n,l=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:a(l),shift:l.shiftKey,modifier:this._getKeyModifier(l)}})}):e.addEventListener(n,l=>{if(n==="blur"){if(!t.focused||!l.relatedTarget)return;t.focused=!1}else if(n==="focus"){if(t.focused)return;t.focused=!0}a&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:a(l)}})})}_setEventListeners(e,t,n,i){for(const[a,l]of n)(l==="Action"||this.data.actions?.[l])&&((l==="Focus"||l==="Blur")&&(t||={focused:!1}),this._setEventListener(e,t,a,l,i),l==="Focus"&&!this.data.actions?.Blur?this._setEventListener(e,t,"blur","Blur",null):l==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(e,t,"focus","Focus",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?"transparent":xe.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||gR,a=e.style;let l;const c=2,d=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-c),f=Math.round(h/(Id*i))||1,g=h/f;l=Math.min(i,d(g/Id))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-c);l=Math.min(i,d(h/Id))}a.fontSize=`calc(${l}px * var(--total-scale-factor))`,a.color=xe.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(a.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class vR extends Is{constructor(e){const t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,n,i){const a=this.annotationStorage;for(const l of this._getElementsByName(e.name,e.id))l.domElement&&(l.domElement[t]=n),a.setValue(l.id,{[i]:n})}render(){const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const i=e.getValue(t,{value:this.data.fieldValue});let a=i.value||"";const l=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;l&&a.length>l&&(a=a.slice(0,l));let c=i.formattedValue||this.data.textContent?.join(`
214
+ `)||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const d={userValue:a,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=c??a,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type=this.data.password?"password":"text",n.setAttribute("value",c??a),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),Ts.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=Qo,this._setRequired(n,this.data.required),l&&(n.maxLength=l),n.addEventListener("input",f=>{e.setValue(t,{value:f.target.value}),this.setPropertyOnSiblings(n,"value",f.target.value,"value"),d.formattedValue=null}),n.addEventListener("resetform",f=>{const g=this.data.defaultFieldValue??"";n.value=d.userValue=g,d.formattedValue=null});let h=f=>{const{formattedValue:g}=d;g!=null&&(f.target.value=g),f.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",g=>{if(d.focused)return;const{target:m}=g;d.userValue&&(m.value=d.userValue),d.lastCommittedValue=m.value,d.commitKey=1,this.data.actions?.Focus||(d.focused=!0)}),n.addEventListener("updatefromsandbox",g=>{this.showElementAndHideCanvas(g.target);const m={value(y){d.userValue=y.detail.value??"",e.setValue(t,{value:d.userValue.toString()}),y.target.value=d.userValue},formattedValue(y){const{formattedValue:x}=y.detail;d.formattedValue=x,x!=null&&y.target!==document.activeElement&&(y.target.value=x),e.setValue(t,{formattedValue:x})},selRange(y){y.target.setSelectionRange(...y.detail.selRange)},charLimit:y=>{const{charLimit:x}=y.detail,{target:w}=y;if(x===0){w.removeAttribute("maxLength");return}w.setAttribute("maxLength",x);let S=d.userValue;!S||S.length<=x||(S=S.slice(0,x),w.value=d.userValue=S,e.setValue(t,{value:S}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:S,willCommit:!0,commitKey:1,selStart:w.selectionStart,selEnd:w.selectionEnd}}))}};this._dispatchEventFromSandbox(m,g)}),n.addEventListener("keydown",g=>{d.commitKey=1;let m=-1;if(g.key==="Escape"?m=0:g.key==="Enter"&&!this.data.multiLine?m=2:g.key==="Tab"&&(d.commitKey=3),m===-1)return;const{value:y}=g.target;d.lastCommittedValue!==y&&(d.lastCommittedValue=y,d.userValue=y,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:y,willCommit:!0,commitKey:m,selStart:g.target.selectionStart,selEnd:g.target.selectionEnd}}))});const f=h;h=null,n.addEventListener("blur",g=>{if(!d.focused||!g.relatedTarget)return;this.data.actions?.Blur||(d.focused=!1);const{value:m}=g.target;d.userValue=m,d.lastCommittedValue!==m&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:m,willCommit:!0,commitKey:d.commitKey,selStart:g.target.selectionStart,selEnd:g.target.selectionEnd}}),f(g)}),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",g=>{d.lastCommittedValue=null;const{data:m,target:y}=g,{value:x,selectionStart:w,selectionEnd:S}=y;let E=w,P=S;switch(g.inputType){case"deleteWordBackward":{const k=x.substring(0,w).match(/\w*[^\w]*$/);k&&(E-=k[0].length);break}case"deleteWordForward":{const k=x.substring(w).match(/^[^\w]*\w*/);k&&(P+=k[0].length);break}case"deleteContentBackward":w===S&&(E-=1);break;case"deleteContentForward":w===S&&(P+=1);break}g.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:x,change:m||"",willCommit:!1,selStart:E,selEnd:P}})}),this._setEventListeners(n,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],g=>g.target.value)}if(h&&n.addEventListener("blur",h),this.data.comb){const g=(this.data.rect[2]-this.data.rect[0])/l;n.classList.add("comb"),n.style.letterSpacing=`calc(${g}px * var(--total-scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class yR extends Is{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class wR extends Is{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,n=t.id;let i=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",e.setValue(n,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const a=document.createElement("input");return Ts.add(a),a.setAttribute("data-element-id",n),a.disabled=t.readOnly,this._setRequired(a,this.data.required),a.type="checkbox",a.name=t.fieldName,i&&a.setAttribute("checked",!0),a.setAttribute("exportValue",t.exportValue),a.tabIndex=Qo,a.addEventListener("change",l=>{const{name:c,checked:d}=l.target;for(const h of this._getElementsByName(c,n)){const f=d&&h.exportValue===t.exportValue;h.domElement&&(h.domElement.checked=f),e.setValue(h.id,{value:f})}e.setValue(n,{value:d})}),a.addEventListener("resetform",l=>{const c=t.defaultFieldValue||"Off";l.target.checked=c===t.exportValue}),this.enableScripting&&this.hasJSActions&&(a.addEventListener("updatefromsandbox",l=>{const c={value(d){d.target.checked=d.detail.value!=="Off",e.setValue(n,{value:d.target.checked})}};this._dispatchEventFromSandbox(c,l)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],l=>l.target.checked)),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class j0 extends Is{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,n=t.id;let i=e.getValue(n,{value:t.fieldValue===t.buttonValue}).value;if(typeof i=="string"&&(i=i!==t.buttonValue,e.setValue(n,{value:i})),i)for(const l of this._getElementsByName(t.fieldName,n))e.setValue(l.id,{value:!1});const a=document.createElement("input");if(Ts.add(a),a.setAttribute("data-element-id",n),a.disabled=t.readOnly,this._setRequired(a,this.data.required),a.type="radio",a.name=t.fieldName,i&&a.setAttribute("checked",!0),a.tabIndex=Qo,a.addEventListener("change",l=>{const{name:c,checked:d}=l.target;for(const h of this._getElementsByName(c,n))e.setValue(h.id,{value:!1});e.setValue(n,{value:d})}),a.addEventListener("resetform",l=>{const c=t.defaultFieldValue;l.target.checked=c!=null&&c===t.buttonValue}),this.enableScripting&&this.hasJSActions){const l=t.buttonValue;a.addEventListener("updatefromsandbox",c=>{const d={value:h=>{const f=l===h.detail.value;for(const g of this._getElementsByName(h.target.name)){const m=f&&g.id===n;g.domElement&&(g.domElement.checked=m),e.setValue(g.id,{value:m})}}};this._dispatchEventFromSandbox(d,c)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],c=>c.target.checked)}return this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class bR extends F0{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",n=>{this._dispatchEventFromSandbox({},n)})),e}}class xR extends Is{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),i=document.createElement("select");Ts.add(i),i.setAttribute("data-element-id",t),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=Qo;let a=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",f=>{const g=this.data.defaultFieldValue;for(const m of i.options)m.selected=m.value===g});for(const f of this.data.options){const g=document.createElement("option");g.textContent=f.displayValue,g.value=f.exportValue,n.value.includes(f.exportValue)&&(g.setAttribute("selected",!0),a=!1),i.append(g)}let l=null;if(a){const f=document.createElement("option");f.value=" ",f.setAttribute("hidden",!0),f.setAttribute("selected",!0),i.prepend(f),l=()=>{f.remove(),i.removeEventListener("input",l),l=null},i.addEventListener("input",l)}const c=f=>{const g=f?"value":"textContent",{options:m,multiple:y}=i;return y?Array.prototype.filter.call(m,x=>x.selected).map(x=>x[g]):m.selectedIndex===-1?null:m[m.selectedIndex][g]};let d=c(!1);const h=f=>{const g=f.target.options;return Array.prototype.map.call(g,m=>({displayValue:m.textContent,exportValue:m.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",f=>{const g={value(m){l?.();const y=m.detail.value,x=new Set(Array.isArray(y)?y:[y]);for(const w of i.options)w.selected=x.has(w.value);e.setValue(t,{value:c(!0)}),d=c(!1)},multipleSelection(m){i.multiple=!0},remove(m){const y=i.options,x=m.detail.remove;y[x].selected=!1,i.remove(x),y.length>0&&Array.prototype.findIndex.call(y,S=>S.selected)===-1&&(y[0].selected=!0),e.setValue(t,{value:c(!0),items:h(m)}),d=c(!1)},clear(m){for(;i.length!==0;)i.remove(0);e.setValue(t,{value:null,items:[]}),d=c(!1)},insert(m){const{index:y,displayValue:x,exportValue:w}=m.detail.insert,S=i.children[y],E=document.createElement("option");E.textContent=x,E.value=w,S?S.before(E):i.append(E),e.setValue(t,{value:c(!0),items:h(m)}),d=c(!1)},items(m){const{items:y}=m.detail;for(;i.length!==0;)i.remove(0);for(const x of y){const{displayValue:w,exportValue:S}=x,E=document.createElement("option");E.textContent=w,E.value=S,i.append(E)}i.options.length>0&&(i.options[0].selected=!0),e.setValue(t,{value:c(!0),items:h(m)}),d=c(!1)},indices(m){const y=new Set(m.detail.indices);for(const x of m.target.options)x.selected=y.has(x.index);e.setValue(t,{value:c(!0)}),d=c(!1)},editable(m){m.target.disabled=!m.detail.editable}};this._dispatchEventFromSandbox(g,f)}),i.addEventListener("input",f=>{const g=c(!0),m=c(!1);e.setValue(t,{value:g}),f.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:d,change:m,changeEx:g,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],f=>f.target.value)):i.addEventListener("input",function(f){e.setValue(t,{value:c(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class ch extends ht{constructor(e){const{data:t,elements:n}=e;super(e,{isRenderable:ht._hasPopupData(t)}),this.elements=n,this.popup=null}render(){this.container.classList.add("popupAnnotation");const e=this.popup=new SR({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 n of this.elements)n.popup=e,n.container.ariaHasPopup="dialog",t.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",t.map(n=>`${Wh}${n}`).join(",")),this.container}}class SR{#e=this.#k.bind(this);#t=this.#C.bind(this);#n=this.#P.bind(this);#r=this.#S.bind(this);#i=null;#s=null;#l=null;#a=null;#d=null;#c=null;#h=null;#u=!1;#f=null;#o=null;#p=null;#m=null;#g=null;#v=null;#y=!1;constructor({container:e,color:t,elements:n,titleObj:i,modificationDate:a,contentsObj:l,richText:c,parent:d,rect:h,parentRect:f,open:g}){this.#s=e,this.#g=i,this.#l=l,this.#m=c,this.#c=d,this.#i=t,this.#p=h,this.#h=f,this.#d=n,this.#a=Gh.toDateObject(a),this.trigger=n.flatMap(m=>m.getElementsToTriggerPopup());for(const m of this.trigger)m.addEventListener("click",this.#r),m.addEventListener("mouseenter",this.#n),m.addEventListener("mouseleave",this.#t),m.classList.add("popupTriggerArea");for(const m of n)m.container?.addEventListener("keydown",this.#e);this.#s.hidden=!0,g&&this.#S()}render(){if(this.#f)return;const e=this.#f=document.createElement("div");if(e.className="popup",this.#i){const a=e.style.outlineColor=xe.makeHexColor(...this.#i);e.style.backgroundColor=`color-mix(in srgb, ${a} 30%, white)`}const t=document.createElement("span");t.className="header";const n=document.createElement("h1");if(t.append(n),{dir:n.dir,str:n.textContent}=this.#g,e.append(t),this.#a){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:this.#a.valueOf()})),t.append(a)}const i=this.#w;if(i)rf.render({xfaHtml:i,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const a=this._formatContents(this.#l);e.append(a)}this.#s.append(e)}get#w(){const e=this.#m,t=this.#l;return e?.str&&(!t?.str||t.str===e.str)&&this.#m.html||null}get#x(){return this.#w?.attributes?.style?.fontSize||0}get#A(){return this.#w?.attributes?.style?.color||null}#_(e){const t=[],n={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},i={style:{color:this.#A,fontSize:this.#x?`calc(${this.#x}px * var(--total-scale-factor))`:""}};for(const a of e.split(`
215
+ `))t.push({name:"span",value:a,attributes:i});return n}_formatContents({str:e,dir:t}){const n=document.createElement("p");n.classList.add("popupContent"),n.dir=t;const i=e.split(/(?:\r\n?|\n)/);for(let a=0,l=i.length;a<l;++a){const c=i[a];n.append(document.createTextNode(c)),a<l-1&&n.append(document.createElement("br"))}return n}#k(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&this.#u)&&this.#S()}updateEdited({rect:e,popupContent:t}){this.#v||={contentsObj:this.#l,richText:this.#m},e&&(this.#o=null),t&&(this.#m=this.#_(t),this.#l=null),this.#f?.remove(),this.#f=null}resetEdited(){this.#v&&({contentsObj:this.#l,richText:this.#m}=this.#v,this.#v=null,this.#f?.remove(),this.#f=null,this.#o=null)}#T(){if(this.#o!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:i,pageY:a}}}=this.#c;let l=!!this.#h,c=l?this.#h:this.#p;for(const x of this.#d)if(!c||xe.intersect(x.data.rect,c)!==null){c=x.data.rect,l=!0;break}const d=xe.normalizeRect([c[0],e[3]-c[1]+e[1],c[2],e[3]-c[3]+e[1]]),f=l?c[2]-c[0]+5:0,g=d[0]+f,m=d[1];this.#o=[100*(g-i)/t,100*(m-a)/n];const{style:y}=this.#s;y.left=`${this.#o[0]}%`,y.top=`${this.#o[1]}%`}#S(){this.#u=!this.#u,this.#u?(this.#P(),this.#s.addEventListener("click",this.#r),this.#s.addEventListener("keydown",this.#e)):(this.#C(),this.#s.removeEventListener("click",this.#r),this.#s.removeEventListener("keydown",this.#e))}#P(){this.#f||this.render(),this.isVisible?this.#u&&this.#s.classList.add("focused"):(this.#T(),this.#s.hidden=!1,this.#s.style.zIndex=parseInt(this.#s.style.zIndex)+1e3)}#C(){this.#s.classList.remove("focused"),!(this.#u||!this.isVisible)&&(this.#s.hidden=!0,this.#s.style.zIndex=parseInt(this.#s.style.zIndex)-1e3)}forceHide(){this.#y=this.isVisible,this.#y&&(this.#s.hidden=!0)}maybeShow(){this.#y&&(this.#f||this.#P(),this.#y=!1,this.#s.hidden=!1)}get isVisible(){return this.#s.hidden===!1}}class z0 extends ht{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=Re.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const n=document.createElement("span");n.textContent=t,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class AR extends ht{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const{data:e,width:t,height:n}=this,i=this.svgFactory.create(t,n,!0),a=this.#e=this.svgFactory.createElement("svg:line");return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),i.append(a),this.container.append(i),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class ER extends ht{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const{data:e,width:t,height:n}=this,i=this.svgFactory.create(t,n,!0),a=e.borderStyle.width,l=this.#e=this.svgFactory.createElement("svg:rect");return l.setAttribute("x",a/2),l.setAttribute("y",a/2),l.setAttribute("width",t-a),l.setAttribute("height",n-a),l.setAttribute("stroke-width",a||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),i.append(l),this.container.append(i),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class _R extends ht{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const{data:e,width:t,height:n}=this,i=this.svgFactory.create(t,n,!0),a=e.borderStyle.width,l=this.#e=this.svgFactory.createElement("svg:ellipse");return l.setAttribute("cx",t/2),l.setAttribute("cy",n/2),l.setAttribute("rx",t/2-a/2),l.setAttribute("ry",n/2-a/2),l.setAttribute("stroke-width",a||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),i.append(l),this.container.append(i),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class $0 extends ht{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:t,borderStyle:n,popupRef:i},width:a,height:l}=this;if(!t)return this.container;const c=this.svgFactory.create(a,l,!0);let d=[];for(let f=0,g=t.length;f<g;f+=2){const m=t[f]-e[0],y=e[3]-t[f+1];d.push(`${m},${y}`)}d=d.join(" ");const h=this.#e=this.svgFactory.createElement(this.svgElementName);return h.setAttribute("points",d),h.setAttribute("stroke-width",n.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),c.append(h),this.container.append(c),!i&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class CR extends $0{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class kR extends ht{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class sf extends ht{#e=null;#t=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Re.HIGHLIGHT:Re.INK}#n(e,t){switch(e){case 90:return{transform:`rotate(90) translate(${-t[0]},${t[1]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};case 180:return{transform:`rotate(180) translate(${-t[2]},${t[1]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]};case 270:return{transform:`rotate(270) translate(${-t[2]},${t[3]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};default:return{transform:`translate(${-t[0]},${t[3]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]}}}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:t,inkLists:n,borderStyle:i,popupRef:a}}=this,{transform:l,width:c,height:d}=this.#n(t,e),h=this.svgFactory.create(c,d,!0),f=this.#e=this.svgFactory.createElement("svg:g");h.append(f),f.setAttribute("stroke-width",i.width||1),f.setAttribute("stroke-linecap","round"),f.setAttribute("stroke-linejoin","round"),f.setAttribute("stroke-miterlimit",10),f.setAttribute("stroke","transparent"),f.setAttribute("fill","transparent"),f.setAttribute("transform",l);for(let g=0,m=n.length;g<m;g++){const y=this.svgFactory.createElement(this.svgElementName);this.#t.push(y),y.setAttribute("points",n[g].join(",")),f.append(y)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(h),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);const{thickness:t,points:n,rect:i}=e,a=this.#e;if(t>=0&&a.setAttribute("stroke-width",t||1),n)for(let l=0,c=this.#t.length;l<c;l++)this.#t[l].setAttribute("points",n[l].join(","));if(i){const{transform:l,width:c,height:d}=this.#n(this.data.rotation,i);a.parentElement.setAttribute("viewBox",`0 0 ${c} ${d}`),a.setAttribute("transform",l)}}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class B0 extends ht{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Re.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class PR extends ht{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class TR extends ht{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class RR extends ht{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class H0 extends ht{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Re.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class NR extends ht{#e=null;constructor(e){super(e,{isRenderable:!0});const{file:t}=this.data;this.filename=t.filename,this.content=t.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...t})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:t}=this;let n;t.hasAppearance||t.fillAlpha===0?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?"paperclip":"pushpin"}.svg`,t.fillAlpha&&t.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(t.fillAlpha*100)}%);`)),n.addEventListener("dblclick",this.#t.bind(this)),this.#e=n;const{isMac:i}=kt.platform;return e.addEventListener("keydown",a=>{a.key==="Enter"&&(i?a.metaKey:a.ctrlKey)&&this.#t()}),!t.popupRef&&this.hasPopupData?this._createPopup():n.classList.add("popupTriggerArea"),e.append(n),e}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}#t(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}let of=class U0{#e=null;#t=null;#n=new Map;#r=null;constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,annotationEditorUIManager:i,page:a,viewport:l,structTreeLayer:c}){this.div=e,this.#e=t,this.#t=n,this.#r=c||null,this.page=a,this.viewport=l,this.zIndex=0,this._annotationEditorUIManager=i}hasEditableAnnotations(){return this.#n.size>0}async#i(e,t){const n=e.firstChild||e,i=n.id=`${Wh}${t}`,a=await this.#r?.getAriaAttributes(i);if(a)for(const[l,c]of a)n.setAttribute(l,c);this.div.append(e),this.#e?.moveElementInDOM(this.div,e,n,!1)}async render(e){const{annotations:t}=e,n=this.div;Yr(n,this.viewport);const i=new Map,a={data:null,layer:n,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new jo,annotationStorage:e.annotationStorage||new Kh,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const l of t){if(l.noHTML)continue;const c=l.annotationType===ct.POPUP;if(c){const f=i.get(l.id);if(!f)continue;a.elements=f}else if(l.rect[2]===l.rect[0]||l.rect[3]===l.rect[1])continue;a.data=l;const d=bv.create(a);if(!d.isRenderable)continue;if(!c&&l.popupRef){const f=i.get(l.popupRef);f?f.push(d):i.set(l.popupRef,[d])}const h=d.render();l.hidden&&(h.style.visibility="hidden"),await this.#i(h,l.id),d._isEditable&&(this.#n.set(d.data.id,d),this._annotationEditorUIManager?.renderAnnotationElement(d))}this.#s()}async addLinkAnnotations(e,t){const n={data:null,layer:this.div,linkService:t,svgFactory:new jo,parent:this};for(const i of e){i.borderStyle||=U0._defaultBorderStyle,n.data=i;const a=bv.create(n);if(!a.isRenderable)continue;const l=a.render();await this.#i(l,i.id)}}update({viewport:e}){const t=this.div;this.viewport=e,Yr(t,{rotation:e.rotation}),this.#s(),t.hidden=!1}#s(){if(!this.#t)return;const e=this.div;for(const[t,n]of this.#t){const i=e.querySelector(`[data-annotation-id="${t}"]`);if(!i)continue;n.className="annotationContent";const{firstChild:a}=i;a?a.nodeName==="CANVAS"?a.replaceWith(n):a.classList.contains("annotationContent")?a.after(n):a.before(n):i.append(n);const l=this.#n.get(t);l&&(l._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(t,i.id,n),l._hasNoCanvas=!1):l.canvas=n)}this.#t.clear()}getEditableAnnotations(){return Array.from(this.#n.values())}getEditableAnnotation(e){return this.#n.get(e)}static get _defaultBorderStyle(){return Me(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:ui.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};const _l=/\r\n?|\n/g;class xt extends _e{#e;#t="";#n=`${this.id}-editor`;#r=null;#i;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const e=xt.prototype,t=a=>a.isEmpty(),n=br.TRANSLATE_SMALL,i=br.TRANSLATE_BIG;return Me(this,"_keyboardManager",new Xo([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[n,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[i,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:t}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,n],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,i],checker:t}]]))}static _type="freetext";static _editorType=Re.FREETEXT;constructor(e){super({...e,name:"freeTextEditor"}),this.#e=e.color||xt._defaultColor||_e._defaultLineColor,this.#i=e.fontSize||xt._defaultFontSize}static initialize(e,t){_e.initialize(e,t);const n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case De.FREETEXT_SIZE:xt._defaultFontSize=t;break;case De.FREETEXT_COLOR:xt._defaultColor=t;break}}updateParams(e,t){switch(e){case De.FREETEXT_SIZE:this.#s(t);break;case De.FREETEXT_COLOR:this.#l(t);break}}static get defaultPropertiesToUpdate(){return[[De.FREETEXT_SIZE,xt._defaultFontSize],[De.FREETEXT_COLOR,xt._defaultColor||_e._defaultLineColor]]}get propertiesToUpdate(){return[[De.FREETEXT_SIZE,this.#i],[De.FREETEXT_COLOR,this.#e]]}#s(e){const t=i=>{this.editorDiv.style.fontSize=`calc(${i}px * var(--total-scale-factor))`,this.translate(0,-(i-this.#i)*this.parentScale),this.#i=i,this.#d()},n=this.#i;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:De.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#l(e){const t=i=>{this.#e=this.editorDiv.style.color=i},n=this.#e;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:De.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){const e=this.parentScale;return[-xt._internalPadding*e,-(xt._internalPadding+this.#i)*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#r=new AbortController;const e=this._uiManager.combinedSignal(this.#r);return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#n),this._isDraggable=!0,this.#r?.abort(),this.#r=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),this._initialOptions?.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()}#a(){const e=[];this.editorDiv.normalize();let t=null;for(const n of this.editorDiv.childNodes)t?.nodeType===Node.TEXT_NODE&&n.nodeName==="BR"||(e.push(xt.#c(n)),t=n);return e.join(`
216
+ `)}#d(){const[e,t]=this.parentDimensions;let n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{const{currentLayer:i,div:a}=this,l=a.style.display,c=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",i.div.append(this.div),n=a.getBoundingClientRect(),a.remove(),a.style.display=l,a.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=n.width/e,this.height=n.height/t):(this.width=n.height/e,this.height=n.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=this.#t,t=this.#t=this.#a().trimEnd();if(e===t)return;const n=i=>{if(this.#t=i,!i){this.remove();return}this.#h(),this._uiManager.rebuild(this),this.#d()};this.addCommands({cmd:()=>{n(t)},undo:()=>{n(e)},mustExec:!1}),this.#d()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){xt._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){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)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,t;(this._isCopy||this.annotationElementId)&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#n),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:n}=this.editorDiv;if(n.fontSize=`calc(${this.#i}px * var(--total-scale-factor))`,n.color=this.#e,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[i,a]=this.parentDimensions;if(this.annotationElementId){const{position:l}=this._initialData;let[c,d]=this.getInitialTranslation();[c,d]=this.pageTranslationToScreen(c,d);const[h,f]=this.pageDimensions,[g,m]=this.pageTranslation;let y,x;switch(this.rotation){case 0:y=e+(l[0]-g)/h,x=t+this.height-(l[1]-m)/f;break;case 90:y=e+(l[0]-g)/h,x=t-(l[1]-m)/f,[c,d]=[d,-c];break;case 180:y=e-this.width+(l[0]-g)/h,x=t-(l[1]-m)/f,[c,d]=[-c,-d];break;case 270:y=e+(l[0]-g-this.height*f)/h,x=t+(l[1]-m-this.width*h)/f,[c,d]=[-d,c];break}this.setAt(y*i,x*a,c,d)}else this._moveAfterPaste(e,t);this.#h(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#c(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(_l,"")}editorDivPaste(e){const t=e.clipboardData||window.clipboardData,{types:n}=t;if(n.length===1&&n[0]==="text/plain")return;e.preventDefault();const i=xt.#f(t.getData("text")||"").replaceAll(_l,`
217
+ `);if(!i)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const l=a.getRangeAt(0);if(!i.includes(`
218
+ `)){l.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:c,startOffset:d}=l,h=[],f=[];if(c.nodeType===Node.TEXT_NODE){const y=c.parentElement;if(f.push(c.nodeValue.slice(d).replaceAll(_l,"")),y!==this.editorDiv){let x=h;for(const w of this.editorDiv.childNodes){if(w===y){x=f;continue}x.push(xt.#c(w))}}h.push(c.nodeValue.slice(0,d).replaceAll(_l,""))}else if(c===this.editorDiv){let y=h,x=0;for(const w of this.editorDiv.childNodes)x++===d&&(y=f),y.push(xt.#c(w))}this.#t=`${h.join(`
219
+ `)}${i}${f.join(`
220
+ `)}`,this.#h();const g=new Range;let m=Math.sumPrecise(h.map(y=>y.length));for(const{firstChild:y}of this.editorDiv.childNodes)if(y.nodeType===Node.TEXT_NODE){const x=y.nodeValue.length;if(m<=x){g.setStart(y,m),g.setEnd(y,m);break}m-=x}a.removeAllRanges(),a.addRange(g)}#h(){if(this.editorDiv.replaceChildren(),!!this.#t)for(const e of this.#t.split(`
221
+ `)){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}}#u(){return this.#t.replaceAll(" "," ")}static#f(e){return e.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}static async deserialize(e,t,n){let i=null;if(e instanceof z0){const{data:{defaultAppearanceData:{fontSize:l,fontColor:c},rect:d,rotation:h,id:f,popupRef:g},textContent:m,textPosition:y,parent:{page:{pageNumber:x}}}=e;if(!m||m.length===0)return null;i=e={annotationType:Re.FREETEXT,color:Array.from(c),fontSize:l,value:m.join(`
222
+ `),position:y,pageIndex:x-1,rect:d.slice(0),rotation:h,id:f,deleted:!1,popupRef:g}}const a=await super.deserialize(e,t,n);return a.#i=e.fontSize,a.#e=xe.makeHexColor(...e.color),a.#t=xt.#f(e.value),a.annotationElementId=e.id||null,a._initialData=i,a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const t=xt._internalPadding*this.parentScale,n=this.getRect(t,t),i=_e._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#e),a={annotationType:Re.FREETEXT,color:i,fontSize:this.#i,value:this.#u(),pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?(a.isCopy=!0,a):this.annotationElementId&&!this.#o(a)?null:(a.id=this.annotationElementId,a)}#o(e){const{value:t,fontSize:n,color:i,pageIndex:a}=this._initialData;return this._hasBeenMoved||e.value!==t||e.fontSize!==n||e.color.some((l,c)=>l!==i[c])||e.pageIndex!==a}renderAnnotationElement(e){const t=super.renderAnnotationElement(e);if(this.deleted)return t;const{style:n}=t;n.fontSize=`calc(${this.#i}px * var(--total-scale-factor))`,n.color=this.#e,t.replaceChildren();for(const a of this.#t.split(`
223
+ `)){const l=document.createElement("div");l.append(a?document.createTextNode(a):document.createElement("br")),t.append(l)}const i=xt._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(i,i),popupContent:this.#t}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}}class pe{static PRECISION=1e-4;toSVGPath(){We("Abstract method `toSVGPath` must be implemented.")}get box(){We("Abstract getter `box` must be implemented.")}serialize(e,t){We("Abstract method `serialize` must be implemented.")}static _rescale(e,t,n,i,a,l){l||=new Float32Array(e.length);for(let c=0,d=e.length;c<d;c+=2)l[c]=t+e[c]*i,l[c+1]=n+e[c+1]*a;return l}static _rescaleAndSwap(e,t,n,i,a,l){l||=new Float32Array(e.length);for(let c=0,d=e.length;c<d;c+=2)l[c]=t+e[c+1]*i,l[c+1]=n+e[c]*a;return l}static _translate(e,t,n,i){i||=new Float32Array(e.length);for(let a=0,l=e.length;a<l;a+=2)i[a]=t+e[a],i[a+1]=n+e[a+1];return i}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,n,i,a){switch(a){case 90:return[1-t/n,e/i];case 180:return[1-e/n,1-t/i];case 270:return[t/n,1-e/i];default:return[e/n,t/i]}}static _normalizePagePoint(e,t,n){switch(n){case 90:return[1-t,e];case 180:return[1-e,1-t];case 270:return[t,1-e];default:return[e,t]}}static createBezierPoints(e,t,n,i,a,l){return[(e+5*n)/6,(t+5*i)/6,(5*n+a)/6,(5*i+l)/6,(n+a)/2,(i+l)/2]}}class vs{#e;#t=[];#n;#r;#i=[];#s=new Float32Array(18);#l;#a;#d;#c;#h;#u;#f=[];static#o=8;static#p=2;static#m=vs.#o+vs.#p;constructor({x:e,y:t},n,i,a,l,c=0){this.#e=n,this.#u=a*i,this.#r=l,this.#s.set([NaN,NaN,NaN,NaN,e,t],6),this.#n=c,this.#c=vs.#o*i,this.#d=vs.#m*i,this.#h=i,this.#f.push(e,t)}isEmpty(){return isNaN(this.#s[8])}#g(){const e=this.#s.subarray(4,6),t=this.#s.subarray(16,18),[n,i,a,l]=this.#e;return[(this.#l+(e[0]-t[0])/2-n)/a,(this.#a+(e[1]-t[1])/2-i)/l,(this.#l+(t[0]-e[0])/2-n)/a,(this.#a+(t[1]-e[1])/2-i)/l]}add({x:e,y:t}){this.#l=e,this.#a=t;const[n,i,a,l]=this.#e;let[c,d,h,f]=this.#s.subarray(8,12);const g=e-h,m=t-f,y=Math.hypot(g,m);if(y<this.#d)return!1;const x=y-this.#c,w=x/y,S=w*g,E=w*m;let P=c,k=d;c=h,d=f,h+=S,f+=E,this.#f?.push(e,t);const T=-E/x,R=S/x,I=T*this.#u,N=R*this.#u;return this.#s.set(this.#s.subarray(2,8),0),this.#s.set([h+I,f+N],4),this.#s.set(this.#s.subarray(14,18),12),this.#s.set([h-I,f-N],16),isNaN(this.#s[6])?(this.#i.length===0&&(this.#s.set([c+I,d+N],2),this.#i.push(NaN,NaN,NaN,NaN,(c+I-n)/a,(d+N-i)/l),this.#s.set([c-I,d-N],14),this.#t.push(NaN,NaN,NaN,NaN,(c-I-n)/a,(d-N-i)/l)),this.#s.set([P,k,c,d,h,f],6),!this.isEmpty()):(this.#s.set([P,k,c,d,h,f],6),Math.abs(Math.atan2(k-d,P-c)-Math.atan2(E,S))<Math.PI/2?([c,d,h,f]=this.#s.subarray(2,6),this.#i.push(NaN,NaN,NaN,NaN,((c+h)/2-n)/a,((d+f)/2-i)/l),[c,d,P,k]=this.#s.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((P+c)/2-n)/a,((k+d)/2-i)/l),!0):([P,k,c,d,h,f]=this.#s.subarray(0,6),this.#i.push(((P+5*c)/6-n)/a,((k+5*d)/6-i)/l,((5*c+h)/6-n)/a,((5*d+f)/6-i)/l,((c+h)/2-n)/a,((d+f)/2-i)/l),[h,f,c,d,P,k]=this.#s.subarray(12,18),this.#t.push(((P+5*c)/6-n)/a,((k+5*d)/6-i)/l,((5*c+h)/6-n)/a,((5*d+f)/6-i)/l,((c+h)/2-n)/a,((d+f)/2-i)/l),!0))}toSVGPath(){if(this.isEmpty())return"";const e=this.#i,t=this.#t;if(isNaN(this.#s[6])&&!this.isEmpty())return this.#v();const n=[];n.push(`M${e[4]} ${e[5]}`);for(let i=6;i<e.length;i+=6)isNaN(e[i])?n.push(`L${e[i+4]} ${e[i+5]}`):n.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);this.#w(n);for(let i=t.length-6;i>=6;i-=6)isNaN(t[i])?n.push(`L${t[i+4]} ${t[i+5]}`):n.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);return this.#y(n),n.join(" ")}#v(){const[e,t,n,i]=this.#e,[a,l,c,d]=this.#g();return`M${(this.#s[2]-e)/n} ${(this.#s[3]-t)/i} L${(this.#s[4]-e)/n} ${(this.#s[5]-t)/i} L${a} ${l} L${c} ${d} L${(this.#s[16]-e)/n} ${(this.#s[17]-t)/i} L${(this.#s[14]-e)/n} ${(this.#s[15]-t)/i} Z`}#y(e){const t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#w(e){const[t,n,i,a]=this.#e,l=this.#s.subarray(4,6),c=this.#s.subarray(16,18),[d,h,f,g]=this.#g();e.push(`L${(l[0]-t)/i} ${(l[1]-n)/a} L${d} ${h} L${f} ${g} L${(c[0]-t)/i} ${(c[1]-n)/a}`)}newFreeDrawOutline(e,t,n,i,a,l){return new V0(e,t,n,i,a,l)}getOutlines(){const e=this.#i,t=this.#t,n=this.#s,[i,a,l,c]=this.#e,d=new Float32Array((this.#f?.length??0)+2);for(let g=0,m=d.length-2;g<m;g+=2)d[g]=(this.#f[g]-i)/l,d[g+1]=(this.#f[g+1]-a)/c;if(d[d.length-2]=(this.#l-i)/l,d[d.length-1]=(this.#a-a)/c,isNaN(n[6])&&!this.isEmpty())return this.#x(d);const h=new Float32Array(this.#i.length+24+this.#t.length);let f=e.length;for(let g=0;g<f;g+=2){if(isNaN(e[g])){h[g]=h[g+1]=NaN;continue}h[g]=e[g],h[g+1]=e[g+1]}f=this.#_(h,f);for(let g=t.length-6;g>=6;g-=6)for(let m=0;m<6;m+=2){if(isNaN(t[g+m])){h[f]=h[f+1]=NaN,f+=2;continue}h[f]=t[g+m],h[f+1]=t[g+m+1],f+=2}return this.#A(h,f),this.newFreeDrawOutline(h,d,this.#e,this.#h,this.#n,this.#r)}#x(e){const t=this.#s,[n,i,a,l]=this.#e,[c,d,h,f]=this.#g(),g=new Float32Array(36);return g.set([NaN,NaN,NaN,NaN,(t[2]-n)/a,(t[3]-i)/l,NaN,NaN,NaN,NaN,(t[4]-n)/a,(t[5]-i)/l,NaN,NaN,NaN,NaN,c,d,NaN,NaN,NaN,NaN,h,f,NaN,NaN,NaN,NaN,(t[16]-n)/a,(t[17]-i)/l,NaN,NaN,NaN,NaN,(t[14]-n)/a,(t[15]-i)/l],0),this.newFreeDrawOutline(g,e,this.#e,this.#h,this.#n,this.#r)}#A(e,t){const n=this.#t;return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6}#_(e,t){const n=this.#s.subarray(4,6),i=this.#s.subarray(16,18),[a,l,c,d]=this.#e,[h,f,g,m]=this.#g();return e.set([NaN,NaN,NaN,NaN,(n[0]-a)/c,(n[1]-l)/d,NaN,NaN,NaN,NaN,h,f,NaN,NaN,NaN,NaN,g,m,NaN,NaN,NaN,NaN,(i[0]-a)/c,(i[1]-l)/d],t),t+=24}}class V0 extends pe{#e;#t=new Float32Array(4);#n;#r;#i;#s;#l;constructor(e,t,n,i,a,l){super(),this.#l=e,this.#i=t,this.#e=n,this.#s=i,this.#n=a,this.#r=l,this.lastPoint=[NaN,NaN],this.#a(l);const[c,d,h,f]=this.#t;for(let g=0,m=e.length;g<m;g+=2)e[g]=(e[g]-c)/h,e[g+1]=(e[g+1]-d)/f;for(let g=0,m=t.length;g<m;g+=2)t[g]=(t[g]-c)/h,t[g+1]=(t[g+1]-d)/f}toSVGPath(){const e=[`M${this.#l[4]} ${this.#l[5]}`];for(let t=6,n=this.#l.length;t<n;t+=6){if(isNaN(this.#l[t])){e.push(`L${this.#l[t+4]} ${this.#l[t+5]}`);continue}e.push(`C${this.#l[t]} ${this.#l[t+1]} ${this.#l[t+2]} ${this.#l[t+3]} ${this.#l[t+4]} ${this.#l[t+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,t,n,i],a){const l=n-e,c=i-t;let d,h;switch(a){case 0:d=pe._rescale(this.#l,e,i,l,-c),h=pe._rescale(this.#i,e,i,l,-c);break;case 90:d=pe._rescaleAndSwap(this.#l,e,t,l,c),h=pe._rescaleAndSwap(this.#i,e,t,l,c);break;case 180:d=pe._rescale(this.#l,n,t,-l,c),h=pe._rescale(this.#i,n,t,-l,c);break;case 270:d=pe._rescaleAndSwap(this.#l,n,i,-l,-c),h=pe._rescaleAndSwap(this.#i,n,i,-l,-c);break}return{outline:Array.from(d),points:[Array.from(h)]}}#a(e){const t=this.#l;let n=t[4],i=t[5];const a=[n,i,n,i];let l=n,c=i;const d=e?Math.max:Math.min;for(let f=6,g=t.length;f<g;f+=6){const m=t[f+4],y=t[f+5];if(isNaN(t[f]))xe.pointBoundingBox(m,y,a),c<y?(l=m,c=y):c===y&&(l=d(l,m));else{const x=[1/0,1/0,-1/0,-1/0];xe.bezierBoundingBox(n,i,...t.slice(f,f+6),x),xe.rectBoundingBox(...x,a),c<x[3]?(l=x[2],c=x[3]):c===x[3]&&(l=d(l,x[2]))}n=m,i=y}const h=this.#t;h[0]=a[0]-this.#n,h[1]=a[1]-this.#n,h[2]=a[2]-a[0]+2*this.#n,h[3]=a[3]-a[1]+2*this.#n,this.lastPoint=[l,c]}get box(){return this.#t}newOutliner(e,t,n,i,a,l=0){return new vs(e,t,n,i,a,l)}getNewOutline(e,t){const[n,i,a,l]=this.#t,[c,d,h,f]=this.#e,g=a*h,m=l*f,y=n*h+c,x=i*f+d,w=this.newOutliner({x:this.#i[0]*g+y,y:this.#i[1]*m+x},this.#e,this.#s,e,this.#r,t??this.#n);for(let S=2;S<this.#i.length;S+=2)w.add({x:this.#i[S]*g+y,y:this.#i[S+1]*m+x});return w.getOutlines()}}class uh{#e;#t;#n=[];#r=[];constructor(e,t=0,n=0,i=!0){const a=[1/0,1/0,-1/0,-1/0],l=10**-4;for(const{x:y,y:x,width:w,height:S}of e){const E=Math.floor((y-t)/l)*l,P=Math.ceil((y+w+t)/l)*l,k=Math.floor((x-t)/l)*l,T=Math.ceil((x+S+t)/l)*l,R=[E,k,T,!0],I=[P,k,T,!1];this.#n.push(R,I),xe.rectBoundingBox(E,k,P,T,a)}const c=a[2]-a[0]+2*n,d=a[3]-a[1]+2*n,h=a[0]-n,f=a[1]-n,g=this.#n.at(i?-1:-2),m=[g[0],g[2]];for(const y of this.#n){const[x,w,S]=y;y[0]=(x-h)/c,y[1]=(w-f)/d,y[2]=(S-f)/d}this.#e=new Float32Array([h,f,c,d]),this.#t=m}getOutlines(){this.#n.sort((t,n)=>t[0]-n[0]||t[1]-n[1]||t[2]-n[2]);const e=[];for(const t of this.#n)t[3]?(e.push(...this.#d(t)),this.#l(t)):(this.#a(t),e.push(...this.#d(t)));return this.#i(e)}#i(e){const t=[],n=new Set;for(const l of e){const[c,d,h]=l;t.push([c,d,l],[c,h,l])}t.sort((l,c)=>l[1]-c[1]||l[0]-c[0]);for(let l=0,c=t.length;l<c;l+=2){const d=t[l][2],h=t[l+1][2];d.push(h),h.push(d),n.add(d),n.add(h)}const i=[];let a;for(;n.size>0;){const l=n.values().next().value;let[c,d,h,f,g]=l;n.delete(l);let m=c,y=d;for(a=[c,h],i.push(a);;){let x;if(n.has(f))x=f;else if(n.has(g))x=g;else break;n.delete(x),[c,d,h,f,g]=x,m!==c&&(a.push(m,y,c,y===d?d:h),m=c),y=y===d?h:d}a.push(m,y)}return new IR(i,this.#e,this.#t)}#s(e){const t=this.#r;let n=0,i=t.length-1;for(;n<=i;){const a=n+i>>1,l=t[a][0];if(l===e)return a;l<e?n=a+1:i=a-1}return i+1}#l([,e,t]){const n=this.#s(e);this.#r.splice(n,0,[e,t])}#a([,e,t]){const n=this.#s(e);for(let i=n;i<this.#r.length;i++){const[a,l]=this.#r[i];if(a!==e)break;if(a===e&&l===t){this.#r.splice(i,1);return}}for(let i=n-1;i>=0;i--){const[a,l]=this.#r[i];if(a!==e)break;if(a===e&&l===t){this.#r.splice(i,1);return}}}#d(e){const[t,n,i]=e,a=[[t,n,i]],l=this.#s(i);for(let c=0;c<l;c++){const[d,h]=this.#r[c];for(let f=0,g=a.length;f<g;f++){const[,m,y]=a[f];if(!(h<=m||y<=d)){if(m>=d){if(y>h)a[f][1]=h;else{if(g===1)return[];a.splice(f,1),f--,g--}continue}a[f][2]=d,y>h&&a.push([t,h,y])}}}return a}}class IR extends pe{#e;#t;constructor(e,t,n){super(),this.#t=e,this.#e=t,this.lastPoint=n}toSVGPath(){const e=[];for(const t of this.#t){let[n,i]=t;e.push(`M${n} ${i}`);for(let a=2;a<t.length;a+=2){const l=t[a],c=t[a+1];l===n?(e.push(`V${c}`),i=c):c===i&&(e.push(`H${l}`),n=l)}e.push("Z")}return e.join(" ")}serialize([e,t,n,i],a){const l=[],c=n-e,d=i-t;for(const h of this.#t){const f=new Array(h.length);for(let g=0;g<h.length;g+=2)f[g]=e+h[g]*c,f[g+1]=i-h[g+1]*d;l.push(f)}return l}get box(){return this.#e}get classNamesForOutlining(){return["highlightOutline"]}}class dh extends vs{newFreeDrawOutline(e,t,n,i,a,l){return new LR(e,t,n,i,a,l)}}class LR extends V0{newOutliner(e,t,n,i,a,l=0){return new dh(e,t,n,i,a,l)}}class an{#e=null;#t=null;#n;#r=null;#i=!1;#s=!1;#l=null;#a;#d=null;#c=null;#h;static#u=null;static get _keyboardManager(){return Me(this,"_keyboardManager",new Xo([[["Escape","mac+Escape"],an.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],an.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],an.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],an.prototype._moveToPrevious],[["Home","mac+Home"],an.prototype._moveToBeginning],[["End","mac+End"],an.prototype._moveToEnd]]))}constructor({editor:e=null,uiManager:t=null}){e?(this.#s=!1,this.#h=De.HIGHLIGHT_COLOR,this.#l=e):(this.#s=!0,this.#h=De.HIGHLIGHT_DEFAULT_COLOR),this.#c=e?._uiManager||t,this.#a=this.#c._eventBus,this.#n=e?.color||this.#c?.highlightColors.values().next().value||"#FFFF98",an.#u||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){const e=this.#e=document.createElement("button");e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.setAttribute("aria-haspopup",!0);const t=this.#c._signal;e.addEventListener("click",this.#m.bind(this),{signal:t}),e.addEventListener("keydown",this.#p.bind(this),{signal:t});const n=this.#t=document.createElement("span");return n.className="swatch",n.setAttribute("aria-hidden",!0),n.style.backgroundColor=this.#n,e.append(n),e}renderMainDropdown(){const e=this.#r=this.#f();return e.setAttribute("aria-orientation","horizontal"),e.setAttribute("aria-labelledby","highlightColorPickerLabel"),e}#f(){const e=document.createElement("div"),t=this.#c._signal;e.addEventListener("contextmenu",An,{signal:t}),e.className="dropdown",e.role="listbox",e.setAttribute("aria-multiselectable",!1),e.setAttribute("aria-orientation","vertical"),e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[n,i]of this.#c.highlightColors){const a=document.createElement("button");a.tabIndex="0",a.role="option",a.setAttribute("data-color",i),a.title=n,a.setAttribute("data-l10n-id",an.#u[n]);const l=document.createElement("span");a.append(l),l.className="swatch",l.style.backgroundColor=i,a.setAttribute("aria-selected",i===this.#n),a.addEventListener("click",this.#o.bind(this,i),{signal:t}),e.append(a)}return e.addEventListener("keydown",this.#p.bind(this),{signal:t}),e}#o(e,t){t.stopPropagation(),this.#a.dispatch("switchannotationeditorparams",{source:this,type:this.#h,value:e})}_colorSelectFromKeyboard(e){if(e.target===this.#e){this.#m(e);return}const t=e.target.getAttribute("data-color");t&&this.#o(t,e)}_moveToNext(e){if(!this.#v){this.#m(e);return}if(e.target===this.#e){this.#r.firstChild?.focus();return}e.target.nextSibling?.focus()}_moveToPrevious(e){if(e.target===this.#r?.firstChild||e.target===this.#e){this.#v&&this._hideDropdownFromKeyboard();return}this.#v||this.#m(e),e.target.previousSibling?.focus()}_moveToBeginning(e){if(!this.#v){this.#m(e);return}this.#r.firstChild?.focus()}_moveToEnd(e){if(!this.#v){this.#m(e);return}this.#r.lastChild?.focus()}#p(e){an._keyboardManager.exec(this,e)}#m(e){if(this.#v){this.hideDropdown();return}if(this.#i=e.detail===0,this.#d||(this.#d=new AbortController,window.addEventListener("pointerdown",this.#g.bind(this),{signal:this.#c.combinedSignal(this.#d)})),this.#r){this.#r.classList.remove("hidden");return}const t=this.#r=this.#f();this.#e.append(t)}#g(e){this.#r?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#r?.classList.add("hidden"),this.#d?.abort(),this.#d=null}get#v(){return this.#r&&!this.#r.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#s){if(!this.#v){this.#l?.unselect();return}this.hideDropdown(),this.#e.focus({preventScroll:!0,focusVisible:this.#i})}}updateColor(e){if(this.#t&&(this.#t.style.backgroundColor=e),!this.#r)return;const t=this.#c.highlightColors.values();for(const n of this.#r.children)n.setAttribute("aria-selected",t.next().value===e)}destroy(){this.#e?.remove(),this.#e=null,this.#t=null,this.#r?.remove(),this.#r=null}}class ut extends _e{#e=null;#t=0;#n;#r=null;#i=null;#s=null;#l=null;#a=0;#d=null;#c=null;#h=null;#u=!1;#f=null;#o;#p=null;#m="";#g;#v="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=Re.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){const e=ut.prototype;return Me(this,"_keyboardManager",new Xo([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"}),this.color=e.color||ut._defaultColor,this.#g=e.thickness||ut._defaultThickness,this.#o=e.opacity||ut._defaultOpacity,this.#n=e.boxes||null,this.#v=e.methodOfCreation||"",this.#m=e.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1?(this.#u=!0,this.#w(e),this.#T()):this.#n&&(this.#e=e.anchorNode,this.#t=e.anchorOffset,this.#l=e.focusNode,this.#a=e.focusOffset,this.#y(),this.#T(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#u?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#g,methodOfCreation:this.#v}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}#y(){const e=new uh(this.#n,.001);this.#c=e.getOutlines(),[this.x,this.y,this.width,this.height]=this.#c.box;const t=new uh(this.#n,.0025,.001,this._uiManager.direction==="ltr");this.#s=t.getOutlines();const{lastPoint:n}=this.#s;this.#f=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height]}#w({highlightOutlines:e,highlightId:t,clipPathId:n}){this.#c=e;const i=1.5;if(this.#s=e.getNewOutline(this.#g/2+i,.0025),t>=0)this.#h=t,this.#r=n,this.parent.drawLayer.finalizeDraw(t,{bbox:e.box,path:{d:e.toSVGPath()}}),this.#p=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#s.box,path:{d:this.#s.toSVGPath()}},!0);else if(this.parent){const f=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#h,{bbox:ut.#S(this.#c.box,(f-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#p,{bbox:ut.#S(this.#s.box,f),path:{d:this.#s.toSVGPath()}})}const[a,l,c,d]=e.box;switch(this.rotation){case 0:this.x=a,this.y=l,this.width=c,this.height=d;break;case 90:{const[f,g]=this.parentDimensions;this.x=l,this.y=1-a,this.width=c*g/f,this.height=d*f/g;break}case 180:this.x=1-a,this.y=1-l,this.width=c,this.height=d;break;case 270:{const[f,g]=this.parentDimensions;this.x=1-l,this.y=a,this.width=c*g/f,this.height=d*f/g;break}}const{lastPoint:h}=this.#s;this.#f=[(h[0]-a)/c,(h[1]-l)/d]}static initialize(e,t){_e.initialize(e,t),ut._defaultColor||=t.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(e,t){switch(e){case De.HIGHLIGHT_DEFAULT_COLOR:ut._defaultColor=t;break;case De.HIGHLIGHT_THICKNESS:ut._defaultThickness=t;break}}translateInPage(e,t){}get toolbarPosition(){return this.#f}updateParams(e,t){switch(e){case De.HIGHLIGHT_COLOR:this.#x(t);break;case De.HIGHLIGHT_THICKNESS:this.#A(t);break}}static get defaultPropertiesToUpdate(){return[[De.HIGHLIGHT_DEFAULT_COLOR,ut._defaultColor],[De.HIGHLIGHT_THICKNESS,ut._defaultThickness]]}get propertiesToUpdate(){return[[De.HIGHLIGHT_COLOR,this.color||ut._defaultColor],[De.HIGHLIGHT_THICKNESS,this.#g||ut._defaultThickness],[De.HIGHLIGHT_FREE,this.#u]]}#x(e){const t=(a,l)=>{this.color=a,this.#o=l,this.parent?.drawLayer.updateProperties(this.#h,{root:{fill:a,"fill-opacity":l}}),this.#i?.updateColor(a)},n=this.color,i=this.#o;this.addCommands({cmd:t.bind(this,e,ut._defaultOpacity),undo:t.bind(this,n,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:De.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)}#A(e){const t=this.#g,n=i=>{this.#g=i,this.#_(i)};this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:De.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(this.#i=new an({editor:this}),e.addColorPicker(this.#i)),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#N())}getBaseTranslation(){return[0,0]}getRect(e,t){return super.getRect(e,t,this.#N())}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this.#k(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#T(),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?this.#k():e&&(this.#T(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),this.show(this._isVisible),t&&this.select()}#_(e){if(!this.#u)return;this.#w({highlightOutlines:this.#c.getNewOutline(e/2)}),this.fixAndSetPosition();const[t,n]=this.parentDimensions;this.setDims(this.width*t,this.height*n)}#k(){this.#h===null||!this.parent||(this.parent.drawLayer.remove(this.#h),this.#h=null,this.parent.drawLayer.remove(this.#p),this.#p=null)}#T(e=this.parent){this.#h===null&&({id:this.#h,clipPathId:this.#r}=e.drawLayer.draw({bbox:this.#c.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.#o},rootClass:{highlight:!0,free:this.#u},path:{d:this.#c.toSVGPath()}},!1,!0),this.#p=e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#u},bbox:this.#s.box,path:{d:this.#s.toSVGPath()}},this.#u),this.#d&&(this.#d.style.clipPath=this.#r))}static#S([e,t,n,i],a){switch(a){case 90:return[1-t-i,e,i,n];case 180:return[1-e-n,1-t-i,n,i];case 270:return[t,1-e-n,i,n]}return[e,t,n,i]}rotate(e){const{drawLayer:t}=this.parent;let n;this.#u?(e=(e-this.rotation+360)%360,n=ut.#S(this.#c.box,e)):n=ut.#S([this.x,this.y,this.width,this.height],e),t.updateProperties(this.#h,{bbox:n,root:{"data-main-rotation":e}}),t.updateProperties(this.#p,{bbox:ut.#S(this.#s.box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;const e=super.render();this.#m&&(e.setAttribute("aria-label",this.#m),e.setAttribute("role","mark")),this.#u?e.classList.add("free"):this.div.addEventListener("keydown",this.#P.bind(this),{signal:this._uiManager._signal});const t=this.#d=document.createElement("div");e.append(t),t.setAttribute("aria-hidden","true"),t.className="internal",t.style.clipPath=this.#r;const[n,i]=this.parentDimensions;return this.setDims(this.width*n,this.height*i),y0(this,this.#d,["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#p,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#p,{rootClass:{hovered:!1}})}#P(e){ut._keyboardManager.exec(this,e)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#C(!0);break;case 1:case 3:this.#C(!1);break}}#C(e){if(!this.#e)return;const t=window.getSelection();e?t.setPosition(this.#e,this.#t):t.setPosition(this.#l,this.#a)}select(){super.select(),this.#p&&this.parent?.drawLayer.updateProperties(this.#p,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#p&&(this.parent?.drawLayer.updateProperties(this.#p,{rootClass:{selected:!1}}),this.#u||this.#C(!1))}get _mustFixPosition(){return!this.#u}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(this.#h,{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(this.#p,{rootClass:{hidden:!e}}))}#N(){return this.#u?this.rotation:0}#I(){if(this.#u)return null;const[e,t]=this.pageDimensions,[n,i]=this.pageTranslation,a=this.#n,l=new Float32Array(a.length*8);let c=0;for(const{x:d,y:h,width:f,height:g}of a){const m=d*e+n,y=(1-h)*t+i;l[c]=l[c+4]=m,l[c+1]=l[c+3]=y,l[c+2]=l[c+6]=m+f*e,l[c+5]=l[c+7]=y-g*t,c+=8}return l}#L(e){return this.#c.serialize(e,this.#N())}static startHighlighting(e,t,{target:n,x:i,y:a}){const{x:l,y:c,width:d,height:h}=n.getBoundingClientRect(),f=new AbortController,g=e.combinedSignal(f),m=y=>{f.abort(),this.#E(e,y)};window.addEventListener("blur",m,{signal:g}),window.addEventListener("pointerup",m,{signal:g}),window.addEventListener("pointerdown",dt,{capture:!0,passive:!1,signal:g}),window.addEventListener("contextmenu",An,{signal:g}),n.addEventListener("pointermove",this.#$.bind(this,e),{signal:g}),this._freeHighlight=new dh({x:i,y:a},[l,c,d,h],e.scale,this._defaultThickness/2,t,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static#$(e,t){this._freeHighlight.add(t)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#E(e,t){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(e,t,n){let i=null;if(e instanceof B0){const{data:{quadPoints:x,rect:w,rotation:S,id:E,color:P,opacity:k,popupRef:T},parent:{page:{pageNumber:R}}}=e;i=e={annotationType:Re.HIGHLIGHT,color:Array.from(P),opacity:k,quadPoints:x,boxes:null,pageIndex:R-1,rect:w.slice(0),rotation:S,id:E,deleted:!1,popupRef:T}}else if(e instanceof sf){const{data:{inkLists:x,rect:w,rotation:S,id:E,color:P,borderStyle:{rawWidth:k},popupRef:T},parent:{page:{pageNumber:R}}}=e;i=e={annotationType:Re.HIGHLIGHT,color:Array.from(P),thickness:k,inkLists:x,boxes:null,pageIndex:R-1,rect:w.slice(0),rotation:S,id:E,deleted:!1,popupRef:T}}const{color:a,quadPoints:l,inkLists:c,opacity:d}=e,h=await super.deserialize(e,t,n);h.color=xe.makeHexColor(...a),h.#o=d||1,c&&(h.#g=e.thickness),h.annotationElementId=e.id||null,h._initialData=i;const[f,g]=h.pageDimensions,[m,y]=h.pageTranslation;if(l){const x=h.#n=[];for(let w=0;w<l.length;w+=8)x.push({x:(l[w]-m)/f,y:1-(l[w+1]-y)/g,width:(l[w+2]-l[w])/f,height:(l[w+1]-l[w+5])/g});h.#y(),h.#T(),h.rotate(h.rotation)}else if(c){h.#u=!0;const x=c[0],w={x:x[0]-m,y:g-(x[1]-y)},S=new dh(w,[0,0,f,g],1,h.#g/2,!0,.001);for(let k=0,T=x.length;k<T;k+=2)w.x=x[k]-m,w.y=g-(x[k+1]-y),S.add(w);const{id:E,clipPathId:P}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:h.color,"fill-opacity":h._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:S.toSVGPath()}},!0,!0);h.#w({highlightOutlines:S.getOutlines(),highlightId:E,clipPathId:P}),h.#T(),h.rotate(h.parentRotation)}return h}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const t=this.getRect(0,0),n=_e._colorManager.convert(this.color),i={annotationType:Re.HIGHLIGHT,color:n,opacity:this.#o,thickness:this.#g,quadPoints:this.#I(),outlines:this.#L(t),pageIndex:this.pageIndex,rect:t,rotation:this.#N(),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!this.#b(i)?null:(i.id=this.annotationElementId,i)}#b(e){const{color:t}=this._initialData;return e.color.some((n,i)=>n!==t[i])}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}class W0{#e=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,n]of Object.entries(e))t.startsWith("_")||this.updateProperty(t,n)}updateSVGProperty(e,t){this.#e[e]=t}toSVGProperties(){const e=this.#e;return this.#e=Object.create(null),{root:e}}reset(){this.#e=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){We("Not implemented")}}class ke extends _e{#e=null;#t;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#n=null;static#r=null;static#i=null;static#s=NaN;static#l=null;static#a=null;static#d=NaN;static _INNER_MARGIN=3;constructor(e){super(e),this.#t=e.mustBeCommitted||!1,this._addOutlines(e)}_addOutlines(e){e.drawOutlines&&(this.#c(e),this.#f())}#c({drawOutlines:e,drawId:t,drawingOptions:n}){this.#e=e,this._drawingOptions||=n,t>=0?(this._drawId=t,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties)):this._drawId=this.#h(e,this.parent),this.#m(e.box)}#h(e,t){const{id:n}=t.drawLayer.draw(ke._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n}static _mergeSVGProperties(e,t){const n=new Set(Object.keys(e));for(const[i,a]of Object.entries(t))n.has(i)?Object.assign(e[i],a):e[i]=a;return e}static getDefaultDrawingOptions(e){We("Not implemented")}static get typesMap(){We("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,t){const n=this.typesMap.get(e);n&&this._defaultDrawingOptions.updateProperty(n,t),this._currentParent&&(ke.#n.updateProperty(n,t),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){const n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){const e=[],t=this._defaultDrawingOptions;for(const[n,i]of this.typesMap)e.push([n,t[i]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:t}=this;for(const[n,i]of this.constructor.typesMap)e.push([n,t[i]]);return e}_updateProperty(e,t,n){const i=this._drawingOptions,a=i[t],l=c=>{i.updateProperty(t,c);const d=this.#e.updateProperty(t,c);d&&this.#m(d),this.parent?.drawLayer.updateProperties(this._drawId,i.toSVGProperties())};this.addCommands({cmd:l.bind(this,n),undo:l.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,ke._mergeSVGProperties(this.#e.getPathResizingSVGProperties(this.#p()),{bbox:this.#g()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,ke._mergeSVGProperties(this.#e.getPathResizedSVGProperties(this.#p()),{bbox:this.#g()}))}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#g()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,ke._mergeSVGProperties(this.#e.getPathTranslatedSVGProperties(this.#p(),this.parentDimensions),{bbox:this.#g()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#t&&(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this.#u(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#f(),this.#m(this.#e.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),this.#u()):e&&(this._uiManager.addShouldRescale(this),this.#f(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),t&&this.select()}#u(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#f(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=this.#h(this.#e,e)}}#o([e,t,n,i]){const{parentDimensions:[a,l],rotation:c}=this;switch(c){case 90:return[t,1-e,n*(l/a),i*(a/l)];case 180:return[1-e,1-t,n,i];case 270:return[1-t,e,n*(l/a),i*(a/l)];default:return[e,t,n,i]}}#p(){const{x:e,y:t,width:n,height:i,parentDimensions:[a,l],rotation:c}=this;switch(c){case 90:return[1-t,e,n*(a/l),i*(l/a)];case 180:return[1-e,1-t,n,i];case 270:return[t,1-e,n*(a/l),i*(l/a)];default:return[e,t,n,i]}}#m(e){if([this.x,this.y,this.width,this.height]=this.#o(e),this.div){this.fixAndSetPosition();const[t,n]=this.parentDimensions;this.setDims(this.width*t,this.height*n)}this._onResized()}#g(){const{x:e,y:t,width:n,height:i,rotation:a,parentRotation:l,parentDimensions:[c,d]}=this;switch((a*4+l)/90){case 1:return[1-t-i,e,i,n];case 2:return[1-e-n,1-t-i,n,i];case 3:return[t,1-e-n,i,n];case 4:return[e,t-n*(c/d),i*(d/c),n*(c/d)];case 5:return[1-t,e,n*(c/d),i*(d/c)];case 6:return[1-e-i*(d/c),1-t,i*(d/c),n*(c/d)];case 7:return[t-n*(c/d),1-e-i*(d/c),n*(c/d),i*(d/c)];case 8:return[e-n,t-i,n,i];case 9:return[1-t,e-n,i,n];case 10:return[1-e,1-t,n,i];case 11:return[t-i,1-e,i,n];case 12:return[e-i*(d/c),t,i*(d/c),n*(c/d)];case 13:return[1-t-n*(c/d),e-i*(d/c),n*(c/d),i*(d/c)];case 14:return[1-e,1-t-n*(c/d),i*(d/c),n*(c/d)];case 15:return[t,1-e,n*(c/d),i*(d/c)];default:return[e,t,n,i]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,ke._mergeSVGProperties({bbox:this.#g()},this.#e.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#m(this.#e.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;this._isCopy&&(e=this.x,t=this.y);const n=super.render();n.classList.add("draw");const i=document.createElement("div");n.append(i),i.setAttribute("aria-hidden","true"),i.className="internal";const[a,l]=this.parentDimensions;return this.setDims(this.width*a,this.height*l),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,t),n}static createDrawerInstance(e,t,n,i,a){We("Not implemented")}static startDrawing(e,t,n,i){const{target:a,offsetX:l,offsetY:c,pointerId:d,pointerType:h}=i;if(ke.#l&&ke.#l!==h)return;const{viewport:{rotation:f}}=e,{width:g,height:m}=a.getBoundingClientRect(),y=ke.#r=new AbortController,x=e.combinedSignal(y);if(ke.#s||=d,ke.#l??=h,window.addEventListener("pointerup",w=>{ke.#s===w.pointerId?this._endDraw(w):ke.#a?.delete(w.pointerId)},{signal:x}),window.addEventListener("pointercancel",w=>{ke.#s===w.pointerId?this._currentParent.endDrawingSession():ke.#a?.delete(w.pointerId)},{signal:x}),window.addEventListener("pointerdown",w=>{ke.#l===w.pointerType&&((ke.#a||=new Set).add(w.pointerId),ke.#n.isCancellable()&&(ke.#n.removeLastElement(),ke.#n.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:x}),window.addEventListener("contextmenu",An,{signal:x}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:x}),a.addEventListener("touchmove",w=>{w.timeStamp===ke.#d&&dt(w)},{signal:x}),e.toggleDrawing(),t._editorUndoBar?.hide(),ke.#n){e.drawLayer.updateProperties(this._currentDrawId,ke.#n.startNew(l,c,g,m,f));return}t.updateUIForDefaultProperties(this),ke.#n=this.createDrawerInstance(l,c,g,m,f),ke.#i=this.getDefaultDrawingOptions(),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(ke.#i.toSVGProperties(),ke.#n.defaultSVGProperties),!0,!1)}static _drawMove(e){if(ke.#d=-1,!ke.#n)return;const{offsetX:t,offsetY:n,pointerId:i}=e;if(ke.#s===i){if(ke.#a?.size>=1){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,ke.#n.add(t,n)),ke.#d=e.timeStamp,dt(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,ke.#n=null,ke.#i=null,ke.#l=null,ke.#d=NaN),ke.#r&&(ke.#r.abort(),ke.#r=null,ke.#s=NaN,ke.#a=null)}static _endDraw(e){const t=this._currentParent;if(t){if(t.toggleDrawing(!0),this._cleanup(!1),e?.target===t.div&&t.drawLayer.updateProperties(this._currentDrawId,ke.#n.end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){const n=ke.#n,i=this._currentDrawId,a=n.getLastElement();t.addCommands({cmd:()=>{t.drawLayer.updateProperties(i,n.setLastElement(a))},undo:()=>{t.drawLayer.updateProperties(i,n.removeLastElement())},mustExec:!1,type:De.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){const t=this._currentParent;if(!t)return null;if(t.toggleDrawing(!0),t.cleanUndoStack(De.DRAW_STEP),!ke.#n.isEmpty()){const{pageDimensions:[n,i],scale:a}=t,l=t.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:ke.#n.getOutlines(n*a,i*a,a,this._INNER_MARGIN),drawingOptions:ke.#i,mustBeCommitted:!e});return this._cleanup(!0),l}return t.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,i,a,l){We("Not implemented")}static async deserialize(e,t,n){const{rawDims:{pageWidth:i,pageHeight:a,pageX:l,pageY:c}}=t.viewport,d=this.deserializeDraw(l,c,i,a,this._INNER_MARGIN,e),h=await super.deserialize(e,t,n);return h.createDrawingOptions(e),h.#c({drawOutlines:d}),h.#f(),h.onScaleChanging(),h.rotate(),h}serializeDraw(e){const[t,n]=this.pageTranslation,[i,a]=this.pageDimensions;return this.#e.serialize([t,n,i,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}class MR{#e=new Float64Array(6);#t;#n;#r;#i;#s;#l="";#a=0;#d=new Jo;#c;#h;constructor(e,t,n,i,a,l){this.#c=n,this.#h=i,this.#r=a,this.#i=l,[e,t]=this.#u(e,t);const c=this.#t=[NaN,NaN,NaN,NaN,e,t];this.#s=[e,t],this.#n=[{line:c,points:this.#s}],this.#e.set(c,0)}updateProperty(e,t){e==="stroke-width"&&(this.#i=t)}#u(e,t){return pe._normalizePoint(e,t,this.#c,this.#h,this.#r)}isEmpty(){return!this.#n||this.#n.length===0}isCancellable(){return this.#s.length<=10}add(e,t){[e,t]=this.#u(e,t);const[n,i,a,l]=this.#e.subarray(2,6),c=e-a,d=t-l;return Math.hypot(this.#c*c,this.#h*d)<=2?null:(this.#s.push(e,t),isNaN(n)?(this.#e.set([a,l,e,t],2),this.#t.push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(this.#e[0])&&this.#t.splice(6,6),this.#e.set([n,i,a,l,e,t],0),this.#t.push(...pe.createBezierPoints(n,i,a,l,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){const n=this.add(e,t);return n||(this.#s.length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,n,i,a){this.#c=n,this.#h=i,this.#r=a,[e,t]=this.#u(e,t);const l=this.#t=[NaN,NaN,NaN,NaN,e,t];this.#s=[e,t];const c=this.#n.at(-1);return c&&(c.line=new Float32Array(c.line),c.points=new Float32Array(c.points)),this.#n.push({line:l,points:this.#s}),this.#e.set(l,0),this.#a=0,this.toSVGPath(),null}getLastElement(){return this.#n.at(-1)}setLastElement(e){return this.#n?(this.#n.push(e),this.#t=e.line,this.#s=e.points,this.#a=0,{path:{d:this.toSVGPath()}}):this.#d.setLastElement(e)}removeLastElement(){if(!this.#n)return this.#d.removeLastElement();this.#n.pop(),this.#l="";for(let e=0,t=this.#n.length;e<t;e++){const{line:n,points:i}=this.#n[e];this.#t=n,this.#s=i,this.#a=0,this.toSVGPath()}return{path:{d:this.#l}}}toSVGPath(){const e=pe.svgRound(this.#t[4]),t=pe.svgRound(this.#t[5]);if(this.#s.length===2)return this.#l=`${this.#l} M ${e} ${t} Z`,this.#l;if(this.#s.length<=6){const i=this.#l.lastIndexOf("M");this.#l=`${this.#l.slice(0,i)} M ${e} ${t}`,this.#a=6}if(this.#s.length===4){const i=pe.svgRound(this.#t[10]),a=pe.svgRound(this.#t[11]);return this.#l=`${this.#l} L ${i} ${a}`,this.#a=12,this.#l}const n=[];this.#a===0&&(n.push(`M ${e} ${t}`),this.#a=6);for(let i=this.#a,a=this.#t.length;i<a;i+=6){const[l,c,d,h,f,g]=this.#t.slice(i,i+6).map(pe.svgRound);n.push(`C${l} ${c} ${d} ${h} ${f} ${g}`)}return this.#l+=n.join(" "),this.#a=this.#t.length,this.#l}getOutlines(e,t,n,i){const a=this.#n.at(-1);return a.line=new Float32Array(a.line),a.points=new Float32Array(a.points),this.#d.build(this.#n,e,t,n,this.#r,this.#i,i),this.#e=null,this.#t=null,this.#n=null,this.#l=null,this.#d}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}class Jo extends pe{#e;#t=0;#n;#r;#i;#s;#l;#a;#d;build(e,t,n,i,a,l,c){this.#i=t,this.#s=n,this.#l=i,this.#a=a,this.#d=l,this.#n=c??0,this.#r=e,this.#u()}get thickness(){return this.#d}setLastElement(e){return this.#r.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#r.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:t}of this.#r){if(e.push(`M${pe.svgRound(t[4])} ${pe.svgRound(t[5])}`),t.length===6){e.push("Z");continue}if(t.length===12&&isNaN(t[6])){e.push(`L${pe.svgRound(t[10])} ${pe.svgRound(t[11])}`);continue}for(let n=6,i=t.length;n<i;n+=6){const[a,l,c,d,h,f]=t.subarray(n,n+6).map(pe.svgRound);e.push(`C${a} ${l} ${c} ${d} ${h} ${f}`)}}return e.join("")}serialize([e,t,n,i],a){const l=[],c=[],[d,h,f,g]=this.#h();let m,y,x,w,S,E,P,k,T;switch(this.#a){case 0:T=pe._rescale,m=e,y=t+i,x=n,w=-i,S=e+d*n,E=t+(1-h-g)*i,P=e+(d+f)*n,k=t+(1-h)*i;break;case 90:T=pe._rescaleAndSwap,m=e,y=t,x=n,w=i,S=e+h*n,E=t+d*i,P=e+(h+g)*n,k=t+(d+f)*i;break;case 180:T=pe._rescale,m=e+n,y=t,x=-n,w=i,S=e+(1-d-f)*n,E=t+h*i,P=e+(1-d)*n,k=t+(h+g)*i;break;case 270:T=pe._rescaleAndSwap,m=e+n,y=t+i,x=-n,w=-i,S=e+(1-h-g)*n,E=t+(1-d-f)*i,P=e+(1-h)*n,k=t+(1-d)*i;break}for(const{line:R,points:I}of this.#r)l.push(T(R,m,y,x,w,a?new Array(R.length):null)),c.push(T(I,m,y,x,w,a?new Array(I.length):null));return{lines:l,points:c,rect:[S,E,P,k]}}static deserialize(e,t,n,i,a,{paths:{lines:l,points:c},rotation:d,thickness:h}){const f=[];let g,m,y,x,w;switch(d){case 0:w=pe._rescale,g=-e/n,m=t/i+1,y=1/n,x=-1/i;break;case 90:w=pe._rescaleAndSwap,g=-t/i,m=-e/n,y=1/i,x=1/n;break;case 180:w=pe._rescale,g=e/n+1,m=-t/i,y=-1/n,x=1/i;break;case 270:w=pe._rescaleAndSwap,g=t/i+1,m=e/n+1,y=-1/i,x=-1/n;break}if(!l){l=[];for(const E of c){const P=E.length;if(P===2){l.push(new Float32Array([NaN,NaN,NaN,NaN,E[0],E[1]]));continue}if(P===4){l.push(new Float32Array([NaN,NaN,NaN,NaN,E[0],E[1],NaN,NaN,NaN,NaN,E[2],E[3]]));continue}const k=new Float32Array(3*(P-2));l.push(k);let[T,R,I,N]=E.subarray(0,4);k.set([NaN,NaN,NaN,NaN,T,R],0);for(let D=4;D<P;D+=2){const V=E[D],j=E[D+1];k.set(pe.createBezierPoints(T,R,I,N,V,j),(D-2)*3),[T,R,I,N]=[I,N,V,j]}}}for(let E=0,P=l.length;E<P;E++)f.push({line:w(l[E].map(k=>k??NaN),g,m,y,x),points:w(c[E].map(k=>k??NaN),g,m,y,x)});const S=new this.prototype.constructor;return S.build(f,n,i,1,d,h,a),S}#c(e=this.#d){const t=this.#n+e/2*this.#l;return this.#a%180===0?[t/this.#i,t/this.#s]:[t/this.#s,t/this.#i]}#h(){const[e,t,n,i]=this.#e,[a,l]=this.#c(0);return[e+a,t+l,n-2*a,i-2*l]}#u(){const e=this.#e=new Float32Array([1/0,1/0,-1/0,-1/0]);for(const{line:i}of this.#r){if(i.length<=12){for(let c=4,d=i.length;c<d;c+=6)xe.pointBoundingBox(i[c],i[c+1],e);continue}let a=i[4],l=i[5];for(let c=6,d=i.length;c<d;c+=6){const[h,f,g,m,y,x]=i.subarray(c,c+6);xe.bezierBoundingBox(a,l,h,f,g,m,y,x,e),a=y,l=x}}const[t,n]=this.#c();e[0]=jt(e[0]-t,0,1),e[1]=jt(e[1]-n,0,1),e[2]=jt(e[2]+t,0,1),e[3]=jt(e[3]+n,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,t){return e==="stroke-width"?this.#f(t):null}#f(e){const[t,n]=this.#c();this.#d=e;const[i,a]=this.#c(),[l,c]=[i-t,a-n],d=this.#e;return d[0]-=l,d[1]-=c,d[2]+=2*l,d[3]+=2*c,d}updateParentDimensions([e,t],n){const[i,a]=this.#c();this.#i=e,this.#s=t,this.#l=n;const[l,c]=this.#c(),d=l-i,h=c-a,f=this.#e;return f[0]-=d,f[1]-=h,f[2]+=2*d,f[3]+=2*h,f}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map(pe.svgRound).join(" ")}get defaultProperties(){const[e,t]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${pe.svgRound(e)} ${pe.svgRound(t)}`}}}get rotationTransform(){const[,,e,t]=this.#e;let n=0,i=0,a=0,l=0,c=0,d=0;switch(this.#t){case 90:i=t/e,a=-e/t,c=e;break;case 180:n=-1,l=-1,c=e,d=t;break;case 270:i=-t/e,a=e/t,d=t;break;default:return""}return`matrix(${n} ${i} ${a} ${l} ${pe.svgRound(c)} ${pe.svgRound(d)})`}getPathResizingSVGProperties([e,t,n,i]){const[a,l]=this.#c(),[c,d,h,f]=this.#e;if(Math.abs(h-a)<=pe.PRECISION||Math.abs(f-l)<=pe.PRECISION){const w=e+n/2-(c+h/2),S=t+i/2-(d+f/2);return{path:{"transform-origin":`${pe.svgRound(e)} ${pe.svgRound(t)}`,transform:`${this.rotationTransform} translate(${w} ${S})`}}}const g=(n-2*a)/(h-2*a),m=(i-2*l)/(f-2*l),y=h/n,x=f/i;return{path:{"transform-origin":`${pe.svgRound(c)} ${pe.svgRound(d)}`,transform:`${this.rotationTransform} scale(${y} ${x}) translate(${pe.svgRound(a)} ${pe.svgRound(l)}) scale(${g} ${m}) translate(${pe.svgRound(-a)} ${pe.svgRound(-l)})`}}}getPathResizedSVGProperties([e,t,n,i]){const[a,l]=this.#c(),c=this.#e,[d,h,f,g]=c;if(c[0]=e,c[1]=t,c[2]=n,c[3]=i,Math.abs(f-a)<=pe.PRECISION||Math.abs(g-l)<=pe.PRECISION){const S=e+n/2-(d+f/2),E=t+i/2-(h+g/2);for(const{line:P,points:k}of this.#r)pe._translate(P,S,E,P),pe._translate(k,S,E,k);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${pe.svgRound(e)} ${pe.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const m=(n-2*a)/(f-2*a),y=(i-2*l)/(g-2*l),x=-m*(d+a)+e+a,w=-y*(h+l)+t+l;if(m!==1||y!==1||x!==0||w!==0)for(const{line:S,points:E}of this.#r)pe._rescale(S,x,w,m,y,S),pe._rescale(E,x,w,m,y,E);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${pe.svgRound(e)} ${pe.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){const[i,a]=n,l=this.#e,c=e-l[0],d=t-l[1];if(this.#i===i&&this.#s===a)for(const{line:h,points:f}of this.#r)pe._translate(h,c,d,h),pe._translate(f,c,d,f);else{const h=this.#i/i,f=this.#s/a;this.#i=i,this.#s=a;for(const{line:g,points:m}of this.#r)pe._rescale(g,c,d,h,f,g),pe._rescale(m,c,d,h,f,m);l[2]*=h,l[3]*=f}return l[0]=e,l[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${pe.svgRound(e)} ${pe.svgRound(t)}`}}}get defaultSVGProperties(){const e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${pe.svgRound(e[0])} ${pe.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}class gc extends W0{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:_e._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){e==="stroke-width"&&(t??=this["stroke-width"],t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){const e=new gc(this._viewParameters);return e.updateAll(this),e}}class af extends ke{static _type="ink";static _editorType=Re.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:"inkEditor"}),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,t){_e.initialize(e,t),this._defaultDrawingOptions=new gc(t.viewParameters)}static getDefaultDrawingOptions(e){const t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return Me(this,"typesMap",new Map([[De.INK_THICKNESS,"stroke-width"],[De.INK_COLOR,"stroke"],[De.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,t,n,i,a){return new MR(e,t,n,i,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,t,n,i,a,l){return Jo.deserialize(e,t,n,i,a,l)}static async deserialize(e,t,n){let i=null;if(e instanceof sf){const{data:{inkLists:l,rect:c,rotation:d,id:h,color:f,opacity:g,borderStyle:{rawWidth:m},popupRef:y},parent:{page:{pageNumber:x}}}=e;i=e={annotationType:Re.INK,color:Array.from(f),thickness:m,opacity:g,paths:{points:l},boxes:null,pageIndex:x-1,rect:c.slice(0),rotation:d,id:h,deleted:!1,popupRef:y}}const a=await super.deserialize(e,t,n);return a.annotationElementId=e.id||null,a._initialData=i,a}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:t,parent:n}=this;t.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:t,opacity:n}){this._drawingOptions=af.getDefaultDrawingOptions({stroke:xe.makeHexColor(...e),"stroke-width":t,"stroke-opacity":n})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:t,points:n,rect:i}=this.serializeDraw(e),{_drawingOptions:{stroke:a,"stroke-opacity":l,"stroke-width":c}}=this,d={annotationType:Re.INK,color:_e._colorManager.convert(a),opacity:l,thickness:c,paths:{lines:t,points:n},pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?(d.isCopy=!0,d):this.annotationElementId&&!this.#e(d)?null:(d.id=this.annotationElementId,d)}#e(e){const{color:t,thickness:n,opacity:i,pageIndex:a}=this._initialData;return this._hasBeenMoved||this._hasBeenResized||e.color.some((l,c)=>l!==t[c])||e.thickness!==n||e.opacity!==i||e.pageIndex!==a}renderAnnotationElement(e){const{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:t}),null}}class hh extends Jo{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}const Cl=8,So=3;class ms{static#e={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#t(e,t,n,i){return n-=e,i-=t,n===0?i>0?0:4:n===1?i+6:2-i}static#n=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#r(e,t,n,i,a,l,c){const d=this.#t(n,i,a,l);for(let h=0;h<8;h++){const f=(-h+d-c+16)%8,g=this.#n[2*f],m=this.#n[2*f+1];if(e[(n+g)*t+(i+m)]!==0)return f}return-1}static#i(e,t,n,i,a,l,c){const d=this.#t(n,i,a,l);for(let h=0;h<8;h++){const f=(h+d+c+16)%8,g=this.#n[2*f],m=this.#n[2*f+1];if(e[(n+g)*t+(i+m)]!==0)return f}return-1}static#s(e,t,n,i){const a=e.length,l=new Int32Array(a);for(let f=0;f<a;f++)l[f]=e[f]<=i?1:0;for(let f=1;f<n-1;f++)l[f*t]=l[f*t+t-1]=0;for(let f=0;f<t;f++)l[f]=l[t*n-1-f]=0;let c=1,d;const h=[];for(let f=1;f<n-1;f++){d=1;for(let g=1;g<t-1;g++){const m=f*t+g,y=l[m];if(y===0)continue;let x=f,w=g;if(y===1&&l[m-1]===0)c+=1,w-=1;else if(y>=1&&l[m+1]===0)c+=1,w+=1,y>1&&(d=y);else{y!==1&&(d=Math.abs(y));continue}const S=[g,f],E=w===g+1,P={isHole:E,points:S,id:c,parent:0};h.push(P);let k;for(const G of h)if(G.id===d){k=G;break}k?k.isHole?P.parent=E?k.parent:d:P.parent=E?d:k.parent:P.parent=E?d:0;const T=this.#r(l,t,f,g,x,w,0);if(T===-1){l[m]=-c,l[m]!==1&&(d=Math.abs(l[m]));continue}let R=this.#n[2*T],I=this.#n[2*T+1];const N=f+R,D=g+I;x=N,w=D;let V=f,j=g;for(;;){const G=this.#i(l,t,V,j,x,w,1);R=this.#n[2*G],I=this.#n[2*G+1];const Z=V+R,K=j+I;S.push(K,Z);const J=V*t+j;if(l[J+1]===0?l[J]=-c:l[J]===1&&(l[J]=c),Z===f&&K===g&&V===N&&j===D){l[m]!==1&&(d=Math.abs(l[m]));break}else x=V,w=j,V=Z,j=K}}}return h}static#l(e,t,n,i){if(n-t<=4){for(let N=t;N<n-2;N+=2)i.push(e[N],e[N+1]);return}const a=e[t],l=e[t+1],c=e[n-4]-a,d=e[n-3]-l,h=Math.hypot(c,d),f=c/h,g=d/h,m=f*l-g*a,y=d/c,x=1/h,w=Math.atan(y),S=Math.cos(w),E=Math.sin(w),P=x*(Math.abs(S)+Math.abs(E)),k=x*(1-P+P**2),T=Math.max(Math.atan(Math.abs(E+S)*k),Math.atan(Math.abs(E-S)*k));let R=0,I=t;for(let N=t+2;N<n-2;N+=2){const D=Math.abs(m-f*e[N+1]+g*e[N]);D>R&&(I=N,R=D)}R>(h*T)**2?(this.#l(e,t,I+2,i),this.#l(e,I,n,i)):i.push(a,l)}static#a(e){const t=[],n=e.length;return this.#l(e,0,n,t),t.push(e[n-2],e[n-1]),t.length<=4?null:t}static#d(e,t,n,i,a,l){const c=new Float32Array(l**2),d=-2*i**2,h=l>>1;for(let w=0;w<l;w++){const S=(w-h)**2;for(let E=0;E<l;E++)c[w*l+E]=Math.exp((S+(E-h)**2)/d)}const f=new Float32Array(256),g=-2*a**2;for(let w=0;w<256;w++)f[w]=Math.exp(w**2/g);const m=e.length,y=new Uint8Array(m),x=new Uint32Array(256);for(let w=0;w<n;w++)for(let S=0;S<t;S++){const E=w*t+S,P=e[E];let k=0,T=0;for(let I=0;I<l;I++){const N=w+I-h;if(!(N<0||N>=n))for(let D=0;D<l;D++){const V=S+D-h;if(V<0||V>=t)continue;const j=e[N*t+V],G=c[I*l+D]*f[Math.abs(j-P)];k+=j*G,T+=G}}const R=y[E]=Math.round(k/T);x[R]++}return[y,x]}static#c(e){const t=new Uint32Array(256);for(const n of e)t[n]++;return t}static#h(e){const t=e.length,n=new Uint8ClampedArray(t>>2);let i=-1/0,a=1/0;for(let c=0,d=n.length;c<d;c++){if(e[(c<<2)+3]===0){i=n[c]=255;continue}const f=n[c]=e[c<<2];f>i&&(i=f),f<a&&(a=f)}const l=255/(i-a);for(let c=0;c<t;c++)n[c]=(n[c]-a)*l;return n}static#u(e){let t,n=-1/0,i=-1/0;const a=e.findIndex(d=>d!==0);let l=a,c=a;for(t=a;t<256;t++){const d=e[t];d>n&&(t-l>i&&(i=t-l,c=t-1),n=d,l=t)}for(t=c-1;t>=0&&!(e[t]>e[t+1]);t--);return t}static#f(e){const t=e,{width:n,height:i}=e,{maxDim:a}=this.#e;let l=n,c=i;if(n>a||i>a){let m=n,y=i,x=Math.log2(Math.max(n,i)/a);const w=Math.floor(x);x=x===w?w-1:w;for(let E=0;E<x;E++){l=Math.ceil(m/2),c=Math.ceil(y/2);const P=new OffscreenCanvas(l,c);P.getContext("2d").drawImage(e,0,0,m,y,0,0,l,c),m=l,y=c,e!==t&&e.close(),e=P.transferToImageBitmap()}const S=Math.min(a/l,a/c);l=Math.round(l*S),c=Math.round(c*S)}const h=new OffscreenCanvas(l,c).getContext("2d",{willReadFrequently:!0});h.filter="grayscale(1)",h.drawImage(e,0,0,e.width,e.height,0,0,l,c);const f=h.getImageData(0,0,l,c).data;return[this.#h(f),l,c]}static extractContoursFromText(e,{fontFamily:t,fontStyle:n,fontWeight:i},a,l,c,d){let h=new OffscreenCanvas(1,1),f=h.getContext("2d",{alpha:!1});const g=200,m=f.font=`${n} ${i} ${g}px ${t}`,{actualBoundingBoxLeft:y,actualBoundingBoxRight:x,actualBoundingBoxAscent:w,actualBoundingBoxDescent:S,fontBoundingBoxAscent:E,fontBoundingBoxDescent:P,width:k}=f.measureText(e),T=1.5,R=Math.ceil(Math.max(Math.abs(y)+Math.abs(x)||0,k)*T),I=Math.ceil(Math.max(Math.abs(w)+Math.abs(S)||g,Math.abs(E)+Math.abs(P)||g)*T);h=new OffscreenCanvas(R,I),f=h.getContext("2d",{alpha:!0,willReadFrequently:!0}),f.font=m,f.filter="grayscale(1)",f.fillStyle="white",f.fillRect(0,0,R,I),f.fillStyle="black",f.fillText(e,R*(T-1)/2,I*(3-T)/2);const N=this.#h(f.getImageData(0,0,R,I).data),D=this.#c(N),V=this.#u(D),j=this.#s(N,R,I,V);return this.processDrawnLines({lines:{curves:j,width:R,height:I},pageWidth:a,pageHeight:l,rotation:c,innerMargin:d,mustSmooth:!0,areContours:!0})}static process(e,t,n,i,a){const[l,c,d]=this.#f(e),[h,f]=this.#d(l,c,d,Math.hypot(c,d)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),g=this.#u(f),m=this.#s(h,c,d,g);return this.processDrawnLines({lines:{curves:m,width:c,height:d},pageWidth:t,pageHeight:n,rotation:i,innerMargin:a,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:i,innerMargin:a,mustSmooth:l,areContours:c}){i%180!==0&&([t,n]=[n,t]);const{curves:d,width:h,height:f}=e,g=e.thickness??0,m=[],y=Math.min(t/h,n/f),x=y/t,w=y/n,S=[];for(const{points:P}of d){const k=l?this.#a(P):P;if(!k)continue;S.push(k);const T=k.length,R=new Float32Array(T),I=new Float32Array(3*(T===2?2:T-2));if(m.push({line:I,points:R}),T===2){R[0]=k[0]*x,R[1]=k[1]*w,I.set([NaN,NaN,NaN,NaN,R[0],R[1]],0);continue}let[N,D,V,j]=k;N*=x,D*=w,V*=x,j*=w,R.set([N,D,V,j],0),I.set([NaN,NaN,NaN,NaN,N,D],0);for(let G=4;G<T;G+=2){const Z=R[G]=k[G]*x,K=R[G+1]=k[G+1]*w;I.set(pe.createBezierPoints(N,D,V,j,Z,K),(G-2)*3),[N,D,V,j]=[V,j,Z,K]}}if(m.length===0)return null;const E=c?new hh:new Jo;return E.build(m,t,n,1,i,c?0:g,a),{outline:E,newCurves:S,areContours:c,thickness:g,width:h,height:f}}static async compressSignature({outlines:e,areContours:t,thickness:n,width:i,height:a}){let l=1/0,c=-1/0,d=0;for(const k of e){d+=k.length;for(let T=2,R=k.length;T<R;T++){const I=k[T]-k[T-2];l=Math.min(l,I),c=Math.max(c,I)}}let h;l>=-128&&c<=127?h=Int8Array:l>=-32768&&c<=32767?h=Int16Array:h=Int32Array;const f=e.length,g=Cl+So*f,m=new Uint32Array(g);let y=0;m[y++]=g*Uint32Array.BYTES_PER_ELEMENT+(d-2*f)*h.BYTES_PER_ELEMENT,m[y++]=0,m[y++]=i,m[y++]=a,m[y++]=t?0:1,m[y++]=Math.max(0,Math.floor(n??0)),m[y++]=f,m[y++]=h.BYTES_PER_ELEMENT;for(const k of e)m[y++]=k.length-2,m[y++]=k[0],m[y++]=k[1];const x=new CompressionStream("deflate-raw"),w=x.writable.getWriter();await w.ready,w.write(m);const S=h.prototype.constructor;for(const k of e){const T=new S(k.length-2);for(let R=2,I=k.length;R<I;R++)T[R-2]=k[R]-k[R-2];w.write(T)}w.close();const E=await new Response(x.readable).arrayBuffer(),P=new Uint8Array(E);return p0(P)}static async decompressSignature(e){try{const t=uT(e),{readable:n,writable:i}=new DecompressionStream("deflate-raw"),a=i.getWriter();await a.ready,a.write(t).then(async()=>{await a.ready,await a.close()}).catch(()=>{});let l=null,c=0;for await(const k of n)l||=new Uint8Array(new Uint32Array(k.buffer,0,4)[0]),l.set(k,c),c+=k.length;const d=new Uint32Array(l.buffer,0,l.length>>2),h=d[1];if(h!==0)throw new Error(`Invalid version: ${h}`);const f=d[2],g=d[3],m=d[4]===0,y=d[5],x=d[6],w=d[7],S=[],E=(Cl+So*x)*Uint32Array.BYTES_PER_ELEMENT;let P;switch(w){case Int8Array.BYTES_PER_ELEMENT:P=new Int8Array(l.buffer,E);break;case Int16Array.BYTES_PER_ELEMENT:P=new Int16Array(l.buffer,E);break;case Int32Array.BYTES_PER_ELEMENT:P=new Int32Array(l.buffer,E);break}c=0;for(let k=0;k<x;k++){const T=d[So*k+Cl],R=new Float32Array(T+2);S.push(R);for(let I=0;I<So-1;I++)R[I]=d[So*k+Cl+I+1];for(let I=0;I<T;I++)R[I+2]=R[I]+P[c++]}return{areContours:m,thickness:y,outlines:S,width:f,height:g}}catch(t){return Ne(`decompressSignature: ${t}`),null}}}class lf extends W0{constructor(){super(),super.updateProperties({fill:_e._defaultLineColor,"stroke-width":0})}clone(){const e=new lf;return e.updateAll(this),e}}class cf extends gc{constructor(e){super(e),super.updateProperties({stroke:_e._defaultLineColor,"stroke-width":1})}clone(){const e=new cf(this._viewParameters);return e.updateAll(this),e}}class Gn extends ke{#e=!1;#t=null;#n=null;#r=null;static _type="signature";static _editorType=Re.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"}),this._willKeepAspectRatio=!0,this.#n=e.signatureData||null,this.#t=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,t){_e.initialize(e,t),this._defaultDrawingOptions=new lf,this._defaultDrawnSignatureOptions=new cf(t.viewParameters)}static getDefaultDrawingOptions(e){const t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return Me(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#t}}static computeTelemetryFinalData(e){const t=e.get("hasDescription");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,t;const{_isCopy:n}=this;if(n&&(this._isCopy=!1,e=this.x,t=this.y),super.render(),this._drawId===null)if(this.#n){const{lines:i,mustSmooth:a,areContours:l,description:c,uuid:d,heightInPage:h}=this.#n,{rawDims:{pageWidth:f,pageHeight:g},rotation:m}=this.parent.viewport,y=ms.processDrawnLines({lines:i,pageWidth:f,pageHeight:g,rotation:m,innerMargin:Gn._INNER_MARGIN,mustSmooth:a,areContours:l});this.addSignature(y,h,c,d)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);return n&&(this._isCopy=!0,this._moveAfterPaste(e,t)),this.div}setUuid(e){this.#r=e,this.addEditToolbar()}getUuid(){return this.#r}get description(){return this.#t}set description(e){this.#t=e,super.addEditToolbar().then(t=>{t?.updateEditSignatureButton(e)})}getSignaturePreview(){const{newCurves:e,areContours:t,thickness:n,width:i,height:a}=this.#n,l=Math.max(i,a),c=ms.processDrawnLines({lines:{curves:e.map(d=>({points:d})),thickness:n,width:i,height:a},pageWidth:l,pageHeight:l,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t});return{areContours:t,outline:c.outline}}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.signatureManager&&this.#t!==null&&(await e.addEditSignatureButton(this._uiManager.signatureManager,this.#r,this.#t),e.show()),e):null}addSignature(e,t,n,i){const{x:a,y:l}=this,{outline:c}=this.#n=e;this.#e=c instanceof hh,this.#t=n,this.div.setAttribute("data-l10n-args",JSON.stringify({description:n}));let d;this.#e?d=Gn.getDefaultDrawingOptions():(d=Gn._defaultDrawnSignatureOptions.clone(),d.updateProperties({"stroke-width":c.thickness})),this._addOutlines({drawOutlines:c,drawingOptions:d});const[h,f]=this.parentDimensions,[,g]=this.pageDimensions;let m=t/g;m=m>=1?.5:m,this.width*=m/this.height,this.width>=1&&(m*=.9/this.width,this.width=.9),this.height=m,this.setDims(h*this.width,f*this.height),this.x=a,this.y=l,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!i,hasDescription:!!n}}),this.div.hidden=!1}getFromImage(e){const{rawDims:{pageWidth:t,pageHeight:n},rotation:i}=this.parent.viewport;return ms.process(e,t,n,i,Gn._INNER_MARGIN)}getFromText(e,t){const{rawDims:{pageWidth:n,pageHeight:i},rotation:a}=this.parent.viewport;return ms.extractContoursFromText(e,t,n,i,a,Gn._INNER_MARGIN)}getDrawnSignature(e){const{rawDims:{pageWidth:t,pageHeight:n},rotation:i}=this.parent.viewport;return ms.processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:i,innerMargin:Gn._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:t}){e?this._drawingOptions=Gn.getDefaultDrawingOptions():(this._drawingOptions=Gn._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":t}))}serialize(e=!1){if(this.isEmpty())return null;const{lines:t,points:n,rect:i}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":a}}=this,l={annotationType:Re.SIGNATURE,isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:a,pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?(l.paths={lines:t,points:n},l.uuid=this.#r,l.isCopy=!0):l.lines=t,this.#t&&(l.accessibilityData={type:"Figure",alt:this.#t}),l}static deserializeDraw(e,t,n,i,a,l){return l.areContours?hh.deserialize(e,t,n,i,a,l):Jo.deserialize(e,t,n,i,a,l)}static async deserialize(e,t,n){const i=await super.deserialize(e,t,n);return i.#e=e.areContours,i.#t=e.accessibilityData?.alt||"",i.#r=e.uuid,i}}class DR extends _e{#e=null;#t=null;#n=null;#r=null;#i=null;#s="";#l=null;#a=!1;#d=null;#c=!1;#h=!1;static _type="stamp";static _editorType=Re.STAMP;constructor(e){super({...e,name:"stampEditor"}),this.#r=e.bitmapUrl,this.#i=e.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,t){_e.initialize(e,t)}static isHandlingMimeForPasting(e){return Ul.includes(e)}static paste(e,t){t.pasteEditor({mode:Re.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){const t=e.get("hasAltText");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#u(e,t=!1){if(!e){this.remove();return}this.#e=e.bitmap,t||(this.#t=e.id,this.#c=e.isSvg),e.file&&(this.#s=e.file.name),this.#p()}#f(){if(this.#n=null,this._uiManager.enableWaiting(!1),!!this.#l){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._editToolbar.hide(),this._uiManager.editAltText(this,!0);return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;const{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:i,width:a,height:l}=e||this.copyCanvas(null,null,!0).imageData,c=await n.guess({name:"altText",request:{data:i,width:a,height:l,channels:i.length/(a*l)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const d=c.output;return await this.setGuessedAltText(d),t&&!this.hasAltTextData()&&(this.altTextData={alt:d,decorative:!1}),d}#o(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(n=>this.#u(n,!0)).finally(()=>this.#f());return}if(this.#r){const n=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(n).then(i=>this.#u(i)).finally(()=>this.#f());return}if(this.#i){const n=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(n).then(i=>this.#u(i)).finally(()=>this.#f());return}const e=document.createElement("input");e.type="file",e.accept=Ul.join(",");const t=this._uiManager._signal;this.#n=new Promise(n=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#u(i)}n()},{signal:t}),e.addEventListener("cancel",()=>{this.remove(),n()},{signal:t})}).finally(()=>this.#f()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#l?.remove(),this.#l=null,this.#d&&(clearTimeout(this.#d),this.#d=null)),super.remove()}rebuild(){if(!this.parent){this.#t&&this.#o();return}super.rebuild(),this.div!==null&&(this.#t&&this.#l===null&&this.#o(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#r||this.#i||this.#t||this.#a)}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;return this._isCopy&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),this.#a||(this.#e?this.#p():this.#o()),this._isCopy&&this._moveAfterPaste(e,t),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){const{id:n,bitmap:i}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#t=n,i&&(this.#e=i),this.#a=!1,this.#p())}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;this.#d!==null&&clearTimeout(this.#d);const e=200;this.#d=setTimeout(()=>{this.#d=null,this.#g()},e)}#p(){const{div:e}=this;let{width:t,height:n}=this.#e;const[i,a]=this.pageDimensions,l=.75;if(this.width)t=this.width*i,n=this.height*a;else if(t>l*i||n>l*a){const f=Math.min(l*i/t,l*a/n);t*=f,n*=f}const[c,d]=this.parentDimensions;this.setDims(t*c/i,n*d/a),this._uiManager.enableWaiting(!1);const h=this.#l=document.createElement("canvas");h.setAttribute("role","img"),this.addContainer(h),this.width=t/i,this.height=n/a,this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),this.#g(),this.#h||(this.parent.addUndoableEditor(this),this.#h=!0),this._reportTelemetry({action:"inserted_image"}),this.#s&&this.div.setAttribute("aria-description",this.#s)}copyCanvas(e,t,n=!1){e||(e=224);const{width:i,height:a}=this.#e,l=new Dn;let c=this.#e,d=i,h=a,f=null;if(t){if(i>t||a>t){const I=Math.min(t/i,t/a);d=Math.floor(i*I),h=Math.floor(a*I)}f=document.createElement("canvas");const m=f.width=Math.ceil(d*l.sx),y=f.height=Math.ceil(h*l.sy);this.#c||(c=this.#m(m,y));const x=f.getContext("2d");x.filter=this._uiManager.hcmFilter;let w="white",S="#cfcfd8";this._uiManager.hcmFilter!=="none"?S="black":window.matchMedia?.("(prefers-color-scheme: dark)").matches&&(w="#8f8f9d",S="#42414d");const E=15,P=E*l.sx,k=E*l.sy,T=new OffscreenCanvas(P*2,k*2),R=T.getContext("2d");R.fillStyle=w,R.fillRect(0,0,P*2,k*2),R.fillStyle=S,R.fillRect(0,0,P,k),R.fillRect(P,k,P,k),x.fillStyle=x.createPattern(T,"repeat"),x.fillRect(0,0,m,y),x.drawImage(c,0,0,c.width,c.height,0,0,m,y)}let g=null;if(n){let m,y;if(l.symmetric&&c.width<e&&c.height<e)m=c.width,y=c.height;else if(c=this.#e,i>e||a>e){const S=Math.min(e/i,e/a);m=Math.floor(i*S),y=Math.floor(a*S),this.#c||(c=this.#m(m,y))}const w=new OffscreenCanvas(m,y).getContext("2d",{willReadFrequently:!0});w.drawImage(c,0,0,c.width,c.height,0,0,m,y),g={width:m,height:y,data:w.getImageData(0,0,m,y).data}}return{canvas:f,width:d,height:h,imageData:g}}#m(e,t){const{width:n,height:i}=this.#e;let a=n,l=i,c=this.#e;for(;a>2*e||l>2*t;){const d=a,h=l;a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),l>2*t&&(l=l>=16384?Math.floor(l/2)-1:Math.ceil(l/2));const f=new OffscreenCanvas(a,l);f.getContext("2d").drawImage(c,0,0,d,h,0,0,a,l),c=f.transferToImageBitmap()}return c}#g(){const[e,t]=this.parentDimensions,{width:n,height:i}=this,a=new Dn,l=Math.ceil(n*e*a.sx),c=Math.ceil(i*t*a.sy),d=this.#l;if(!d||d.width===l&&d.height===c)return;d.width=l,d.height=c;const h=this.#c?this.#e:this.#m(l,c),f=d.getContext("2d");f.filter=this._uiManager.hcmFilter,f.drawImage(h,0,0,h.width,h.height,0,0,l,c)}#v(e){if(e){if(this.#c){const i=this._uiManager.imageManager.getSvgUrl(this.#t);if(i)return i}const t=document.createElement("canvas");return{width:t.width,height:t.height}=this.#e,t.getContext("2d").drawImage(this.#e,0,0),t.toDataURL()}if(this.#c){const[t,n]=this.pageDimensions,i=Math.round(this.width*t*Ps.PDF_TO_CSS_UNITS),a=Math.round(this.height*n*Ps.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(i,a);return l.getContext("2d").drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,i,a),l.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,t,n){let i=null,a=!1;if(e instanceof H0){const{data:{rect:w,rotation:S,id:E,structParent:P,popupRef:k},container:T,parent:{page:{pageNumber:R}},canvas:I}=e;let N,D;I?(delete e.canvas,{id:N,bitmap:D}=n.imageManager.getFromCanvas(T.id,I),I.remove()):(a=!0,e._hasNoCanvas=!0);const V=(await t._structTree.getAriaAttributes(`${Wh}${E}`))?.get("aria-label")||"";i=e={annotationType:Re.STAMP,bitmapId:N,bitmap:D,pageIndex:R-1,rect:w.slice(0),rotation:S,id:E,deleted:!1,accessibilityData:{decorative:!1,altText:V},isSvg:!1,structParent:P,popupRef:k}}const l=await super.deserialize(e,t,n),{rect:c,bitmap:d,bitmapUrl:h,bitmapId:f,isSvg:g,accessibilityData:m}=e;a?(n.addMissingCanvas(e.id,l),l.#a=!0):f&&n.imageManager.isValidId(f)?(l.#t=f,d&&(l.#e=d)):l.#r=h,l.#c=g;const[y,x]=l.pageDimensions;return l.width=(c[2]-c[0])/y,l.height=(c[3]-c[1])/x,l.annotationElementId=e.id||null,m&&(l.altTextData=m),l._initialData=i,l.#h=!!i,l}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n={annotationType:Re.STAMP,bitmapId:this.#t,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#c,structTreeParentId:this._structTreeParentId};if(e)return n.bitmapUrl=this.#v(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;const{decorative:i,altText:a}=this.serializeAltText(!1);if(!i&&a&&(n.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const c=this.#y(n);if(c.isSame)return null;c.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1}if(n.id=this.annotationElementId,t===null)return n;t.stamps||=new Map;const l=this.#c?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:l,serialized:n}),n.bitmap=this.#v(!1);else if(this.#c){const c=t.stamps.get(this.#t);l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=this.#v(!1))}return n}#y(e){const{pageIndex:t,accessibilityData:{altText:n}}=this._initialData,i=e.pageIndex===t,a=(e.accessibilityData?.alt||"")===n;return{isSame:!this._hasBeenMoved&&!this._hasBeenResized&&i&&a,isSameAltText:a}}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}}class Xn{#e;#t=!1;#n=null;#r=null;#i=null;#s=new Map;#l=!1;#a=!1;#d=!1;#c=null;#h=null;#u=null;#f=null;#o;static _initialized=!1;static#p=new Map([xt,af,DR,ut,Gn].map(e=>[e._editorType,e]));constructor({uiManager:e,pageIndex:t,div:n,structTreeLayer:i,accessibilityManager:a,annotationLayer:l,drawLayer:c,textLayer:d,viewport:h,l10n:f}){const g=[...Xn.#p.values()];if(!Xn._initialized){Xn._initialized=!0;for(const m of g)m.initialize(f,e)}e.registerEditorTypes(g),this.#o=e,this.pageIndex=t,this.div=n,this.#e=a,this.#n=l,this.viewport=h,this.#u=d,this.drawLayer=c,this._structTree=i,this.#o.addLayer(this)}get isEmpty(){return this.#s.size===0}get isInvisible(){return this.isEmpty&&this.#o.getMode()===Re.NONE}updateToolbar(e){this.#o.updateToolbar(e)}updateMode(e=this.#o.getMode()){switch(this.#w(),e){case Re.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Re.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Re.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const n of Xn.#p.values())t.toggle(`${n._type}Editing`,e===n._editorType);this.div.hidden=!1}hasTextLayer(e){return e===this.#u?.div}setEditingState(e){this.#o.setEditingState(e)}addCommands(e){this.#o.addCommands(e)}cleanUndoStack(e){this.#o.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#n?.div.classList.toggle("disabled",!e)}async enable(){this.#d=!0,this.div.tabIndex=0,this.togglePointerEvents(!0);const e=new Set;for(const n of this.#s.values())n.enableEditing(),n.show(!0),n.annotationElementId&&(this.#o.removeChangedExistingAnnotation(n),e.add(n.annotationElementId));if(!this.#n){this.#d=!1;return}const t=this.#n.getEditableAnnotations();for(const n of t){if(n.hide(),this.#o.isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;const i=await this.deserialize(n);i&&(this.addOrRebuild(i),i.enableEditing())}this.#d=!1}disable(){this.#a=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,t=new Map;for(const i of this.#s.values())if(i.disableEditing(),!!i.annotationElementId){if(i.serialize()!==null){e.set(i.annotationElementId,i);continue}else t.set(i.annotationElementId,i);this.getEditableAnnotation(i.annotationElementId)?.show(),i.remove()}if(this.#n){const i=this.#n.getEditableAnnotations();for(const a of i){const{id:l}=a.data;if(this.#o.isDeletedAnnotationElement(l))continue;let c=t.get(l);if(c){c.resetAnnotationElement(a),c.show(!1),a.show();continue}c=e.get(l),c&&(this.#o.addChangedExistingAnnotation(c),c.renderAnnotationElement(a)&&c.show(!1)),a.show()}}this.#w(),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const i of Xn.#p.values())n.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#a=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#o.getActive()!==e&&this.#o.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#u?.div&&!this.#f){this.#f=new AbortController;const e=this.#o.combinedSignal(this.#f);this.#u.div.addEventListener("pointerdown",this.#m.bind(this),{signal:e}),this.#u.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#u?.div&&this.#f&&(this.#f.abort(),this.#f=null,this.#u.div.classList.remove("highlighting"))}#m(e){this.#o.unselectAll();const{target:t}=e;if(t===this.#u.div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent"))&&this.#u.div.contains(t)){const{isMac:n}=kt.platform;if(e.button!==0||e.ctrlKey&&n)return;this.#o.showAllEditors("highlight",!0,!0),this.#u.div.classList.add("free"),this.toggleDrawing(),ut.startHighlighting(this,this.#o.direction==="ltr",{target:this.#u.div,x:e.x,y:e.y}),this.#u.div.addEventListener("pointerup",()=>{this.#u.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#o._signal}),e.preventDefault()}}enableClick(){if(this.#r)return;this.#r=new AbortController;const e=this.#o.combinedSignal(this.#r);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e}),this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){this.#r?.abort(),this.#r=null}attach(e){this.#s.set(e.id,e);const{annotationElementId:t}=e;t&&this.#o.isDeletedAnnotationElement(t)&&this.#o.removeDeletedAnnotationElement(e)}detach(e){this.#s.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#a&&e.annotationElementId&&this.#o.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#o.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#o.addDeletedAnnotationElement(e.annotationElementId),_e.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),this.#o.addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#d),this.#o.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!this.#i&&(e._focusEventsAllowed=!1,this.#i=setTimeout(()=>{this.#i=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#o._signal}),t.focus())},0)),e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const t=()=>e._uiManager.rebuild(e),n=()=>{e.remove()};this.addCommands({cmd:t,undo:n,mustExec:!1})}getNextId(){return this.#o.getId()}get#g(){return Xn.#p.get(this.#o.getMode())}combinedSignal(e){return this.#o.combinedSignal(e)}#v(e){const t=this.#g;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#g?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await this.#o.updateMode(e.mode);const{offsetX:n,offsetY:i}=this.#y(),a=this.getNextId(),l=this.#v({parent:this,id:a,x:n,y:i,uiManager:this.#o,isCentered:!0,...t});l&&this.add(l)}async deserialize(e){return await Xn.#p.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#o)||null}createAndAddNewEditor(e,t,n={}){const i=this.getNextId(),a=this.#v({parent:this,id:i,x:e.offsetX,y:e.offsetY,uiManager:this.#o,isCentered:t,...n});return a&&this.add(a),a}#y(){const{x:e,y:t,width:n,height:i}=this.div.getBoundingClientRect(),a=Math.max(0,e),l=Math.max(0,t),c=Math.min(window.innerWidth,e+n),d=Math.min(window.innerHeight,t+i),h=(a+c)/2-e,f=(l+d)/2-t,[g,m]=this.viewport.rotation%180===0?[h,f]:[f,h];return{offsetX:g,offsetY:m}}addNewEditor(e={}){this.createAndAddNewEditor(this.#y(),!0,e)}setSelected(e){this.#o.setSelected(e)}toggleSelected(e){this.#o.toggleSelected(e)}unselect(e){this.#o.unselect(e)}pointerup(e){const{isMac:t}=kt.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!this.#l||(this.#l=!1,this.#g?.isDrawer&&this.#g.supportMultipleDrawings))return;if(!this.#t){this.#t=!0;return}const n=this.#o.getMode();if(n===Re.STAMP||n===Re.SIGNATURE){this.#o.unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#o.getMode()===Re.HIGHLIGHT&&this.enableTextSelection(),this.#l){this.#l=!1;return}const{isMac:t}=kt.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(this.#l=!0,this.#g?.isDrawer){this.startDrawingSession(e);return}const n=this.#o.getActive();this.#t=!n||n.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#c){this.#g.startDrawing(this,this.#o,!1,e);return}this.#o.setCurrentDrawingSession(this),this.#c=new AbortController;const t=this.#o.combinedSignal(this.#c);this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(this.#h=null,this.commitOrRemove())},{signal:t}),this.#g.startDrawing(this,this.#o,!1,e)}pause(e){if(e){const{activeElement:t}=document;this.div.contains(t)&&(this.#h=t);return}this.#h&&setTimeout(()=>{this.#h?.focus(),this.#h=null},0)}endDrawingSession(e=!1){return this.#c?(this.#o.setCurrentDrawingSession(null),this.#c.abort(),this.#c=null,this.#h=null,this.#g.endDrawing(e)):null}findNewParent(e,t,n){const i=this.#o.findParent(t,n);return i===null||i===this?!1:(i.changeParent(e),!0)}commitOrRemove(){return this.#c?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#c&&this.#g.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#o.getActive()?.parent===this&&(this.#o.commitOrRemove(),this.#o.setActiveEditor(null)),this.#i&&(clearTimeout(this.#i),this.#i=null);for(const e of this.#s.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#s.clear(),this.#o.removeLayer(this)}#w(){for(const e of this.#s.values())e.isEmpty()&&e.remove()}render({viewport:e}){this.viewport=e,Yr(this.div,e);for(const t of this.#o.getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){this.#o.commitOrRemove(),this.#w();const t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,Yr(this.div,{rotation:n}),t!==n)for(const i of this.#s.values())i.rotate(n)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#o.viewParameters.realScale}}class Ct{#e=null;#t=new Map;#n=new Map;static#r=0;constructor({pageIndex:e}){this.pageIndex=e}setParent(e){if(!this.#e){this.#e=e;return}if(this.#e!==e){if(this.#t.size>0)for(const t of this.#t.values())t.remove(),e.append(t);this.#e=e}}static get _svgFactory(){return Me(this,"_svgFactory",new jo)}static#i(e,[t,n,i,a]){const{style:l}=e;l.top=`${100*n}%`,l.left=`${100*t}%`,l.width=`${100*i}%`,l.height=`${100*a}%`}#s(){const e=Ct._svgFactory.create(1,1,!0);return this.#e.append(e),e.setAttribute("aria-hidden",!0),e}#l(e,t){const n=Ct._svgFactory.createElement("clipPath");e.append(n);const i=`clip_${t}`;n.setAttribute("id",i),n.setAttribute("clipPathUnits","objectBoundingBox");const a=Ct._svgFactory.createElement("use");return n.append(a),a.setAttribute("href",`#${t}`),a.classList.add("clip"),i}#a(e,t){for(const[n,i]of Object.entries(t))i===null?e.removeAttribute(n):e.setAttribute(n,i)}draw(e,t=!1,n=!1){const i=Ct.#r++,a=this.#s(),l=Ct._svgFactory.createElement("defs");a.append(l);const c=Ct._svgFactory.createElement("path");l.append(c);const d=`path_p${this.pageIndex}_${i}`;c.setAttribute("id",d),c.setAttribute("vector-effect","non-scaling-stroke"),t&&this.#n.set(i,c);const h=n?this.#l(l,d):null,f=Ct._svgFactory.createElement("use");return a.append(f),f.setAttribute("href",`#${d}`),this.updateProperties(a,e),this.#t.set(i,a),{id:i,clipPathId:`url(#${h})`}}drawOutline(e,t){const n=Ct.#r++,i=this.#s(),a=Ct._svgFactory.createElement("defs");i.append(a);const l=Ct._svgFactory.createElement("path");a.append(l);const c=`path_p${this.pageIndex}_${n}`;l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke");let d;if(t){const g=Ct._svgFactory.createElement("mask");a.append(g),d=`mask_p${this.pageIndex}_${n}`,g.setAttribute("id",d),g.setAttribute("maskUnits","objectBoundingBox");const m=Ct._svgFactory.createElement("rect");g.append(m),m.setAttribute("width","1"),m.setAttribute("height","1"),m.setAttribute("fill","white");const y=Ct._svgFactory.createElement("use");g.append(y),y.setAttribute("href",`#${c}`),y.setAttribute("stroke","none"),y.setAttribute("fill","black"),y.setAttribute("fill-rule","nonzero"),y.classList.add("mask")}const h=Ct._svgFactory.createElement("use");i.append(h),h.setAttribute("href",`#${c}`),d&&h.setAttribute("mask",`url(#${d})`);const f=h.cloneNode();return i.append(f),h.classList.add("mainOutline"),f.classList.add("secondaryOutline"),this.updateProperties(i,e),this.#t.set(n,i),n}finalizeDraw(e,t){this.#n.delete(e),this.updateProperties(e,t)}updateProperties(e,t){if(!t)return;const{root:n,bbox:i,rootClass:a,path:l}=t,c=typeof e=="number"?this.#t.get(e):e;if(c){if(n&&this.#a(c,n),i&&Ct.#i(c,i),a){const{classList:d}=c;for(const[h,f]of Object.entries(a))d.toggle(h,f)}if(l){const h=c.firstChild.firstChild;this.#a(h,l)}}}updateParent(e,t){if(t===this)return;const n=this.#t.get(e);n&&(t.#e.append(n),this.#t.delete(e),t.#t.set(e,n))}remove(e){this.#n.delete(e),this.#e!==null&&(this.#t.get(e).remove(),this.#t.delete(e))}destroy(){this.#e=null;for(const e of this.#t.values())e.remove();this.#t.clear(),this.#n.clear()}}globalThis._pdfjsTestingUtils={HighlightOutliner:uh};globalThis.pdfjsLib={AbortException:wr,AnnotationEditorLayer:Xn,AnnotationEditorParamsType:De,AnnotationEditorType:Re,AnnotationEditorUIManager:br,AnnotationLayer:of,AnnotationMode:Kn,AnnotationType:ct,build:O0,ColorPicker:an,createValidAbsoluteUrl:Hh,DOMSVGFactory:jo,DrawLayer:Ct,FeatureTest:kt,fetchData:Ii,getDocument:ef,getFilenameFromUrl:g0,getPdfFilenameFromUrl:m0,getUuid:Vh,getXfaPageViewport:v0,GlobalWorkerOptions:Gr,ImageKind:To,InvalidPDFException:Hl,isDataScheme:qo,isPdfFile:fc,isValidExplicitDest:x0,MathClamp:jt,noContextMenu:An,normalizeUnicode:f0,OPS:Lo,OutputScale:Dn,PasswordResponses:d0,PDFDataRangeTransport:nf,PDFDateString:Gh,PDFWorker:Ei,PermissionFlag:u0,PixelsPerInch:Ps,RenderingCancelledException:hc,ResponseException:Mo,setLayerDimensions:Yr,shadow:Me,SignatureExtractor:ms,stopEvent:dt,SupportedImageMimeTypes:Ul,TextLayer:Do,TouchManager:Yo,updateUrlHash:Uh,Util:xe,VerbosityLevel:Vo,version:Fo,XfaLayer:rf};const OR=Object.freeze(Object.defineProperty({__proto__:null,AbortException:wr,AnnotationEditorLayer:Xn,AnnotationEditorParamsType:De,AnnotationEditorType:Re,AnnotationEditorUIManager:br,AnnotationLayer:of,AnnotationMode:Kn,AnnotationType:ct,ColorPicker:an,DOMSVGFactory:jo,DrawLayer:Ct,FeatureTest:kt,GlobalWorkerOptions:Gr,ImageKind:To,InvalidPDFException:Hl,MathClamp:jt,OPS:Lo,OutputScale:Dn,PDFDataRangeTransport:nf,PDFDateString:Gh,PDFWorker:Ei,PasswordResponses:d0,PermissionFlag:u0,PixelsPerInch:Ps,RenderingCancelledException:hc,ResponseException:Mo,SignatureExtractor:ms,SupportedImageMimeTypes:Ul,TextLayer:Do,TouchManager:Yo,Util:xe,VerbosityLevel:Vo,XfaLayer:rf,build:O0,createValidAbsoluteUrl:Hh,fetchData:Ii,getDocument:ef,getFilenameFromUrl:g0,getPdfFilenameFromUrl:m0,getUuid:Vh,getXfaPageViewport:v0,isDataScheme:qo,isPdfFile:fc,isValidExplicitDest:x0,noContextMenu:An,normalizeUnicode:f0,setLayerDimensions:Yr,shadow:Me,stopEvent:dt,updateUrlHash:Uh,version:Fo},Symbol.toStringTag,{value:"Module"})),FR=["onCopy","onCut","onPaste"],jR=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],zR=["onFocus","onBlur"],$R=["onInput","onInvalid","onReset","onSubmit"],BR=["onLoad","onError"],HR=["onKeyDown","onKeyPress","onKeyUp"],UR=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],VR=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],WR=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],GR=["onSelect"],qR=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],XR=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],YR=["onScroll"],KR=["onWheel"],QR=["onAnimationStart","onAnimationEnd","onAnimationIteration"],JR=["onTransitionEnd"],ZR=["onToggle"],eN=["onChange"],tN=[...FR,...jR,...zR,...$R,...BR,...HR,...UR,...VR,...WR,...GR,...qR,...XR,...YR,...KR,...QR,...JR,...eN,...ZR];function G0(s,e){const t={};for(const n of tN){const i=s[n];i&&(e?t[n]=a=>i(a,e(n)):t[n]=i)}return t}function Zo(s){let e=!1;return{promise:new Promise((n,i)=>{s.then(a=>!e&&n(a)).catch(a=>!e&&i(a))}),cancel(){e=!0}}}var nN="Invariant failed";function qe(s,e){if(!s)throw new Error(nN)}var $d,xv;function rN(){if(xv)return $d;xv=1;var s=function(){};return $d=s,$d}var sN=rN();const zt=gh(sN);var Sv=Object.prototype.hasOwnProperty;function Av(s,e,t){for(t of s.keys())if(wi(t,e))return t}function wi(s,e){var t,n,i;if(s===e)return!0;if(s&&e&&(t=s.constructor)===e.constructor){if(t===Date)return s.getTime()===e.getTime();if(t===RegExp)return s.toString()===e.toString();if(t===Array){if((n=s.length)===e.length)for(;n--&&wi(s[n],e[n]););return n===-1}if(t===Set){if(s.size!==e.size)return!1;for(n of s)if(i=n,i&&typeof i=="object"&&(i=Av(e,i),!i)||!e.has(i))return!1;return!0}if(t===Map){if(s.size!==e.size)return!1;for(n of s)if(i=n[0],i&&typeof i=="object"&&(i=Av(e,i),!i)||!wi(n[1],e.get(i)))return!1;return!0}if(t===ArrayBuffer)s=new Uint8Array(s),e=new Uint8Array(e);else if(t===DataView){if((n=s.byteLength)===e.byteLength)for(;n--&&s.getInt8(n)===e.getInt8(n););return n===-1}if(ArrayBuffer.isView(s)){if((n=s.byteLength)===e.byteLength)for(;n--&&s[n]===e[n];);return n===-1}if(!t||typeof s=="object"){n=0;for(t in s)if(Sv.call(s,t)&&++n&&!Sv.call(e,t)||!(t in e)||!wi(s[t],e[t]))return!1;return Object.keys(e).length===n}}return s!==s&&e!==e}const q0=A.createContext(null);function bi({children:s,type:e}){return _.jsx("div",{className:`react-pdf__message react-pdf__message--${e}`,children:s})}const iN="noopener noreferrer nofollow";class oN{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(e){this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setExternalLinkRel(e){this.externalLinkRel=e}setExternalLinkTarget(e){this.externalLinkTarget=e}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return qe(this.pdfViewer),this.pdfViewer.currentPageNumber||0}set page(e){qe(this.pdfViewer),this.pdfViewer.currentPageNumber=e}get rotation(){return 0}set rotation(e){}goToDestination(e){return new Promise(t=>{qe(this.pdfDocument),qe(e),typeof e=="string"?this.pdfDocument.getDestination(e).then(t):Array.isArray(e)?t(e):e.then(t)}).then(t=>{qe(Array.isArray(t));const n=t[0];new Promise(i=>{qe(this.pdfDocument),n instanceof Object?this.pdfDocument.getPageIndex(n).then(a=>{i(a)}).catch(()=>{qe(!1)}):typeof n=="number"?i(n):qe(!1)}).then(i=>{const a=i+1;qe(this.pdfViewer),qe(a>=1&&a<=this.pagesCount),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:i,pageNumber:a})})})}navigateTo(e){this.goToDestination(e)}goToPage(e){const t=e-1;qe(this.pdfViewer),qe(e>=1&&e<=this.pagesCount),this.pdfViewer.scrollPageIntoView({pageIndex:t,pageNumber:e})}addLinkAttributes(e,t,n){e.href=t,e.rel=this.externalLinkRel||iN,e.target=n?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const Ev={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},mc=typeof window<"u",X0=mc&&window.location.protocol==="file:";function aN(s){return typeof s<"u"}function gs(s){return aN(s)&&s!==null}function lN(s){return typeof s=="string"}function cN(s){return s instanceof ArrayBuffer}function uN(s){return qe(mc),s instanceof Blob}function fh(s){return lN(s)&&/^data:/.test(s)}function _v(s){qe(fh(s));const[e="",t=""]=s.split(",");return e.split(";").indexOf("base64")!==-1?atob(t):unescape(t)}function dN(){return mc&&window.devicePixelRatio||1}const Y0="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Cv(){zt(!X0,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${Y0}`)}function hN(){zt(!X0,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${Y0}`)}function Rs(s){s?.cancel&&s.cancel()}function ph(s,e){return Object.defineProperty(s,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(s,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(s,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(s,"originalHeight",{get(){return this.view[3]},configurable:!0}),s}function fN(s){return s.name==="RenderingCancelledException"}function pN(s){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{if(!n.result)return t(new Error("Error while reading a file."));e(n.result)},n.onerror=i=>{if(!i.target)return t(new Error("Error while reading a file."));const{error:a}=i.target;if(!a)return t(new Error("Error while reading a file."));switch(a.code){case a.NOT_FOUND_ERR:return t(new Error("Error while reading a file: File not found."));case a.SECURITY_ERR:return t(new Error("Error while reading a file: Security error."));case a.ABORT_ERR:return t(new Error("Error while reading a file: Aborted."));default:return t(new Error("Error while reading a file."))}},n.readAsArrayBuffer(s)})}function gN(s,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return s}}function _i(){return A.useReducer(gN,{value:void 0,error:void 0})}var kv=function(s,e){var t={};for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&e.indexOf(n)<0&&(t[n]=s[n]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(s);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(s,n[i])&&(t[n[i]]=s[n[i]]);return t};const{PDFDataRangeTransport:mN}=OR,vN=(s,e)=>{switch(e){case Ev.NEED_PASSWORD:{const t=prompt("Enter the password to open this PDF file.");s(t);break}case Ev.INCORRECT_PASSWORD:{const t=prompt("Invalid password. Please try again.");s(t);break}}};function Pv(s){return typeof s=="object"&&s!==null&&("data"in s||"range"in s||"url"in s)}const yN=A.forwardRef(function(e,t){var{children:n,className:i,error:a="Failed to load PDF file.",externalLinkRel:l,externalLinkTarget:c,file:d,inputRef:h,imageResourcesPath:f,loading:g="Loading PDF…",noData:m="No PDF file specified.",onItemClick:y,onLoadError:x,onLoadProgress:w,onLoadSuccess:S,onPassword:E=vN,onSourceError:P,onSourceSuccess:k,options:T,renderMode:R,rotate:I,scale:N}=e,D=kv(e,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate","scale"]);const[V,j]=_i(),{value:G,error:Z}=V,[K,J]=_i(),{value:ee,error:B}=K,$=A.useRef(new oN),M=A.useRef([]),Q=A.useRef(void 0),ne=A.useRef(void 0);d&&d!==Q.current&&Pv(d)&&(zt(!wi(d,Q.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),Q.current=d),T&&T!==ne.current&&(zt(!wi(T,ne.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),ne.current=T);const F=A.useRef({scrollPageIntoView:Ce=>{const{dest:He,pageNumber:je,pageIndex:ft=je-1}=Ce;if(y){y({dest:He,pageIndex:ft,pageNumber:je});return}const Qe=M.current[ft];if(Qe){Qe.scrollIntoView();return}zt(!1,`An internal link leading to page ${je} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});A.useImperativeHandle(t,()=>({linkService:$,pages:M,viewer:F}),[]);function Y(){k&&k()}function q(){Z&&(zt(!1,Z.toString()),P&&P(Z))}function te(){j({type:"RESET"})}A.useEffect(te,[d,j]);const se=A.useCallback(async()=>{if(!d)return null;if(typeof d=="string")return fh(d)?{data:_v(d)}:(Cv(),{url:d});if(d instanceof mN)return{range:d};if(cN(d))return{data:d};if(mc&&uN(d))return{data:await pN(d)};if(qe(typeof d=="object"),qe(Pv(d)),"url"in d&&typeof d.url=="string"){if(fh(d.url)){const{url:Ce}=d,He=kv(d,["url"]),je=_v(Ce);return Object.assign({data:je},He)}Cv()}return d},[d]);A.useEffect(()=>{const Ce=Zo(se());return Ce.promise.then(He=>{j({type:"RESOLVE",value:He})}).catch(He=>{j({type:"REJECT",error:He})}),()=>{Rs(Ce)}},[se,j]),A.useEffect(()=>{if(!(typeof G>"u")){if(G===!1){q();return}Y()}},[G]);function ie(){ee&&(S&&S(ee),M.current=new Array(ee.numPages),$.current.setDocument(ee))}function H(){B&&(zt(!1,B.toString()),x&&x(B))}A.useEffect(function(){J({type:"RESET"})},[J,G]),A.useEffect(function(){if(!G)return;const He=T?Object.assign(Object.assign({},G),T):G,je=ef(He);w&&(je.onProgress=w),E&&(je.onPassword=E);const ft=je,Qe=ft.promise.then(fn=>{J({type:"RESOLVE",value:fn})}).catch(fn=>{ft.destroyed||J({type:"REJECT",error:fn})});return()=>{Qe.finally(()=>ft.destroy())}},[T,J,G]),A.useEffect(()=>{if(!(typeof ee>"u")){if(ee===!1){H();return}ie()}},[ee]),A.useEffect(function(){$.current.setViewer(F.current),$.current.setExternalLinkRel(l),$.current.setExternalLinkTarget(c)},[l,c]);const ae=A.useCallback((Ce,He)=>{M.current[Ce]=He},[]),de=A.useCallback(Ce=>{delete M.current[Ce]},[]),ce=A.useMemo(()=>({imageResourcesPath:f,linkService:$.current,onItemClick:y,pdf:ee,registerPage:ae,renderMode:R,rotate:I,scale:N,unregisterPage:de}),[f,y,ee,ae,R,I,N,de]),Se=A.useMemo(()=>G0(D,()=>ee),[D,ee]);function Pe(){return _.jsx(q0.Provider,{value:ce,children:n})}function be(){return d?ee==null?_.jsx(bi,{type:"loading",children:typeof g=="function"?g():g}):ee===!1?_.jsx(bi,{type:"error",children:typeof a=="function"?a():a}):Pe():_.jsx(bi,{type:"no-data",children:typeof m=="function"?m():m})}return _.jsx("div",Object.assign({className:Ci("react-pdf__Document",i),ref:h},Se,{children:be()}))});function K0(){return A.useContext(q0)}function Q0(){for(var s=[],e=0;e<arguments.length;e++)s[e]=arguments[e];var t=s.filter(Boolean);if(t.length<=1){var n=t[0];return n||null}return function(a){for(var l=0,c=t;l<c.length;l++){var d=c[l];typeof d=="function"?d(a):d&&(d.current=a)}}}const J0=A.createContext(null),Z0={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},wN=/^H(\d+)$/;function bN(s){return s in Z0}function vc(s){return"children"in s}function eb(s){return vc(s)?s.children.length===1&&0 in s.children&&"id"in s.children[0]:!1}function xN(s){const e={};if(vc(s)){const{role:t}=s,n=t.match(wN);if(n)e.role="heading",e["aria-level"]=Number(n[1]);else if(bN(t)){const i=Z0[t];i&&(e.role=i)}}return e}function tb(s){const e={};if(vc(s)){if(s.alt!==void 0&&(e["aria-label"]=s.alt),s.lang!==void 0&&(e.lang=s.lang),eb(s)){const[t]=s.children;if(t){const n=tb(t);return Object.assign(Object.assign({},e),n)}}}else"id"in s&&(e["aria-owns"]=s.id);return e}function SN(s){return s?Object.assign(Object.assign({},xN(s)),tb(s)):null}function nb({className:s,node:e}){const t=A.useMemo(()=>SN(e),[e]),n=A.useMemo(()=>!vc(e)||eb(e)?null:e.children.map((i,a)=>_.jsx(nb,{node:i},a)),[e]);return _.jsx("span",Object.assign({className:s},t,{children:n}))}function yc(){return A.useContext(J0)}function AN(){const s=yc();qe(s);const{onGetStructTreeError:e,onGetStructTreeSuccess:t}=s,[n,i]=_i(),{value:a,error:l}=n,{customTextRenderer:c,page:d}=s;function h(){a&&t&&t(a)}function f(){l&&(zt(!1,l.toString()),e&&e(l))}return A.useEffect(function(){i({type:"RESET"})},[i,d]),A.useEffect(function(){if(c||!d)return;const m=Zo(d.getStructTree()),y=m;return m.promise.then(x=>{i({type:"RESOLVE",value:x})}).catch(x=>{i({type:"REJECT",error:x})}),()=>Rs(y)},[c,d,i]),A.useEffect(()=>{if(a!==void 0){if(a===!1){f();return}h()}},[a]),a?_.jsx(nb,{className:"react-pdf__Page__structTree structTree",node:a}):null}const Tv=Kn;function EN(s){const e=yc();qe(e);const t=Object.assign(Object.assign({},e),s),{_className:n,canvasBackground:i,devicePixelRatio:a=dN(),onRenderError:l,onRenderSuccess:c,page:d,renderForms:h,renderTextLayer:f,rotate:g,scale:m}=t,{canvasRef:y}=s;qe(d);const x=A.useRef(null);function w(){d&&c&&c(ph(d,m))}function S(T){fN(T)||(zt(!1,T.toString()),l&&l(T))}const E=A.useMemo(()=>d.getViewport({scale:m*a,rotation:g}),[a,d,g,m]),P=A.useMemo(()=>d.getViewport({scale:m,rotation:g}),[d,g,m]);A.useEffect(function(){if(!d)return;d.cleanup();const{current:R}=x;if(!R)return;R.width=E.width,R.height=E.height,R.style.width=`${Math.floor(P.width)}px`,R.style.height=`${Math.floor(P.height)}px`,R.style.visibility="hidden";const I={annotationMode:h?Tv.ENABLE_FORMS:Tv.ENABLE,canvasContext:R.getContext("2d",{alpha:!1}),viewport:E};i&&(I.background=i);const N=d.render(I),D=N;return N.promise.then(()=>{R.style.visibility="",w()}).catch(S),()=>Rs(D)},[i,d,h,E,P]);const k=A.useCallback(()=>{const{current:T}=x;T&&(T.width=0,T.height=0)},[]);return A.useEffect(()=>k,[k]),_.jsx("canvas",{className:`${n}__canvas`,dir:"ltr",ref:Q0(y,x),style:{display:"block",userSelect:"none"},children:f?_.jsx(AN,{}):null})}function _N(s){return"str"in s}function CN(){const s=yc();qe(s);const{customTextRenderer:e,onGetTextError:t,onGetTextSuccess:n,onRenderTextLayerError:i,onRenderTextLayerSuccess:a,page:l,pageIndex:c,pageNumber:d,rotate:h,scale:f}=s;qe(l);const[g,m]=_i(),{value:y,error:x}=g,w=A.useRef(null);zt(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function S(){y&&n&&n(y)}function E(){x&&(zt(!1,x.toString()),t&&t(x))}A.useEffect(function(){m({type:"RESET"})},[l,m]),A.useEffect(function(){if(!l)return;const D=Zo(l.getTextContent()),V=D;return D.promise.then(j=>{m({type:"RESOLVE",value:j})}).catch(j=>{m({type:"REJECT",error:j})}),()=>Rs(V)},[l,m]),A.useEffect(()=>{if(y!==void 0){if(y===!1){E();return}S()}},[y]);const P=A.useCallback(()=>{a&&a()},[a]),k=A.useCallback(N=>{zt(!1,N.toString()),i&&i(N)},[i]);function T(){const N=w.current;N&&N.classList.add("selecting")}function R(){const N=w.current;N&&N.classList.remove("selecting")}const I=A.useMemo(()=>l.getViewport({scale:f,rotation:h}),[l,h,f]);return A.useLayoutEffect(function(){if(!l||!y)return;const{current:D}=w;if(!D)return;D.innerHTML="";const V=l.streamTextContent({includeMarkedContent:!0}),j={container:D,textContentSource:V,viewport:I},G=new Do(j),Z=G;return G.render().then(()=>{const K=document.createElement("div");K.className="endOfContent",D.append(K);const J=D.querySelectorAll('[role="presentation"]');if(e){let ee=0;y.items.forEach((B,$)=>{if(!_N(B))return;const M=J[ee];if(!M)return;const Q=e(Object.assign({pageIndex:c,pageNumber:d,itemIndex:$},B));M.innerHTML=Q,ee+=B.str&&B.hasEOL?2:1})}P()}).catch(k),()=>Rs(Z)},[e,k,P,l,c,d,y,I]),_.jsx("div",{className:Ci("react-pdf__Page__textContent","textLayer"),onMouseUp:R,onMouseDown:T,ref:w})}function kN(){const s=K0(),e=yc();qe(e);const t=Object.assign(Object.assign({},s),e),{imageResourcesPath:n,linkService:i,onGetAnnotationsError:a,onGetAnnotationsSuccess:l,onRenderAnnotationLayerError:c,onRenderAnnotationLayerSuccess:d,page:h,pdf:f,renderForms:g,rotate:m,scale:y=1}=t;qe(f),qe(h),qe(i);const[x,w]=_i(),{value:S,error:E}=x,P=A.useRef(null);zt(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function k(){S&&l&&l(S)}function T(){E&&(zt(!1,E.toString()),a&&a(E))}A.useEffect(function(){w({type:"RESET"})},[w,h]),A.useEffect(function(){if(!h)return;const V=Zo(h.getAnnotations()),j=V;return V.promise.then(G=>{w({type:"RESOLVE",value:G})}).catch(G=>{w({type:"REJECT",error:G})}),()=>{Rs(j)}},[w,h]),A.useEffect(()=>{if(S!==void 0){if(S===!1){T();return}k()}},[S]);function R(){d&&d()}function I(D){zt(!1,`${D}`),c&&c(D)}const N=A.useMemo(()=>h.getViewport({scale:y,rotation:m}),[h,m,y]);return A.useEffect(function(){if(!f||!h||!i||!S)return;const{current:V}=P;if(!V)return;const j=N.clone({dontFlip:!0}),G={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:V,l10n:null,page:h,structTreeLayer:null,viewport:j},Z={annotations:S,annotationStorage:f.annotationStorage,div:V,imageResourcesPath:n,linkService:i,page:h,renderForms:g,viewport:j};V.innerHTML="";try{new of(G).render(Z),R()}catch(K){I(K)}return()=>{}},[S,n,i,h,f,g,N]),_.jsx("div",{className:Ci("react-pdf__Page__annotations","annotationLayer"),ref:P})}var PN=function(s,e){var t={};for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&e.indexOf(n)<0&&(t[n]=s[n]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(s);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(s,n[i])&&(t[n[i]]=s[n[i]]);return t};const Rv=1;function TN(s){const e=K0(),t=Object.assign(Object.assign({},e),s),{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:i=!0,canvasBackground:a,canvasRef:l,children:c,className:d,customRenderer:h,customTextRenderer:f,devicePixelRatio:g,error:m="Failed to load the page.",height:y,inputRef:x,loading:w="Loading page…",noData:S="No page specified.",onGetAnnotationsError:E,onGetAnnotationsSuccess:P,onGetStructTreeError:k,onGetStructTreeSuccess:T,onGetTextError:R,onGetTextSuccess:I,onLoadError:N,onLoadSuccess:D,onRenderAnnotationLayerError:V,onRenderAnnotationLayerSuccess:j,onRenderError:G,onRenderSuccess:Z,onRenderTextLayerError:K,onRenderTextLayerSuccess:J,pageIndex:ee,pageNumber:B,pdf:$,registerPage:M,renderAnnotationLayer:Q=!0,renderForms:ne=!1,renderMode:F="canvas",renderTextLayer:Y=!0,rotate:q,scale:te=Rv,unregisterPage:se,width:ie}=t,H=PN(t,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[ae,de]=_i(),{value:ce,error:Se}=ae,Pe=A.useRef(null);qe($);const be=gs(B)?B-1:ee??null,Ce=B??(gs(ee)?ee+1:null),He=q??(ce?ce.rotate:null),je=A.useMemo(()=>{if(!ce)return null;let On=1;const rr=te??Rv;if(ie||y){const Zr=ce.getViewport({scale:1,rotation:He});ie?On=ie/Zr.width:y&&(On=y/Zr.height)}return rr*On},[y,ce,He,te,ie]);A.useEffect(function(){return()=>{gs(be)&&i&&se&&se(be)}},[i,$,be,se]);function ft(){if(D){if(!ce||!je)return;D(ph(ce,je))}if(i&&M){if(!gs(be)||!Pe.current)return;M(be,Pe.current)}}function Qe(){Se&&(zt(!1,Se.toString()),N&&N(Se))}A.useEffect(function(){de({type:"RESET"})},[de,$,be]),A.useEffect(function(){if(!$||!Ce)return;const rr=Zo($.getPage(Ce)),Zr=rr;return rr.promise.then(sr=>{de({type:"RESOLVE",value:sr})}).catch(sr=>{de({type:"REJECT",error:sr})}),()=>Rs(Zr)},[de,$,Ce]),A.useEffect(()=>{if(ce!==void 0){if(ce===!1){Qe();return}ft()}},[ce,je]);const fn=A.useMemo(()=>ce&&gs(be)&&Ce&&gs(He)&&gs(je)?{_className:n,canvasBackground:a,customTextRenderer:f,devicePixelRatio:g,onGetAnnotationsError:E,onGetAnnotationsSuccess:P,onGetStructTreeError:k,onGetStructTreeSuccess:T,onGetTextError:R,onGetTextSuccess:I,onRenderAnnotationLayerError:V,onRenderAnnotationLayerSuccess:j,onRenderError:G,onRenderSuccess:Z,onRenderTextLayerError:K,onRenderTextLayerSuccess:J,page:ce,pageIndex:be,pageNumber:Ce,renderForms:ne,renderTextLayer:Y,rotate:He,scale:je}:null,[n,a,f,g,E,P,k,T,R,I,V,j,G,Z,K,J,ce,be,Ce,ne,Y,He,je]),nr=A.useMemo(()=>G0(H,()=>ce&&(je?ph(ce,je):void 0)),[H,ce,je]),Pt=`${be}@${je}/${He}`;function xr(){switch(F){case"custom":return qe(h),_.jsx(h,{},`${Pt}_custom`);case"none":return null;case"canvas":default:return _.jsx(EN,{canvasRef:l},`${Pt}_canvas`)}}function Ls(){return Y?_.jsx(CN,{},`${Pt}_text`):null}function ea(){return Q?_.jsx(kN,{},`${Pt}_annotations`):null}function ta(){return _.jsxs(J0.Provider,{value:fn,children:[xr(),Ls(),ea(),c]})}function na(){return Ce?$===null||ce===void 0||ce===null?_.jsx(bi,{type:"loading",children:typeof w=="function"?w():w}):$===!1||ce===!1?_.jsx(bi,{type:"error",children:typeof m=="function"?m():m}):ta():_.jsx(bi,{type:"no-data",children:typeof S=="function"?S():S})}return _.jsx("div",Object.assign({className:Ci(n,d),"data-page-number":Ce,ref:Q0(x,Pe),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${je}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:a||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},nr,{children:na()}))}hN();Gr.workerSrc="pdf.worker.mjs";typeof window<"u"&&(Gr.workerSrc=`//unpkg.com/pdfjs-dist@${Fo}/build/pdf.worker.min.mjs`);Bh(()=>Promise.resolve().then(()=>DN),[]);Bh(()=>Promise.resolve().then(()=>ON),void 0);var RN={cMapUrl:`https://unpkg.com/pdfjs-dist@${Fo}/cmaps/`,wasmUrl:`https://unpkg.com/pdfjs-dist@${Fo}/wasm/`},NN=10*1024*1024,IN=({url:s,onDownload:e,highlight:t})=>{const[n,i]=A.useState(),[a,l]=A.useState(1),[c,d]=A.useState(1),[h,f]=A.useState(null),[g,m]=A.useState(!1),[y,x]=A.useState(0),[w,S]=A.useState(!0),E=A.useRef(null),P=A.useRef({}),k=A.useRef(!1),[T,R]=A.useState({}),[I,N]=A.useState(!1),D=[{id:"highlight",x:t?.x||0,y:t?.y||0,width:t?.width||0,height:t?.height||0,color:"rgba(255, 215, 0, 0.25)"}];function V({numPages:$}){i($),x(0),S(!0)}function j(){x($=>{const M=$+1;return M===n&&S(!1),M})}A.useEffect(()=>{if(!t||!n)return;P.current[t.page]&&(J(t.page),N(!0))},[t,n]);const G=$=>{const M=$.getViewport({scale:1});if(R(Q=>Ft(Fe({},Q),{[$.pageNumber]:{width:M.width,height:M.height}})),!k.current&&$.pageNumber===1&&E.current){const ne=E.current.clientWidth/M.width;d(ne),k.current=!0}},Z=()=>{I&&N(!1)};A.useEffect(()=>{const $=()=>{if(!E.current)return;const Q=E.current.getBoundingClientRect(),ne=Q.top+Q.height/2;let F=1,Y=1/0;Object.entries(P.current).forEach(([q,te])=>{if(te){const se=te.getBoundingClientRect(),ie=se.top+se.height/2,H=Math.abs(ie-ne);H<Y&&(Y=H,F=parseInt(q))}}),l(F)},M=E.current;if(M)return M.addEventListener("scroll",$),()=>M.removeEventListener("scroll",$)},[n]);const K=A.useRef(null);A.useEffect(()=>K.current===s?void 0:(K.current=s,(async()=>{m(!0);const Q=await(await fetch(s)).blob();f(new File([Q],"document.pdf",{type:"application/pdf"})),m(!1)})(),()=>{f(null)}),[s]);const J=$=>{const M=P.current[$];M&&E.current&&M.scrollIntoView({behavior:"instant",block:"center"})};A.useEffect(()=>{const $=E.current;if(!$)return;const M=Q=>{Q.key==="ArrowLeft"?(Q.preventDefault(),a>1&&J(a-1)):Q.key==="ArrowRight"?(Q.preventDefault(),a<(n||1)&&J(a+1)):Q.key==="="||Q.key==="+"?(Q.preventDefault(),d(ne=>Math.min(ne+.25,3))):Q.key==="-"&&(Q.preventDefault(),d(ne=>Math.max(ne-.25,.5)))};return $.addEventListener("keydown",M),$.tabIndex=0,()=>{$.removeEventListener("keydown",M)}},[a,n]);const ee=()=>{if(e)e();else if(h){const $=URL.createObjectURL(h),M=document.createElement("a");M.href=$,M.download=h.name,document.body.appendChild(M),M.click(),document.body.removeChild(M),URL.revokeObjectURL($)}else window.open(s,"_blank")},B=()=>{l(1),J(1)};return g?_.jsx("div",{className:"relative h-full flex items-center justify-center bg-gray-50",children:_.jsxs("div",{className:"text-center",children:[_.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 mx-auto mb-2"}),_.jsx("p",{className:"text-gray-600",children:"Loading PDF..."})]})}):_.jsxs("div",{className:"relative h-full",children:[w&&h&&h.size>NN&&_.jsx(LN,{renderedPages:y,numPages:n}),_.jsx("div",{ref:E,className:"overflow-auto h-full",children:_.jsx(yN,{file:h,onLoadSuccess:V,loading:g,options:RN,children:Array.from(new Array(n),($,M)=>_.jsx("div",{ref:Q=>{P.current[M+1]=Q},className:"mb-4 flex justify-center",children:_.jsxs("div",{className:"relative inline-block",children:[_.jsx(TN,{pageNumber:M+1,scale:c,renderTextLayer:!0,renderAnnotationLayer:!0,onLoadSuccess:G,onClick:Z,onRenderSuccess:j}),t&&I&&t.page===M+1&&T[M+1]&&_.jsx(WP,{boundingBoxes:D,zoom:c,containerWidth:T[M+1].width,containerHeight:T[M+1].height})]})},`page_${M+1}`))})}),n&&_.jsx(GP,{currentPage:a,totalPages:n,scale:c,onPageChange:J,onScaleChange:d,onDownload:ee,onReset:B})]})};function LN({renderedPages:s,numPages:e}){return _.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50 bg-opacity-90 z-50",children:_.jsxs("div",{className:"bg-white shadow-lg rounded-2xl p-6 w-80 text-center",children:[_.jsx("div",{className:"flex justify-center mb-4",children:_.jsx("div",{className:"animate-spin rounded-full h-10 w-10 border-4 border-primary border-t-transparent"})}),_.jsx("h2",{className:"text-lg font-semibold text-gray-800 mb-2",children:"Rendering PDF…"}),_.jsxs("p",{className:"text-sm text-gray-600 mb-3",children:["Page ",s," of ",e]}),_.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2.5 mb-4",children:_.jsx("div",{className:"bg-primary h-2.5 rounded-full transition-all duration-300",style:{width:e&&e>0?`${Math.round(s/e*100)}%`:"0%"}})}),_.jsx("p",{className:"text-xs text-gray-500",children:"Large PDFs or those with heavy images may take longer to render."})]})})}const MN=Object.freeze(Object.defineProperty({__proto__:null,PdfPreviewImpl:IN},Symbol.toStringTag,{value:"Module"})),DN=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),ON=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));