PageSourceSearch

https://siliconheroes.com/assets/index-CF75GXjB.js

js siliconheroes.com collected 2026-10-08 23:43:37 UTC 746,757 bytes, 192 lines download raw bytes

vendor: 4,148 bytes, lines 1-9
1var UC=Object.defineProperty;var Wb=s=>{throw TypeError(s)};var zC=(s,e,t)=>e in s?UC(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var I=(s,e,t)=>zC(s,typeof e!="symbol"?e+"":e,t),a0=(s,e,t)=>e.has(s)||Wb("Cannot "+t);var a=(s,e,t)=>(a0(s,e,"read from private field"),t?t.call(s):e.get(s)),v=(s,e,t)=>e.has(s)?Wb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),g=(s,e,t,n)=>(a0(s,e,"write to private field"),n?n.call(s,t):e.set(s,t),t),S=(s,e,t)=>(a0(s,e,"access private method"),t);var gt=(s,e,t,n)=>({set _(i){g(s,e,i,t)},get _(){return a(s,e,n)}});(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 r of i)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function n(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();var Ds=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function HC(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(n){var i=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return s[n]}})}),t}var G1={exports:{}},Ly={},q1={exports:{}},ce={};/**
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 zp=Symbol.for("react.element"),VC=Symbol.for("react.portal"),WC=Symbol.for("react.fragment"),GC=Symbol.for("react.strict_mode"),qC=Symbol.for("react.profiler"),XC=Symbol.for("react.provider"),KC=Symbol.for("react.context"),YC=Symbol.for("react.forward_ref"),QC=Symbol.for("react.suspense"),JC=Symbol.for("react.memo"),ZC=Symbol.for("react.lazy"),Gb=Symbol.iterator;function eT(s){return s===null||typeof s!="object"?null:(s=Gb&&s[Gb]||s["@@iterator"],typeof s=="function"?s:null)}var X1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},K1=Object.assign,Y1={};function xh(s,e,t){this.props=s,this.context=e,this.refs=Y1,this.updater=t||X1}xh.prototype.isReactComponent={};xh.prototype.setState=function(s,e){if(typeof s!="object"&&typeof s!="function"&&s!=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,s,e,"setState")};xh.prototype.forceUpdate=function(s){this.updater.enqueueForceUpdate(this,s,"forceUpdate")};function Q1(){}Q1.prototype=xh.prototype;function T_(s,e,t){this.props=s,this.context=e,this.refs=Y1,this.updater=t||X1}var P_=T_.prototype=new Q1;P_.constructor=T_;K1(P_,xh.prototype);P_.isPureReactComponent=!0;var qb=Array.isArray,J1=Object.prototype.hasOwnProperty,R_={current:null},Z1={key:!0,ref:!0,__self:!0,__source:!0};function eA(s,e,t){var n,i={},r=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(r=""+e.key),e)J1.call(e,n)&&!Z1.hasOwnProperty(n)&&(i[n]=e[n]);var l=arguments.length-2;if(l===1)i.children=t;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}if(s&&s.defaultProps)for(n in l=s.defaultProps,l)i[n]===void 0&&(i[n]=l[n]);return{$$typeof:zp,type:s,key:r,ref:o,props:i,_owner:R_.current}}function tT(s,e){return{$$typeof:zp,type:s.type,key:e,ref:s.ref,props:s.props,_owner:s._owner}}
vendor: 5,005 bytes, lines 9-17
9function L_(s){return typeof s=="object"&&s!==null&&s.$$typeof===zp}function nT(s){var e={"=":"=0",":":"=2"};return"$"+s.replace(/[=:]/g,function(t){return e[t]})}var Xb=/\/+/g;function l0(s,e){return typeof s=="object"&&s!==null&&s.key!=null?nT(""+s.key):e.toString(36)}function Dg(s,e,t,n,i){var r=typeof s;(r==="undefined"||r==="boolean")&&(s=null);var o=!1;if(s===null)o=!0;else switch(r){case"string":case"number":o=!0;break;case"object":switch(s.$$typeof){case zp:case VC:o=!0}}if(o)return o=s,i=i(o),s=n===""?"."+l0(o,0):n,qb(i)?(t="",s!=null&&(t=s.replace(Xb,"$&/")+"/"),Dg(i,e,t,"",function(u){return u})):i!=null&&(L_(i)&&(i=tT(i,t+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(Xb,"$&/")+"/")+s)),e.push(i)),1;if(o=0,n=n===""?".":n+":",qb(s))for(var l=0;l<s.length;l++){r=s[l];var c=n+l0(r,l);o+=Dg(r,e,t,c,i)}else if(c=eT(s),typeof c=="function")for(s=c.call(s),l=0;!(r=s.next()).done;)r=r.value,c=n+l0(r,l++),o+=Dg(r,e,t,c,i);else if(r==="object")throw e=String(s),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function sg(s,e,t){if(s==null)return s;var n=[],i=0;return Dg(s,n,"","",function(r){return e.call(t,r,i++)}),n}function sT(s){if(s._status===-1){var e=s._result;e=e(),e.then(function(t){(s._status===0||s._status===-1)&&(s._status=1,s._result=t)},function(t){(s._status===0||s._status===-1)&&(s._status=2,s._result=t)}),s._status===-1&&(s._status=0,s._result=e)}if(s._status===1)return s._result.default;throw s._result}var wn={current:null},Mg={transition:null},iT={ReactCurrentDispatcher:wn,ReactCurrentBatchConfig:Mg,ReactCurrentOwner:R_};function tA(){throw Error("act(...) is not supported in production builds of React.")}ce.Children={map:sg,forEach:function(s,e,t){sg(s,function(){e.apply(this,arguments)},t)},count:function(s){var e=0;return sg(s,function(){e++}),e},toArray:function(s){return sg(s,function(e){return e})||[]},only:function(s){if(!L_(s))throw Error("React.Children.only expected to receive a single React element child.");return s}};ce.Component=xh;ce.Fragment=WC;ce.Profiler=qC;ce.PureComponent=T_;ce.StrictMode=GC;ce.Suspense=QC;ce.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=iT;ce.act=tA;ce.cloneElement=function(s,e,t){if(s==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+s+".");var n=K1({},s.props),i=s.key,r=s.ref,o=s._owner;if(e!=null){if(e.ref!==void 0&&(r=e.ref,o=R_.current),e.key!==void 0&&(i=""+e.key),s.type&&s.type.defaultProps)var l=s.type.defaultProps;for(c in e)J1.call(e,c)&&!Z1.hasOwnProperty(c)&&(n[c]=e[c]===void 0&&l!==void 0?l[c]:e[c])}var c=arguments.length-2;if(c===1)n.children=t;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];n.children=l}return{$$typeof:zp,type:s.type,key:i,ref:r,props:n,_owner:o}};ce.createContext=function(s){return s={$$typeof:KC,_currentValue:s,_currentValue2:s,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},s.Provider={$$typeof:XC,_context:s},s.Consumer=s};ce.createElement=eA;ce.createFactory=function(s){var e=eA.bind(null,s);return e.type=s,e};ce.createRef=function(){return{current:null}};ce.forwardRef=function(s){return{$$typeof:YC,render:s}};ce.isValidElement=L_;ce.lazy=function(s){return{$$typeof:ZC,_payload:{_status:-1,_result:s},_init:sT}};ce.memo=function(s,e){return{$$typeof:JC,type:s,compare:e===void 0?null:e}};ce.startTransition=function(s){var e=Mg.transition;Mg.transition={};try{s()}finally{Mg.transition=e}};ce.unstable_act=tA;ce.useCallback=function(s,e){return wn.current.useCallback(s,e)};ce.useContext=function(s){return wn.current.useContext(s)};ce.useDebugValue=function(){};ce.useDeferredValue=function(s){return wn.current.useDeferredValue(s)};ce.useEffect=function(s,e){return wn.current.useEffect(s,e)};ce.useId=function(){return wn.current.useId()};ce.useImperativeHandle=function(s,e,t){return wn.current.useImperativeHandle(s,e,t)};ce.useInsertionEffect=function(s,e){return wn.current.useInsertionEffect(s,e)};ce.useLayoutEffect=function(s,e){return wn.current.useLayoutEffect(s,e)};ce.useMemo=function(s,e){return wn.current.useMemo(s,e)};ce.useReducer=function(s,e,t){return wn.current.useReducer(s,e,t)};ce.useRef=function(s){return wn.current.useRef(s)};ce.useState=function(s){return wn.current.useState(s)};ce.useSyncExternalStore=function(s,e,t){return wn.current.useSyncExternalStore(s,e,t)};ce.useTransition=function(){return wn.current.useTransition()};ce.version="18.3.1";q1.exports=ce;var G=q1.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 rT=G,oT=Symbol.for("react.element"),aT=Symbol.for("react.fragment"),lT=Object.prototype.hasOwnProperty,cT=rT.__SECRET_INT
vendor: 8,863 bytes, lines 17-33
17ERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,uT={key:!0,ref:!0,__self:!0,__source:!0};function nA(s,e,t){var n,i={},r=null,o=null;t!==void 0&&(r=""+t),e.key!==void 0&&(r=""+e.key),e.ref!==void 0&&(o=e.ref);for(n in e)lT.call(e,n)&&!uT.hasOwnProperty(n)&&(i[n]=e[n]);if(s&&s.defaultProps)for(n in e=s.defaultProps,e)i[n]===void 0&&(i[n]=e[n]);return{$$typeof:oT,type:s,key:r,ref:o,props:i,_owner:cT.current}}Ly.Fragment=aT;Ly.jsx=nA;Ly.jsxs=nA;G1.exports=Ly;var T=G1.exports,sA={exports:{}},hs={},iA={exports:{}},rA={};/**
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 */(function(s){function e(M,V){var X=M.length;M.push(V);e:for(;0<X;){var ye=X-1>>>1,Q=M[ye];if(0<i(Q,V))M[ye]=V,M[X]=Q,X=ye;else break e}}function t(M){return M.length===0?null:M[0]}function n(M){if(M.length===0)return null;var V=M[0],X=M.pop();if(X!==V){M[0]=X;e:for(var ye=0,Q=M.length,fe=Q>>>1;ye<fe;){var pt=2*(ye+1)-1,on=M[pt],Mt=pt+1,Be=M[Mt];if(0>i(on,X))Mt<Q&&0>i(Be,on)?(M[ye]=Be,M[Mt]=X,ye=Mt):(M[ye]=on,M[pt]=X,ye=pt);else if(Mt<Q&&0>i(Be,X))M[ye]=Be,M[Mt]=X,ye=Mt;else break e}}return V}function i(M,V){var X=M.sortIndex-V.sortIndex;return X!==0?X:M.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var r=performance;s.unstable_now=function(){return r.now()}}else{var o=Date,l=o.now();s.unstable_now=function(){return o.now()-l}}var c=[],u=[],h=1,d=null,f=3,p=!1,y=!1,_=!1,A=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(M){for(var V=t(u);V!==null;){if(V.callback===null)n(u);else if(V.startTime<=M)n(u),V.sortIndex=V.expirationTime,e(c,V);else break;V=t(u)}}function E(M){if(_=!1,w(M),!y)if(t(c)!==null)y=!0,z(k);else{var V=t(u);V!==null&&H(E,V.startTime-M)}}function k(M,V){y=!1,_&&(_=!1,m(P),P=-1),p=!0;var X=f;try{for(w(V),d=t(c);d!==null&&(!(d.expirationTime>V)||M&&!D());){var ye=d.callback;if(typeof ye=="function"){d.callback=null,f=d.priorityLevel;var Q=ye(d.expirationTime<=V);V=s.unstable_now(),typeof Q=="function"?d.callback=Q:d===t(c)&&n(c),w(V)}else n(c);d=t(c)}if(d!==null)var fe=!0;else{var pt=t(u);pt!==null&&H(E,pt.startTime-V),fe=!1}return fe}finally{d=null,f=X,p=!1}}var x=!1,C=null,P=-1,R=5,L=-1;function D(){return!(s.unstable_now()-L<R)}function F(){if(C!==null){var M=s.unstable_now();L=M;var V=!0;try{V=C(!0,M)}finally{V?Y():(x=!1,C=null)}}else x=!1}var Y;if(typeof b=="function")Y=function(){b(F)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,oe=q.port2;q.port1.onmessage=F,Y=function(){oe.postMessage(null)}}else Y=function(){A(F,0)};function z(M){C=M,x||(x=!0,Y())}function H(M,V){P=A(function(){M(s.unstable_now())},V)}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(){y||p||(y=!0,z(k))},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"):R=0<M?Math.floor(1e3/M):5},s.unstable_getCurrentPriorityLevel=function(){return f},s.unstable_getFirstCallbackNode=function(){return t(c)},s.unstable_next=function(M){switch(f){case 1:case 2:case 3:var V=3;break;default:V=f}var X=f;f=V;try{return M()}finally{f=X}},s.unstable_pauseExecution=function(){},s.unstable_requestPaint=function(){},s.unstable_runWithPriority=function(M,V){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var X=f;f=M;try{return V()}finally{f=X}},s.unstable_scheduleCallback=function(M,V,X){var ye=s.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?ye+X:ye):X=ye,M){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=X+Q,M={id:h++,callback:V,priorityLevel:M,startTime:X,expirationTime:Q,sortIndex:-1},X>ye?(M.sortIndex=X,e(u,M),t(c)===null&&M===t(u)&&(_?(m(P),P=-1):_=!0,H(E,X-ye))):(M.sortIndex=Q,e(c,M),y||p||(y=!0,z(k))),M},s.unstable_shouldYield=D,s.unstable_wrapCallback=function(M){var V=f;return function(){var X=f;f=V;try{return M.apply(this,arguments)}finally{f=X}}}})(rA);iA.exports=rA;var hT=iA.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 dT=G,us=hT;function N(s){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+s,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+s+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var oA=new Set,Pd={};function Zl(s,e){yh(s,e),yh(s+"Capture",e)}function yh(s,e){for(Pd[s]=e,s=0;s<e.length;s++)oA.add(e[s])}var jr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Q0=Object.prototype.hasOwnProperty,fT=/^[: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]*$/,Kb={},Yb={};function pT(s){return Q0.call(Yb,s)?!0:Q0.call(Kb,s)?!1:fT.test(s)?Yb[s]=!0:(Kb[s]=!0,!1)}function gT(s,e,t,n){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:t!==null?!t.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function mT(s,e,t,n){if(e===null||typeof e>"u"||gT(s,e,t,n))return!0;if(n)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function _n(s,e,t,n,i,r,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=s,this.type=e,this.sanitizeURL=r,this.removeEmptyString=o}var qt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){qt[s]=new _n(s,0,!1,s,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var e=s[0];qt[e]=new _n(e,1,!1,s[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(s){qt[s]=new _n(s,2,!1,s.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){qt[s]=new _n(s,2,!1,s,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(s){qt[s]=new _n(s,3,!1,s.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(s){qt[s]=new _n(s,3,!0,s,null,!1,!1)});["capture","download"].forEach(function(s){qt[s]=new _n(s,4,!1,s,null,!1,!1)});["cols","rows","size","span"].forEach(function(s){qt[s]=new _n(s,6,!1,s,null,!1,!1)});["rowSpan","start"].forEach(function(s){qt[s]=new _n(s,5,!1,s.toLowerCase(),null,!1,!1)});var I_=/[\-:]([a-z])/g;function D_(s){return s[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
33-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(s){var e=s.replace(I_,D_);qt[e]=new _n(e,1,!1,s,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var e=s.replace(I_,D_);qt[e]=new _n(e,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(s){var e=s.replace(I_,D_);qt[e]=new _n(e,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(s){qt[s]=new _n(s,1,!1,s.toLowerCase(),null,!1,!1)});qt.xlinkHref=new _n("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(s){qt[s]=new _n(s,1,!1,s.toLowerCase(),null,!0,!0)});function M_(s,e,t,n){var i=qt.hasOwnProperty(e)?qt[e]:null;(i!==null?i.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(mT(e,t,i,n)&&(t=null),n||i===null?pT(e)&&(t===null?s.removeAttribute(e):s.setAttribute(e,""+t)):i.mustUseProperty?s[i.propertyName]=t===null?i.type===3?!1:"":t:(e=i.attributeName,n=i.attributeNamespace,t===null?s.removeAttribute(e):(i=i.type,t=i===3||i===4&&t===!0?"":""+t,n?s.setAttributeNS(n,e,t):s.setAttribute(e,t))))}var Vr=dT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ig=Symbol.for("react.element"),bc=Symbol.for("react.portal"),Sc=Symbol.for("react.fragment"),N_=Symbol.for("react.strict_mode"),J0=Symbol.for("react.profiler"),aA=Symbol.for("react.provider"),lA=Symbol.for("react.context"),O_=Symbol.for("react.forward_ref"),Z0=Symbol.for("react.suspense"),ev=Symbol.for("react.suspense_list"),F_=Symbol.for("react.memo"),Kr=Symbol.for("react.lazy"),cA=Symbol.for("react.offscreen"),Qb=Symbol.iterator;function Lh(s){return s===null||typeof s!="object"?null:(s=Qb&&s[Qb]||s["@@iterator"],typeof s=="function"?s:null)}var Je=Object.assign,c0;function Wh(s){if(c0===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);c0=e&&e[1]||""}return`
34`+c0+s}var u0=!1;function h0(s,e){if(!s||u0)return"";u0=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var n=u}Reflect.construct(s,[],e)}else{try{e.call()}catch(u){n=u}s.call(e.prototype)}else{try{throw Error()}catch(u){n=u}s()}}catch(u){if(u&&n&&typeof u.stack=="string"){for(var i=u.stack.split(`
35`),r=n.stack.split(`
36`),o=i.length-1,l=r.length-1;1<=o&&0<=l&&i[o]!==r[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==r[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==r[l]){var c=`
37`+i[o].replace(" at new "," at ");return s.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",s.displayName)),c}while(1<=o&&0<=l);break}}}finally{u0=!1,Error.prepareStackTrace=t}return(s=s?s.displayName||s.name:"")?Wh(s):""}function yT(s){switch(s.tag){case 5:return Wh(s.type);case 16:return Wh("Lazy");case 13:return Wh("Suspense");case 19:return Wh("SuspenseList");case 0:case 2:case 15:return s=h0(s.type,!1),s;case 11:return s=h0(s.type.render,!1),s;case 1:return s=h0(s.type,!0),s;default:return""}}function tv(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case Sc:return"Fragment";case bc:return"Portal";case J0:return"Profiler";case N_:return"StrictMode";case Z0:return"Suspense";case ev:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case lA:return(s.displayName||"Context")+".Consumer";case aA:return(s._context.displayName||"Context")+".Provider";case O_:var e=s.render;return s=s.displayName,s||(s=e.displayName||e.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case F_:return e=s.displayName||null,e!==null?e:tv(s.type)||"Memo";case Kr:e=s._payload,s=s._init;try{return tv(s(e))}catch{}}return null}function vT(s){var e=s.type;switch(s.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=e.render,s=s.displayName||s.name||"",e.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return tv(e);case 8:return e===N_?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function sa(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function uA(s){var e=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function wT(s){var e=uA(s)?"checked":"value",t=Object.getOwnPropertyDescriptor(s.constructor.prototype,e),n=""+s[e];if(!s.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,r=t.set;return Object.defineProperty(s,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,r.call(this,o)}}),Object.defineProperty(s,e,{enumerable:t.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){s._valueTracker=null,delete s[e]}}}}function rg(s){s._valueTracker||(s._valueTracker=wT(s))}function hA(s){if(!s)return!1;var e=s._valueTracker;if(!e)return!0;var t=e.getValue(),n="";return s&&(n=uA(s)?s.checked?"true":"false":s.value),s=n,s!==t?(e.setValue(s),!0):!1}function xm(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function nv(s,e){var t=e.checked;return Je({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??s._wrapperState.initialChecked})}function Jb(s,e){var t=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;t=sa(e.value!=null?e.value:t),s._wrapperState={initialChecked:n,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function dA(s,e){e=e.checked,e!=null&&M_(s,"checked",e,!1)}function sv(s,e){dA(s,e);var t=sa(e.value),n=e.type;if(t!=null)n==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+t):s.value!==""+t&&(s.value=""+t);else if(n==="submit"||n==="reset"){s.removeAttribute("value");return}e.hasOwnProperty("value")?iv(s,e.type,t):e.hasOwnProperty("defaultValue")&&iv(s,e.type,sa(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(s.defaultChecked=!!e.defaultChecked)}function Zb(s,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+s._wrapperState.initialValue,t||e===s.value||(s.value=e),s.defaultValue=e}t=s.name,t!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,t!==""&&(s.name=t)}function iv(s,e,t){(e!=="number"||xm(s.ownerDocument)!==s)&&(t==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+t&&(s.defaultValue=""+t))}var Gh=Array.isArray;function Bc(s,e,t,n){if(s=s.options,e){e={};for(var i=0;i<t.length;i++)e["$"+t[i]]=!0;for(t=0;t<s.length;t++)i=e.hasOwnProperty("$"+s[t].value),s[t].selected!==i&&(s[t].selected=i),i&&n&&(s[t].defaultSelected=!0)}else{for(t=""+sa(t),e=null,i=0;i<s.length;i++){if(s[i].value===t){s[i].selected=!0,n&&(s[i].defaultSelected=!0);return}e!==null||s[i].disabled||(e=s[i])}e!==null&&(e.selected=!0)}}function rv(s,e){if(e.dangerouslySetInnerHTML!=null)throw Error(N(91));return Je({},e,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function eS(s,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(N(92));if(Gh(t)){if(1<t.length)throw Error(N(93));t=t[0]}e=t}e==null&&(e=""),t=e}s._wrapperState={initialValue:sa(t)}}function fA(s,e){var t=sa(e.value),n=sa(e.defaultValue);t!=null&&(t=""+t,t!==s.value&&(s.value=t),e.defaultValue==null&&s.defaultValue!==t&&(s.defaultValue=t)),n!=null&&(s.defaultValue=""+n)}function tS(s){var e=s.textContent;e===s._wrapperState.initialValue&&e!==""&&e!==null&&(s.value=e)}function pA(s){switch(s){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 ov(s,e){return s==null||s==="http://www.w3.org/1999/xhtml"?pA(e):s==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var og,gA=function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,n,i){MSApp.execUnsafeLocalFunction(function(){return s(e,t,n,i)})}:s}(function(s,e){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=e;else{for(og=og||document.createElement("div"),og.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=og.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;e.firstChild;)s.appendChild(e.firstChild)}});function Rd(s,e){if(e){var t=s.firstChild;if(t&&t===s.lastChild&&t.nodeType===3){t.nodeValue=e;return}}s.textContent=e}var yd={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},_T=["Webkit","ms","Moz","O"];
vendor: 6,768 bytes, line 37
37Object.keys(yd).forEach(function(s){_T.forEach(function(e){e=e+s.charAt(0).toUpperCase()+s.substring(1),yd[e]=yd[s]})});function mA(s,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||yd.hasOwnProperty(s)&&yd[s]?(""+e).trim():e+"px"}function yA(s,e){s=s.style;for(var t in e)if(e.hasOwnProperty(t)){var n=t.indexOf("--")===0,i=mA(t,e[t],n);t==="float"&&(t="cssFloat"),n?s.setProperty(t,i):s[t]=i}}var bT=Je({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 av(s,e){if(e){if(bT[s]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(N(137,s));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(N(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(N(61))}if(e.style!=null&&typeof e.style!="object")throw Error(N(62))}}function lv(s,e){if(s.indexOf("-")===-1)return typeof e.is=="string";switch(s){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 cv=null;function j_(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var uv=null,$c=null,Uc=null;function nS(s){if(s=Wp(s)){if(typeof uv!="function")throw Error(N(280));var e=s.stateNode;e&&(e=Oy(e),uv(s.stateNode,s.type,e))}}function vA(s){$c?Uc?Uc.push(s):Uc=[s]:$c=s}function wA(){if($c){var s=$c,e=Uc;if(Uc=$c=null,nS(s),e)for(s=0;s<e.length;s++)nS(e[s])}}function _A(s,e){return s(e)}function bA(){}var d0=!1;function SA(s,e,t){if(d0)return s(e,t);d0=!0;try{return _A(s,e,t)}finally{d0=!1,($c!==null||Uc!==null)&&(bA(),wA())}}function Ld(s,e){var t=s.stateNode;if(t===null)return null;var n=Oy(t);if(n===null)return null;t=n[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(s=s.type,n=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!n;break e;default:s=!1}if(s)return null;if(t&&typeof t!="function")throw Error(N(231,e,typeof t));return t}var hv=!1;if(jr)try{var Ih={};Object.defineProperty(Ih,"passive",{get:function(){hv=!0}}),window.addEventListener("test",Ih,Ih),window.removeEventListener("test",Ih,Ih)}catch{hv=!1}function ST(s,e,t,n,i,r,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{e.apply(t,u)}catch(h){this.onError(h)}}var vd=!1,km=null,Cm=!1,dv=null,AT={onError:function(s){vd=!0,km=s}};function ET(s,e,t,n,i,r,o,l,c){vd=!1,km=null,ST.apply(AT,arguments)}function xT(s,e,t,n,i,r,o,l,c){if(ET.apply(this,arguments),vd){if(vd){var u=km;vd=!1,km=null}else throw Error(N(198));Cm||(Cm=!0,dv=u)}}function ec(s){var e=s,t=s;if(s.alternate)for(;e.return;)e=e.return;else{s=e;do e=s,e.flags&4098&&(t=e.return),s=e.return;while(s)}return e.tag===3?t:null}function AA(s){if(s.tag===13){var e=s.memoizedState;if(e===null&&(s=s.alternate,s!==null&&(e=s.memoizedState)),e!==null)return e.dehydrated}return null}function sS(s){if(ec(s)!==s)throw Error(N(188))}function kT(s){var e=s.alternate;if(!e){if(e=ec(s),e===null)throw Error(N(188));return e!==s?null:s}for(var t=s,n=e;;){var i=t.return;if(i===null)break;var r=i.alternate;if(r===null){if(n=i.return,n!==null){t=n;continue}break}if(i.child===r.child){for(r=i.child;r;){if(r===t)return sS(i),s;if(r===n)return sS(i),e;r=r.sibling}throw Error(N(188))}if(t.return!==n.return)t=i,n=r;else{for(var o=!1,l=i.child;l;){if(l===t){o=!0,t=i,n=r;break}if(l===n){o=!0,n=i,t=r;break}l=l.sibling}if(!o){for(l=r.child;l;){if(l===t){o=!0,t=r,n=i;break}if(l===n){o=!0,n=r,t=i;break}l=l.sibling}if(!o)throw Error(N(189))}}if(t.alternate!==n)throw Error(N(190))}if(t.tag!==3)throw Error(N(188));return t.stateNode.current===t?s:e}function EA(s){return s=kT(s),s!==null?xA(s):null}function xA(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var e=xA(s);if(e!==null)return e;s=s.sibling}return null}var kA=us.unstable_scheduleCallback,iS=us.unstable_cancelCallback,CT=us.unstable_shouldYield,TT=us.unstable_requestPaint,lt=us.unstable_now,PT=us.unstable_getCurrentPriorityLevel,B_=us.unstable_ImmediatePriority,CA=us.unstable_UserBlockingPriority,Tm=us.unstable_NormalPriority,RT=us.unstable_LowPriority,TA=us.unstable_IdlePriority,Iy=null,ji=null;function LT(s){if(ji&&typeof ji.onCommitFiberRoot=="function")try{ji.onCommitFiberRoot(Iy,s,void 0,(s.current.flags&128)===128)}catch{}}var ri=Math.clz32?Math.clz32:MT,IT=Math.log,DT=Math.LN2;function MT(s){return s>>>=0,s===0?32:31-(IT(s)/DT|0)|0}var ag=64,lg=4194304;function qh(s){switch(s&-s){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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function Pm(s,e){var t=s.pendingLanes;if(t===0)return 0;var n=0,i=s.suspendedLanes,r=s.pingedLanes,o=t&268435455;if(o!==0){var l=o&~i;l!==0?n=qh(l):(r&=o,r!==0&&(n=qh(r)))}else o=t&~i,o!==0?n=qh(o):r!==0&&(n=qh(r));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,r=e&-e,i>=r||i===16&&(r&4194240)!==0))return e;if(n&4&&(n|=t&16),e=s.entangledLanes,e!==0)for(s=s.entanglements,e&=n;0<e;)t=31-ri(e),i=1<<t,n|=s[t],e&=~i;return n}function NT(s,e){switch(s){case 1:case 2:case 4:return e+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 e+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 OT(s,e){for(var t=s.suspendedLanes,n=s.pingedLanes,i=s.expirationTimes,r=s.pendingLanes;0<r;){var o=31-ri(r),l=1<<o,c=i[o];c===-1?(!(l&t)||l&n)&&(i[o]=NT(l,e)):c<=e&&(s.expiredLanes|=l),r&=~l}}function fv(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function PA(){var s=ag;return ag<<=1,!(ag&4194240)&&(ag=64),s}function f0(s){for(var e=[],t=0;31>t;t++)e.push(s);return e}function Hp(s,e,t){s.pendingLanes|=e,e!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,e=31-ri(e),s[e]=t}function FT(s,e){var t=s.pendingLanes&~e;
vendor: 4,148 bytes, line 37
37s.pendingLanes=e,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=e,s.mutableReadLanes&=e,s.entangledLanes&=e,e=s.entanglements;var n=s.eventTimes;for(s=s.expirationTimes;0<t;){var i=31-ri(t),r=1<<i;e[i]=0,n[i]=-1,s[i]=-1,t&=~r}}function $_(s,e){var t=s.entangledLanes|=e;for(s=s.entanglements;t;){var n=31-ri(t),i=1<<n;i&e|s[n]&e&&(s[n]|=e),t&=~i}}var Se=0;function RA(s){return s&=-s,1<s?4<s?s&268435455?16:536870912:4:1}var LA,U_,IA,DA,MA,pv=!1,cg=[],Ko=null,Yo=null,Qo=null,Id=new Map,Dd=new Map,Qr=[],jT="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 rS(s,e){switch(s){case"focusin":case"focusout":Ko=null;break;case"dragenter":case"dragleave":Yo=null;break;case"mouseover":case"mouseout":Qo=null;break;case"pointerover":case"pointerout":Id.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dd.delete(e.pointerId)}}function Dh(s,e,t,n,i,r){return s===null||s.nativeEvent!==r?(s={blockedOn:e,domEventName:t,eventSystemFlags:n,nativeEvent:r,targetContainers:[i]},e!==null&&(e=Wp(e),e!==null&&U_(e)),s):(s.eventSystemFlags|=n,e=s.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),s)}function BT(s,e,t,n,i){switch(e){case"focusin":return Ko=Dh(Ko,s,e,t,n,i),!0;case"dragenter":return Yo=Dh(Yo,s,e,t,n,i),!0;case"mouseover":return Qo=Dh(Qo,s,e,t,n,i),!0;case"pointerover":var r=i.pointerId;return Id.set(r,Dh(Id.get(r)||null,s,e,t,n,i)),!0;case"gotpointercapture":return r=i.pointerId,Dd.set(r,Dh(Dd.get(r)||null,s,e,t,n,i)),!0}return!1}function NA(s){var e=xa(s.target);if(e!==null){var t=ec(e);if(t!==null){if(e=t.tag,e===13){if(e=AA(t),e!==null){s.blockedOn=e,MA(s.priority,function(){IA(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){s.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Ng(s){if(s.blockedOn!==null)return!1;for(var e=s.targetContainers;0<e.length;){var t=gv(s.domEventName,s.eventSystemFlags,e[0],s.nativeEvent);if(t===null){t=s.nativeEvent;var n=new t.constructor(t.type,t);cv=n,t.target.dispatchEvent(n),cv=null}else return e=Wp(t),e!==null&&U_(e),s.blockedOn=t,!1;e.shift()}return!0}function oS(s,e,t){Ng(s)&&t.delete(e)}function $T(){pv=!1,Ko!==null&&Ng(Ko)&&(Ko=null),Yo!==null&&Ng(Yo)&&(Yo=null),Qo!==null&&Ng(Qo)&&(Qo=null),Id.forEach(oS),Dd.forEach(oS)}function Mh(s,e){s.blockedOn===e&&(s.blockedOn=null,pv||(pv=!0,us.unstable_scheduleCallback(us.unstable_NormalPriority,$T)))}function Md(s){function e(i){return Mh(i,s)}if(0<cg.length){Mh(cg[0],s);for(var t=1;t<cg.length;t++){var n=cg[t];n.blockedOn===s&&(n.blockedOn=null)}}for(Ko!==null&&Mh(Ko,s),Yo!==null&&Mh(Yo,s),Qo!==null&&Mh(Qo,s),Id.forEach(e),Dd.forEach(e),t=0;t<Qr.length;t++)n=Qr[t],n.blockedOn===s&&(n.blockedOn=null);for(;0<Qr.length&&(t=Qr[0],t.blockedOn===null);)NA(t),t.blockedOn===null&&Qr.shift()}var zc=Vr.ReactCurrentBatchConfig,Rm=!0;function UT(s,e,t,n){var i=Se,r=zc.transition;zc.transition=null;try{Se=1,z_(s,e,t,n)}finally{Se=i,zc.transition=r}}function zT(s,e,t,n){var i=Se,r=zc.transition;zc.transition=null;try{Se=4,z_(s,e,t,n)}finally{Se=i,zc.transition=r}}function z_(s,e,t,n){if(Rm){var i=gv(s,e,t,n);if(i===null)A0(s,e,n,Lm,t),rS(s,n);else if(BT(i,s,e,t,n))n.stopPropagation();else if(rS(s,n),e&4&&-1<jT.indexOf(s)){for(;i!==null;){var r=Wp(i);if(r!==null&&LA(r),r=gv(s,e,t,n),r===null&&A0(s,e,n,Lm,t),r===i)break;i=r}i!==null&&n.stopPropagation()}else A0(s,e,n,null,t)}}var Lm=null;function gv(s,e,t,n){if(Lm=null,s=j_(n),s=xa(s),s!==null)if(e=ec(s),e===null)s=null;else if(t=e.tag,t===13){if(s=AA(e),s!==null)return s;s=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;s=null}else e!==s&&(s=null);return Lm=s,null}function OA(s){switch(s){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"invali
37d":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(PT()){case B_:return 1;case CA:return 4;case Tm:case RT:return 16;case TA:return 536870912;default:return 16}default:return 16}}var qo=null,H_=null,Og=null;function FA(){if(Og)return Og;var s,e=H_,t=e.length,n,i="value"in qo?qo.value:qo.textContent,r=i.length;for(s=0;s<t&&e[s]===i[s];s++);var o=t-s;for(n=1;n<=o&&e[t-n]===i[r-n];n++);return Og=i.slice(s,1<n?1-n:void 0)}function Fg(s){var e=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&e===13&&(s=13)):s=e,s===10&&(s=13),32<=s||s===13?s:0}function ug(){return!0}function aS(){return!1}function ds(s){function e(t,n,i,r,o){this._reactName=t,this._targetInst=i,this.type=n,this.nativeEvent=r,this.target=o,this.currentTarget=null;for(var l in s)s.hasOwnProperty(l)&&(t=s[l],this[l]=t?t(r):r[l]);return this.isDefaultPrevented=(r.defaultPrevented!=null?r.defaultPrevented:r.returnValue===!1)?ug:aS,this.isPropagationStopped=aS,this}return Je(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=ug)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=ug)},persist:function(){},isPersistent:ug}),e}var kh={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},V_=ds(kh),Vp=Je({},kh,{view:0,detail:0}),HT=ds(Vp),p0,g0,Nh,Dy=Je({},Vp,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:W_,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Nh&&(Nh&&s.type==="mousemove"?(p0=s.screenX-Nh.screenX,g0=s.screenY-Nh.screenY):g0=p0=0,Nh=s),p0)},movementY:function(s){return"movementY"in s?s.movementY:g0}}),lS=ds(Dy),VT=Je({},Dy,{dataTransfer:0}),WT=ds(VT),GT=Je({},Vp,{relatedTarget:0}),m0=ds(GT),qT=Je({},kh,{animationName:0,elapsedTime:0,pseudoElement:0}),XT=ds(qT),KT=Je({},kh,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),YT=ds(KT),QT=Je({},kh,{data:0}),cS=ds(QT),JT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ZT={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"},eP={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tP(s){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(s):(s=eP[s])?!!e[s]:!1}function W_(){return tP}var nP=Je({},Vp,{key:function(s){if(s.key){var e=JT[s.key]||s.key;if(e!=="Unidentified")return e}
vendor: 5,708 bytes, line 37
37return s.type==="keypress"?(s=Fg(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?ZT[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:W_,charCode:function(s){return s.type==="keypress"?Fg(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Fg(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),sP=ds(nP),iP=Je({},Dy,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),uS=ds(iP),rP=Je({},Vp,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:W_}),oP=ds(rP),aP=Je({},kh,{propertyName:0,elapsedTime:0,pseudoElement:0}),lP=ds(aP),cP=Je({},Dy,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),uP=ds(cP),hP=[9,13,27,32],G_=jr&&"CompositionEvent"in window,wd=null;jr&&"documentMode"in document&&(wd=document.documentMode);var dP=jr&&"TextEvent"in window&&!wd,jA=jr&&(!G_||wd&&8<wd&&11>=wd),hS=" ",dS=!1;function BA(s,e){switch(s){case"keyup":return hP.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $A(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Ac=!1;function fP(s,e){switch(s){case"compositionend":return $A(e);case"keypress":return e.which!==32?null:(dS=!0,hS);case"textInput":return s=e.data,s===hS&&dS?null:s;default:return null}}function pP(s,e){if(Ac)return s==="compositionend"||!G_&&BA(s,e)?(s=FA(),Og=H_=qo=null,Ac=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return jA&&e.locale!=="ko"?null:e.data;default:return null}}var gP={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 fS(s){var e=s&&s.nodeName&&s.nodeName.toLowerCase();return e==="input"?!!gP[s.type]:e==="textarea"}function UA(s,e,t,n){vA(n),e=Im(e,"onChange"),0<e.length&&(t=new V_("onChange","change",null,t,n),s.push({event:t,listeners:e}))}var _d=null,Nd=null;function mP(s){JA(s,0)}function My(s){var e=kc(s);if(hA(e))return s}function yP(s,e){if(s==="change")return e}var zA=!1;if(jr){var y0;if(jr){var v0="oninput"in document;if(!v0){var pS=document.createElement("div");pS.setAttribute("oninput","return;"),v0=typeof pS.oninput=="function"}y0=v0}else y0=!1;zA=y0&&(!document.documentMode||9<document.documentMode)}function gS(){_d&&(_d.detachEvent("onpropertychange",HA),Nd=_d=null)}function HA(s){if(s.propertyName==="value"&&My(Nd)){var e=[];UA(e,Nd,s,j_(s)),SA(mP,e)}}function vP(s,e,t){s==="focusin"?(gS(),_d=e,Nd=t,_d.attachEvent("onpropertychange",HA)):s==="focusout"&&gS()}function wP(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return My(Nd)}function _P(s,e){if(s==="click")return My(e)}function bP(s,e){if(s==="input"||s==="change")return My(e)}function SP(s,e){return s===e&&(s!==0||1/s===1/e)||s!==s&&e!==e}var ai=typeof Object.is=="function"?Object.is:SP;function Od(s,e){if(ai(s,e))return!0;if(typeof s!="object"||s===null||typeof e!="object"||e===null)return!1;var t=Object.keys(s),n=Object.keys(e);if(t.length!==n.length)return!1;for(n=0;n<t.length;n++){var i=t[n];if(!Q0.call(e,i)||!ai(s[i],e[i]))return!1}return!0}function mS(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function yS(s,e){var t=mS(s);s=0;for(var n;t;){if(t.nodeType===3){if(n=s+t.textContent.length,s<=e&&n>=e)return{node:t,offset:e-s};s=n}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=mS(t)}}function VA(s,e){return s&&e?s===e?!0:s&&s.nodeType===3?!1:e&&e.nodeType===3?VA(s,e.parentNode):"contains"in s?s.contains(e):s.compareDocumentPosition?!!(s.compareDocumentPosition(e)&16):!1:!1}function WA(){for(var s=window,e=xm();e instanceof s.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)s=e.contentWindow;else break;e=xm(s.document)}return e}function q_(s){var e=s&&s.nodeName&&s.nodeName.toLowerCase();return e&&(e==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||e==="textarea"||s.contentEditable==="true")}function AP(s){var e=WA(),t=s.focusedElem,n=s.selectionRange;if(e!==t&&t&&t.ownerDocument&&VA(t.ownerDocument.documentElement,t)){if(n!==null&&q_(t)){if(e=n.start,s=n.end,s===void 0&&(s=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(s,t.value.length);else if(s=(e=t.ownerDocument||document)&&e.defaultView||window,s.getSelection){s=s.getSelection();var i=t.textContent.length,r=Math.min(n.start,i);n=n.end===void 0?r:Math.min(n.end,i),!s.extend&&r>n&&(i=n,n=r,r=i),i=yS(t,r);var o=yS(t,n);i&&o&&(s.rangeCount!==1||s.anchorNode!==i.node||s.anchorOffset!==i.offset||s.focusNode!==o.node||s.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),s.removeAllRanges(),r>n?(s.addRange(e),s.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),s.addRange(e)))}}for(e=[],s=t;s=s.parentNode;)s.nodeType===1&&e.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)s=e[t],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var EP=jr&&"documentMode"in document&&11>=document.documentMode,Ec=null,mv=null,bd=null,yv=!1;
vendor: 4,821 bytes, line 37
37function vS(s,e,t){var n=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;yv||Ec==null||Ec!==xm(n)||(n=Ec,"selectionStart"in n&&q_(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),bd&&Od(bd,n)||(bd=n,n=Im(mv,"onSelect"),0<n.length&&(e=new V_("onSelect","select",null,e,t),s.push({event:e,listeners:n}),e.target=Ec)))}function hg(s,e){var t={};return t[s.toLowerCase()]=e.toLowerCase(),t["Webkit"+s]="webkit"+e,t["Moz"+s]="moz"+e,t}var xc={animationend:hg("Animation","AnimationEnd"),animationiteration:hg("Animation","AnimationIteration"),animationstart:hg("Animation","AnimationStart"),transitionend:hg("Transition","TransitionEnd")},w0={},GA={};jr&&(GA=document.createElement("div").style,"AnimationEvent"in window||(delete xc.animationend.animation,delete xc.animationiteration.animation,delete xc.animationstart.animation),"TransitionEvent"in window||delete xc.transitionend.transition);function Ny(s){if(w0[s])return w0[s];if(!xc[s])return s;var e=xc[s],t;for(t in e)if(e.hasOwnProperty(t)&&t in GA)return w0[s]=e[t];return s}var qA=Ny("animationend"),XA=Ny("animationiteration"),KA=Ny("animationstart"),YA=Ny("transitionend"),QA=new Map,wS="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 la(s,e){QA.set(s,e),Zl(e,[s])}for(var _0=0;_0<wS.length;_0++){var b0=wS[_0],xP=b0.toLowerCase(),kP=b0[0].toUpperCase()+b0.slice(1);la(xP,"on"+kP)}la(qA,"onAnimationEnd");la(XA,"onAnimationIteration");la(KA,"onAnimationStart");la("dblclick","onDoubleClick");la("focusin","onFocus");la("focusout","onBlur");la(YA,"onTransitionEnd");yh("onMouseEnter",["mouseout","mouseover"]);yh("onMouseLeave",["mouseout","mouseover"]);yh("onPointerEnter",["pointerout","pointerover"]);yh("onPointerLeave",["pointerout","pointerover"]);Zl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Zl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Zl("onBeforeInput",["compositionend","keypress","textInput","paste"]);Zl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Zl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Zl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xh="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(" "),CP=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xh));function _S(s,e,t){var n=s.type||"unknown-event";s.currentTarget=t,xT(n,e,void 0,s),s.currentTarget=null}function JA(s,e){e=(e&4)!==0;for(var t=0;t<s.length;t++){var n=s[t],i=n.event;n=n.listeners;e:{var r=void 0;if(e)for(var o=n.length-1;0<=o;o--){var l=n[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==r&&i.isPropagationStopped())break e;_S(i,l,u),r=c}else for(o=0;o<n.length;o++){if(l=n[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==r&&i.isPropagationStopped())break e;_S(i,l,u),r=c}}}if(Cm)throw s=dv,Cm=!1,dv=null,s}function $e(s,e){var t=e[Sv];t===void 0&&(t=e[Sv]=new Set);var n=s+"__bubble";t.has(n)||(ZA(e,s,2,!1),t.add(n))}function S0(s,e,t){var n=0;e&&(n|=4),ZA(t,s,n,e)}var dg="_reactListening"+Math.random().toString(36).slice(2);function Fd(s){if(!s[dg]){s[dg]=!0,oA.forEach(function(t){t!=="selectionchange"&&(CP.has(t)||S0(t,!1,s),S0(t,!0,s))});var e=s.nodeType===9?s:s.ownerDocument;e===null||e[dg]||(e[dg]=!0,S0("selectionchange",!1,e))}}function ZA(s,e,t,n){switch(OA(e)){case 1:var i=UT;break;case 4:i=zT;break;default:i=z_}t=i.bind(null,e,t,s),i=void 0,!hv||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),n?i!==void 0?s.addEventListener(e,t,{capture:!0,passive:i}):s.addEventListener(e,t,!0):i!==void 0?s.addEventListener(e,t,{passive:i}):s.addEventListener(e,t,!1)}function A0(s,e,t,n,i){var r=n;if(!(e&1)&&!(e&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var l=n.stateNode.containerInfo;
vendor: 22,617 bytes, lines 37-38
37if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=n.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;l!==null;){if(o=xa(l),o===null)return;if(c=o.tag,c===5||c===6){n=r=o;continue e}l=l.parentNode}}n=n.return}SA(function(){var u=r,h=j_(t),d=[];e:{var f=QA.get(s);if(f!==void 0){var p=V_,y=s;switch(s){case"keypress":if(Fg(t)===0)break e;case"keydown":case"keyup":p=sP;break;case"focusin":y="focus",p=m0;break;case"focusout":y="blur",p=m0;break;case"beforeblur":case"afterblur":p=m0;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=lS;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=WT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=oP;break;case qA:case XA:case KA:p=XT;break;case YA:p=lP;break;case"scroll":p=HT;break;case"wheel":p=uP;break;case"copy":case"cut":case"paste":p=YT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=uS}var _=(e&4)!==0,A=!_&&s==="scroll",m=_?f!==null?f+"Capture":null:f;_=[];for(var b=u,w;b!==null;){w=b;var E=w.stateNode;if(w.tag===5&&E!==null&&(w=E,m!==null&&(E=Ld(b,m),E!=null&&_.push(jd(b,E,w)))),A)break;b=b.return}0<_.length&&(f=new p(f,y,null,t,h),d.push({event:f,listeners:_}))}}if(!(e&7)){e:{if(f=s==="mouseover"||s==="pointerover",p=s==="mouseout"||s==="pointerout",f&&t!==cv&&(y=t.relatedTarget||t.fromElement)&&(xa(y)||y[Br]))break e;if((p||f)&&(f=h.window===h?h:(f=h.ownerDocument)?f.defaultView||f.parentWindow:window,p?(y=t.relatedTarget||t.toElement,p=u,y=y?xa(y):null,y!==null&&(A=ec(y),y!==A||y.tag!==5&&y.tag!==6)&&(y=null)):(p=null,y=u),p!==y)){if(_=lS,E="onMouseLeave",m="onMouseEnter",b="mouse",(s==="pointerout"||s==="pointerover")&&(_=uS,E="onPointerLeave",m="onPointerEnter",b="pointer"),A=p==null?f:kc(p),w=y==null?f:kc(y),f=new _(E,b+"leave",p,t,h),f.target=A,f.relatedTarget=w,E=null,xa(h)===u&&(_=new _(m,b+"enter",y,t,h),_.target=w,_.relatedTarget=A,E=_),A=E,p&&y)t:{for(_=p,m=y,b=0,w=_;w;w=ic(w))b++;for(w=0,E=m;E;E=ic(E))w++;for(;0<b-w;)_=ic(_),b--;for(;0<w-b;)m=ic(m),w--;for(;b--;){if(_===m||m!==null&&_===m.alternate)break t;_=ic(_),m=ic(m)}_=null}else _=null;p!==null&&bS(d,f,p,_,!1),y!==null&&A!==null&&bS(d,A,y,_,!0)}}e:{if(f=u?kc(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var k=yP;else if(fS(f))if(zA)k=bP;else{k=wP;var x=vP}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(k=_P);if(k&&(k=k(s,u))){UA(d,k,t,h);break e}x&&x(s,f,u),s==="focusout"&&(x=f._wrapperState)&&x.controlled&&f.type==="number"&&iv(f,"number",f.value)}switch(x=u?kc(u):window,s){case"focusin":(fS(x)||x.contentEditable==="true")&&(Ec=x,mv=u,bd=null);break;case"focusout":bd=mv=Ec=null;break;case"mousedown":yv=!0;break;case"contextmenu":case"mouseup":case"dragend":yv=!1,vS(d,t,h);break;case"selectionchange":if(EP)break;case"keydown":case"keyup":vS(d,t,h)}var C;if(G_)e:{switch(s){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Ac?BA(s,t)&&(P="onCompositionEnd"):s==="keydown"&&t.keyCode===229&&(P="onCompositionStart");P&&(jA&&t.locale!=="ko"&&(Ac||P!=="onCompositionStart"?P==="onCompositionEnd"&&Ac&&(C=FA()):(qo=h,H_="value"in qo?qo.value:qo.textContent,Ac=!0)),x=Im(u,P),0<x.length&&(P=new cS(P,s,null,t,h),d.push({event:P,listeners:x}),C?P.data=C:(C=$A(t),C!==null&&(P.data=C)))),(C=dP?fP(s,t):pP(s,t))&&(u=Im(u,"onBeforeInput"),0<u.length&&(h=new cS("onBeforeInput","beforeinput",null,t,h),d.push({event:h,listeners:u}),h.data=C))}JA(d,e)})}function jd(s,e,t){return{instance:s,listener:e,currentTarget:t}}function Im(s,e){for(var t=e+"Capture",n=[];s!==null;){var i=s,r=i.stateNode;i.tag===5&&r!==null&&(i=r,r=Ld(s,t),r!=null&&n.unshift(jd(s,r,i)),r=Ld(s,e),r!=null&&n.push(jd(s,r,i))),s=s.return}return n}function ic(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function bS(s,e,t,n,i){for(var r=e._reactName,o=[];t!==null&&t!==n;){var l=t,c=l.alternate,u=l.stateNode;if(c!==null&&c===n)break;l.tag===5&&u!==null&&(l=u,i?(c=Ld(t,r),c!=null&&o.unshift(jd(t,c,l))):i||(c=Ld(t,r),c!=null&&o.push(jd(t,c,l)))),t=t.return}o.length!==0&&s.push({event:e,listeners:o})}var TP=/\r\n?/g,PP=/\u0000|\uFFFD/g;function SS(s){return(typeof s=="string"?s:""+s).replace(TP,`
38`).replace(PP,"")}function fg(s,e,t){if(e=SS(e),SS(s)!==e&&t)throw Error(N(425))}function Dm(){}var vv=null,wv=null;function _v(s,e){return s==="textarea"||s==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var bv=typeof setTimeout=="function"?setTimeout:void 0,RP=typeof clearTimeout=="function"?clearTimeout:void 0,AS=typeof Promise=="function"?Promise:void 0,LP=typeof queueMicrotask=="function"?queueMicrotask:typeof AS<"u"?function(s){return AS.resolve(null).then(s).catch(IP)}:bv;function IP(s){setTimeout(function(){throw s})}function E0(s,e){var t=e,n=0;do{var i=t.nextSibling;if(s.removeChild(t),i&&i.nodeType===8)if(t=i.data,t==="/$"){if(n===0){s.removeChild(i),Md(e);return}n--}else t!=="$"&&t!=="$?"&&t!=="$!"||n++;t=i}while(t);Md(e)}function Jo(s){for(;s!=null;s=s.nextSibling){var e=s.nodeType;if(e===1||e===3)break;if(e===8){if(e=s.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return s}function ES(s){s=s.previousSibling;for(var e=0;s;){if(s.nodeType===8){var t=s.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return s;e--}else t==="/$"&&e++}s=s.previousSibling}return null}var Ch=Math.random().toString(36).slice(2),Fi="__reactFiber$"+Ch,Bd="__reactProps$"+Ch,Br="__reactContainer$"+Ch,Sv="__reactEvents$"+Ch,DP="__reactListeners$"+Ch,MP="__reactHandles$"+Ch;function xa(s){var e=s[Fi];if(e)return e;for(var t=s.parentNode;t;){if(e=t[Br]||t[Fi]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(s=ES(s);s!==null;){if(t=s[Fi])return t;s=ES(s)}return e}s=t,t=s.parentNode}return null}function Wp(s){return s=s[Fi]||s[Br],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function kc(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(N(33))}function Oy(s){return s[Bd]||null}var Av=[],Cc=-1;function ca(s){return{current:s}}function ze(s){0>Cc||(s.current=Av[Cc],Av[Cc]=null,Cc--)}function Fe(s,e){Cc++,Av[Cc]=s.current,s.current=e}var ia={},rn=ca(ia),Nn=ca(!1),Wl=ia;function vh(s,e){var t=s.type.contextTypes;if(!t)return ia;var n=s.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},r;for(r in t)i[r]=e[r];return n&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=e,s.__reactInternalMemoizedMaskedChildContext=i),i}function On(s){return s=s.childContextTypes,s!=null}function Mm(){ze(Nn),ze(rn)}function xS(s,e,t){if(rn.current!==ia)throw Error(N(168));Fe(rn,e),Fe(Nn,t)}function eE(s,e,t){var n=s.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return t;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(N(108,vT(s)||"Unknown",i));return Je({},t,n)}function Nm(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||ia,Wl=rn.current,Fe(rn,s),Fe(Nn,Nn.current),!0}function kS(s,e,t){var n=s.stateNode;if(!n)throw Error(N(169));t?(s=eE(s,e,Wl),n.__reactInternalMemoizedMergedChildContext=s,ze(Nn),ze(rn),Fe(rn,s)):ze(Nn),Fe(Nn,t)}var Yi=null,Fy=!1,x0=!1;function tE(s){Yi===null?Yi=[s]:Yi.push(s)}function NP(s){Fy=!0,tE(s)}function ua(){if(!x0&&Yi!==null){x0=!0;var s=0,e=Se;try{var t=Yi;for(Se=1;s<t.length;s++){var n=t[s];do n=n(!0);while(n!==null)}Yi=null,Fy=!1}catch(i){throw Yi!==null&&(Yi=Yi.slice(s+1)),kA(B_,ua),i}finally{Se=e,x0=!1}}return null}var Tc=[],Pc=0,Om=null,Fm=0,Cs=[],Ts=0,Gl=null,Ir=1,Dr="";function ga(s,e){Tc[Pc++]=Fm,Tc[Pc++]=Om,Om=s,Fm=e}function nE(s,e,t){Cs[Ts++]=Ir,Cs[Ts++]=Dr,Cs[Ts++]=Gl,Gl=s;var n=Ir;s=Dr;var i=32-ri(n)-1;n&=~(1<<i),t+=1;var r=32-ri(e)+i;if(30<r){var o=i-i%5;r=(n&(1<<o)-1).toString(32),n>>=o,i-=o,Ir=1<<32-ri(e)+i|t<<i|n,Dr=r+s}else Ir=1<<r|t<<i|n,Dr=s}function X_(s){s.return!==null&&(ga(s,1),nE(s,1,0))}function K_(s){for(;s===Om;)Om=Tc[--Pc],Tc[Pc]=null,Fm=Tc[--Pc],Tc[Pc]=null;for(;s===Gl;)Gl=Cs[--Ts],Cs[Ts]=null,Dr=Cs[--Ts],Cs[Ts]=null,Ir=Cs[--Ts],Cs[Ts]=null}var ls=null,as=null,Ge=!1,ni=null;function sE(s,e){var t=Rs(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=s,e=s.deletions,e===null?(s.deletions=[t],s.flags|=16):e.push(t)}function CS(s,e){switch(s.tag){case 5:var t=s.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(s.stateNode=e,ls=s,as=Jo(e.firstChild),!0):!1;case 6:return e=s.pendingProps===""||e.nodeType!==3?null:e,e!==null?(s.stateNode=e,ls=s,as=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=Gl!==null?{id:Ir,overflow:Dr}:null,s.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=Rs(18,null,null,0),t.stateNode=e,t.return=s,s.child=t,ls=s,as=null,!0):!1;default:return!1}}function Ev(s){return(s.mode&1)!==0&&(s.flags&128)===0}function xv(s){if(Ge){var e=as;if(e){var t=e;if(!CS(s,e)){if(Ev(s))throw Error(N(418));e=Jo(t.nextSibling);var n=ls;e&&CS(s,e)?sE(n,t):(s.flags=s.flags&-4097|2,Ge=!1,ls=s)}}else{if(Ev(s))throw Error(N(418));s.flags=s.flags&-4097|2,Ge=!1,ls=s}}}function TS(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;ls=s}function pg(s){if(s!==ls)return!1;if(!Ge)return TS(s),Ge=!0,!1;var e;if((e=s.tag!==3)&&!(e=s.tag!==5)&&(e=s.type,e=e!=="head"&&e!=="body"&&!_v(s.type,s.memoizedProps)),e&&(e=as)){if(Ev(s))throw iE(),Error(N(418));for(;e;)sE(s,e),e=Jo(e.nextSibling)}if(TS(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(N(317));e:{for(s=s.nextSibling,e=0;s;){if(s.nodeType===8){var t=s.data;if(t==="/$"){if(e===0){as=Jo(s.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}s=s.nextSibling}as=null}}else as=ls?Jo(s.stateNode.nextSibling):null;return!0}function iE(){for(var s=as;s;)s=Jo(s.nextSibling)}function wh(){as=ls=null,Ge=!1}function Y_(s){ni===null?ni=[s]:ni.push(s)}var OP=Vr.ReactCurrentBatchConfig;function Oh(s,e,t){if(s=t.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(N(309));var n=t.stateNode}if(!n)throw Error(N(147,s));var i=n,r=""+s;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===r?e.ref:(e=function(o){var l=i.refs;o===null?delete l[r]:l[r]=o},e._stringRef=r,e)}if(typeof s!="string")throw Error(N(284));if(!t._owner)throw Error(N(290,s))}return s}function gg(s,e){throw s=Object.prototype.toString.call(e),Error(N(31,s==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":s))}function PS(s){var e=s._init;return e(s._payload)}function rE(s){function e(m,b){if(s){var w=m.deletions;w===null?(m.deletions=[b],m.flags|=16):w.push(b)}}function t(m,b){if(!s)return null;for(;b!==null;)e(m,b),b=b.sibling;return null}function n(m,b){for(m=new Map;b!==null;)b.key!==null?m.set(b.key,b):m.set(b.index,b),b=b.sibling;return m}function i(m,b){return m=na(m,b),m.index=0,m.sibling=null,m}function r(m,b,w){return m.index=w,s?(w=m.alternate,w!==null?(w=w.index,w<b?(m.flags|=2,b):w):(m.flags|=2,b)):(m.flags|=1048576,b)}function o(m){return s&&m.alternate===null&&(m.flags|=2),m}function l(m,b,w,E){return b===null||b.tag!==6?(b=I0(w,m.mode,E),b.return=m,b):(b=i(b,w),b.return=m,b)}function c(m,b,w,E){var k=w.type;return k===Sc?h(m,b,w.props.children,E,w.key):b!==null&&(b.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Kr&&PS(k)===b.type)?(E=i(b,w.props),E.ref=Oh(m,b,w),E.return=m,E):(E=Vg(w.type,w.key,w.props,null,m.mode,E),E.ref=Oh(m,b,w),E.return=m,E)}function u(m,b,w,E){return b===null||b.tag!==4||b.stateNode.containerInfo!==w.containerInfo||b.stateNode.implementation!==w.implementation?(b=D0(w,m.mode,E),b.return=m,b):(b=i(b,w.children||[]),b.return=m,b)}function h(m,b,w,E,k){return b===null||b.tag!==7?(b=Vl(w,m.mode,E,k),b.return=m,b):(b=i(b,w),b.return=m,b)}function d(m,b,w){if(typeof b=="string"&&b!==""||typeof b=="number")return b=I0(""+b,m.mode,w),b.return=m,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case ig:return w=Vg(b.type,b.key,b.props,null,m.mode,w),w.ref=Oh(m,null,b),w.return=m,w;case bc:return b=D0(b,m.mode,w),b.return=m,b;case Kr:var E=b._init;return d(m,E(b._payload),w)}if(Gh(b)||Lh(b))return b=Vl(b,m.mode,w,null),b.return=m,b;gg(m,b)}return null}function f(m,b,w,E){var k=b!==null?b.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return k!==null?null:l(m,b,""+w,E);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case ig:return w.key===k?c(m,b,w,E):null;case bc:return w.key===k?u(m,b,w,E):null;case Kr:return k=w._init,f(m,b,k(w._payload),E)}if(Gh(w)||Lh(w))return k!==null?null:h(m,b,w,E,null);gg(m,w)}return null}function p(m,b,w,E,k){if(typeof E=="string"&&E!==""||typeof E=="number")return m=m.get(w)||null,l(b,m,""+E,k);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case ig:return m=m.get(E.key===null?w:E.key)||null,c(b,m,E,k);case bc:return m=m.get(E.key===null?w:E.key)||null,u(b,m,E,k);case Kr:var x=E._init;return p(m,b,w,x(E._payload),k)}if(Gh(E)||Lh(E))return m=m.get(w)||null,h(b,m,E,k,null);gg(b,E)}return null}function y(m,b,w,E){for(var k=null,x=null,C=b,P=b=0,R=null;C!==null&&P<w.length;P++){C.index>P?(R=C,C=null):R=C.sibling;var L=f(m,C,w[P],E);if(L===null){C===null&&(C=R);break}s&&C&&L.alternate===null&&e(m,C),b=r(L,b,P),x===null?k=L:x.sibling=L,x=L,C=R}if(P===w.length)return t(m,C),Ge&&ga(m,P),k;if(C===null){for(;P<w.length;P++)C=d(m,w[P],E),C!==null&&(b=r(C,b,P),x===null?k=C:x.sibling=C,x=C);return Ge&&ga(m,P),k}for(C=n(m,C);P<w.length;P++)R=p(C,m,P,w[P],E),R!==null&&(s&&R.alternate!==null&&C.delete(R.key===null?P:R.key),b=r(R,b,P),x===null?k=R:x.sibling=R,x=R);return s&&C.forEach(function(D){return e(m,D)}),Ge&&ga(m,P),k}function _(m,b,w,E){var k=Lh(w);if(typeof k!="function")throw Error(N(150));if(w=k.call(w),w==null)throw Error(N(151));for(var x=k=null,C=b,P=b=0,R=null,L=w.next();C!==null&&!L.done;P++,L=w.next()){C.index>P?(R=C,C=null):R=C.sibling;var D=f(m,C,L.value,E);if(D===null){C===null&&(C=R);break}s&&C&&D.alternate===null&&e(m,C),b=r(D,b,P),x===null?k=D:x.sibling=D,x=D,C=R}if(L.done)return t(m,C),Ge&&ga(m,P),k;if(C===null){for(;!L.done;P++,L=w.next())L=d(m,L.value,E),L!==null&&(b=r(L,b,P),x===null?k=L:x.sibling=L,x=L);return Ge&&ga(m,P),k}for(C=n(m,C);!L.done;P++,L=w.next())L=p(C,m,P,L.value,E),L!==null&&(s&&L.alternate!==null&&C.delete(L.key===null?P:L.key),b=r(L,b,P),x===null?k=L:x.sibling=L,x=L);return s&&C.forEach(function(F){return e(m,F)}),Ge&&ga(m,P),k}function A(m,b,w,E){if(typeof w=="object"&&w!==null&&w.type===Sc&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case ig:e:{for(var k=w.key,x=b;x!==null;){if(x.key===k){if(k=w.type,k===Sc){if(x.tag===7){t(m,x.sibling),b=i(x,w.props.children),b.return=m,m=b;break e}}else if(x.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Kr&&PS(k)===x.type){t(m,x.sibling),b=i(x,w.props),b.ref=Oh(m,x,w),b.return=m,m=b;break e}t(m,x);break}else e(m,x);x=x.sibling}w.type===Sc?(b=Vl(w.props.children,m.mode,E,w.key),b.return=m,m=b):(E=Vg(w.type,w.key,w.props,null,m.mode,E),E.ref=Oh(m,b,w),E.return=m,m=E)}return o(m);case bc:e:{for(x=w.key;b!==null;){if(b.key===x)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){t(m,b.sibling),b=i(b,w.children||[]),b.return=m,m=b;break e}else{t(m,b);break}else e(m,b);b=b.sibling}b=D0(w,m.mode,E),b.return=m,m=b}return o(m);case Kr:return x=w._init,A(m,b,x(w._payload),E)}if(Gh(w))return y(m,b,w,E);if(Lh(w))return _(m,b,w,E);gg(m,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(t(m,b.sibling),b=i(b,w),b.return=m,m=b):(t(m,b),b=I0(w,m.mode,E),b.return=m,m=b),o(m)):t(m,b)}return A}var _h=rE(!0),oE=rE(!1),jm=ca(null),Bm=null,Rc=null,Q_=null;function J_(){Q_=Rc=Bm=null}function Z_(s){var e=jm.current;ze(jm),s._currentValue=e}function kv(s,e,t){for(;s!==null;){var n=s.alternate;if((s.childLanes&e)!==e?(s.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),s===t)break;s=s.return}}function Hc(s,e){Bm=s,Q_=Rc=null,s=s.dependencies,s!==null&&s.firstContext!==null&&(s.lanes&e&&(Mn=!0),s.firstContext=null)}function Ms(s){var e=s._currentValue;if(Q_!==s)if(s={context:s,memoizedValue:e,next:null},Rc===null){if(Bm===null)throw Error(N(308));Rc=s,Bm.dependencies={lanes:0,firstContext:s}}else Rc=Rc.next=s;return e}var ka=null;function eb(s){ka===null?ka=[s]:ka.push(s)}function aE(s,e,t,n){var i=e.interleaved;return i===null?(t.next=t,eb(e)):(t.next=i.next,i.next=t),e.interleaved=t,$r(s,n)}function $r(s,e){s.lanes|=e;var t=s.alternate;for(t!==null&&(t.lanes|=e),t=s,s=s.return;s!==null;)s.childLanes|=e,t=s.alternate,t!==null&&(t.childLanes|=e),t=s,s=s.return;return t.tag===3?t.stateNode:null}var Yr=!1;function tb(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lE(s,e){s=s.updateQueue,e.updateQueue===s&&(e.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Mr(s,e){return{eventTime:s,lane:e,tag:0,payload:null,callback:null,next:null}}function Zo(s,e,t){var n=s.updateQueue;if(n===null)return null;if(n=n.shared,pe&2){var i=n.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),n.pending=e,$r(s,t)}return i=n.interleaved,i===null?(e.next=e,eb(n)):(e.next=i.next,i.next=e),n.interleaved=e,$r(s,t)}function jg(s,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var n=e.lanes;n&=s.pendingLanes,t|=n,e.lanes=t,$_(s,t)}}function RS(s,e){var t=s.updateQueue,n=s.alternate;if(n!==null&&(n=n.updateQueue,t===n)){var i=null,r=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};r===null?i=r=o:r=r.next=o,t=t.next}while(t!==null);r===null?i=r=e:r=r.next=e}else i=r=e;t={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:r,shared:n.shared,effects:n.effects},s.updateQueue=t;return}s=t.lastBaseUpdate,s===null?t.firstBaseUpdate=e:s.next=e,t.lastBaseUpdate=e}function $m(s,e,t,n){var i=s.updateQueue;Yr=!1;var r=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?r=u:o.next=u,o=c;var h=s.alternate;h!==null&&(h=h.updateQueue,l=h.lastBaseUpdate,l!==o&&(l===null?h.firstBaseUpdate=u:l.next=u,h.lastBaseUpdate=c))}if(r!==null){var d=i.baseState;o=0,h=u=c=null,l=r;do{var f=l.lane,p=l.eventTime;if((n&f)===f){h!==null&&(h=h.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=s,_=l;switch(f=e,p=t,_.tag){case 1:if(y=_.payload,typeof y=="function"){d=y.call(p,d,f);break e}d=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=_.payload,f=typeof y=="function"?y.call(p,d,f):y,f==null)break e;d=Je({},d,f);break e;case 2:Yr=!0}}l.callback!==null&&l.lane!==0&&(s.flags|=64,f=i.effects,f===null?i.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(u=h=p,c=d):h=h.next=p,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;f=l,l=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(h===null&&(c=d),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=h,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else r===null&&(i.shared.lanes=0);Xl|=o,s.lanes=o,s.memoizedState=d}}function LS(s,e,t){if(s=e.effects,e.effects=null,s!==null)for(e=0;e<s.length;e++){var n=s[e],i=n.callback;if(i!==null){if(n.callback=null,n=t,typeof i!="function")throw Error(N(191,i));i.call(n)}}}var Gp={},Bi=ca(Gp),$d=ca(Gp),Ud=ca(Gp);function Ca(s){if(s===Gp)throw Error(N(174));return s}function nb(s,e){switch(Fe(Ud,e),Fe($d,s),Fe(Bi,Gp),s=e.nodeType,s){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:ov(null,"");break;default:s=s===8?e.parentNode:e,e=s.namespaceURI||null,s=s.tagName,e=ov(e,s)}ze(Bi),Fe(Bi,e)}function bh(){ze(Bi),ze($d),ze(Ud)}function cE(s){Ca(Ud.current);var e=Ca(Bi.current),t=ov(e,s.type);e!==t&&(Fe($d,s),Fe(Bi,t))}function sb(s){$d.current===s&&(ze(Bi),ze($d))}var Ke=ca(0);function Um(s){for(var e=s;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===s)break;for(;e.sibling===null;){if(e.return===null||e.return===s)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var k0=[];function ib(){for(var s=0;s<k0.length;s++)k0[s]._workInProgressVersionPrimary=null;k0.length=0}var Bg=Vr.ReactCurrentDispatcher,C0=Vr.ReactCurrentBatchConfig,ql=0,Ye=null,St=null,It=null,zm=!1,Sd=!1,zd=0,FP=0;function Xt(){throw Error(N(321))}function rb(s,e){if(e===null)return!1;for(var t=0;t<e.length&&t<s.length;t++)if(!ai(s[t],e[t]))return!1;return!0}function ob(s,e,t,n,i,r){if(ql=r,Ye=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Bg.current=s===null||s.memoizedState===null?UP:zP,s=t(n,i),Sd){r=0;do{if(Sd=!1,zd=0,25<=r)throw Error(N(301));r+=1,It=St=null,e.updateQueue=null,Bg.current=HP,s=t(n,i)}while(Sd)}if(Bg.current=Hm,e=St!==null&&St.next!==null,ql=0,It=St=Ye=null,zm=!1,e)throw Error(N(300));return s}function ab(){var s=zd!==0;return zd=0,s}function fi(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?Ye.memoizedState=It=s:It=It.next=s,It}function Ns(){if(St===null){var s=Ye.alternate;s=s!==null?s.memoizedState:null}else s=St.next;var e=It===null?Ye.memoizedState:It.next;if(e!==null)It=e,St=s;else{if(s===null)throw Error(N(310));St=s,s={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},It===null?Ye.memoizedState=It=s:It=It.next=s}return It}function Hd(s,e){return typeof e=="function"?e(s):e}function T0(s){var e=Ns(),t=e.queue;if(t===null)throw Error(N(311));t.lastRenderedReducer=s;
vendor: 5,688 bytes, line 38
38var n=St,i=n.baseQueue,r=t.pending;if(r!==null){if(i!==null){var o=i.next;i.next=r.next,r.next=o}n.baseQueue=i=r,t.pending=null}if(i!==null){r=i.next,n=n.baseState;var l=o=null,c=null,u=r;do{var h=u.lane;if((ql&h)===h)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:s(n,u.action);else{var d={lane:h,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=d,o=n):c=c.next=d,Ye.lanes|=h,Xl|=h}u=u.next}while(u!==null&&u!==r);c===null?o=n:c.next=l,ai(n,e.memoizedState)||(Mn=!0),e.memoizedState=n,e.baseState=o,e.baseQueue=c,t.lastRenderedState=n}if(s=t.interleaved,s!==null){i=s;do r=i.lane,Ye.lanes|=r,Xl|=r,i=i.next;while(i!==s)}else i===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function P0(s){var e=Ns(),t=e.queue;if(t===null)throw Error(N(311));t.lastRenderedReducer=s;var n=t.dispatch,i=t.pending,r=e.memoizedState;if(i!==null){t.pending=null;var o=i=i.next;do r=s(r,o.action),o=o.next;while(o!==i);ai(r,e.memoizedState)||(Mn=!0),e.memoizedState=r,e.baseQueue===null&&(e.baseState=r),t.lastRenderedState=r}return[r,n]}function uE(){}function hE(s,e){var t=Ye,n=Ns(),i=e(),r=!ai(n.memoizedState,i);if(r&&(n.memoizedState=i,Mn=!0),n=n.queue,lb(pE.bind(null,t,n,s),[s]),n.getSnapshot!==e||r||It!==null&&It.memoizedState.tag&1){if(t.flags|=2048,Vd(9,fE.bind(null,t,n,i,e),void 0,null),Dt===null)throw Error(N(349));ql&30||dE(t,e,i)}return i}function dE(s,e,t){s.flags|=16384,s={getSnapshot:e,value:t},e=Ye.updateQueue,e===null?(e={lastEffect:null,stores:null},Ye.updateQueue=e,e.stores=[s]):(t=e.stores,t===null?e.stores=[s]:t.push(s))}function fE(s,e,t,n){e.value=t,e.getSnapshot=n,gE(e)&&mE(s)}function pE(s,e,t){return t(function(){gE(e)&&mE(s)})}function gE(s){var e=s.getSnapshot;s=s.value;try{var t=e();return!ai(s,t)}catch{return!0}}function mE(s){var e=$r(s,1);e!==null&&oi(e,s,1,-1)}function IS(s){var e=fi();return typeof s=="function"&&(s=s()),e.memoizedState=e.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Hd,lastRenderedState:s},e.queue=s,s=s.dispatch=$P.bind(null,Ye,s),[e.memoizedState,s]}function Vd(s,e,t,n){return s={tag:s,create:e,destroy:t,deps:n,next:null},e=Ye.updateQueue,e===null?(e={lastEffect:null,stores:null},Ye.updateQueue=e,e.lastEffect=s.next=s):(t=e.lastEffect,t===null?e.lastEffect=s.next=s:(n=t.next,t.next=s,s.next=n,e.lastEffect=s)),s}function yE(){return Ns().memoizedState}function $g(s,e,t,n){var i=fi();Ye.flags|=s,i.memoizedState=Vd(1|e,t,void 0,n===void 0?null:n)}function jy(s,e,t,n){var i=Ns();n=n===void 0?null:n;var r=void 0;if(St!==null){var o=St.memoizedState;if(r=o.destroy,n!==null&&rb(n,o.deps)){i.memoizedState=Vd(e,t,r,n);return}}Ye.flags|=s,i.memoizedState=Vd(1|e,t,r,n)}function DS(s,e){return $g(8390656,8,s,e)}function lb(s,e){return jy(2048,8,s,e)}function vE(s,e){return jy(4,2,s,e)}function wE(s,e){return jy(4,4,s,e)}function _E(s,e){if(typeof e=="function")return s=s(),e(s),function(){e(null)};if(e!=null)return s=s(),e.current=s,function(){e.current=null}}function bE(s,e,t){return t=t!=null?t.concat([s]):null,jy(4,4,_E.bind(null,e,s),t)}function cb(){}function SE(s,e){var t=Ns();e=e===void 0?null:e;var n=t.memoizedState;return n!==null&&e!==null&&rb(e,n[1])?n[0]:(t.memoizedState=[s,e],s)}function AE(s,e){var t=Ns();e=e===void 0?null:e;var n=t.memoizedState;return n!==null&&e!==null&&rb(e,n[1])?n[0]:(s=s(),t.memoizedState=[s,e],s)}function EE(s,e,t){return ql&21?(ai(t,e)||(t=PA(),Ye.lanes|=t,Xl|=t,s.baseState=!0),e):(s.baseState&&(s.baseState=!1,Mn=!0),s.memoizedState=t)}function jP(s,e){var t=Se;Se=t!==0&&4>t?t:4,s(!0);var n=C0.transition;C0.transition={};try{s(!1),e()}finally{Se=t,C0.transition=n}}function xE(){return Ns().memoizedState}function BP(s,e,t){var n=ta(s);if(t={lane:n,action:t,hasEagerState:!1,eagerState:null,next:null},kE(s))CE(e,t);else if(t=aE(s,e,t,n),t!==null){var i=yn();oi(t,s,n,i),TE(t,e,n)}}function $P(s,e,t){var n=ta(s),i={lane:n,action:t,hasEagerState:!1,eagerState:null,next:null};if(kE(s))CE(e,i);else{var r=s.alternate;if(s.lanes===0&&(r===null||r.lanes===0)&&(r=e.lastRenderedReducer,r!==null))try{var o=e.lastRenderedState,l=r(o,t);if(i.hasEagerState=!0,i.eagerState=l,ai(l,o)){var c=e.interleaved;c===null?(i.next=i,eb(e)):(i.next=c.next,c.next=i),e.interleaved=i;return}}catch{}finally{}t=aE(s,e,i,n),t!==null&&(i=yn(),oi(t,s,n,i),TE(t,e,n))}}function kE(s){var e=s.alternate;return s===Ye||e!==null&&e===Ye}function CE(s,e){Sd=zm=!0;var t=s.pending;t===null?e.next=e:(e.next=t.next,t.next=e),s.pending=e}function TE(s,e,t){if(t&4194240){var n=e.lanes;n&=s.pendingLanes,t|=n,e.lanes=t,$_(s,t)}}var Hm={readContext:Ms,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useInsertionEffect:Xt,useLayoutEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useMutableSource:Xt,useSyncExternalStore:Xt,useId:Xt,unstable_isNewReconciler:!1},UP={readContext:Ms,useCallback:function(s,e){return fi().memoizedState=[s,e===void 0?null:e],s},useContext:Ms,useEffect:DS,useImperativeHandle:function(s,e,t){return t=t!=null?t.concat([s]):null,$g(4194308,4,_E.bind(null,e,s),t)},useLayoutEffect:function(s,e){return $g(4194308,4,s,e)},useInsertionEffect:function(s,e){return $g(4,2,s,e)},useMemo:function(s,e){var t=fi();return e=e===void 0?null:e,s=s(),t.memoizedState=[s,e],s},useReducer:function(s,e,t){var n=fi();return e=t!==void 0?t(e):e,n.memoizedState=n.baseState=e,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:e},n.queue=s,s=s.dispatch=BP.bind(null,Ye,s),[n.memoizedState,s]}
vendor: 5,753 bytes, lines 38-40
38,useRef:function(s){var e=fi();return s={current:s},e.memoizedState=s},useState:IS,useDebugValue:cb,useDeferredValue:function(s){return fi().memoizedState=s},useTransition:function(){var s=IS(!1),e=s[0];return s=jP.bind(null,s[1]),fi().memoizedState=s,[e,s]},useMutableSource:function(){},useSyncExternalStore:function(s,e,t){var n=Ye,i=fi();if(Ge){if(t===void 0)throw Error(N(407));t=t()}else{if(t=e(),Dt===null)throw Error(N(349));ql&30||dE(n,e,t)}i.memoizedState=t;var r={value:t,getSnapshot:e};return i.queue=r,DS(pE.bind(null,n,r,s),[s]),n.flags|=2048,Vd(9,fE.bind(null,n,r,t,e),void 0,null),t},useId:function(){var s=fi(),e=Dt.identifierPrefix;if(Ge){var t=Dr,n=Ir;t=(n&~(1<<32-ri(n)-1)).toString(32)+t,e=":"+e+"R"+t,t=zd++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=FP++,e=":"+e+"r"+t.toString(32)+":";return s.memoizedState=e},unstable_isNewReconciler:!1},zP={readContext:Ms,useCallback:SE,useContext:Ms,useEffect:lb,useImperativeHandle:bE,useInsertionEffect:vE,useLayoutEffect:wE,useMemo:AE,useReducer:T0,useRef:yE,useState:function(){return T0(Hd)},useDebugValue:cb,useDeferredValue:function(s){var e=Ns();return EE(e,St.memoizedState,s)},useTransition:function(){var s=T0(Hd)[0],e=Ns().memoizedState;return[s,e]},useMutableSource:uE,useSyncExternalStore:hE,useId:xE,unstable_isNewReconciler:!1},HP={readContext:Ms,useCallback:SE,useContext:Ms,useEffect:lb,useImperativeHandle:bE,useInsertionEffect:vE,useLayoutEffect:wE,useMemo:AE,useReducer:P0,useRef:yE,useState:function(){return P0(Hd)},useDebugValue:cb,useDeferredValue:function(s){var e=Ns();return St===null?e.memoizedState=s:EE(e,St.memoizedState,s)},useTransition:function(){var s=P0(Hd)[0],e=Ns().memoizedState;return[s,e]},useMutableSource:uE,useSyncExternalStore:hE,useId:xE,unstable_isNewReconciler:!1};function Us(s,e){if(s&&s.defaultProps){e=Je({},e),s=s.defaultProps;for(var t in s)e[t]===void 0&&(e[t]=s[t]);return e}return e}function Cv(s,e,t,n){e=s.memoizedState,t=t(n,e),t=t==null?e:Je({},e,t),s.memoizedState=t,s.lanes===0&&(s.updateQueue.baseState=t)}var By={isMounted:function(s){return(s=s._reactInternals)?ec(s)===s:!1},enqueueSetState:function(s,e,t){s=s._reactInternals;var n=yn(),i=ta(s),r=Mr(n,i);r.payload=e,t!=null&&(r.callback=t),e=Zo(s,r,i),e!==null&&(oi(e,s,i,n),jg(e,s,i))},enqueueReplaceState:function(s,e,t){s=s._reactInternals;var n=yn(),i=ta(s),r=Mr(n,i);r.tag=1,r.payload=e,t!=null&&(r.callback=t),e=Zo(s,r,i),e!==null&&(oi(e,s,i,n),jg(e,s,i))},enqueueForceUpdate:function(s,e){s=s._reactInternals;var t=yn(),n=ta(s),i=Mr(t,n);i.tag=2,e!=null&&(i.callback=e),e=Zo(s,i,n),e!==null&&(oi(e,s,n,t),jg(e,s,n))}};function MS(s,e,t,n,i,r,o){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(n,r,o):e.prototype&&e.prototype.isPureReactComponent?!Od(t,n)||!Od(i,r):!0}function PE(s,e,t){var n=!1,i=ia,r=e.contextType;return typeof r=="object"&&r!==null?r=Ms(r):(i=On(e)?Wl:rn.current,n=e.contextTypes,r=(n=n!=null)?vh(s,i):ia),e=new e(t,r),s.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=By,s.stateNode=e,e._reactInternals=s,n&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=i,s.__reactInternalMemoizedMaskedChildContext=r),e}function NS(s,e,t,n){s=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,n),e.state!==s&&By.enqueueReplaceState(e,e.state,null)}function Tv(s,e,t,n){var i=s.stateNode;i.props=t,i.state=s.memoizedState,i.refs={},tb(s);var r=e.contextType;typeof r=="object"&&r!==null?i.context=Ms(r):(r=On(e)?Wl:rn.current,i.context=vh(s,r)),i.state=s.memoizedState,r=e.getDerivedStateFromProps,typeof r=="function"&&(Cv(s,e,r,t),i.state=s.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&By.enqueueReplaceState(i,i.state,null),$m(s,t,i,n),i.state=s.memoizedState),typeof i.componentDidMount=="function"&&(s.flags|=4194308)}function Sh(s,e){try{var t="",n=e;do t+=yT(n),n=n.return;while(n);var i=t}catch(r){i=`
39Error generating stack: `+r.message+`
40`+r.stack}return{value:s,source:e,stack:i,digest:null}}function R0(s,e,t){return{value:s,source:null,stack:t??null,digest:e??null}}function Pv(s,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var VP=typeof WeakMap=="function"?WeakMap:Map;function RE(s,e,t){t=Mr(-1,t),t.tag=3,t.payload={element:null};var n=e.value;return t.callback=function(){Wm||(Wm=!0,Bv=n),Pv(s,e)},t}function LE(s,e,t){t=Mr(-1,t),t.tag=3;var n=s.type.getDerivedStateFromError;if(typeof n=="function"){var i=e.value;t.payload=function(){return n(i)},t.callback=function(){Pv(s,e)}}var r=s.stateNode;return r!==null&&typeof r.componentDidCatch=="function"&&(t.callback=function(){Pv(s,e),typeof n!="function"&&(ea===null?ea=new Set([this]):ea.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function OS(s,e,t){var n=s.pingCache;if(n===null){n=s.pingCache=new VP;var i=new Set;n.set(e,i)}else i=n.get(e),i===void 0&&(i=new Set,n.set(e,i));i.has(t)||(i.add(t),s=i2.bind(null,s,e,t),e.then(s,s))}function FS(s){do{var e;if((e=s.tag===13)&&(e=s.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return s;s=s.return}while(s!==null);return null}function jS(s,e,t,n,i){return s.mode&1?(s.flags|=65536,s.lanes=i,s):(s===e?s.flags|=65536:(s.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Mr(-1,1),e.tag=2,Zo(t,e,1)
vendor: 6,389 bytes, line 40
40)),t.lanes|=1),s)}var WP=Vr.ReactCurrentOwner,Mn=!1;function gn(s,e,t,n){e.child=s===null?oE(e,null,t,n):_h(e,s.child,t,n)}function BS(s,e,t,n,i){t=t.render;var r=e.ref;return Hc(e,i),n=ob(s,e,t,n,r,i),t=ab(),s!==null&&!Mn?(e.updateQueue=s.updateQueue,e.flags&=-2053,s.lanes&=~i,Ur(s,e,i)):(Ge&&t&&X_(e),e.flags|=1,gn(s,e,n,i),e.child)}function $S(s,e,t,n,i){if(s===null){var r=t.type;return typeof r=="function"&&!yb(r)&&r.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=r,IE(s,e,r,n,i)):(s=Vg(t.type,null,n,e,e.mode,i),s.ref=e.ref,s.return=e,e.child=s)}if(r=s.child,!(s.lanes&i)){var o=r.memoizedProps;if(t=t.compare,t=t!==null?t:Od,t(o,n)&&s.ref===e.ref)return Ur(s,e,i)}return e.flags|=1,s=na(r,n),s.ref=e.ref,s.return=e,e.child=s}function IE(s,e,t,n,i){if(s!==null){var r=s.memoizedProps;if(Od(r,n)&&s.ref===e.ref)if(Mn=!1,e.pendingProps=n=r,(s.lanes&i)!==0)s.flags&131072&&(Mn=!0);else return e.lanes=s.lanes,Ur(s,e,i)}return Rv(s,e,t,n,i)}function DE(s,e,t){var n=e.pendingProps,i=n.children,r=s!==null?s.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Fe(Ic,is),is|=t;else{if(!(t&1073741824))return s=r!==null?r.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:s,cachePool:null,transitions:null},e.updateQueue=null,Fe(Ic,is),is|=s,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=r!==null?r.baseLanes:t,Fe(Ic,is),is|=n}else r!==null?(n=r.baseLanes|t,e.memoizedState=null):n=t,Fe(Ic,is),is|=n;return gn(s,e,i,t),e.child}function ME(s,e){var t=e.ref;(s===null&&t!==null||s!==null&&s.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function Rv(s,e,t,n,i){var r=On(t)?Wl:rn.current;return r=vh(e,r),Hc(e,i),t=ob(s,e,t,n,r,i),n=ab(),s!==null&&!Mn?(e.updateQueue=s.updateQueue,e.flags&=-2053,s.lanes&=~i,Ur(s,e,i)):(Ge&&n&&X_(e),e.flags|=1,gn(s,e,t,i),e.child)}function US(s,e,t,n,i){if(On(t)){var r=!0;Nm(e)}else r=!1;if(Hc(e,i),e.stateNode===null)Ug(s,e),PE(e,t,n),Tv(e,t,n,i),n=!0;else if(s===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var c=o.context,u=t.contextType;typeof u=="object"&&u!==null?u=Ms(u):(u=On(t)?Wl:rn.current,u=vh(e,u));var h=t.getDerivedStateFromProps,d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||c!==u)&&NS(e,o,n,u),Yr=!1;var f=e.memoizedState;o.state=f,$m(e,n,o,i),c=e.memoizedState,l!==n||f!==c||Nn.current||Yr?(typeof h=="function"&&(Cv(e,t,h,n),c=e.memoizedState),(l=Yr||MS(e,t,l,n,f,c,u))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=c),o.props=n,o.state=c,o.context=u,n=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{o=e.stateNode,lE(s,e),l=e.memoizedProps,u=e.type===e.elementType?l:Us(e.type,l),o.props=u,d=e.pendingProps,f=o.context,c=t.contextType,typeof c=="object"&&c!==null?c=Ms(c):(c=On(t)?Wl:rn.current,c=vh(e,c));var p=t.getDerivedStateFromProps;(h=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==d||f!==c)&&NS(e,o,n,c),Yr=!1,f=e.memoizedState,o.state=f,$m(e,n,o,i);var y=e.memoizedState;l!==d||f!==y||Nn.current||Yr?(typeof p=="function"&&(Cv(e,t,p,n),y=e.memoizedState),(u=Yr||MS(e,t,u,n,f,y,c)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,y,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,y,c)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===s.memoizedProps&&f===s.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===s.memoizedProps&&f===s.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=y),o.props=n,o.state=y,o.context=c,n=u):(typeof o.componentDidUpdate!="function"||l===s.memoizedProps&&f===s.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===s.memoizedProps&&f===s.memoizedState||(e.flags|=1024),n=!1)}return Lv(s,e,t,n,r,i)}function Lv(s,e,t,n,i,r){ME(s,e);var o=(e.flags&128)!==0;if(!n&&!o)return i&&kS(e,t,!1),Ur(s,e,r);n=e.stateNode,WP.current=e;var l=o&&typeof t.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,s!==null&&o?(e.child=_h(e,s.child,null,r),e.child=_h(e,null,l,r)):gn(s,e,l,r),e.memoizedState=n.state,i&&kS(e,t,!0),e.child}function NE(s){var e=s.stateNode;e.pendingContext?xS(s,e.pendingContext,e.pendingContext!==e.context):e.context&&xS(s,e.context,!1),nb(s,e.containerInfo)}function zS(s,e,t,n,i){return wh(),Y_(i),e.flags|=256,gn(s,e,t,n),e.child}var Iv={dehydrated:null,treeContext:null,retryLane:0};function Dv(s){return{baseLanes:s,cachePool:null,transitions:null}}function OE(s,e,t){var n=e.pendingProps,i=Ke.current,r=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=s!==null&&s.memoizedState===null?!1:(i&2)!==0),l?(r=!0,e.flags&=-129):(s===null||s.memoizedState!==null)&&(i|=1),Fe(Ke,i&1),s===null)return xv(e),s=e.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?(e.mode&1?s.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=n.children,s=n.fallback,r?(n=e.mode,r=e.child,o={mode:"hidden",children:o},!(n&1)&&r!==null?(r.childLanes=0,r.pendingProps=o):r=zy(o,n,0,null),s=Vl(s,n,t,null),r.return=e,s.return=e,r.sibling=s,e.child=r,e.child.memoizedState=Dv(t),e.memoizedState=Iv,s):ub(e,o));if(i=s.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return GP(s,e,o,n,l,i,t);if(r){r=n.fallback,o=e.mode,i=s.child,l=i.sibling;var c={mode:"hidden",children:n.children};return!(o&1)&&e.child!==i?(n=e.child,n.childLanes=0,n.pendingProps=c,e.deletions=null):(n=na(i,c),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?r=na(l,r):(r=Vl(r,o,t,null),r.flags|=2),r.return=e,n.return=e,n.sibling=r,e.child=n,n=r,r=e.child,o=s.child.memoizedState,o=o===null?Dv(t):{base
vendor: 4,804 bytes, line 40
40Lanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},r.memoizedState=o,r.childLanes=s.childLanes&~t,e.memoizedState=Iv,n}return r=s.child,s=r.sibling,n=na(r,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=t),n.return=e,n.sibling=null,s!==null&&(t=e.deletions,t===null?(e.deletions=[s],e.flags|=16):t.push(s)),e.child=n,e.memoizedState=null,n}function ub(s,e){return e=zy({mode:"visible",children:e},s.mode,0,null),e.return=s,s.child=e}function mg(s,e,t,n){return n!==null&&Y_(n),_h(e,s.child,null,t),s=ub(e,e.pendingProps.children),s.flags|=2,e.memoizedState=null,s}function GP(s,e,t,n,i,r,o){if(t)return e.flags&256?(e.flags&=-257,n=R0(Error(N(422))),mg(s,e,o,n)):e.memoizedState!==null?(e.child=s.child,e.flags|=128,null):(r=n.fallback,i=e.mode,n=zy({mode:"visible",children:n.children},i,0,null),r=Vl(r,i,o,null),r.flags|=2,n.return=e,r.return=e,n.sibling=r,e.child=n,e.mode&1&&_h(e,s.child,null,o),e.child.memoizedState=Dv(o),e.memoizedState=Iv,r);if(!(e.mode&1))return mg(s,e,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var l=n.dgst;return n=l,r=Error(N(419)),n=R0(r,n,void 0),mg(s,e,o,n)}if(l=(o&s.childLanes)!==0,Mn||l){if(n=Dt,n!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|o)?0:i,i!==0&&i!==r.retryLane&&(r.retryLane=i,$r(s,i),oi(n,s,i,-1))}return mb(),n=R0(Error(N(421))),mg(s,e,o,n)}return i.data==="$?"?(e.flags|=128,e.child=s.child,e=r2.bind(null,s),i._reactRetry=e,null):(s=r.treeContext,as=Jo(i.nextSibling),ls=e,Ge=!0,ni=null,s!==null&&(Cs[Ts++]=Ir,Cs[Ts++]=Dr,Cs[Ts++]=Gl,Ir=s.id,Dr=s.overflow,Gl=e),e=ub(e,n.children),e.flags|=4096,e)}function HS(s,e,t){s.lanes|=e;var n=s.alternate;n!==null&&(n.lanes|=e),kv(s.return,e,t)}function L0(s,e,t,n,i){var r=s.memoizedState;r===null?s.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:t,tailMode:i}:(r.isBackwards=e,r.rendering=null,r.renderingStartTime=0,r.last=n,r.tail=t,r.tailMode=i)}function FE(s,e,t){var n=e.pendingProps,i=n.revealOrder,r=n.tail;if(gn(s,e,n.children,t),n=Ke.current,n&2)n=n&1|2,e.flags|=128;else{if(s!==null&&s.flags&128)e:for(s=e.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&HS(s,t,e);else if(s.tag===19)HS(s,t,e);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break e;for(;s.sibling===null;){if(s.return===null||s.return===e)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}n&=1}if(Fe(Ke,n),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(t=e.child,i=null;t!==null;)s=t.alternate,s!==null&&Um(s)===null&&(i=t),t=t.sibling;t=i,t===null?(i=e.child,e.child=null):(i=t.sibling,t.sibling=null),L0(e,!1,i,t,r);break;case"backwards":for(t=null,i=e.child,e.child=null;i!==null;){if(s=i.alternate,s!==null&&Um(s)===null){e.child=i;break}s=i.sibling,i.sibling=t,t=i,i=s}L0(e,!0,t,null,r);break;case"together":L0(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Ug(s,e){!(e.mode&1)&&s!==null&&(s.alternate=null,e.alternate=null,e.flags|=2)}function Ur(s,e,t){if(s!==null&&(e.dependencies=s.dependencies),Xl|=e.lanes,!(t&e.childLanes))return null;if(s!==null&&e.child!==s.child)throw Error(N(153));if(e.child!==null){for(s=e.child,t=na(s,s.pendingProps),e.child=t,t.return=e;s.sibling!==null;)s=s.sibling,t=t.sibling=na(s,s.pendingProps),t.return=e;t.sibling=null}return e.child}function qP(s,e,t){switch(e.tag){case 3:NE(e),wh();break;case 5:cE(e);break;case 1:On(e.type)&&Nm(e);break;case 4:nb(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,i=e.memoizedProps.value;Fe(jm,n._currentValue),n._currentValue=i;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(Fe(Ke,Ke.current&1),e.flags|=128,null):t&e.child.childLanes?OE(s,e,t):(Fe(Ke,Ke.current&1),s=Ur(s,e,t),s!==null?s.sibling:null);Fe(Ke,Ke.current&1);break;case 19:if(n=(t&e.childLanes)!==0,s.flags&128){if(n)return FE(s,e,t);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Fe(Ke,Ke.current),n)break;return null;case 22:case 23:return e.lanes=0,DE(s,e,t)}return Ur(s,e,t)}var jE,Mv,BE,$E;jE=function(s,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)s.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};Mv=function(){};BE=function(s,e,t,n){var i=s.memoizedProps;if(i!==n){s=e.stateNode,Ca(Bi.current);var r=null;
vendor: 4,114 bytes, line 40
40switch(t){case"input":i=nv(s,i),n=nv(s,n),r=[];break;case"select":i=Je({},i,{value:void 0}),n=Je({},n,{value:void 0}),r=[];break;case"textarea":i=rv(s,i),n=rv(s,n),r=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(s.onclick=Dm)}av(t,n);var o;t=null;for(u in i)if(!n.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var l=i[u];for(o in l)l.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Pd.hasOwnProperty(u)?r||(r=[]):(r=r||[]).push(u,null));for(u in n){var c=n[u];if(l=i!=null?i[u]:void 0,n.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(t||(t={}),t[o]=c[o])}else t||(r||(r=[]),r.push(u,t)),t=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(r=r||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(r=r||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Pd.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&$e("scroll",s),r||l===c||(r=[])):(r=r||[]).push(u,c))}t&&(r=r||[]).push("style",t);var u=r;(e.updateQueue=u)&&(e.flags|=4)}};$E=function(s,e,t,n){t!==n&&(e.flags|=4)};function Fh(s,e){if(!Ge)switch(s.tailMode){case"hidden":e=s.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?s.tail=null:t.sibling=null;break;case"collapsed":t=s.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e||s.tail===null?s.tail=null:s.tail.sibling=null:n.sibling=null}}function Kt(s){var e=s.alternate!==null&&s.alternate.child===s.child,t=0,n=0;if(e)for(var i=s.child;i!==null;)t|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=s,i=i.sibling;else for(i=s.child;i!==null;)t|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=s,i=i.sibling;return s.subtreeFlags|=n,s.childLanes=t,e}function XP(s,e,t){var n=e.pendingProps;switch(K_(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(e),null;case 1:return On(e.type)&&Mm(),Kt(e),null;case 3:return n=e.stateNode,bh(),ze(Nn),ze(rn),ib(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(s===null||s.child===null)&&(pg(e)?e.flags|=4:s===null||s.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,ni!==null&&(zv(ni),ni=null))),Mv(s,e),Kt(e),null;case 5:sb(e);var i=Ca(Ud.current);if(t=e.type,s!==null&&e.stateNode!=null)BE(s,e,t,n,i),s.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(N(166));return Kt(e),null}if(s=Ca(Bi.current),pg(e)){n=e.stateNode,t=e.type;var r=e.memoizedProps;switch(n[Fi]=e,n[Bd]=r,s=(e.mode&1)!==0,t){case"dialog":$e("cancel",n),$e("close",n);break;case"iframe":case"object":case"embed":$e("load",n);break;case"video":case"audio":for(i=0;i<Xh.length;i++)$e(Xh[i],n);break;case"source":$e("error",n);break;case"img":case"image":case"link":$e("error",n),$e("load",n);break;case"details":$e("toggle",n);break;case"input":Jb(n,r),$e("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!r.multiple},$e("invalid",n);break;case"textarea":eS(n,r),$e("invalid",n)}av(t,r),i=null;for(var o in r)if(r.hasOwnProperty(o)){var l=r[o];o==="children"?typeof l=="string"?n.textContent!==l&&(r.suppressHydrationWarning!==!0&&fg(n.textContent,l,s),i=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(r.suppressHydrationWarning!==!0&&fg(n.textContent,l,s),i=["children",""+l]):Pd.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&$e("scroll",n)}switch(t){case"input":rg(n),Zb(n,r,!0);break;case"textarea":rg(n),tS(n);break;case"select":case"option":break;default:typeof r.onClick=="function"&&(n.onclick=Dm)}n=i,e.updateQueue=n,n!==null&&(e.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=pA(t)),s==="http://www.w3.org/1999/xhtml"?t==="script"?(s=o.createElement("div"),s.innerHTML="<script><\/script>
40",s=s.removeChild(s.firstChild)):typeof n.is=="string"?s=o.createElement(t,{is:n.is}):(s=o.createElement(t),t==="select"&&(o=s,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):s=o.createElementNS(s,t),s[Fi]=e,s[Bd]=n,jE(s,e,!1,!1),e.stateNode=s;e:{switch(o=lv(t,n),t){case"dialog":$e("cancel",s),$e("close",s),i=n;break;case"iframe":case"object":case"embed":$e("load",s),i=n;break;case"video":case"audio":for(i=0;i<Xh.length;i++)$e(Xh[i],s);i=n;break;case"source":$e("error",s),i=n;break;case"img":case"image":case"link":$e("error",s),$e("load",s),i=n;break;case"details":$e("toggle",s),i=n;break;case"input":Jb(s,n),i=nv(s,n),$e("invalid",s);break;case"option":i=n;break;case"select":s._wrapperState={wasMultiple:!!n.multiple},i=Je({},n,{value:void 0}),$e("invalid",s);break;case"textarea":eS(s,n),i=rv(s,n),$e("invalid",s);break;default:i=n}av(t,i),l=i;for(r in l)if(l.hasOwnProperty(r)){var c=l[r];r==="style"?yA(s,c):r==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&gA(s,c)):r==="children"?typeof c=="string"?(t!=="textarea"||c!=="")&&Rd(s,c):typeof c=="number"&&Rd(s,""+c):r!=="suppressContentEditableWarning"&&r!=="suppressHydrationWarning"&&r!=="autoFocus"&&(Pd.hasOwnProperty(r)?c!=null&&r==="onScroll"&&$e("scroll",s):c!=null&&M_(s,r,c,o))}switch(t){case"input":rg(s),Zb(s,n,!1);break;case"textarea":rg(s),tS(s);break;case"option":n.value!=null&&s.setAttribute("value",""+sa(n.value));break;case"select":s.multiple=!!n.multiple,r=n.value,r!=null?Bc(s,!!n.multiple,r,!1):n.defaultValue!=null&&Bc(s,!!n.multiple,n.defaultValue,!0);break;default:typeof i.onClick=="function"&&(s.onclick=Dm)}switch(t){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Kt(e),null;case 6:if(s&&e.stateNode!=null)$E(s,e,s.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(N(166));if(t=Ca(Ud.current),Ca(Bi.current),pg(e)){if(n=e.stateNode,t=e.memoizedProps,n[Fi]=e,(r=n.nodeValue!==t)&&(s=ls,s!==null))switch(s.tag){case 3:fg(n.nodeValue,t,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&fg(n.nodeValue,t,(s.mode&1)!==0)}r&&(e.flags|=4)}else n=(t.nodeType===9?t:t.ownerDocument).createTextNode(n),n[Fi]=e,e.stateNode=n}return Kt(e),null;case 13:if(ze(Ke),n=e.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(Ge&&as!==null&&e.mode&1&&!(e.flags&128))iE(),wh(),e.flags|=98560,r=!1;else if(r=pg(e),n!==null&&n.dehydrated!==null){if(s===null){if(!r)throw Error(N(318));if(r=e.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(N(317));r[Fi]=e}else wh(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Kt(e),r=!1}else ni!==null&&(zv(ni),ni=null),r=!0;if(!r)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(n=n!==null,n!==(s!==null&&s.memoizedState!==null)&&n&&(e.child.flags|=8192,e.mode&1&&(s===null||Ke.current&1?At===0&&(At=3):mb())),e.updateQueue!==null&&(e.flags|=4),Kt(e),null);case 4:return bh(),Mv(s,e),s===null&&Fd(e.stateNode.containerInfo),Kt(e),null;case 10:return Z_(e.type._context),Kt(e),null;case 17:return On(e.type)&&Mm(),Kt(e),null;case 19:if(ze(Ke),r=e.memoizedState,r===null)return Kt(e),null;if(n=(e.flags&128)!==0,o=r.rendering,o===null)if(n)Fh(r,!1);else{if(At!==0||s!==null&&s.flags&128)for(s=e.child;s!==null;){if(o=Um(s),o!==null){for(e.flags|=128,Fh(r,!1),n=o.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),e.subtreeFlags=0,n=t,t=e.child;t!==null;)r=t,s=n,r.flags&=14680066,o=r.alternate,o===null?(r.childLanes=0,r.lanes=s,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,s=o.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),t=t.sibling;return Fe(Ke,Ke.current&1|2),e.child}s=s.sibling}r.tail!==null&&lt()>Ah&&(e.flags|=128,n=!0,Fh(r,!1),e.lanes=4194304)}else{if(!n)if(s=Um(o),s!==null){if(e.flags|=128,n=!0,t=s.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Fh(r,!0),r.tail===null&&r.tailMode==="hidden"&&!o.alternate&&!Ge)return Kt(e),null}else 2*lt()-r.renderingStartTime>Ah&&t!==1073741824&&(e.flags|=128,n=!0,Fh(r,!1),e.lanes=4194304);r.isBackwards?(o.sibling=e.child,e.child=o):(t=r.last,t!==null?t.sibling=o:e.child=o,r.last=o
vendor: 26,835 bytes, line 40
40)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=lt(),e.sibling=null,t=Ke.current,Fe(Ke,n?t&1|2:t&1),e):(Kt(e),null);case 22:case 23:return gb(),n=e.memoizedState!==null,s!==null&&s.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?is&1073741824&&(Kt(e),e.subtreeFlags&6&&(e.flags|=8192)):Kt(e),null;case 24:return null;case 25:return null}throw Error(N(156,e.tag))}function KP(s,e){switch(K_(e),e.tag){case 1:return On(e.type)&&Mm(),s=e.flags,s&65536?(e.flags=s&-65537|128,e):null;case 3:return bh(),ze(Nn),ze(rn),ib(),s=e.flags,s&65536&&!(s&128)?(e.flags=s&-65537|128,e):null;case 5:return sb(e),null;case 13:if(ze(Ke),s=e.memoizedState,s!==null&&s.dehydrated!==null){if(e.alternate===null)throw Error(N(340));wh()}return s=e.flags,s&65536?(e.flags=s&-65537|128,e):null;case 19:return ze(Ke),null;case 4:return bh(),null;case 10:return Z_(e.type._context),null;case 22:case 23:return gb(),null;case 24:return null;default:return null}}var yg=!1,sn=!1,YP=typeof WeakSet=="function"?WeakSet:Set,$=null;function Lc(s,e){var t=s.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(n){it(s,e,n)}else t.current=null}function Nv(s,e,t){try{t()}catch(n){it(s,e,n)}}var VS=!1;function QP(s,e){if(vv=Rm,s=WA(),q_(s)){if("selectionStart"in s)var t={start:s.selectionStart,end:s.selectionEnd};else e:{t=(t=s.ownerDocument)&&t.defaultView||window;var n=t.getSelection&&t.getSelection();if(n&&n.rangeCount!==0){t=n.anchorNode;var i=n.anchorOffset,r=n.focusNode;n=n.focusOffset;try{t.nodeType,r.nodeType}catch{t=null;break e}var o=0,l=-1,c=-1,u=0,h=0,d=s,f=null;t:for(;;){for(var p;d!==t||i!==0&&d.nodeType!==3||(l=o+i),d!==r||n!==0&&d.nodeType!==3||(c=o+n),d.nodeType===3&&(o+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===s)break t;if(f===t&&++u===i&&(l=o),f===r&&++h===n&&(c=o),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}t=l===-1||c===-1?null:{start:l,end:c}}else t=null}t=t||{start:0,end:0}}else t=null;for(wv={focusedElem:s,selectionRange:t},Rm=!1,$=e;$!==null;)if(e=$,s=e.child,(e.subtreeFlags&1028)!==0&&s!==null)s.return=e,$=s;else for(;$!==null;){e=$;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var _=y.memoizedProps,A=y.memoizedState,m=e.stateNode,b=m.getSnapshotBeforeUpdate(e.elementType===e.type?_:Us(e.type,_),A);m.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=e.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(N(163))}}catch(E){it(e,e.return,E)}if(s=e.sibling,s!==null){s.return=e.return,$=s;break}$=e.return}return y=VS,VS=!1,y}function Ad(s,e,t){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&s)===s){var r=i.destroy;i.destroy=void 0,r!==void 0&&Nv(e,t,r)}i=i.next}while(i!==n)}}function $y(s,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&s)===s){var n=t.create;t.destroy=n()}t=t.next}while(t!==e)}}function Ov(s){var e=s.ref;if(e!==null){var t=s.stateNode;switch(s.tag){case 5:s=t;break;default:s=t}typeof e=="function"?e(s):e.current=s}}function UE(s){var e=s.alternate;e!==null&&(s.alternate=null,UE(e)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(e=s.stateNode,e!==null&&(delete e[Fi],delete e[Bd],delete e[Sv],delete e[DP],delete e[MP])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function zE(s){return s.tag===5||s.tag===3||s.tag===4}function WS(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||zE(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Fv(s,e,t){var n=s.tag;if(n===5||n===6)s=s.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(s,e):t.insertBefore(s,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(s,t)):(e=t,e.appendChild(s)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Dm));else if(n!==4&&(s=s.child,s!==null))for(Fv(s,e,t),s=s.sibling;s!==null;)Fv(s,e,t),s=s.sibling}function jv(s,e,t){var n=s.tag;if(n===5||n===6)s=s.stateNode,e?t.insertBefore(s,e):t.appendChild(s);else if(n!==4&&(s=s.child,s!==null))for(jv(s,e,t),s=s.sibling;s!==null;)jv(s,e,t),s=s.sibling}var Ut=null,ei=!1;function Wr(s,e,t){for(t=t.child;t!==null;)HE(s,e,t),t=t.sibling}function HE(s,e,t){if(ji&&typeof ji.onCommitFiberUnmount=="function")try{ji.onCommitFiberUnmount(Iy,t)}catch{}switch(t.tag){case 5:sn||Lc(t,e);case 6:var n=Ut,i=ei;Ut=null,Wr(s,e,t),Ut=n,ei=i,Ut!==null&&(ei?(s=Ut,t=t.stateNode,s.nodeType===8?s.parentNode.removeChild(t):s.removeChild(t)):Ut.removeChild(t.stateNode));break;case 18:Ut!==null&&(ei?(s=Ut,t=t.stateNode,s.nodeType===8?E0(s.parentNode,t):s.nodeType===1&&E0(s,t),Md(s)):E0(Ut,t.stateNode));break;case 4:n=Ut,i=ei,Ut=t.stateNode.containerInfo,ei=!0,Wr(s,e,t),Ut=n,ei=i;break;case 0:case 11:case 14:case 15:if(!sn&&(n=t.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var r=i,o=r.destroy;r=r.tag,o!==void 0&&(r&2||r&4)&&Nv(t,e,o),i=i.next}while(i!==n)}Wr(s,e,t);break;case 1:if(!sn&&(Lc(t,e),n=t.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=t.memoizedProps,n.state=t.memoizedState,n.componentWillUnmount()}catch(l){it(t,e,l)}Wr(s,e,t);break;case 21:Wr(s,e,t);break;case 22:t.mode&1?(sn=(n=sn)||t.memoizedState!==null,Wr(s,e,t),sn=n):Wr(s,e,t);break;default:Wr(s,e,t)}}function GS(s){var e=s.updateQueue;if(e!==null){s.updateQueue=null;var t=s.stateNode;t===null&&(t=s.stateNode=new YP),e.forEach(function(n){var i=o2.bind(null,s,n);t.has(n)||(t.add(n),n.then(i,i))})}}function Fs(s,e){var t=e.deletions;if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];try{var r=s,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:Ut=l.stateNode,ei=!1;break e;case 3:Ut=l.stateNode.containerInfo,ei=!0;break e;case 4:Ut=l.stateNode.containerInfo,ei=!0;break e}l=l.return}if(Ut===null)throw Error(N(160));HE(r,o,i),Ut=null,ei=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(u){it(i,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)VE(e,s),e=e.sibling}function VE(s,e){var t=s.alternate,n=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(Fs(e,s),ci(s),n&4){try{Ad(3,s,s.return),$y(3,s)}catch(_){it(s,s.return,_)}try{Ad(5,s,s.return)}catch(_){it(s,s.return,_)}}break;case 1:Fs(e,s),ci(s),n&512&&t!==null&&Lc(t,t.return);break;case 5:if(Fs(e,s),ci(s),n&512&&t!==null&&Lc(t,t.return),s.flags&32){var i=s.stateNode;try{Rd(i,"")}catch(_){it(s,s.return,_)}}if(n&4&&(i=s.stateNode,i!=null)){var r=s.memoizedProps,o=t!==null?t.memoizedProps:r,l=s.type,c=s.updateQueue;if(s.updateQueue=null,c!==null)try{l==="input"&&r.type==="radio"&&r.name!=null&&dA(i,r),lv(l,o);var u=lv(l,r);for(o=0;o<c.length;o+=2){var h=c[o],d=c[o+1];h==="style"?yA(i,d):h==="dangerouslySetInnerHTML"?gA(i,d):h==="children"?Rd(i,d):M_(i,h,d,u)}switch(l){case"input":sv(i,r);break;case"textarea":fA(i,r);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!r.multiple;var p=r.value;p!=null?Bc(i,!!r.multiple,p,!1):f!==!!r.multiple&&(r.defaultValue!=null?Bc(i,!!r.multiple,r.defaultValue,!0):Bc(i,!!r.multiple,r.multiple?[]:"",!1))}i[Bd]=r}catch(_){it(s,s.return,_)}}break;case 6:if(Fs(e,s),ci(s),n&4){if(s.stateNode===null)throw Error(N(162));i=s.stateNode,r=s.memoizedProps;try{i.nodeValue=r}catch(_){it(s,s.return,_)}}break;case 3:if(Fs(e,s),ci(s),n&4&&t!==null&&t.memoizedState.isDehydrated)try{Md(e.containerInfo)}catch(_){it(s,s.return,_)}break;case 4:Fs(e,s),ci(s);break;case 13:Fs(e,s),ci(s),i=s.child,i.flags&8192&&(r=i.memoizedState!==null,i.stateNode.isHidden=r,!r||i.alternate!==null&&i.alternate.memoizedState!==null||(fb=lt())),n&4&&GS(s);break;case 22:if(h=t!==null&&t.memoizedState!==null,s.mode&1?(sn=(u=sn)||h,Fs(e,s),sn=u):Fs(e,s),ci(s),n&8192){if(u=s.memoizedState!==null,(s.stateNode.isHidden=u)&&!h&&s.mode&1)for($=s,h=s.child;h!==null;){for(d=$=h;$!==null;){switch(f=$,p=f.child,f.tag){case 0:case 11:case 14:case 15:Ad(4,f,f.return);break;case 1:Lc(f,f.return);var y=f.stateNode;if(typeof y.componentWillUnmount=="function"){n=f,t=f.return;try{e=n,y.props=e.memoizedProps,y.state=e.memoizedState,y.componentWillUnmount()}catch(_){it(n,t,_)}}break;case 5:Lc(f,f.return);break;case 22:if(f.memoizedState!==null){XS(d);continue}}p!==null?(p.return=f,$=p):XS(d)}h=h.sibling}e:for(h=null,d=s;;){if(d.tag===5){if(h===null){h=d;try{i=d.stateNode,u?(r=i.style,typeof r.setProperty=="function"?r.setProperty("display","none","important"):r.display="none"):(l=d.stateNode,c=d.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=mA("display",o))}catch(_){it(s,s.return,_)}}}else if(d.tag===6){if(h===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(_){it(s,s.return,_)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===s)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===s)break e;for(;d.sibling===null;){if(d.return===null||d.return===s)break e;h===d&&(h=null),d=d.return}h===d&&(h=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Fs(e,s),ci(s),n&4&&GS(s);break;case 21:break;default:Fs(e,s),ci(s)}}function ci(s){var e=s.flags;if(e&2){try{e:{for(var t=s.return;t!==null;){if(zE(t)){var n=t;break e}t=t.return}throw Error(N(160))}switch(n.tag){case 5:var i=n.stateNode;n.flags&32&&(Rd(i,""),n.flags&=-33);var r=WS(s);jv(s,r,i);break;case 3:case 4:var o=n.stateNode.containerInfo,l=WS(s);Fv(s,l,o);break;default:throw Error(N(161))}}catch(c){it(s,s.return,c)}s.flags&=-3}e&4096&&(s.flags&=-4097)}function JP(s,e,t){$=s,WE(s)}function WE(s,e,t){for(var n=(s.mode&1)!==0;$!==null;){var i=$,r=i.child;if(i.tag===22&&n){var o=i.memoizedState!==null||yg;if(!o){var l=i.alternate,c=l!==null&&l.memoizedState!==null||sn;l=yg;var u=sn;if(yg=o,(sn=c)&&!u)for($=i;$!==null;)o=$,c=o.child,o.tag===22&&o.memoizedState!==null?KS(i):c!==null?(c.return=o,$=c):KS(i);for(;r!==null;)$=r,WE(r),r=r.sibling;$=i,yg=l,sn=u}qS(s)}else i.subtreeFlags&8772&&r!==null?(r.return=i,$=r):qS(s)}}function qS(s){for(;$!==null;){var e=$;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:sn||$y(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!sn)if(t===null)n.componentDidMount();else{var i=e.elementType===e.type?t.memoizedProps:Us(e.type,t.memoizedProps);n.componentDidUpdate(i,t.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var r=e.updateQueue;r!==null&&LS(e,r,n);break;case 3:var o=e.updateQueue;if(o!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}LS(e,o,t)}break;case 5:var l=e.stateNode;if(t===null&&e.flags&4){t=l;var c=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&t.focus();break;case"img":c.src&&(t.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var h=u.memoizedState;if(h!==null){var d=h.dehydrated;d!==null&&Md(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(N(163))}sn||e.flags&512&&Ov(e)}catch(f){it(e,e.return,f)}}if(e===s){$=null;break}if(t=e.sibling,t!==null){t.return=e.return,$=t;break}$=e.return}}function XS(s){for(;$!==null;){var e=$;if(e===s){$=null;break}var t=e.sibling;if(t!==null){t.return=e.return,$=t;break}$=e.return}}function KS(s){for(;$!==null;){var e=$;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{$y(4,e)}catch(c){it(e,t,c)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var i=e.return;try{n.componentDidMount()}catch(c){it(e,i,c)}}var r=e.return;try{Ov(e)}catch(c){it(e,r,c)}break;case 5:var o=e.return;try{Ov(e)}catch(c){it(e,o,c)}}}catch(c){it(e,e.return,c)}if(e===s){$=null;break}var l=e.sibling;if(l!==null){l.return=e.return,$=l;break}$=e.return}}var ZP=Math.ceil,Vm=Vr.ReactCurrentDispatcher,hb=Vr.ReactCurrentOwner,Ls=Vr.ReactCurrentBatchConfig,pe=0,Dt=null,dt=null,Wt=0,is=0,Ic=ca(0),At=0,Wd=null,Xl=0,Uy=0,db=0,Ed=null,In=null,fb=0,Ah=1/0,Gi=null,Wm=!1,Bv=null,ea=null,vg=!1,Xo=null,Gm=0,xd=0,$v=null,zg=-1,Hg=0;function yn(){return pe&6?lt():zg!==-1?zg:zg=lt()}function ta(s){return s.mode&1?pe&2&&Wt!==0?Wt&-Wt:OP.transition!==null?(Hg===0&&(Hg=PA()),Hg):(s=Se,s!==0||(s=window.event,s=s===void 0?16:OA(s.type)),s):1}function oi(s,e,t,n){if(50<xd)throw xd=0,$v=null,Error(N(185));Hp(s,t,n),(!(pe&2)||s!==Dt)&&(s===Dt&&(!(pe&2)&&(Uy|=t),At===4&&Jr(s,Wt)),Fn(s,n),t===1&&pe===0&&!(e.mode&1)&&(Ah=lt()+500,Fy&&ua()))}function Fn(s,e){var t=s.callbackNode;OT(s,e);var n=Pm(s,s===Dt?Wt:0);if(n===0)t!==null&&iS(t),s.callbackNode=null,s.callbackPriority=0;else if(e=n&-n,s.callbackPriority!==e){if(t!=null&&iS(t),e===1)s.tag===0?NP(YS.bind(null,s)):tE(YS.bind(null,s)),LP(function(){!(pe&6)&&ua()}),t=null;else{switch(RA(n)){case 1:t=B_;break;case 4:t=CA;break;case 16:t=Tm;break;case 536870912:t=TA;break;default:t=Tm}t=ZE(t,GE.bind(null,s))}s.callbackPriority=e,s.callbackNode=t}}function GE(s,e){if(zg=-1,Hg=0,pe&6)throw Error(N(327));var t=s.callbackNode;if(Vc()&&s.callbackNode!==t)return null;var n=Pm(s,s===Dt?Wt:0);if(n===0)return null;if(n&30||n&s.expiredLanes||e)e=qm(s,n);else{e=n;var i=pe;pe|=2;var r=XE();(Dt!==s||Wt!==e)&&(Gi=null,Ah=lt()+500,Hl(s,e));do try{n2();break}catch(l){qE(s,l)}while(!0);J_(),Vm.current=r,pe=i,dt!==null?e=0:(Dt=null,Wt=0,e=At)}if(e!==0){if(e===2&&(i=fv(s),i!==0&&(n=i,e=Uv(s,i))),e===1)throw t=Wd,Hl(s,0),Jr(s,n),Fn(s,lt()),t;if(e===6)Jr(s,n);else{if(i=s.current.alternate,!(n&30)&&!e2(i)&&(e=qm(s,n),e===2&&(r=fv(s),r!==0&&(n=r,e=Uv(s,r))),e===1))throw t=Wd,Hl(s,0),Jr(s,n),Fn(s,lt()),t;switch(s.finishedWork=i,s.finishedLanes=n,e){case 0:case 1:throw Error(N(345));case 2:ma(s,In,Gi);break;case 3:if(Jr(s,n),(n&130023424)===n&&(e=fb+500-lt(),10<e)){if(Pm(s,0)!==0)break;if(i=s.suspendedLanes,(i&n)!==n){yn(),s.pingedLanes|=s.suspendedLanes&i;break}s.timeoutHandle=bv(ma.bind(null,s,In,Gi),e);break}ma(s,In,Gi);break;case 4:if(Jr(s,n),(n&4194240)===n)break;for(e=s.eventTimes,i=-1;0<n;){var o=31-ri(n);r=1<<o,o=e[o],o>i&&(i=o),n&=~r}if(n=i,n=lt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*ZP(n/1960))-n,10<n){s.timeoutHandle=bv(ma.bind(null,s,In,Gi),n);break}ma(s,In,Gi);break;case 5:ma(s,In,Gi);break;default:throw Error(N(329))}}}return Fn(s,lt()),s.callbackNode===t?GE.bind(null,s):null}function Uv(s,e){var t=Ed;return s.current.memoizedState.isDehydrated&&(Hl(s,e).flags|=256),s=qm(s,e),s!==2&&(e=In,In=t,e!==null&&zv(e)),s}function zv(s){In===null?In=s:In.push.apply(In,s)}function e2(s){for(var e=s;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var n=0;n<t.length;n++){var i=t[n],r=i.getSnapshot;i=i.value;try{if(!ai(r(),i))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===s)break;for(;e.sibling===null;){if(e.return===null||e.return===s)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Jr(s,e){for(e&=~db,e&=~Uy,s.suspendedLanes|=e,s.pingedLanes&=~e,s=s.expirationTimes;0<e;){var t=31-ri(e),n=1<<t;s[t]=-1,e&=~n}}function YS(s){if(pe&6)throw Error(N(327));Vc();var e=Pm(s,0);if(!(e&1))return Fn(s,lt()),null;var t=qm(s,e);if(s.tag!==0&&t===2){var n=fv(s);n!==0&&(e=n,t=Uv(s,n))}if(t===1)throw t=Wd,Hl(s,0),Jr(s,e),Fn(s,lt()),t;if(t===6)throw Error(N(345));return s.finishedWork=s.current.alternate,s.finishedLanes=e,ma(s,In,Gi),Fn(s,lt()),null}function pb(s,e){var t=pe;pe|=1;try{return s(e)}finally{pe=t,pe===0&&(Ah=lt()+500,Fy&&ua())}}function Kl(s){Xo!==null&&Xo.tag===0&&!(pe&6)&&Vc();var e=pe;pe|=1;var t=Ls.transition,n=Se;try{if(Ls.transition=null,Se=1,s)return s()}finally{Se=n,Ls.transition=t,pe=e,!(pe&6)&&ua()}}function gb(){is=Ic.current,ze(Ic)}function Hl(s,e){s.finishedWork=null,s.finishedLanes=0;var t=s.timeoutHandle;if(t!==-1&&(s.timeoutHandle=-1,RP(t)),dt!==null)for(t=dt.return;t!==null;){var n=t;switch(K_(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Mm();break;case 3:bh(),ze(Nn),ze(rn),ib();break;case 5:sb(n);break;case 4:bh();break;case 13:ze(Ke);break;case 19:ze(Ke);break;case 10:Z_(n.type._context);break;case 22:case 23:gb()}t=t.return}if(Dt=s,dt=s=na(s.current,null),Wt=is=e,At=0,Wd=null,db=Uy=Xl=0,In=Ed=null,ka!==null){for(e=0;e<ka.length;e++)if(t=ka[e],n=t.interleaved,n!==null){t.interleaved=null;var i=n.next,r=t.pending;if(r!==null){var o=r.next;r.next=i,n.next=o}t.pending=n}ka=null}return s}function qE(s,e){do{var t=dt;try{if(J_(),Bg.current=Hm,zm){for(var n=Ye.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}zm=!1}if(ql=0,It=St=Ye=null,Sd=!1,zd=0,hb.current=null,t===null||t.return===null){At=1,Wd=e,dt=null;break}e:{var r=s,o=t.return,l=t,c=e;if(e=Wt,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,h=l,d=h.tag;if(!(h.mode&1)&&(d===0||d===11||d===15)){var f=h.alternate;f?(h.updateQueue=f.updateQueue,h.memoizedState=f.memoizedState,h.lanes=f.lanes):(h.updateQueue=null,h.memoizedState=null)}var p=FS(o);if(p!==null){p.flags&=-257,jS(p,o,l,r,e),p.mode&1&&OS(r,u,e),e=p,c=u;var y=e.updateQueue;if(y===null){var _=new Set;_.add(c),e.updateQueue=_}else y.add(c);break e}else{if(!(e&1)){OS(r,u,e),mb();break e}c=Error(N(426))}}else if(Ge&&l.mode&1){var A=FS(o);if(A!==null){!(A.flags&65536)&&(A.flags|=256),jS(A,o,l,r,e),Y_(Sh(c,l));break e}}r=c=Sh(c,l),At!==4&&(At=2),Ed===null?Ed=[r]:Ed.push(r),r=o;do{switch(r.tag){case 3:r.flags|=65536,e&=-e,r.lanes|=e;var m=RE(r,c,e);RS(r,m);break e;case 1:l=c;var b=r.type,w=r.stateNode;if(!(r.flags&128)&&(typeof b.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(ea===null||!ea.has(w)))){r.flags|=65536,e&=-e,r.lanes|=e;var E=LE(r,l,e);RS(r,E);break e}}r=r.return}while(r!==null)}YE(t)}catch(k){e=k,dt===t&&t!==null&&(dt=t=t.return);continue}break}while(!0)}function XE(){var s=Vm.current;return Vm.current=Hm,s===null?Hm:s}function mb(){(At===0||At===3||At===2)&&(At=4),Dt===null||!(Xl&268435455)&&!(Uy&268435455)||Jr(Dt,Wt)}function qm(s,e){var t=pe;pe|=2;var n=XE();(Dt!==s||Wt!==e)&&(Gi=null,Hl(s,e));do try{t2();break}catch(i){qE(s,i)}while(!0);if(J_(),pe=t,Vm.current=n,dt!==null)throw Error(N(261));return Dt=null,Wt=0,At}function t2(){for(;dt!==null;)KE(dt)}function n2(){for(;dt!==null&&!CT();)KE(dt)}function KE(s){var e=JE(s.alternate,s,is);s.memoizedProps=s.pendingProps,e===null?YE(s):dt=e,hb.current=null}function YE(s){var e=s;do{var t=e.alternate;if(s=e.return,e.flags&32768){if(t=KP(t,e),t!==null){t.flags&=32767,dt=t;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{At=6,dt=null;return}}else if(t=XP(t,e,is),t!==null){dt=t;return}if(e=e.sibling,e!==null){dt=e;return}dt=e=s}while(e!==null);At===0&&(At=5)}function ma(s,e,t){var n=Se,i=Ls.transition;try{Ls.transition=null,Se=1,s2(s,e,t,n)}finally{Ls.transition=i,Se=n}return null}function s2(s,e,t,n){do Vc();while(Xo!==null);if(pe&6)throw Error(N(327));t=s.finishedWork;var i=s.finishedLanes;if(t===null)return null;if(s.finishedWork=null,s.finishedLanes=0,t===s.current)throw Error(N(177));s.callbackNode=null,s.callbackPriority=0;var r=t.lanes|t.childLanes;if(FT(s,r),s===Dt&&(dt=Dt=null,Wt=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||vg||(vg=!0,ZE(Tm,function(){return Vc(),null})),r=(t.flags&15990)!==0,t.subtreeFlags&15990||r){r=Ls.transition,Ls.transition=null;var o=Se;Se=1;var l=pe;pe|=4,hb.current=null,QP(s,t),VE(t,s),AP(wv),Rm=!!vv,wv=vv=null,s.current=t,JP(t),TT(),pe=l,Se=o,Ls.transition=r}else s.current=t;if(vg&&(vg=!1,Xo=s,Gm=i),r=s.pendingLanes,r===0&&(ea=null),LT(t.stateNode),Fn(s,lt()),e!==null)for(n=s.onRecoverableError,t=0;t<e.length;t++)i=e[t],n(i.value,{componentStack:i.stack,digest:i.digest});if(Wm)throw Wm=!1,s=Bv,Bv=null,s;return Gm&1&&s.tag!==0&&Vc(),r=s.pendingLanes,r&1?s===$v?xd++:(xd=0,$v=s):xd=0,ua(),null}function Vc(){if(Xo!==null){var s=RA(Gm),e=Ls.transition,t=Se;try{if(Ls.transition=null,Se=16>s?16:s,Xo===null)var n=!1;else{if(s=Xo,Xo=null,Gm=0,pe&6)throw Error(N(331));var i=pe;for(pe|=4,$=s.current;$!==null;){var r=$,o=r.child;if($.flags&16){var l=r.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for($=u;$!==null;){var h=$;switch(h.tag){case 0:case 11:case 15:Ad(8,h,r)}var d=h.child;if(d!==null)d.return=h,$=d;else for(;$!==null;){h=$;var f=h.sibling,p=h.return;if(UE(h),h===u){$=null;break}if(f!==null){f.return=p,$=f;break}$=p}}}var y=r.alternate;if(y!==null){var _=y.child;if(_!==null){y.child=null;do{var A=_.sibling;_.sibling=null,_=A}while(_!==null)}}$=r}}if(r.subtreeFlags&2064&&o!==null)o.return=r,$=o;else e:for(;$!==null;){if(r=$,r.flags&2048)switch(r.tag){case 0:case 11:case 15:Ad(9,r,r.return)}var m=r.sibling;if(m!==null){m.return=r.return,$=m;break e}$=r.return}}var b=s.current;for($=b;$!==null;){o=$;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,$=w;else e:for(o=b;$!==null;){if(l=$,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:$y(9,l)}}catch(k){it(l,l.return,k)}if(l===o){$=null;break e}var E=l.sibling;if(E!==null){E.return=l.return,$=E;break e}$=l.return}}if(pe=i,ua(),ji&&typeof ji.onPostCommitFiberRoot=="function")try{ji.onPostCommitFiberRoot(Iy,s)}catch{}n=!0}return n}finally{Se=t,Ls.transition=e}}return!1}function QS(s,e,t){e=Sh(t,e),e=RE(s,e,1),s=Zo(s,e,1),e=yn(),s!==null&&(Hp(s,1,e),Fn(s,e))}function it(s,e,t){if(s.tag===3)QS(s,s,t);else for(;e!==null;){if(e.tag===3){QS(e,s,t);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(ea===null||!ea.has(n))){s=Sh(t,s),s=LE(e,s,1),e=Zo(e,s,1),s=yn(),e!==null&&(Hp(e,1,s),Fn(e,s));break}}e=e.return}}function i2(s,e,t){var n=s.pingCache;n!==null&&n.delete(e),e=yn(),s.pingedLanes|=s.suspendedLanes&t,Dt===s&&(Wt&t)===t&&(At===4||At===3&&(Wt&130023424)===Wt&&500>lt()-fb?Hl(s,0):db|=t),Fn(s,e)}function QE(s,e){e===0&&(s.mode&1?(e=lg,lg<<=1,!(lg&130023424)&&(lg=4194304)):e=1);var t=yn();s=$r(s,e),s!==null&&(Hp(s,e,t),Fn(s,t))}function r2(s){var e=s.memoizedState,t=0;e!==null&&(t=e.retryLane),QE(s,t)}function o2(s,e){var t=0;switch(s.tag){case 13:var n=s.stateNode,i=s.memoizedState;i!==null&&(t=i.retryLane);break;case 19:n=s.stateNode;break;default:throw Error(N(314))}n!==null&&n.delete(e),QE(s,t)}var JE;JE=function(s,e,t){if(s!==null)if(s.memoizedProps!==e.pendingProps||Nn.current)Mn=!0;else{if(!(s.lanes&t)&&!(e.flags&128))return Mn=!1,qP(s,e,t);Mn=!!(s.flags&131072)}else Mn=!1,Ge&&e.flags&1048576&&nE(e,Fm,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;Ug(s,e),s=e.pendingProps;var i=vh(e,rn.current);Hc(e,t),i=ob(null,e,n,s,i,t);var r=ab();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,On(n)?(r=!0,Nm(e)):r=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,tb(e),i.updater=By,e.stateNode=i,i._reactInternals=e,Tv(e,n,s,t),e=Lv(null,e,n,!0,r,t)):(e.tag=0,Ge&&r&&X_(e),gn(null,e,i,t),e=e.child),e;case 16:n=e.elementType;e:{switch(Ug(s,e),s=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=l2(n),s=Us(n,s),i){case 0:e=Rv(null,e,n,s,t);break e;case 1:e=US(null,e,n,s,t);break e;case 11:e=BS(null,e,n,s,t);break e;case 14:e=$S(null,e,n,Us(n.type,s),t);break e}throw Error(N(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Us(n,i),Rv(s,e,n,i,t);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Us(n,i),US(s,e,n,i,t);case 3:e:{if(NE(e),s===null)throw Error(N(387));n=e.pendingProps,r=e.memoizedState,i=r.element,lE(s,e),$m(e,n,null,t);var o=e.memoizedState;if(n=o.element,r.isDehydrated)if(r={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=r,e.memoizedState=r,e.flags&256){i=Sh(Error(N(423)),e),e=zS(s,e,n,t,i);break e}else if(n!==i){i=Sh(Error(N(424)),e),e=zS(s,e,n,t,i);break e}else for(as=Jo(e.stateNode.containerInfo.firstChild),ls=e,Ge=!0,ni=null,t=oE(e,null,n,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(wh(),n===i){e=Ur(s,e,t);break e}gn(s,e,n,t)}e=e.child}return e;case 5:return cE(e),s===null&&xv(e),n=e.type,i=e.pendingProps,r=s!==null?s.memoizedProps:null,o=i.children,_v(n,i)?o=null:r!==null&&_v(n,r)&&(e.flags|=32),ME(s,e),gn(s,e,o,t),e.child;case 6:return s===null&&xv(e),null;case 13:return OE(s,e,t);case 4:return nb(e,e.stateNode.containerInfo),n=e.pendingProps,s===null?e.child=_h(e,null,n,t):gn(s,e,n,t),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Us(n,i),BS(s,e,n,i,t);case 7:return gn(s,e,e.pendingProps,t),e.child;case 8:return gn(s,e,e.pendingProps.children,t),e.child;case 12:return gn(s,e,e.pendingProps.children,t),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,r=e.memoizedProps,o=i.value,Fe(jm,n._currentValue),n._currentValue=o,r!==null)if(ai(r.value,o)){if(r.children===i.children&&!Nn.current){e=Ur(s,e,t);break e}}else for(r=e.child,r!==null&&(r.return=e);r!==null;){var l=r.dependencies;if(l!==null){o=r.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(r.tag===1){c=Mr(-1,t&-t),c.tag=2;var u=r.updateQueue;if(u!==null){u=u.shared;var h=u.pending;h===null?c.next=c:(c.next=h.next,h.next=c),u.pending=c}}r.lanes|=t,c=r.alternate,c!==null&&(c.lanes|=t),kv(r.return,t,e),l.lanes|=t;break}c=c.next}}else if(r.tag===10)o=r.type===e.type?null:r.child;else if(r.tag===18){if(o=r.return,o===null)throw Error(N(341));o.lanes|=t,l=o.alternate,l!==null&&(l.lanes|=t),kv(o,t,e),o=r.sibling}else o=r.child;if(o!==null)o.return=r;else for(o=r;o!==null;){if(o===e){o=null;break}if(r=o.sibling,r!==null){r.return=o.return,o=r;break}o=o.return}r=o}gn(s,e,i.children,t),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Hc(e,t),i=Ms(i),n=n(i),e.flags|=1,gn(s,e,n,t),e.child;case 14:return n=e.type,i=Us(n,e.pendingProps),i=Us(n.type,i),$S(s,e,n,i,t);case 15:return IE(s,e,e.type,e.pendingProps,t);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Us(n,i),Ug(s,e),e.tag=1,On(n)?(s=!0,Nm(e)):s=!1,Hc(e,t),PE(e,n,i),Tv(e,n,i,t),Lv(null,e,n,!0,s,t);case 19:return FE(s,e,t);case 22:return DE(s,e,t)}throw Error(N(156,e.tag))};function ZE(s,e){return kA(s,e)}function a2(s,e,t,n){this.tag=s,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rs(s,e,t,n){return new a2(s,e,t,n)}function yb(s){return s=s.prototype,!(!s||!s.isReactComponent)}
vendor: 9,639 bytes, line 40
40function l2(s){if(typeof s=="function")return yb(s)?1:0;if(s!=null){if(s=s.$$typeof,s===O_)return 11;if(s===F_)return 14}return 2}function na(s,e){var t=s.alternate;return t===null?(t=Rs(s.tag,e,s.key,s.mode),t.elementType=s.elementType,t.type=s.type,t.stateNode=s.stateNode,t.alternate=s,s.alternate=t):(t.pendingProps=e,t.type=s.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=s.flags&14680064,t.childLanes=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,e=s.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=s.sibling,t.index=s.index,t.ref=s.ref,t}function Vg(s,e,t,n,i,r){var o=2;if(n=s,typeof s=="function")yb(s)&&(o=1);else if(typeof s=="string")o=5;else e:switch(s){case Sc:return Vl(t.children,i,r,e);case N_:o=8,i|=8;break;case J0:return s=Rs(12,t,e,i|2),s.elementType=J0,s.lanes=r,s;case Z0:return s=Rs(13,t,e,i),s.elementType=Z0,s.lanes=r,s;case ev:return s=Rs(19,t,e,i),s.elementType=ev,s.lanes=r,s;case cA:return zy(t,i,r,e);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case aA:o=10;break e;case lA:o=9;break e;case O_:o=11;break e;case F_:o=14;break e;case Kr:o=16,n=null;break e}throw Error(N(130,s==null?s:typeof s,""))}return e=Rs(o,t,e,i),e.elementType=s,e.type=n,e.lanes=r,e}function Vl(s,e,t,n){return s=Rs(7,s,n,e),s.lanes=t,s}function zy(s,e,t,n){return s=Rs(22,s,n,e),s.elementType=cA,s.lanes=t,s.stateNode={isHidden:!1},s}function I0(s,e,t){return s=Rs(6,s,null,e),s.lanes=t,s}function D0(s,e,t){return e=Rs(4,s.children!==null?s.children:[],s.key,e),e.lanes=t,e.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},e}function c2(s,e,t,n,i){this.tag=e,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=f0(0),this.expirationTimes=f0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=f0(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function vb(s,e,t,n,i,r,o,l,c){return s=new c2(s,e,t,l,c),e===1?(e=1,r===!0&&(e|=8)):e=0,r=Rs(3,null,null,e),s.current=r,r.stateNode=s,r.memoizedState={element:n,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},tb(r),s}function u2(s,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:bc,key:n==null?null:""+n,children:s,containerInfo:e,implementation:t}}function ex(s){if(!s)return ia;s=s._reactInternals;e:{if(ec(s)!==s||s.tag!==1)throw Error(N(170));var e=s;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(On(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(N(171))}if(s.tag===1){var t=s.type;if(On(t))return eE(s,t,e)}return e}function tx(s,e,t,n,i,r,o,l,c){return s=vb(t,n,!0,s,i,r,o,l,c),s.context=ex(null),t=s.current,n=yn(),i=ta(t),r=Mr(n,i),r.callback=e??null,Zo(t,r,i),s.current.lanes=i,Hp(s,i,n),Fn(s,n),s}function Hy(s,e,t,n){var i=e.current,r=yn(),o=ta(i);return t=ex(t),e.context===null?e.context=t:e.pendingContext=t,e=Mr(r,o),e.payload={element:s},n=n===void 0?null:n,n!==null&&(e.callback=n),s=Zo(i,e,o),s!==null&&(oi(s,i,o,r),jg(s,i,o)),o}function Xm(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function JS(s,e){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var t=s.retryLane;s.retryLane=t!==0&&t<e?t:e}}function wb(s,e){JS(s,e),(s=s.alternate)&&JS(s,e)}function h2(){return null}var nx=typeof reportError=="function"?reportError:function(s){console.error(s)};function _b(s){this._internalRoot=s}Vy.prototype.render=_b.prototype.render=function(s){var e=this._internalRoot;if(e===null)throw Error(N(409));Hy(s,e,null,null)};Vy.prototype.unmount=_b.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var e=s.containerInfo;Kl(function(){Hy(null,s,null,null)}),e[Br]=null}};function Vy(s){this._internalRoot=s}Vy.prototype.unstable_scheduleHydration=function(s){if(s){var e=DA();s={blockedOn:null,target:s,priority:e};for(var t=0;t<Qr.length&&e!==0&&e<Qr[t].priority;t++);Qr.splice(t,0,s),t===0&&NA(s)}};function bb(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function Wy(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function ZS(){}function d2(s,e,t,n,i){if(i){if(typeof n=="function"){var r=n;n=function(){var u=Xm(o);r.call(u)}}var o=tx(e,n,s,0,null,!1,!1,"",ZS);return s._reactRootContainer=o,s[Br]=o.current,Fd(s.nodeType===8?s.parentNode:s),Kl(),o}for(;i=s.lastChild;)s.removeChild(i);if(typeof n=="function"){var l=n;n=function(){var u=Xm(c);l.call(u)}}var c=vb(s,0,!1,null,null,!1,!1,"",ZS);return s._reactRootContainer=c,s[Br]=c.current,Fd(s.nodeType===8?s.parentNode:s),Kl(function(){Hy(e,c,t,n)}),c}function Gy(s,e,t,n,i){var r=t._reactRootContainer;if(r){var o=r;if(typeof i=="function"){var l=i;i=function(){var c=Xm(o);l.call(c)}}Hy(e,o,s,i)}else o=d2(t,e,s,i,n);return Xm(o)}LA=function(s){switch(s.tag){case 3:var e=s.stateNode;if(e.current.memoizedState.isDehydrated){var t=qh(e.pendingLanes);t!==0&&($_(e,t|1),Fn(e,lt()),!(pe&6)&&(Ah=lt()+500,ua()))}break;case 13:Kl(function(){var n=$r(s,1);if(n!==null){var i=yn();oi(n,s,1,i)}}),wb(s,1)}};U_=function(s){if(s.tag===13){var e=$r(s,134217728);if(e!==null){var t=yn();oi(e,s,134217728,t)}wb(s,134217728)}};IA=function(s){if(s.tag===13){var e=ta(s),t=$r(s,e);if(t!==null){var n=yn();oi(t,s,e,n)}wb(s,e)}};DA=function(){return Se};MA=function(s,e){var t=Se;try{return Se=s,e()}finally{Se=t}};uv=function(s,e,t){switch(e){case"input":if(sv(s,t),e=t.name,t.type==="radio"&&e!=null){for(t=s;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var n=t[e];if(n!==s&&n.form===s.form){var i=Oy(n);if(!i)throw Error(N(90));hA(n),sv(n,i)}}}break;case"textarea":fA(s,t);break;case"select":e=t.value,e!=null&&Bc(s,!!t.multiple,e,!1)}};_A=pb;bA=Kl;var f2={usingClientEntryPoint:!1,Events:[Wp,kc,Oy,vA,wA,pb]},jh={findFiberByHostInstance:xa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},p2={bundleType:jh.bundleType,version:jh.version,rendererPackageName:jh.rendererPackageName,rendererConfig:jh.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Vr.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=EA(s),s===null?null:s.stateNode},findFiberByHostInstance:jh.findFiberByHostInstance||h2,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 wg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wg.isDisabled&&wg.supportsFiber)try{Iy=wg.inject(p2),ji=wg}catch{}}hs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=f2;hs.createPortal=function(s,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bb(e))throw Error(N(200));return u2(s,e,null,t)};hs.createRoot=function(s,e){if(!bb(s))throw Error(N(299));var t=!1,n="",i=nx;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=vb(s,1,!1,null,null,t,!1,n,i),s[Br]=e.current,Fd(s.nodeType===8?s.parentNode:s),new _b(e)};hs.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var e=s._reactInternals;if(e===void 0)throw typeof s.render=="function"?Error(N(188)):(s=Object.keys(s).join(","),Error(N(268,s)));return s=EA(e),s=s===null?null:s.stateNode,s};hs.flushSync=function(s){return Kl(s)};hs.hydrate=function(s,e,t){if(!Wy(e))throw Error(N(200));return Gy(null,s,e,!0,t)};hs.hydrateRoot=function(s,e,t){if(!bb(s))throw Error(N(405));var n=t!=null&&t.hydratedSources||null,i=!1,r="",o=nx;if(t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=tx(e,null,s,1,t??null,i,!1,r,o),s[Br]=e.current,Fd(s),n)for(s=0;s<n.length;s++)t=n[s],i=t._getVersion,i=i(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,i]:e.mutableSourceEagerHydrationData.push(t,i);return new Vy(e)};hs.render=function(s,e,t){if(!Wy(e))throw Error(N(200));return Gy(null,s,e,!1,t)};hs.unmountComponentAtNode=function(s){if(!Wy(s))throw Error(N(40));return s._reactRootContainer?(Kl(function(){Gy(null,null,s,!1,function(){s._reactRootContainer=null,s[Br]=null})}),!0):!1};hs.unstable_batchedUpdates=pb;hs.unstable_renderSubtreeIntoContainer=function(s,e,t,n){if(!Wy(t))throw Error(N(200));if(s==null||s._reactInternals===void 0)throw Error(N(38));return Gy(s,e,t,!1,n)};hs.version="18.3.1-next-f1338f8080-20240426";function sx(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(sx)}catch(s){console.error(s)}}sx(),sA.exports=hs;var g2=sA.exports,ix,e1=g2;ix=e1.createRoot,e1.hydrateRoot;const m2="modulepreload",y2=function(s){return"/"+s}
40,t1={},qp=function(e,t,n){let i=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(t.map(c=>{if(c=y2(c),c in t1)return;t1[c]=!0;const u=c.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":m2,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((f,p)=>{d.addEventListener("load",f),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&r(l.reason);return e().catch(r)})},v2=s=>{let e;return s?e=s:typeof fetch>"u"?e=(...t)=>qp(async()=>{const{default:n}=await Promise.resolve().then(()=>Th);return{default:n}},[]).then(({default:n})=>n(...t)):e=fetch,(...t)=>e(...t)};class Sb extends Error{constructor(e,t="FunctionsError",n){super(e),this.name=t,this.context=n}}class w2 extends Sb{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class n1 extends Sb{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class s1 extends Sb{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Hv;(function(s){s.Any="any",s.ApNortheast1="ap-northeast-1",s.ApNortheast2="ap-northeast-2",s.ApSouth1="ap-south-1",s.ApSoutheast1="ap-southeast-1",s.ApSoutheast2="ap-southeast-2",s.CaCentral1="ca-central-1",s.EuCentral1="eu-central-1",s.EuWest1="eu-west-1",s.EuWest2="eu-west-2",s.EuWest3="eu-west-3",s.SaEast1="sa-east-1",s.UsEast1="us-east-1",s.UsWest1="us-west-1",s.UsWest2="us-west-2"})(Hv||(Hv={}));var _2=function(s,e,t,n){function i(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function l(h){try{u(n.next(h))}catch(d){o(d)}}function c(h){try{u(n.throw(h))}catch(d){o(d)}}function u(h){h.done?r(h.value):i(h.value).then(l,c)}u((n=n.apply(s,e||[])).next())})};class b2{constructor(e,{headers:t={},customFetch:n,region:i=Hv.Any}={}){this.url=e,this.headers=t,this.region=i,this.fetch=v2(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var n;return _2(this,void 0,void 0,function*(){try{const{headers:i,method:r,body:o}=t;let l={},{region:c}=t;c||(c=this.region);const u=new URL(`${this.url}/${e}`);c&&c!=="any"&&(l["x-region"]=c,u.searchParams.set("forceFunctionRegion",c));let h;o&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)&&(typeof Blob<"u"&&o instanceof Blob||o instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",h=o):typeof o=="string"?(l["Content-Type"]="text/plain",h=o):typeof FormData<"u"&&o instanceof FormData?h=o:(l["Content-Type"]="application/json",h=JSON.stringify(o)));const d=yield this.fetch(u.toString(),{method:r||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),i),body:h}).catch(_=>{throw new w2(_)}),f=d.headers.get("x-relay-error");if(f&&f==="true")throw new n1(d);if(!d.ok)throw new s1(d);let p=((n=d.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),y;return p==="application/json"?y=yield d.json():p==="application/octet-stream"?y=yield d.blob():p==="text/event-stream"?y=d:p==="multipart/form-data"?y=yield d.formData():y=yield d.text(),{data:y,error:null,response:d}}catch(i){return{data:null,error:i,response:i instanceof s1||i instanceof n1?i.context:void 0}}})}}var Dn={},Ab={},qy={},Xp={},Xy={},Ky={},S2=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},Eh=S2();const A2=Eh.fetch,rx=Eh.fetch.bind(Eh),ox=Eh.Headers,E2=Eh.Request,x2=Eh.Response,Th=Object.freeze(Object.defineProperty({__proto__:null,Headers:ox,Request:E2,Re
40sponse:x2,default:rx,fetch:A2},Symbol.toStringTag,{value:"Module"})),k2=HC(Th);var Yy={};Object.defineProperty(Yy,"__esModule",{value:!0});let C2=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Yy.default=C2;var ax=Ds&&Ds.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ky,"__esModule",{value:!0});const T2=ax(k2),P2=ax(Yy);let R2=class{constructor(e){var t,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:typeof fetch>"u"?this.fetch=T2.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const n=this.fetch;let i=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async r=>{var o,l,c,u;let h=null,d=null,f=null,p=r.status,y=r.statusText;if(r.ok){if(this.method!=="HEAD"){const b=await r.text();b===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?d=b:d=JSON.parse(b))}const A=(l=this.headers.get("Prefer"))===null||l===void 0?void 0:l.match(/count=(exact|planned|estimated)/),m=(c=r.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");A&&m&&m.length>1&&(f=parseInt(m[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(h={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,f=null,p=406,y="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{const A=await r.text();try{h=JSON.parse(A),Array.isArray(h)&&r.status===404&&(d=[],h=null,p=200,y="OK")}catch{r.status===404&&A===""?(p=204,y="No Content"):h={message:A}}if(h&&this.isMaybeSingle&&(!((u=h==null?void 0:h.details)===null||u===void 0)&&u.includes("0 rows"))&&(h=null,p=200,y="OK"),h&&this.shouldThrowOnError)throw new P2.default(h)}return{error:h,data:d,count:f,status:p,statusText:y}});return this.shouldThrowOnError||(i=i.catch(r=>{var o,l,c;return{error:{message:`${(o=r==null?void 0:r.name)!==null&&o!==void 0?o:"FetchError"}: ${r==null?void 0:r.message}`,details:`${(l=r==null?void 0:r.stack)!==null&&l!==void 0?l:""}`,hint:"",code:`${(c=r==null?void 0:r.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),i.then(e,t)}returns(){return this}overrideTypes(){return this}};Ky.default=R2;var L2=Ds&&Ds.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Xy,"__esModule",{value:!0});const I2=L2(Ky);let D2=class extends I2.default{select(e){let t=!1;const n=(e??"*").split("").map(i=>/\s/.test(i)&&!t?"":(i==='"'&&(t=!t),i)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:i,referencedTable:r=i}={}){const o=r?`${r}.order`:"order",l=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:i=n}={}){const r=typeof i>"u"?"offset":`${i}.offset`,o=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(r,`${e}`),this.url.searchParams.set(o,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
40explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:i=!1,wal:r=!1,format:o="text"}={}){var l;const c=[e?"analyze":null,t?"verbose":null,n?"settings":null,i?"buffers":null,r?"wal":null].filter(Boolean).join("|"),u=(l=this.headers.get("Accept"))!==null&&l!==void 0?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${u}"; options=${c};`),o==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};Xy.default=D2;var M2=Ds&&Ds.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Xp,"__esModule",{value:!0});const N2=M2(Xy);let O2=class extends N2.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(i=>typeof i=="string"&&new RegExp("[,()]").test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:i}={}){let r="";i==="plain"?r="pl":i==="phrase"?r="ph":i==="websearch"&&(r="w");const o=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${r}fts${o}.${t}`),this}match(e){return Object.entries(e).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const i=n?`${n}.or`:"or";return this.url.searchParams.append(i,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}};Xp.default=O2;var F2=Ds&&Ds.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(qy,"__esModule",{value:!0});const Bh=F2(Xp);let j2=class{constructor(e,{headers:t={},schema:n,fetch:i}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=i}select(e,{head:t=!1,count:n}={}){const i=t?"HEAD":"GET";let r=!1;const o=(e??"*").split("").map(l=>/\s/.test(l)&&!r?"":(l==='"'&&(r=!r),l)).join("");return this.url.searchParams.set("select",o),n&&this.headers.append("Prefer",`count=${n}`),new Bh.default({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:n=!0}={}){var i;const r="POST";if(t&&this.headers.append("Prefer",`count=${t}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const o=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new Bh.default({method:r,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:i,defaultToNull:r=!0}={}){var o;const l="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&this.url.searchParams.set("on_conflict",t),i&&this.headers.append("Prefer",`count=${i}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(c.length>0){const u=[...new Set(c)].map(h=>`"${h}"`);this.url.searchParams.set("columns",u.join(","))}}return new Bh.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(e,{count:t}={}){var n;const i="PATCH";return t&&this.headers.append("Prefer",`count=${t}`),new Bh.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var t;const n="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new Bh.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}};qy.default=j2;var lx=Ds&&Ds.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};
40Object.defineProperty(Ab,"__esModule",{value:!0});const B2=lx(qy),$2=lx(Xp);let U2=class cx{constructor(e,{headers:t={},schema:n,fetch:i}={}){this.url=e,this.headers=new Headers(t),this.schemaName=n,this.fetch=i}from(e){const t=new URL(`${this.url}/${e}`);return new B2.default(t,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new cx(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:n=!1,get:i=!1,count:r}={}){var o;let l;const c=new URL(`${this.url}/rpc/${e}`);let u;n||i?(l=n?"HEAD":"GET",Object.entries(t).filter(([d,f])=>f!==void 0).map(([d,f])=>[d,Array.isArray(f)?`{${f.join(",")}}`:`${f}`]).forEach(([d,f])=>{c.searchParams.append(d,f)})):(l="POST",u=t);const h=new Headers(this.headers);return r&&h.set("Prefer",`count=${r}`),new $2.default({method:l,url:c,headers:h,schema:this.schemaName,body:u,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};Ab.default=U2;var Ph=Ds&&Ds.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Dn,"__esModule",{value:!0});Dn.PostgrestError=Dn.PostgrestBuilder=Dn.PostgrestTransformBuilder=Dn.PostgrestFilterBuilder=Dn.PostgrestQueryBuilder=Dn.PostgrestClient=void 0;const ux=Ph(Ab);Dn.PostgrestClient=ux.default;const hx=Ph(qy);Dn.PostgrestQueryBuilder=hx.default;const dx=Ph(Xp);Dn.PostgrestFilterBuilder=dx.default;const fx=Ph(Xy);Dn.PostgrestTransformBuilder=fx.default;const px=Ph(Ky);Dn.PostgrestBuilder=px.default;const gx=Ph(Yy);Dn.PostgrestError=gx.default;var z2=Dn.default={PostgrestClient:ux.default,PostgrestQueryBuilder:hx.default,PostgrestFilterBuilder:dx.default,PostgrestTransformBuilder:fx.default,PostgrestBuilder:px.default,PostgrestError:gx.default};const{PostgrestClient:H2,PostgrestQueryBuilder:lM,PostgrestFilterBuilder:cM,PostgrestTransformBuilder:uM,PostgrestBuilder:hM,PostgrestError:dM}=z2;class V2{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const t=process.versions;if(t&&t.node){const n=t.node,i=parseInt(n.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
41import ws from "ws"
42new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=`
43
44Suggested solution: ${e.workaround}`),new Error(t)}static createWebSocket(e,t){const n=this.getWebSocketConstructor();return new n(e,t)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const W2="2.15.5",G2=`realtime-js/${W2}`,q2="1.0.0",Vv=1e4,X2=1e3,K2=100;var kd;(function(s){s[s.connecting=0]="connecting",s[s.open=1]="open",s[s.closing=2]="closing",s[s.closed=3]="closed"})(kd||(kd={}));var mt;(function(s){s.closed="closed",s.errored="errored",s.joined="joined",s.joining="joining",s.leaving="leaving"})(mt||(mt={}));var ti;(function(s){s.close="phx_close",s.error="phx_error",s.join="phx_join",s.reply="phx_reply",s.leave="phx_leave",s.access_token="access_token"})(ti||(ti={}));var Wv;(function(s){s.websocket="websocket"})(Wv||(Wv={}));var ba;(function(s){s.Connecting="connecting",s.Open="open",s.Closing="closing",s.Closed="closed"})(ba||(ba={}));class Y2{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),n=new TextDecoder;return this._decodeBroadcast(e,t,n)}_decodeBroadcast(e,t,n){const i=t.getUint8(1),r=t.getUint8(2);let o=this.HEADER_LENGTH+2;const l=n.decode(e.slice(o,o+i));o=o+i;const c=n.decode(e.slice(o,o+r));o=o+r;const u=JSON.parse(n.decode(e.slice(o,e.byteLength)));return{ref:null,topic:l,event:c,payload:u}}}class mx{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var De;(function(s){s.abstime="abstime",s.bool="bool",s.date="date",s.daterange="daterange",s.float4="float4",s.float8="float8",s.int2="int2",s.int4="int4",s.int4range="int4range",s.int8="int8",s.int8range="int8range",s.json="json",s.jsonb="jsonb",s.money="money",s.numeric="numeric",s.oid="oid",s.reltime="reltime",s.text="text",s.time="time",s.timestamp="timestamp",s.timestamptz="timestamptz",s.timetz="timetz",s.tsrange="tsrange",s.tstzrange="tstzrange"})(De||(De={}));const i1=(s,e,t={})=>{var n;const i=(n=t.skipTypes)!==null&&n!==void 0?n:[];return Object.keys(e).reduce((r,o)=>(r[o]=Q2(o,s,e,i),r),{})},Q2=(s,e,t,n)=>{const i=e.find(l=>
vendor: 6,408 bytes, line 44
44l.name===s),r=i==null?void 0:i.type,o=t[s];return r&&!n.includes(r)?yx(r,o):Gv(o)},yx=(s,e)=>{if(s.charAt(0)==="_"){const t=s.slice(1,s.length);return tR(e,t)}switch(s){case De.bool:return J2(e);case De.float4:case De.float8:case De.int2:case De.int4:case De.int8:case De.numeric:case De.oid:return Z2(e);case De.json:case De.jsonb:return eR(e);case De.timestamp:return nR(e);case De.abstime:case De.date:case De.daterange:case De.int4range:case De.int8range:case De.money:case De.reltime:case De.text:case De.time:case De.timestamptz:case De.timetz:case De.tsrange:case De.tstzrange:return Gv(e);default:return Gv(e)}},Gv=s=>s,J2=s=>{switch(s){case"t":return!0;case"f":return!1;default:return s}},Z2=s=>{if(typeof s=="string"){const e=parseFloat(s);if(!Number.isNaN(e))return e}return s},eR=s=>{if(typeof s=="string")try{return JSON.parse(s)}catch(e){return console.log(`JSON parse error: ${e}`),s}return s},tR=(s,e)=>{if(typeof s!="string")return s;const t=s.length-1,n=s[t];if(s[0]==="{"&&n==="}"){let r;const o=s.slice(1,t);try{r=JSON.parse("["+o+"]")}catch{r=o?o.split(","):[]}return r.map(l=>yx(e,l))}return s},nR=s=>typeof s=="string"?s.replace(" ","T"):s,vx=s=>{let e=s;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"};class M0{constructor(e,t,n={},i=Vv){this.channel=e,this.event=t,this.payload=n,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var n;return this._hasReceived(e)&&t((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=t=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=t,this._matchReceive(t)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var r1;(function(s){s.SYNC="sync",s.JOIN="join",s.LEAVE="leave"})(r1||(r1={}));class Cd{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(t==null?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},i=>{const{onJoin:r,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Cd.syncState(this.state,i,r,o),this.pendingDiffs.forEach(c=>{this.state=Cd.syncDiff(this.state,c,r,o)}),this.pendingDiffs=[],l()}),this.channel._on(n.diff,{},i=>{const{onJoin:r,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=Cd.syncDiff(this.state,i,r,o),l())}),this.onJoin((i,r,o)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:r,newPresences:o})}),this.onLeave((i,r,o)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:r,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,n,i){const r=this.cloneDeep(e),o=this.transformState(t),l={},c={};return this.map(r,(u,h)=>{o[u]||(c[u]=h)}),this.map(o,(u,h)=>{const d=r[u];if(d){const f=h.map(A=>A.presence_ref),p=d.map(A=>A.presence_ref),y=h.filter(A=>p.indexOf(A.presence_ref)<0),_=d.filter(A=>f.indexOf(A.presence_ref)<0);y.length>0&&(l[u]=y),_.length>0&&(c[u]=_)}else l[u]=h}),this.syncDiff(r,{joins:l,leaves:c},n,i)}static syncDiff(e,t,n,i){const{joins:r,leaves:o}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return n||(n=()=>{}),i||(i=()=>{}),this.map(r,(l,c)=>{var u;const h=(u=e[l])!==null&&u!==void 0?u:[];if(e[l]=this.cloneDeep(c),h.length>0){const d=e[l].map(p=>p.presence_ref),f=h.filter(p=>d.indexOf(p.presence_ref)<0);e[l].unshift(...f)}n(l,h,c)}),this.map(o,(l,c)=>{let u=e[l];if(!u)return;const h=c.map(d=>d.presence_ref);u=u.filter(d=>h.indexOf(d.presence_ref)<0),e[l]=u,i(l,u,c),u.length===0&&delete e[l]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(n=>t(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,n)=>{const i=e[n];return"metas"in i?t[n]=i.metas.map(r=>(r.presence_ref=r.phx_ref,delete r.phx_ref,delete r.phx_ref_prev,r)):t[n]=i,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var o1;(function(s){s.ALL="*",s.INSERT="INSERT",s.UPDATE="UPDATE",s.DELETE="DELETE"})(o1||(o1={}));var Td;(function(s){s.BROADCAST="broadcast",s.PRESENCE="presence",s.POSTGRES_CHANGES="postgres_changes",s.SYSTEM="system"})(Td||(Td={}));var qi;(function(s){s.SUBSCRIBED="SUBSCRIBED",s.TIMED_OUT="TIMED_OUT",s.CLOSED="CLOSED",s.CHANNEL_ERROR="CHANNEL_ERROR"})(qi||(qi={}));class Eb{constructor(e,t={config:{}},n){this.topic=e,this.params=t,this.socket=n,this.bindings={},this.state=mt.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new M0(this,ti.join,this.params,this.timeout),this.rejoinTimer=new mx(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=mt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(i=>
44i.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=mt.closed,this.socket._remove(this)}),this._onError(i=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,i),this.state=mt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=mt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",i=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,i),this.state=mt.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ti.reply,{},(i,r)=>{this._trigger(this._replyEventName(r),i)}),this.presence=new Cd(this),this.broadcastEndpointURL=vx(this.socket.endPoint),this.private=this.params.config.private||!1}subscribe(e,t=this.timeout){var n,i,r;if(this.socket.isConnected()||this.socket.connect(),this.state==mt.closed){const{config:{broadcast:o,presence:l,private:c}}=this.params,u=(i=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(p=>p.filter))!==null&&i!==void 0?i:[],h=!!this.bindings[Td.PRESENCE]&&this.bindings[Td.PRESENCE].length>0||((r=this.params.config.presence)===null||r===void 0?void 0:r.enabled)===!0,d={},f={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:h}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(p=>e==null?void 0:e(qi.CHANNEL_ERROR,p)),this._onClose(()=>e==null?void 0:e(qi.CLOSED)),this.updateJoinPayload(Object.assign({config:f},d)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:p})=>{var y;if(this.socket.setAuth(),p===void 0){e==null||e(qi.SUBSCRIBED);return}else{const _=this.bindings.postgres_changes,A=(y=_==null?void 0:_.length)!==null&&y!==void 0?y:0,m=[];for(let b=0;b<A;b++){const w=_[b],{filter:{event:E,schema:k,table:x,filter:C}}=w,P=p&&p[b];if(P&&P.event===E&&P.schema===k&&P.table===x&&P.filter===C)m.push(Object.assign(Object.assign({},w),{id:P.id}));else{this.unsubscribe(),this.state=mt.errored,e==null||e(qi.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=m,e&&e(qi.SUBSCRIBED);return}}).receive("error",p=>{this.state=mt.errored,e==null||e(qi.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(p).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(qi.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,n){return this.state===mt.joined&&e===Td.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,t,n)}async send(e,t={}){var n,i;if(!this._canPush()&&e.type==="broadcast"){const{event:r,payload:o}=e,c={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:r,payload:o,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=t.timeout)!==null&&n!==void 0?n:this.timeout);return await((i=u.body)===null||i===void 0?void 0:i.cancel()),u.ok?"ok":"error"}catch(u){return u.name==="AbortError"?"timed out":"error"}}else return new Promise(r=>{var o,l,c;const u=this._push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&r("ok"),u.receive("ok",()=>r("ok")),u.receive("error",()=>r("error")),u.receive("timeout",()=>r("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=mt.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ti.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(i=>{n=new M0(this,ti.leave,{},e),n.receive("ok",()=>{t(),i("ok")}).receive("timeout",()=>{t(),i("timed out")}).receive("error",()=>{i("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n==null||n.destroy()})}
44teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=mt.closed,this.bindings={}}async _fetchWithTimeout(e,t,n){const i=new AbortController,r=setTimeout(()=>i.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(r),o}_push(e,t,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new M0(this,e,t,n);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>K2){const t=this.pushBuffer.shift();t&&(t.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${t.event}`,t.payload))}}_onMessage(e,t,n){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,n){var i,r;const o=e.toLocaleLowerCase(),{close:l,error:c,leave:u,join:h}=ti;if(n&&[l,c,u,h].indexOf(o)>=0&&n!==this._joinRef())return;let f=this._onMessage(o,t,n);if(t&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(p=>{var y,_,A;return((y=p.filter)===null||y===void 0?void 0:y.event)==="*"||((A=(_=p.filter)===null||_===void 0?void 0:_.event)===null||A===void 0?void 0:A.toLocaleLowerCase())===o}).map(p=>p.callback(f,n)):(r=this.bindings[o])===null||r===void 0||r.filter(p=>{var y,_,A,m,b,w;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in p){const E=p.id,k=(y=p.filter)===null||y===void 0?void 0:y.event;return E&&((_=t.ids)===null||_===void 0?void 0:_.includes(E))&&(k==="*"||(k==null?void 0:k.toLocaleLowerCase())===((A=t.data)===null||A===void 0?void 0:A.type.toLocaleLowerCase()))}else{const E=(b=(m=p==null?void 0:p.filter)===null||m===void 0?void 0:m.event)===null||b===void 0?void 0:b.toLocaleLowerCase();return E==="*"||E===((w=t==null?void 0:t.event)===null||w===void 0?void 0:w.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===o}).map(p=>{if(typeof f=="object"&&"ids"in f){const y=f.data,{schema:_,table:A,commit_timestamp:m,type:b,errors:w}=y;f=Object.assign(Object.assign({},{schema:_,table:A,commit_timestamp:m,eventType:b,new:{},old:{},errors:w}),this._getPayloadRecords(y))}p.callback(f,n)})}_isClosed(){return this.state===mt.closed}_isJoined(){return this.state===mt.joined}_isJoining(){return this.state===mt.joining}_isLeaving(){return this.state===mt.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,n){const i=e.toLocaleLowerCase(),r={type:i,filter:t,callback:n};return this.bindings[i]?this.bindings[i].push(r):this.bindings[i]=[r],this}_off(e,t){const n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(i=>{var r;return!(((r=i.type)===null||r===void 0?void 0:r.toLocaleLowerCase())===n&&Eb.isEqual(i.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(ti.close,{},e)}_onError(e){this._on(ti.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=mt.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=i1(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=i1(e.columns,e.old_record)),t}}const N0=()=>{},_g={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},sR=[1e3,2e3,5e3,1e4],iR=1e4,rR=`
45  addEventListener("message", (e) => {
46    if (e.data.event === "start") {
47      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
48    }
49  });`;class oR{constructor(e,t){var n;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Vv,this.transport=null,this.heartbeatIntervalMs=_g.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=N0,this.ref=0,this.reconnectTimer=null,this.logger=N0,this.conn=null,this.sendBuffer=[],this.serializer
49=new Y2,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=i=>{let r;return i?r=i:typeof fetch>"u"?r=(...o)=>qp(async()=>{const{default:l}=await Promise.resolve().then(()=>Th);return{default:l}},void 0).then(({default:l})=>l(...o)).catch(l=>{throw new Error(`Failed to load @supabase/node-fetch: ${l.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):r=fetch,(...o)=>r(...o)},!(!((n=t==null?void 0:t.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${Wv.websocket}`,this.httpEndpoint=vx(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(t==null?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=V2.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const t=e.message;throw t.includes("Node.js")?new Error(`${t}
50
51To use Realtime in Node.js, you need to provide a WebSocket implementation:
52
53Option 1: Use Node.js 22+ which has native WebSocket support
54Option 2: Install and provide the "ws" package:
55
56  npm install ws
57
58  import ws from "ws"
59  const client = new RealtimeClient(url, {
60    ...options,
61    transport: ws
62  })`):new Error(`WebSocket not available: ${t}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:q2}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},e?this.conn.close(e,t??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map(t=>t.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,n){this.logger(e,t,n)}connectionState(){switch(this.conn&&this.conn.readyState){case kd.connecting:return ba.Connecting;case kd.open:return ba.Open;case kd.closing:return ba.Closing;default:return ba.Closed}}isConnected(){return this.connectionState()===ba.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,t={config:{}}){const n=`realtime:${e}`,i=this.getChannels().find(r=>r.topic===n);if(i)return i;{const r=new Eb(`realtime:${e}`,t,this);return this.channels.push(r),r}}push(e){const{topic:t,event:n,payload:i,ref:r}=e,o=()=>{this.encode(e,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${t} ${n} (${r})`,i),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(X2,"heartbeat timeout"),setTimeout(()=>{var t;this.isConnected()||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout()},_g.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>
620&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n._isJoined()||n._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,t=>{if(t.topic==="phoenix"&&t.event==="phx_reply")try{this.heartbeatCallback(t.payload.status==="ok"?"ok":"error")}catch(u){this.log("error","error in heartbeat callback",u)}t.ref&&t.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:n,event:i,payload:r,ref:o}=t,l=o?`(${o})`:"",c=r.status||"";this.log("receive",`${c} ${n} ${i} ${l}`.trim(),r),this.channels.filter(u=>u._isMember(n)).forEach(u=>u._trigger(i,r,o)),this._triggerStateCallbacks("message",t)})}_clearTimer(e){var t;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((t=this.reconnectTimer)===null||t===void 0||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=t=>{this.log("worker","worker error",t.message),this.workerRef.terminate()},this.workerRef.onmessage=t=>{t.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(ti.error))}_appendParams(e,t){if(Object.keys(t).length===0)return e;const n=e.match(/\?/)?"&":"?",i=new URLSearchParams(t);return`${e}${n}${i}`}_workerObjectUrl(e){let t;if(e)t=e;else{const n=new Blob([rR],{type:"application/javascript"});t=URL.createObjectURL(n)}return t}_setConnectionState(e,t=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t;e?t=e:this.accessToken?t=await this.accessToken():t=this.accessTokenValue,this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(n=>{const i={access_token:t,version:G2};t&&n.updateJoinPayload(i),n.joinedOnce&&n._isJoined()&&n._push(ti.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(t=>{this.log("error",`error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(t)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new mx(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},_g.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var t,n,i,r,o,l,c,u,h;if(this.transport=(t=e==null?void 0:e.transport)!==null&&t!==void 0?t:null,this.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:Vv,this.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:_g.HEARTBEAT_INTERVAL,this.worker=(r=e==null?void 0:e.worker)!==null&&r!==void 0?r:!1,this.accessToken=(o=e==null?void 0:e.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(l=e==null?void 0:e.heartbeatCallback)!==null&&l!==void 0?l:N0,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=e==null?void 0:e.reconnectAfterMs)!==null&&c!==void 0?c:d=>sR[d-1]||iR,this.encode=(u=e==null?void 0:e.encode)!==null&&u!==void 0?u:(d,f)=>f(JSON.stringify(d)),this.decode=(h=e==null?void 0:e.decode)!==null&&h!==void 0?h:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}
62class xb extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function bt(s){return typeof s=="object"&&s!==null&&"__isStorageError"in s}class aR extends xb{constructor(e,t,n){super(e),this.name="StorageApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class qv extends xb{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}var lR=function(s,e,t,n){function i(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function l(h){try{u(n.next(h))}catch(d){o(d)}}function c(h){try{u(n.throw(h))}catch(d){o(d)}}function u(h){h.done?r(h.value):i(h.value).then(l,c)}u((n=n.apply(s,e||[])).next())})};const wx=s=>{let e;return s?e=s:typeof fetch>"u"?e=(...t)=>qp(async()=>{const{default:n}=await Promise.resolve().then(()=>Th);return{default:n}},void 0).then(({default:n})=>n(...t)):e=fetch,(...t)=>e(...t)},cR=()=>lR(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield qp(()=>Promise.resolve().then(()=>Th),void 0)).Response:Response}),Xv=s=>{if(Array.isArray(s))return s.map(t=>Xv(t));if(typeof s=="function"||s!==Object(s))return s;const e={};return Object.entries(s).forEach(([t,n])=>{const i=t.replace(/([-_][a-z])/gi,r=>r.toUpperCase().replace(/[-_]/g,""));e[i]=Xv(n)}),e},uR=s=>{if(typeof s!="object"||s===null)return!1;const e=Object.getPrototypeOf(s);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in s)&&!(Symbol.iterator in s)};var tc=function(s,e,t,n){function i(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function l(h){try{u(n.next(h))}catch(d){o(d)}}function c(h){try{u(n.throw(h))}catch(d){o(d)}}function u(h){h.done?r(h.value):i(h.value).then(l,c)}u((n=n.apply(s,e||[])).next())})};const O0=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),hR=(s,e,t)=>tc(void 0,void 0,void 0,function*(){const n=yield cR();s instanceof n&&!(t!=null&&t.noResolveJson)?s.json().then(i=>{const r=s.status||500,o=(i==null?void 0:i.statusCode)||r+"";e(new aR(O0(i),r,o))}).catch(i=>{e(new qv(O0(i),i))}):e(new qv(O0(s),s))}),dR=(s,e,t,n)=>{const i={method:s,headers:(e==null?void 0:e.headers)||{}};return s==="GET"||!n?i:(uR(n)?(i.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(n)):i.body=n,e!=null&&e.duplex&&(i.duplex=e.duplex),Object.assign(Object.assign({},i),t))};function Kp(s,e,t,n,i,r){return tc(this,void 0,void 0,function*(){return new Promise((o,l)=>{s(t,dR(e,n,i,r)).then(c=>{if(!c.ok)throw c;return n!=null&&n.noResolveJson?c:c.json()}).then(c=>o(c)).catch(c=>hR(c,l,n))})})}function Km(s,e,t,n){return tc(this,void 0,void 0,function*(){return Kp(s,"GET",e,t,n)})}function pi(s,e,t,n,i){return tc(this,void 0,void 0,function*(){return Kp(s,"POST",e,n,i,t)})}function Kv(s,e,t,n,i){return tc(this,void 0,void 0,function*(){return Kp(s,"PUT",e,n,i,t)})}function fR(s,e,t,n){return tc(this,void 0,void 0,function*(){return Kp(s,"HEAD",e,Object.assign(Object.assign({},t),{noResolveJson:!0}),n)})}function _x(s,e,t,n,i){return tc(this,void 0,void 0,function*(){return Kp(s,"DELETE",e,n,i,t)})}var an=function(s,e,t,n){function i(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function l(h){try{u(n.next(h))}catch(d){o(d)}}function c(h){try{u(n.throw(h))}catch(d){o(d)}}function u(h){h.done?r(h.value):i(h.value).then(l,c)}u((n=n.apply(s,e||[])).next())})};const pR={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},a1={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class gR{constructor(e,t={},n,i){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=n,this.fetch=wx(i)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,t,n,i){return an(this,void 0,void 0,function*(){try{let r;const o=Object.assign(Object.assign({},a1),i);let l=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;typeof Blob<"u"&&n instanceof Blob?(r=new FormData,r.append("cacheControl",o.cacheControl),c&&r.append("metadata",this.encodeMetadata(c)),r.append("",n)):typeof FormData<"u"&&n instanceof FormData?(r=n,r.append("cacheControl",o.cacheControl),c&&r.append("metadata",this.encodeMetadata(c))):(r=n,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=this.toBase64(this.encodeMetadata(c)))),i!=null&&i.headers&&(l=Object.assign(Object.assign({},l),i.headers));const u=this._removeEmptyFolders(t),h=this._getFinalPath(u),d=yield(e=="PUT"?Kv:pi)(this.fetch,`${this.url}/object/${h}`,r,Object.assign({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{data:{path:u,id:d.Id,fullPath:d.Key},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(bt(r))return{data:null,error:r};throw r}})}upload(e,t,n){return an(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,n)})}uploadToSignedUrl(e,t,n,i){return an(this,void 0,void 0,function*(){const r=this._removeEmptyFolders(e),o=this._getFinalPath(r),l=new URL(this.url+`/object/upload/sign/${o}`);l.searchParams.set("token",t);try{let c;const u=Object.assign({upsert:a1.upsert},i),h=Object.assign(Object.assign({},this.headers),{"x-upsert":String(u.upsert)});typeof Blob<"u"&&n instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),c.append("",n)):typeof FormData<"u"&&n instanceof FormData?(c=n,c.append("cacheControl",u.cacheControl)):(c=n,h["cache-control"]=`max-age=${u.cacheControl}`,h["content-type"]=u.contentType);const d=yield Kv(this.fetch,l.toString(),c,{headers:h});return{data:{path:r,fullPath:d.Key},error:null}}catch(c){if(this.shouldThrowOnError)throw c;if(bt(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(e,t){return an(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e);const i=Object.assign({},this.headers);t!=null&&t.upsert&&(i["x-upsert"]="true");const r=yield pi(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:i}),o=new URL(this.url+r.url),l=o.searchParams.get("token");if(!l)throw new xb("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:l},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(bt(n))return{data:null,error:n};throw n}})}update(e,t,n){return an(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,n)})}move(e,t,n){return an(this,void 0,void 0,function*(){try{return{data:yield pi(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,de
62stinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(bt(i))return{data:null,error:i};throw i}})}copy(e,t,n){return an(this,void 0,void 0,function*(){try{return{data:{path:(yield pi(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers})).Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(bt(i))return{data:null,error:i};throw i}})}createSignedUrl(e,t,n){return an(this,void 0,void 0,function*(){try{let i=this._getFinalPath(e),r=yield pi(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:t},n!=null&&n.transform?{transform:n.transform}:{}),{headers:this.headers});const o=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return r={signedUrl:encodeURI(`${this.url}${r.signedURL}${o}`)},{data:r,error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(bt(i))return{data:null,error:i};throw i}})}createSignedUrls(e,t,n){return an(this,void 0,void 0,function*(){try{const i=yield pi(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),r=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return{data:i.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${r}`):null})),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(bt(i))return{data:null,error:i};throw i}})}download(e,t){return an(this,void 0,void 0,function*(){const i=typeof(t==null?void 0:t.transform)<"u"?"render/image/authenticated":"object",r=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),o=r?`?${r}`:"";try{const l=this._getFinalPath(e);return{data:yield(yield Km(this.fetch,`${this.url}/${i}/${l}${o}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(l){if(this.shouldThrowOnError)throw l;if(bt(l))return{data:null,error:l};throw l}})}info(e){return an(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{const n=yield Km(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:Xv(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(bt(n))return{data:null,error:n};throw n}})}exists(e){return an(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{return yield fR(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(bt(n)&&n instanceof qv){const i=n.originalError;if([400,404].includes(i==null?void 0:i.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,t){const n=this._getFinalPath(e),i=[],r=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";r!==""&&i.push(r);const l=typeof(t==null?void 0:t.transform)<"u"?"render/image":"object",c=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});c!==""&&i.push(c);let u=i.join("&");return u!==""&&(u=`?${u}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${n}${u}`)}}}remove(e){return an(this,void 0,void 0,function*(){try{return{data:yield _x(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(bt(t))return{data:null,error:t};throw t}})}list(e,t,n){return an(this,void 0,void 0,function*(){try{const i=Object.assign(Object.assign(Object.assign({},pR),t),{prefix:e||""});return{data:yield pi(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},n),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(bt(i))return{data:null,error:i};throw i}})}listV2(e,t){return an(this,void 0,void 0,function*(){try{const n=Object.assign({},e);return{data:yield pi(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},t),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(bt(n))return{data:null,error:n};throw n}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}const mR="2.12.1",yR={"X-Client-Info":`storage-js/${mR}`};var rc=function(s,e,t,n){function i(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function l(h){try{u(n.next(h))}catch(d){o(d)}}function c(h){try{u(n.throw(h))}catch(d){o(d)}}function u(h){h.done?r(h.value):i(h.value).then(l,c)}u((n=n.apply(s,e||[])).next())})};class vR{constructor(e,t={},n,i){this.shouldThrowOnError=!1;
62const r=new URL(e);i!=null&&i.useNewHostname&&/supabase\.(co|in|red)$/.test(r.hostname)&&!r.hostname.includes("storage.supabase.")&&(r.hostname=r.hostname.replace("supabase.","storage.supabase.")),this.url=r.href,this.headers=Object.assign(Object.assign({},yR),t),this.fetch=wx(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(){return rc(this,void 0,void 0,function*(){try{return{data:yield Km(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(bt(e))return{data:null,error:e};throw e}})}getBucket(e){return rc(this,void 0,void 0,function*(){try{return{data:yield Km(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(bt(t))return{data:null,error:t};throw t}})}createBucket(e,t={public:!1}){return rc(this,void 0,void 0,function*(){try{return{data:yield pi(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(bt(n))return{data:null,error:n};throw n}})}updateBucket(e,t){return rc(this,void 0,void 0,function*(){try{return{data:yield Kv(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(bt(n))return{data:null,error:n};throw n}})}emptyBucket(e){return rc(this,void 0,void 0,function*(){try{return{data:yield pi(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(bt(t))return{data:null,error:t};throw t}})}deleteBucket(e){return rc(this,void 0,void 0,function*(){try{return{data:yield _x(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(bt(t))return{data:null,error:t};throw t}})}}class wR extends vR{constructor(e,t={},n,i){super(e,t,n,i)}from(e){return new gR(this.url,this.headers,e,this.fetch)}}const _R="2.57.4";let Kh="";typeof Deno<"u"?Kh="deno":typeof document<"u"?Kh="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Kh="react-native":Kh="node";const bR={"X-Client-Info":`supabase-js-${Kh}/${_R}`},SR={headers:bR},AR={schema:"public"},ER={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},xR={};var kR=function(s,e,t,n){function i(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function l(h){try{u(n.next(h))}catch(d){o(d)}}function c(h){try{u(n.throw(h))}catch(d){o(d)}}function u(h){h.done?r(h.value):i(h.value).then(l,c)}u((n=n.apply(s,e||[])).next())})};const CR=s=>{let e;return s?e=s:typeof fetch>"u"?e=rx:e=fetch,(...t)=>e(...t)},TR=()=>typeof Headers>"u"?ox:Headers,PR=(s,e,t)=>{const n=CR(t),i=TR();return(r,o)=>kR(void 0,void 0,void 0,function*(){var l;const c=(l=yield e())!==null&&l!==void 0?l:s;let u=new i(o==null?void 0:o.headers);return u.has("apikey")||u.set("apikey",s),u.has("Authorization")||u.set("Authorization",`Bearer ${c}`),n(r,Object.assign(Object.assign({},o),{headers:u}))})};var RR=function(s,e,t,n){function i(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function l(h){try{u(n.next(h))}catch(d){o(d)}}function c(h){try{u(n.throw(h))}catch(d){o(d)}}function u(h){h.done?r(h.value):i(h.value).then(l,c)}u((n=n.apply(s,e||[])).next())})};function LR(s){return s.endsWith("/")?s:s+"/"}function IR(s,e){var t,n;const{db:i,auth:r,realtime:o,global:l}=s,{db:c,auth:u,realtime:h,global:d}=e,f={db:Object.assign(Object.assign({},c),i),auth:Object.assign(Object.assign({},u),r),realtime:Object.assign(Object.assign({},h),o),storage:{},global:Object.assign(Object.assign(Object.assign({},d),l),{headers:Object.assign(Object.assign({},(t=d==null?void 0:d.headers)!==null&&t!==void 0?t:{}),(n=l==null?void 0:l.headers)!==null&&n!==void 0?n:{})}),accessToken:()=>RR(this,void 0,void 0,function*(){return""})};return s.accessToken?f.accessToken=s.accessToken:delete f.accessToken,f}function DR(s){const e=s==null?void 0:s.trim();if(!e)throw new Error("supabaseUrl is required.");
62if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(LR(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const bx="2.71.1",hc=30*1e3,Yv=3,F0=Yv*hc,MR="http://localhost:9999",NR="supabase.auth.token",OR={"X-Client-Info":`gotrue-js/${bx}`},Qv="X-Supabase-Api-Version",Sx={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},FR=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,jR=10*60*1e3;class kb extends Error{constructor(e,t,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=n}}function ne(s){return typeof s=="object"&&s!==null&&"__isAuthError"in s}class BR extends kb{constructor(e,t,n){super(e,t,n),this.name="AuthApiError",this.status=t,this.code=n}}function $R(s){return ne(s)&&s.name==="AuthApiError"}class Ax extends kb{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class ha extends kb{constructor(e,t,n,i){super(e,n,i),this.name=t,this.status=n}}class qr extends ha{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function UR(s){return ne(s)&&s.name==="AuthSessionMissingError"}class bg extends ha{constructor(){super("Auth session or user missing","AuthInvalidToken
62ResponseError",500,void 0)}}class Sg extends ha{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Ag extends ha{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function zR(s){return ne(s)&&s.name==="AuthImplicitGrantRedirectError"}class l1 extends ha{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Jv extends ha{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function j0(s){return ne(s)&&s.name==="AuthRetryableFetchError"}class c1 extends ha{constructor(e,t,n){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=n}}class Zv extends ha{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ym="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),u1=` 	
63\r=`.split(""),HR=(()=>{const s=new Array(128);for(let e=0;e<s.length;e+=1)s[e]=-1;for(let e=0;e<u1.length;e+=1)s[u1[e].charCodeAt(0)]=-2;for(let e=0;e<Ym.length;e+=1)s[Ym[e].charCodeAt(0)]=e;return s})();function h1(s,e,t){if(s!==null)for(e.queue=e.queue<<8|s,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;t(Ym[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;t(Ym[n]),e.queuedBits-=6}}function Ex(s,e,t){const n=HR[s];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)t(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(s)}"`)}}function d1(s){const e=[],t=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},r=o=>{GR(o,n,t)};for(let o=0;o<s.length;o+=1)Ex(s.charCodeAt(o),i,r);return e.join("")}function VR(s,e){if(s<=127){e(s);return}else if(s<=2047){e(192|s>>6),e(128|s&63);return}else if(s<=65535){e(224|s>>12),e(128|s>>6&63),e(128|s&63);return}else if(s<=1114111){e(240|s>>18),e(128|s>>12&63),e(128|s>>6&63),e(128|s&63);return}throw new Error(`Unrecognized Unicode codepoint: ${s.toString(16)}`)}function WR(s,e){for(let t=0;t<s.length;t+=1){let n=s.charCodeAt(t);if(n>55295&&n<=56319){const i=(n-55296)*1024&65535;n=(s.charCodeAt(t+1)-56320&65535|i)+65536,t+=1}VR(n,e)}}function GR(s,e,t){if(e.utf8seq===0){if(s<=127){t(s);return}for(let n=1;n<6;n+=1)if(!(s>>7-n&1)){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=s&31;else if(e.utf8seq===3)e.codepoint=s&15;else if(e.utf8seq===4)e.codepoint=s&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(s<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|s&63,e.utf8seq-=1,e.utf8seq===0&&t(e.codepoint)}}function qR(s){const e=[],t={queue:0,queuedBits:0},n=i=>{e.push(i)};for(let i=0;i<s.length;i+=1)Ex(s.charCodeAt(i),t,n);return new Uint8Array(e)}function XR(s){const e=[];return WR(s,t=>e.push(t)),new Uint8Array(e)}function KR(s){const e=[],t={queue:0,queuedBits:0},n=i=>{e.push(i)};return s.forEach(i=>h1(i,t,n)),h1(null,t,n),e.join("")}function YR(s){return Math.round(Date.now()/1e3)+s}function QR(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(s){const e=Math.random()*16|0;return(s=="x"?e:e&3|8).toString(16)})}const js=()=>typeof window<"u"&&typeof document<"u",fa={tested:!1,writable:!1},xx=()=>{if(!js())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(fa.tested)return fa.writable;const s=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(s,s),globalThis.localStorage.removeItem(s),fa.tested=!0,fa.writable=!0}catch{fa.tested=!0,fa.writable=!1}return fa.writable};function JR(s){const e={},t=new URL(s);if(t.hash&&t.hash[0]==="#")try{new URLSearchParams(t.hash.substring(1)).forEach((i,r)=>{e[r]=i})}catch{}return t.searchParams.forEach((n,i)=>{e[i]=n}),e}const kx=s=>{let e;return s?e=s:typeof fetch>"u"?e=(...t)=>qp(async()=>{const{default:n}=await Promise.resolve().then(()=>Th);return{default:n}},void 0).then(({default:n})=>n(...t)):e=fetch,(...t)=>e(...t)},ZR=s=>typeof s=="object"&&s!==null&&"status"in s&&"ok"in s&&"json"in s&&typeof s.json=="function",dc=async(s,e,t)=>{await s.setItem(e,JSON.stringify(t))},pa=async(s,e)=>{const t=await s.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}},Gr=async(s,e)=>{await s.removeItem(e)};class Qy{constructor(){this.promise=new Qy.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}Qy.promiseConstructor=Promise;function B0(s){const e=s.split(".");if(e.length!==3)throw new Zv("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!FR.test(e[n]))throw new Zv("JWT not in base64url format");return{header:JSON.parse(d1(e[0])),payload:JSON.parse(d1(e[1])),signature:qR(e[2]),raw:{header:e[0],payload:e[1]}}}async function eL(s){return await new Promise(e=>{setTimeout(()=>e(null),s)})}function tL(s,e){return new Promise((n,i)=>{(async()=>{for(let r=0;r<1/0;r++)try{const o=await s(r);if(!e(r,null,o)){n(o);return}}catch(o){if(!e(r,o)){i(o);return}}})()})}function nL(s){return("0"+s.toString(16)).substr(-2)}function sL(){const e=new Uint32Array(56);if(typeof crypto>"u"){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=t.length;let i="";for(let r=0;r<56;r++)i+=t.charAt(Math.floor(Math.random()*n));return i}return crypto.getRandomValues(e),Array.from(e,nL).join("")}async function iL(s){const t=new TextEncoder().encode(s),n=await crypto.subtle.digest("SHA-256",t),i=new Uint8Array(n);return Array.from(i).map(r=>String.fromCharCode(r)).join("")}async function rL(s){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code 
63challenge method will default to use plain instead of sha256."),s;const t=await iL(s);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function oc(s,e,t=!1){const n=sL();let i=n;t&&(i+="/PASSWORD_RECOVERY"),await dc(s,`${e}-code-verifier`,i);const r=await rL(n);return[r,n===r?"plain":"s256"]}const oL=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function aL(s){const e=s.headers.get(Qv);if(!e||!e.match(oL))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function lL(s){if(!s)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(s<=e)throw new Error("JWT has expired")}function cL(s){switch(s){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const uL=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ac(s){if(!uL.test(s))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function $0(){const s={};return new Proxy(s,{get:(e,t)=>{if(t==="__isUserNotAvailableProxy")return!0;if(typeof t=="symbol"){const n=t.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function f1(s){return JSON.parse(JSON.stringify(s))}var hL=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 ya=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),dL=[502,503,504];async function p1(s){var e;if(!ZR(s))throw new Jv(ya(s),0);if(dL.includes(s.status))throw new Jv(ya(s),s.status);let t;try{t=await s.json()}catch(r){throw new Ax(ya(r),r)}let n;const i=aL(s);if(i&&i.getTime()>=Sx["2024-01-01"].timestamp&&typeof t=="object"&&t&&typeof t.code=="string"?n=t.code:typeof t=="object"&&t&&typeof t.error_code=="string"&&(n=t.error_code),n){if(n==="weak_password")throw new c1(ya(t),s.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new qr}else if(typeof t=="object"&&t&&typeof t.weak_password=="object"&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce((r,o)=>r&&typeof o=="string",!0))throw new c1(ya(t),s.status,t.weak_password.reasons);throw new BR(ya(t),s.status||500,n)}const fL=(s,e,t,n)=>{const i={method:s,headers:(e==null?void 0:e.headers)||{}};return s==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),i.body=JSON.stringify(n),Object.assign(Object.assign({},i),t))};async function le(s,e,t,n){var i;const r=Object.assign({},n==null?void 0:n.headers);r[Qv]||(r[Qv]=Sx["2024-01-01"].name),n!=null&&n.jwt&&(r.Authorization=`Bearer ${n.jwt}`);const o=(i=n==null?void 0:n.query)!==null&&i!==void 0?i:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await pL(s,e,t+l,{headers:r,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(c):{data:Object.assign({},c),error:null}}async function pL(s,e,t,n,i,r){const o=fL(e,n,i,r);let l;try{l=await s(t,Object.assign({},o))}catch(c){throw console.error(c),new Jv(ya(c),0)}if(l.ok||await p1(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(c){await p1(c)}}function zi(s){var e;let t=null;vL(s)&&(t=Object.assign({},s),s.expires_at||(t.expires_at=YR(s.expires_in)));const n=(e=s.user)!==null&&e!==void 0?e:s;return{data:{session:t,user:n},error:null}}function g1(s){const e=zi(s);return!e.error&&s.weak_password&&typeof s.weak_password=="object"&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.message&&typeof s.weak_password.message=="string"&&s.weak_password.reasons.reduce((t,n)=>t&&typeof n=="string",!0)&&(e.data.weak_password=s.weak_password),e}function Zr(s){var e;return{data:{user:(e=s.user)!==null&&e!==void 0?e:s},error:null}}function gL(s){return{data:s,error:null}}function mL(s){const{action_link:e,email_otp:t,hashed_token:n,redirect_to:i,verification_type:r}=s,o=hL(s,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:t,hashed_token:n,redirect_to:i,verification_type:r},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function yL(s){return s}function vL(s){return s.access_token&&s.refresh_token&&s.expires_in}const U0=["global","local","others"];var wL=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};class _L{constructor({url:e="",headers:t={},fetch:n}){this.url=e,this.headers=t,this.fetch=kx(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t=U0[0]){if(U0.indexOf(t)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${U0.join(", ")}`);try{return await le(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ne(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,t={}){try{return await le(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:Zr})}catch(n){if(ne(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:t}=e,n=wL(e,["options"]),i=Object.assign(Object.assign({},n),t);return"newEmail"in n&&(i.new_email=n==null?void 0:n.newEmail,delete i.newEmail),await le(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:mL,redirectTo:t==null?void 0:t.redirectTo})}catch(t){if(ne(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await le(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Zr})}catch(t){if(ne(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,n,i,r,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},h=await le(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(t=e==null?void 0:e.page)===null||t===void 0?void 0:t.toString())!==null&&n!==void 0?n:"",per_page:(r=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&r!==void 0?r:""},xform:yL});if(h.error)throw h.error;const d=await h.json(),f=(o=h.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(l=h.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>
630&&(p.forEach(y=>{const _=parseInt(y.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(y.split(";")[1].split("=")[1]);u[`${A}Page`]=_}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},d),u),error:null}}catch(u){if(ne(u))return{data:{users:[]},error:u};throw u}}async getUserById(e){ac(e);try{return await le(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Zr})}catch(t){if(ne(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){ac(e);try{return await le(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:Zr})}catch(n){if(ne(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,t=!1){ac(e);try{return await le(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:Zr})}catch(n){if(ne(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){ac(e.userId);try{const{data:t,error:n}=await le(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:t,error:n}}catch(t){if(ne(t))return{data:null,error:t};throw t}}async _deleteFactor(e){ac(e.userId),ac(e.id);try{return{data:await le(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(ne(t))return{data:null,error:t};throw t}}}function m1(s={}){return{getItem:e=>s[e]||null,setItem:(e,t)=>{s[e]=t},removeItem:e=>{delete s[e]}}}function bL(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}const lc={debug:!!(globalThis&&xx()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Cx extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class SL extends Cx{}async function AL(s,e,t){lc.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",s,e);const n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),lc.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",s)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(s,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async i=>{if(i){lc.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",s,i.name);try{return await t()}finally{lc.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",s,i.name)}}else{if(e===0)throw lc.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",s),new SL(`Acquiring an exclusive Navigator LockManager lock "${s}" immediately failed`);if(lc.debug)try{const r=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(r,null,"  "))}catch(r){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",r)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await t()}}))}bL();const EL={url:MR,storageKey:NR,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:OR,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function y1(s,e,t){return await t()}const cc={};class Gd{constructor(e){var t,n;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=Gd.nextInstanceID,Gd.nextInstanceID+=1,this.instanceID>0&&js()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const i=Object.assign(Object.assign({},EL),e);if(this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new _L({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=kx(i.fetch),this.lock=i.lock||y1,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,i.lock?this.lock=i.lock:js()&&(!((t=globalThis==null?void 0:globalThis.navigator)===null||t===void 0)&&t.locks)?this.lock=AL:this.lock=y1,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:xx()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=m1(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=m1(this.memoryStorage)),js()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(r){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",r)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async r=>{this._debug("received broadcast notification from other tab or client",r),await this._notifyAllSubscribers(r.data.event,r.data.session,!1)})}this.initialize()}get jwks(){var e,t;return(t=(e=cc[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&t!==void 0?t:{keys:[]}}set jwks(e){cc[this.storageKey]=Object.assign(Object.assign({},cc[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return(t=(e=cc[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&t!==void 0?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){cc[this.storageKey]=Object.assign(Object.assign({},cc[this.storageKey]),{cachedAt:e})}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${bx}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{const t=JR(window.location.href);let n="none";if(this._isImplicitGrantCallback(t)?n="implicit":await this._isPKCECallback(t)&&(n="pkce"),js()&&this.detectSessionInUrl&&n!=="none"){const{data:i,error:r}=await this._getSessionFromURL(t,n);if(r){if(this._debug("#_initialize()","error detecting session from URL",r),zR(r)){const c=(e=r.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:r}}return await this._removeSession(),{error:r}}const{session:o,redirectType:l}=i;return this._debug("#_initialize()","detected session in URL",o,"redirect type",l),await this._saveSession(o),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return ne(t)?{error:t}:{error:new Ax("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,n,i;try{const r=await le(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(t=e==null?void 0:e.options)===null||t===void 0?void 0:t.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}},xform:zi}),{data:o,error:l}=r;
63if(l||!o)return{data:{user:null,session:null},error:l};const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:u,session:c},error:null}}catch(r){if(ne(r))return{data:{user:null,session:null},error:r};throw r}}async signUp(e){var t,n,i;try{let r;if("email"in e){const{email:h,password:d,options:f}=e;let p=null,y=null;this.flowType==="pkce"&&([p,y]=await oc(this.storage,this.storageKey)),r=await le(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:h,password:d,data:(t=f==null?void 0:f.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:y},xform:zi})}else if("phone"in e){const{phone:h,password:d,options:f}=e;r=await le(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:h,password:d,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},channel:(i=f==null?void 0:f.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:zi})}else throw new Sg("You must provide either an email or phone number and a password");const{data:o,error:l}=r;if(l||!o)return{data:{user:null,session:null},error:l};const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:u,session:c},error:null}}catch(r){if(ne(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithPassword(e){try{let t;if("email"in e){const{email:r,password:o,options:l}=e;t=await le(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:g1})}else if("phone"in e){const{phone:r,password:o,options:l}=e;t=await le(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:g1})}else throw new Sg("You must provide either an email or phone number and a password");const{data:n,error:i}=t;return i?{data:{user:null,session:null},error:i}:!n||!n.session||!n.user?{data:{user:null,session:null},error:new bg}:(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),{data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:i})}catch(t){if(ne(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOAuth(e){var t,n,i,r;return await this._handleProviderSignIn(e.provider,{redirectTo:(t=e.options)===null||t===void 0?void 0:t.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(r=e.options)===null||r===void 0?void 0:r.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:t}=e;if(t==="solana")return await this.signInWithSolana(e);throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}async signInWithSolana(e){var t,n,i,r,o,l,c,u,h,d,f,p;let y,_;if("message"in e)y=e.message,_=e.signature;else{const{chain:A,wallet:m,statement:b,options:w}=e;let E;if(js())if(typeof m=="object")E=m;else{const x=window;if("solana"in x&&typeof x.solana=="object"&&("signIn"in x.solana&&typeof x.solana.signIn=="function"||"signMessage"in x.solana&&typeof x.solana.signMessage=="function"))E=x.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof m!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");E=m}const k=new URL((t=w==null?void 0:w.url)!==null&&t!==void 0?t:window.location.href);if("signIn"in E&&E.signIn){const x=await E.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w==null?void 0:w.signInWithSolana),{version:"1",domain:k.host,uri:k.href}),b?{statement:b}:null));let C;if(Array.isArray(x)&&x[0]&&typeof x[0]=="object")C=x[0];else if(x&&typeof x=="object"&&"signedMessage"in x&&"signature"in x)C=x;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in C&&"signature"in C&&(typeof C.signedMessage=="string"||C.signedMessage instanceof Uint8Array)&&C.signature instanceof Uint8Array)y=typeof C.signedMessage=="string"?C.signedMessage:new TextDecoder().decode(C.signedMessage),_=C.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in E)||typeof E.signMessage!="function"||!("publicKey"in E)||typeof E!="object"||!E.publicKey||!("toBase58"in E.publicKey)||typeof E.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");y=[`${k.host} wants you to sign in with your Solana account:`,E.publicKey.toBase58(),...b?["",b,""]:[""],"Version: 1",`URI: ${k.href}`,`Issued At: ${(i=(n=w==null?void 0:w.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((r=w==null?void 0:w.signInWithSolana)===null||r===void 0)&&r.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((o=w==null?void 0:w.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((l=w==null?void 0:w.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((c=w==null?void 0:w.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((u=w==null?void 0:w.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((d=(h=w==null?void 0:w.signInWithSolana)===null||h===void 0?void 0:h.resources)===null||d===void 0)&&d.length?["Resources",...w.sign
63InWithSolana.resources.map(C=>`- ${C}`)]:[]].join(`
64`);const x=await E.signMessage(new TextEncoder().encode(y),"utf8");if(!x||!(x instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");_=x}}try{const{data:A,error:m}=await le(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:y,signature:KR(_)},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(p=e.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:zi});if(m)throw m;return!A||!A.session||!A.user?{data:{user:null,session:null},error:new bg}:(A.session&&(await this._saveSession(A.session),await this._notifyAllSubscribers("SIGNED_IN",A.session)),{data:Object.assign({},A),error:m})}catch(A){if(ne(A))return{data:{user:null,session:null},error:A};throw A}}async _exchangeCodeForSession(e){const t=await pa(this.storage,`${this.storageKey}-code-verifier`),[n,i]=(t??"").split("/");try{const{data:r,error:o}=await le(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:zi});if(await Gr(this.storage,`${this.storageKey}-code-verifier`),o)throw o;return!r||!r.session||!r.user?{data:{user:null,session:null,redirectType:null},error:new bg}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign(Object.assign({},r),{redirectType:i??null}),error:o})}catch(r){if(ne(r))return{data:{user:null,session:null,redirectType:null},error:r};throw r}}async signInWithIdToken(e){try{const{options:t,provider:n,token:i,access_token:r,nonce:o}=e,l=await le(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:i,access_token:r,nonce:o,gotrue_meta_security:{captcha_token:t==null?void 0:t.captchaToken}},xform:zi}),{data:c,error:u}=l;return u?{data:{user:null,session:null},error:u}:!c||!c.session||!c.user?{data:{user:null,session:null},error:new bg}:(c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),{data:c,error:u})}catch(t){if(ne(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOtp(e){var t,n,i,r,o;try{if("email"in e){const{email:l,options:c}=e;let u=null,h=null;this.flowType==="pkce"&&([u,h]=await oc(this.storage,this.storageKey));const{error:d}=await le(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(t=c==null?void 0:c.data)!==null&&t!==void 0?t:{},create_user:(n=c==null?void 0:c.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:h},redirectTo:c==null?void 0:c.emailRedirectTo});return{data:{user:null,session:null},error:d}}if("phone"in e){const{phone:l,options:c}=e,{data:u,error:h}=await le(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(i=c==null?void 0:c.data)!==null&&i!==void 0?i:{},create_user:(r=c==null?void 0:c.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:h}}throw new Sg("You must provide either an email or phone number.")}catch(l){if(ne(l))return{data:{user:null,session:null},error:l};throw l}}async verifyOtp(e){var t,n;try{let i,r;"options"in e&&(i=(t=e.options)===null||t===void 0?void 0:t.redirectTo,r=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:l}=await le(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:r}}),redirectTo:i,xform:zi});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,u=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),{data:{user:u,session:c},error:null}}catch(i){if(ne(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithSSO(e){var t,n,i;try{let r=null,o=null;return this.flowType==="pkce"&&([r,o]=await oc(this.storage,this.storageKey)),await le(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(t=e.options)===null||t===void 0?void 0:t.redirectTo)!==null&&n!==void 0?n:void 0}),!((i=e==null?void 0:e.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:r,code_challenge_method:o}),headers:this.headers,xform:gL})}catch(r){if(ne(r))return{data:null,error:r};throw r}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:n}=e;if(n)throw n;if(!t)throw new qr;const{error:i}=await le(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:i}})}catch(e){if(ne(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const t=`${this.url}/resend`;if("email"in e){const{email:n,type:i,options:r}=e,{error:o}=await le(this.fetch,"POST",t,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},redirectTo:r==null?void 0:r.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:n,type:i,options:r}=e,{data:o,error:l}=await le(this.fetch,"POST",t,{headers:this.headers,body:{phone:n,type:i,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}}});return{data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l}}throw new Sg("You must provide either an email or phone number and a type")}catch(t){if(ne(t))return{data:{user:null,session:null},error:t};throw t}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async t=>t))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await n,await t()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=t();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const t=await pa(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),t!==null&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not val
64id"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<F0:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await pa(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=$0()}if(this.storage.isServer&&e.user){let o=this.suppressGetSessionWarning;e=new Proxy(e,{get:(c,u,h)=>(!o&&u==="user"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),o=!0,this.suppressGetSessionWarning=!0),Reflect.get(c,u,h))})}return{data:{session:e},error:null}}const{session:i,error:r}=await this._callRefreshToken(e.refresh_token);return r?{data:{session:null},error:r}:{data:{session:i},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await le(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Zr}):await this._useSession(async t=>{var n,i,r;const{data:o,error:l}=t;if(l)throw l;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new qr}:await le(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(r=(i=o.session)===null||i===void 0?void 0:i.access_token)!==null&&r!==void 0?r:void 0,xform:Zr})})}catch(t){if(ne(t))return UR(t)&&(await this._removeSession(),await Gr(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:t};throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async n=>{const{data:i,error:r}=n;if(r)throw r;if(!i.session)throw new qr;const o=i.session;let l=null,c=null;this.flowType==="pkce"&&e.email!=null&&([l,c]=await oc(this.storage,this.storageKey));const{data:u,error:h}=await le(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:t==null?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:Zr});if(h)throw h;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(n){if(ne(n))return{data:{user:null},error:n};throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new qr;const t=Date.now()/1e3;let n=t,i=!0,r=null;const{payload:o}=B0(e.access_token);if(o.exp&&(n=o.exp,i=n<=t),i){const{session:l,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return{data:{user:null,session:null},error:c};if(!l)return{data:{user:null,session:null},error:null};r=l}else{const{data:l,error:c}=await this._getUser(e.access_token);if(c)throw c;r={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:n-t,expires_at:n},await this._saveSession(r),await this._notifyAllSubscribers("SIGNED_IN",r)}return{data:{user:r.user,session:r},error:null}}catch(t){if(ne(t))return{data:{session:null,user:null},error:t};throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var n;if(!e){const{data:o,error:l}=t;if(l)throw l;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new qr;const{session:i,error:r}=await this._callRefreshToken(e.refresh_token);return r?{data:{user:null,session:null},error:r}:i?{data:{user:i.user,session:i},error:null}:{data:{user:null,session:null},error:null}})}catch(t){if(ne(t))return{data:{user:null,session:null},error:t};throw t}}async _getSessionFromURL(e,t){try{if(!js())throw new Ag("No browser detected.");
64if(e.error||e.error_description||e.error_code)throw new Ag(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if(this.flowType==="pkce")throw new l1("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Ag("Not a valid implicit grant flow url.");break;default:}if(t==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new l1("No code detected.");const{data:b,error:w}=await this._exchangeCodeForSession(e.code);if(w)throw w;const E=new URL(window.location.href);return E.searchParams.delete("code"),window.history.replaceState(window.history.state,"",E.toString()),{data:{session:b.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:i,access_token:r,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=e;if(!r||!l||!o||!u)throw new Ag("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const p=f-h;p*1e3<=hc&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${d}s`);const y=f-d;h-y>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",y,f,h):h-y<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",y,f,h);const{data:_,error:A}=await this._getUser(r);if(A)throw A;const m={provider_token:n,provider_refresh_token:i,access_token:r,expires_in:d,expires_at:f,refresh_token:o,token_type:u,user:_.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:m,redirectType:e.type},error:null}}catch(n){if(ne(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const t=await pa(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var n;const{data:i,error:r}=t;if(r)return{error:r};const o=(n=i.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:l}=await this.admin.signOut(o,e);if(l&&!($R(l)&&(l.status===404||l.status===401||l.status===403)))return{error:l}}return e!=="others"&&(await this._removeSession(),await Gr(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const t=QR(),n={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async t=>{var n,i;try{const{data:{session:r},error:o}=t;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",r)),this._debug("INITIAL_SESSION","callback id",e,"session",r)}catch(r){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",r),console.error(r)}})}async resetPasswordForEmail(e,t={}){let n=null,i=null;this.flowType==="pkce"&&([n,i]=await oc(this.storage,this.storageKey,!0));try{return await le(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:i,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(r){if(ne(r))return{data:null,error:r};throw r}}async getUserIdentities(){var e;try{const{data:t,error:n}=await this.getUser();if(n)throw n;return{data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(t){if(ne(t))return{data:null,error:t};throw t}}async linkIdentity(e){var t;try{const{data:n,error:i}=await this._useSession(async r=>{var o,l,c,u,h;const{data:d,error:f}=r;if(f)throw f;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await le(this.fetch,"GET",p,{headers:this.headers,jwt:(h=(u=d.session)===null||u===void 0?void 0:u.access_token)!==null&&h!==void 0?h:void 0})});if(i)throw i;
64return js()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),{data:{provider:e.provider,url:n==null?void 0:n.url},error:null}}catch(n){if(ne(n))return{data:{provider:e.provider,url:null},error:n};throw n}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var n,i;const{data:r,error:o}=t;if(o)throw o;return await le(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0})})}catch(t){if(ne(t))return{data:null,error:t};throw t}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const n=Date.now();return await tL(async i=>(i>0&&await eL(200*Math.pow(2,i-1)),this._debug(t,"refreshing attempt",i),await le(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:zi})),(i,r)=>{const o=200*Math.pow(2,i);return r&&j0(r)&&Date.now()+o-n<hc})}catch(n){if(this._debug(t,"error",n),ne(n))return{data:{session:null,user:null},error:n};throw n}finally{this._debug(t,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",n),js()&&!t.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,t;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const i=await pa(this.storage,this.storageKey);if(i&&this.userStorage){let o=await pa(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:i.user},await dc(this.userStorage,this.storageKey+"-user",o)),i.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:$0()}else if(i&&!i.user&&!i.user){const o=await pa(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(i.user=o.user,await Gr(this.storage,this.storageKey+"-user"),await dc(this.storage,this.storageKey,i)):i.user=$0()}if(this._debug(n,"session from storage",i),!this._isValidSession(i)){this._debug(n,"session is not valid"),i!==null&&await this._removeSession();return}const r=((t=i.expires_at)!==null&&t!==void 0?t:1/0)*1e3-Date.now()<F0;if(this._debug(n,`session has${r?"":" not"} expired with margin of ${F0}s`),r){if(this.autoRefreshToken&&i.refresh_token){const{error:o}=await this._callRefreshToken(i.refresh_token);o&&(console.error(o),j0(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(i.access_token);!l&&(o!=null&&o.user)?(i.user=o.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(n,"error",i),console.error(i);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var t,n;if(!e)throw new qr;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new Qy;const{data:r,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!r.session)throw new qr;await this._saveSession(r.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",r.session);const l={session:r.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(r){if(this._debug(i,"error",r),ne(r)){const o={session:null,error:r};return j0(r)||await this._removeSession(),(t=this.refreshingDeferred)===null||t===void 0||t.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(r),r}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,t,n=!0){const i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",t,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,t)}catch(c){r.push(c)}});if(await Promise.all(o),r.length>0){for(let l=0;l<r.length;l+=1)console.error(r[l]);throw r[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const t=Object.assign({},e),n=t.user&&t.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&t.user&&await dc(this.userStorage,this.storageKey+"-user",{user:t.user});const i=Object.assign({},t);delete i.user;const r=f1(i);await dc(this.storage,this.storageKey,r)}else{const i=f1(t);await dc(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),await Gr(this.storage,this.storageKey),await Gr(this.storage,this.storageKey+"-code-verifier"),await Gr(this.storage,this.storageKey+"-user"),this.userStorage&&await Gr(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&js()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
64catch(t){console.error("removing visibilitychange callback failed",t)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),hc);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:n}}=t;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((n.expires_at*1e3-e)/hc);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${hc}ms, refresh threshold is ${Yv} ticks`),i<=Yv&&await this._callRefreshToken(n.refresh_token)})}catch(t){console.error("Auto refresh tick failed with error. This is likely a transient error.",t)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof Cx)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!js()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,n){const i=[`provider=${encodeURIComponent(t)}`];if(n!=null&&n.redirectTo&&i.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&i.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[r,o]=await oc(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(r)}`,code_challenge_method:`${encodeURIComponent(o)}`});i.push(l.toString())}if(n!=null&&n.queryParams){const r=new URLSearchParams(n.queryParams);i.push(r.toString())}return n!=null&&n.skipBrowserRedirect&&i.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var n;const{data:i,error:r}=t;return r?{data:null,error:r}:await le(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token})})}catch(t){if(ne(t))return{data:null,error:t};throw t}}async _enroll(e){try{return await this._useSession(async t=>{var n,i;const{data:r,error:o}=t;if(o)return{data:null,error:o};const l=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:{issuer:e.issuer}),{data:c,error:u}=await le(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token});return u?{data:null,error:u}:(e.factorType==="totp"&&(!((i=c==null?void 0:c.totp)===null||i===void 0)&&i.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),{data:c,error:null})})}catch(t){if(ne(t))return{data:null,error:t};throw t}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var n;const{data:i,error:r}=t;if(r)return{data:null,error:r};const{data:o,error:l}=await le(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),{data:o,error:l})})}catch(t){if(ne(t))return{data:null,error:t};throw t}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var n;const{data:i,error:r}=t;return r?{data:null,error:r}:await le(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token})})}catch(t){if(ne(t))return{data:null,error:t};throw t}})}async _challengeAndVerify(e){const{data:t,error:n}=await this._challenge({factorId:e.factorId});return n?{data:null,error:n}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){const{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};const n=(e==null?void 0:e.factors)||[],i=n.filter(o=>o.factor_type==="totp"&&o.status==="verified"),r=n.filter(o=>o.factor_type==="phone"&&o.status==="verified");return{data:{all:n,totp:i,phone:r},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,n;const{data:{session:i},error:r}=e;if(r)return{data:null,error:r};
64if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=B0(i.access_token);let l=null;o.aal&&(l=o.aal);let c=l;((n=(t=i.user.factors)===null||t===void 0?void 0:t.filter(d=>d.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(c="aal2");const h=o.amr||[];return{data:{currentLevel:l,nextLevel:c,currentAuthenticationMethods:h},error:null}}))}async fetchJwk(e,t={keys:[]}){let n=t.keys.find(l=>l.kid===e);if(n)return n;const i=Date.now();if(n=this.jwks.keys.find(l=>l.kid===e),n&&this.jwks_cached_at+jR>i)return n;const{data:r,error:o}=await le(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!r.keys||r.keys.length===0||(this.jwks=r,this.jwks_cached_at=i,n=r.keys.find(l=>l.kid===e),!n)?null:n}async getClaims(e,t={}){try{let n=e;if(!n){const{data:p,error:y}=await this.getSession();if(y||!p.session)return{data:null,error:y};n=p.session.access_token}const{header:i,payload:r,signature:o,raw:{header:l,payload:c}}=B0(n);t!=null&&t.allowExpired||lL(r.exp);const u=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,t!=null&&t.keys?{keys:t.keys}:t==null?void 0:t.jwks);if(!u){const{error:p}=await this.getUser(n);if(p)throw p;return{data:{claims:r,header:i,signature:o},error:null}}const h=cL(i.alg),d=await crypto.subtle.importKey("jwk",u,h,!0,["verify"]);if(!await crypto.subtle.verify(h,d,o,XR(`${l}.${c}`)))throw new Zv("Invalid JWT signature");return{data:{claims:r,header:i,signature:o},error:null}}catch(n){if(ne(n))return{data:null,error:n};throw n}}}Gd.nextInstanceID=0;const xL=Gd;class kL extends xL{constructor(e){super(e)}}var CL=function(s,e,t,n){function i(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function l(h){try{u(n.next(h))}catch(d){o(d)}}function c(h){try{u(n.throw(h))}catch(d){o(d)}}function u(h){h.done?r(h.value):i(h.value).then(l,c)}u((n=n.apply(s,e||[])).next())})};class TL{constructor(e,t,n){var i,r,o;this.supabaseUrl=e,this.supabaseKey=t;const l=DR(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",l),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",l),this.storageUrl=new URL("storage/v1",l),this.functionsUrl=new URL("functions/v1",l);const c=`sb-${l.hostname.split(".")[0]}-auth-token`,u={db:AR,realtime:xR,auth:Object.assign(Object.assign({},ER),{storageKey:c}),global:SR},h=IR(n??{},u);this.storageKey=(i=h.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(r=h.global.headers)!==null&&r!==void 0?r:{},h.accessToken?(this.accessToken=h.accessToken,this.auth=new Proxy({},{get:(d,f)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(f)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=h.auth)!==null&&o!==void 0?o:{},this.headers,h.global.fetch),this.fetch=PR(t,this._getAccessToken.bind(this),h.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},h.realtime)),this.rest=new H2(new URL("rest/v1",l).href,{headers:this.headers,schema:h.db.schema,fetch:this.fetch}),this.storage=new wR(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new b2(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t;return CL(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();const{data:n}=yield this.auth.getSession();return(t=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&t!==void 0?t:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:i,userStorage:r,storageKey:o,flowType:l,lock:c,debug:u},h,d){const f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new kL({url:this.authUrl.href,headers:Object.assign(Object.assign({},f),h),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:i,userStorage:r,flowType:l,lock:c,debug:u,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(p=>p.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new oR(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,n)=>{this._handleTokenChanged(t,"CLIENT",n==null?void 0:n.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?this.changedAccessToken=n:e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const PL=(s,e,t)=>new TL(s,e,t);function RL(){if(typeof window<"u"||typeof process>"u")return!1;const s=process.version;if(s==null)return!1;const e=s.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}
64RL()&&console.warn("⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const LL="https://diiwcgaibphyqpuvvrwn.supabase.co",IL="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRpaXdjZ2FpYnBoeXFwdXZ2cnduIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjIwNzYzODUsImV4cCI6MjA3NzY1MjM4NX0.yNNGsy8WkWWFsc3b1fRekP8ElGR1CGk_qfX60z_55d8",Oe=PL(LL,IL),Tx=G.createContext(void 0);function DL({children:s}){const[e,t]=G.useState(null),[n,i]=G.useState(!1),[r,o]=G.useState(!0);G.useEffect(()=>{Oe.auth.getSession().then(({data:{session:d}})=>{t((d==null?void 0:d.user)??null),l((d==null?void 0:d.user)??null)});const{data:{subscription:h}}=Oe.auth.onAuthStateChange((d,f)=>{t((f==null?void 0:f.user)??null),l((f==null?void 0:f.user)??null)});return()=>h.unsubscribe()},[]);const l=async h=>{if(o(!0),h){const{data:d}=await Oe.from("admin_users").select("id").eq("id",h.id).maybeSingle();i(!!d)}else i(!1);o(!1)},c=async(h,d)=>{const{error:f}=await Oe.auth.signInWithPassword({email:h,password:d});return{error:f}},u=async()=>{await Oe.auth.signOut()};return T.jsx(Tx.Provider,{value:{user:e,isAdmin:n,loading:r,signIn:c,signOut:u},children:s})}function Cb(){const s=G.useContext(Tx);if(s===void 0)throw new Error("useAuth must be used within an AuthProvider");return s}/**
65 * @license lucide-react v0.344.0 - ISC
66 *
67 * This source code is licensed under the ISC license.
68 * See the LICENSE file in the root directory of this source tree.
69 */var ML={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"};/**
70 * @license lucide-react v0.344.0 - ISC
71 *
72 * This source code is licensed under the ISC license.
73 * See the LICENSE file in the root directory of this source tree.
74 */const NL=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),bn=(s,e)=>{const t=G.forwardRef(({color:n="currentColor",size:i=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:c,...u},h)=>G.createElement("svg",{ref:h,...ML,width:i,height:i,stroke:n,strokeWidth:o?Number(r)*24/Number(i):r,className:["lucide",`lucide-${NL(s)}`,l].join(" "),...u},[...e.map(([d,f])=>G.createElement(d,f)),...Array.isArray(c)?c:[c]]));return t.displayName=`${s}`,t};/**
75 * @license lucide-react v0.344.0 - ISC
76 *
77 * This source code is licensed under the ISC license.
78 * See the LICENSE file in the root directory of this source tree.
79 */const Qm=bn("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/**
80 * @license lucide-react v0.344.0 - ISC
81 *
82 * This source code is licensed under the ISC license.
83 * See the LICENSE file in the root directory of this source tree.
84 */const OL=bn("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/**
85 * @license lucide-react v0.344.0 - ISC
86 *
87 * This source code is licensed under the ISC license.
88 * See the LICENSE file in the root directory of this source tree.
89 */const FL=bn("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
90 * @license lucide-react v0.344.0 - ISC
91 *
92 * This source code is licensed under the ISC license.
93 * See the LICENSE file in the root directory of this source tree.
94 */const jL=bn("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
95 * @license lucide-react v0.344.0 - ISC
96 *
97 * This source code is licensed under the ISC license.
98 * See the LICENSE file in the root directory of this source tree.
99 */const BL=bn("FileText",[["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"}]]);/**
100 * @license lucide-react v0.344.0 - ISC
101 *
102 * This source code is licensed under the ISC license.
103 * See the LICENSE file in the root directory of this source tree.
104 */const Jm=bn("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
105 * @license lucide-react v0.344.0 - ISC
106 *
107 * This source code is licensed under the ISC license.
108 * See the LICENSE file in the root directory of this source tree.
109 */const $L=bn("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
110 * @license lucide-react v0.344.0 - ISC
111 *
112 * This source code is licensed under the ISC license.
113 * See the LICENSE file in the root directory of this source tree.
114 */const v1=bn("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
115 * @license lucide-react v0.344.0 - ISC
116 *
117 * This source code is licensed under the ISC license.
118 * See the LICENSE file in the root directory of this source tree.
119 */const UL=bn("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/**
120 * @license lucide-react v0.344.0 - ISC
121 *
122 * This source code is licensed under the ISC license.
123 * See the LICENSE file in the root directory of this source tree.
124 */const zL=bn("Settings",[["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"}]]);/**
125 * @license lucide-react v0.344.0 - ISC
126 *
127 * This source code is licensed under the ISC license.
128 * See the LICENSE file in the root directory of this source tree.
129 */const HL=bn("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
129],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
130 * @license lucide-react v0.344.0 - ISC
131 *
132 * This source code is licensed under the ISC license.
133 * See the LICENSE file in the root directory of this source tree.
134 */const VL=bn("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
135 * @license lucide-react v0.344.0 - ISC
136 *
137 * This source code is licensed under the ISC license.
138 * See the LICENSE file in the root directory of this source tree.
139 */const Px=bn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
140 * @license lucide-react v0.344.0 - ISC
141 *
142 * This source code is licensed under the ISC license.
143 * See the LICENSE file in the root directory of this source tree.
144 */const WL=bn("ZoomIn",[["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"}]]);/**
145 * @license lucide-react v0.344.0 - ISC
146 *
147 * This source code is licensed under the ISC license.
148 * See the LICENSE file in the root directory of this source tree.
149 */const GL=bn("ZoomOut",[["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"}]]);function qL(){const[s,e]=G.useState(""),[t,n]=G.useState(""),[i,r]=G.useState(""),[o,l]=G.useState(!1),{signIn:c}=Cb(),u=async h=>{h.preventDefault(),r(""),l(!0);const{error:d}=await c(s,t);d&&(r("Invalid email or password"),l(!1))};return T.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-4",children:T.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-8 w-full max-w-md",children:[T.jsx("div",{className:"flex items-center justify-center mb-8",children:T.jsx(Qm,{className:"w-12 h-12 text-slate-800"})}),T.jsx("h1",{className:"text-3xl font-bold text-center mb-2 text-slate-900",children:"Admin Login"}),T.jsx("p",{className:"text-center text-slate-600 mb-8",children:"Access the content management system"}),T.jsxs("form",{onSubmit:u,className:"space-y-6",children:[T.jsxs("div",{children:[T.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-slate-700 mb-2",children:"Email"}),T.jsx("input",{id:"email",type:"email",value:s,onChange:h=>e(h.target.value),className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all",placeholder:"[email protected]",required:!0})]}),T.jsxs("div",{children:[T.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-slate-700 mb-2",children:"Password"}),T.jsx("input",{id:"password",type:"password",value:t,onChange:h=>n(h.target.value),className:"w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all",placeholder:"Enter your password",required:!0})]}),i&&T.jsx("div",{className:"bg-red-50 text-red-600 px-4 py-3 rounded-lg text-sm",children:i}),T.jsx("button",{type:"submit",disabled:o,className:"w-full bg-slate-800 text-white py-3 rounded-lg font-medium hover:bg-slate-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:o?"Signing in...":"Sign In"})]})]})})}function XL(){const[s,e]=G.useState(""),[t,n]=G.useState(""),[i,r]=G.useState(""),[o,l]=G.useState(""),[c,u]=G.useState(!0),[h,d]=G.useState(!1),[f,p]=G.useState(!1),[y,_]=G.useState("");G.useEffect(()=>{A()},[]);const A=async()=>{const{data:E}=await Oe.from("novel_metadata").select("*").maybeSingle();E&&(e(E.title),n(E.author),r(E.description),l(E.cover_url)),u(!1)},m=async E=>{var F;const k=(F=E.target.files)==null?void 0:F[0];if(!k)return;p(!0),_("");const x=k.name.split(".").pop(),P=`covers/${`cover-${Date.now()}.${x}`}`,{error:R,data:L}=await Oe.storage.from("graphic-novel").upload(P,k,{cacheControl:"3600",upsert:!1});
149if(R){_("Error uploading image"),p(!1);return}const{data:{publicUrl:D}}=Oe.storage.from("graphic-novel").getPublicUrl(P);l(D),p(!1)},b=()=>{l("")},w=async E=>{E.preventDefault(),d(!0),_("");const{data:k}=await Oe.from("novel_metadata").select("id").maybeSingle();if(k){const{error:x}=await Oe.from("novel_metadata").update({title:s,author:t,description:i,cover_url:o,updated_at:new Date().toISOString()}).eq("id",k.id);_(x?"Error saving metadata":"Metadata saved successfully!")}else{const{error:x}=await Oe.from("novel_metadata").insert({title:s,author:t,description:i,cover_url:o});_(x?"Error saving metadata":"Metadata saved successfully!")}d(!1),setTimeout(()=>_(""),3e3)};return c?T.jsx("div",{className:"flex justify-center py-12",children:T.jsx(Jm,{className:"w-8 h-8 animate-spin text-slate-400"})}):T.jsxs("form",{onSubmit:w,className:"max-w-2xl space-y-6",children:[T.jsxs("div",{children:[T.jsx("label",{htmlFor:"title",className:"block text-sm font-medium text-slate-700 mb-2",children:"Novel Title"}),T.jsx("input",{id:"title",type:"text",value:s,onChange:E=>e(E.target.value),className:"w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-slate-500 focus:border-transparent",required:!0})]}),T.jsxs("div",{children:[T.jsx("label",{htmlFor:"author",className:"block text-sm font-medium text-slate-700 mb-2",children:"Author"}),T.jsx("input",{id:"author",type:"text",value:t,onChange:E=>n(E.target.value),className:"w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-slate-500 focus:border-transparent"})]}),T.jsxs("div",{children:[T.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-slate-700 mb-2",children:"Description"}),T.jsx("textarea",{id:"description",value:i,onChange:E=>r(E.target.value),rows:4,className:"w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-slate-500 focus:border-transparent"})]}),T.jsxs("div",{children:[T.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-2",children:"Cover Image"}),o?T.jsx("div",{className:"space-y-4",children:T.jsxs("div",{className:"relative inline-block",children:[T.jsx("img",{src:o,alt:"Cover preview",className:"max-w-xs rounded-lg shadow-md"}),T.jsx("button",{type:"button",onClick:b,className:"absolute top-2 right-2 p-1.5 bg-red-500 text-white rounded-full hover:bg-red-600 transition-colors",children:T.jsx(Px,{className:"w-4 h-4"})})]})}):T.jsx("div",{className:"flex items-center gap-4",children:T.jsxs("label",{className:"flex items-center gap-2 px-4 py-2 bg-white border-2 border-dashed border-slate-300 rounded-lg cursor-pointer hover:border-slate-400 transition-colors",children:[T.jsx(VL,{className:"w-5 h-5 text-slate-500"}),T.jsx("span",{className:"text-sm text-slate-600",children:f?"Uploading...":"Upload Cover Image"}),T.jsx("input",{type:"file",accept:"image/*",onChange:m,disabled:f,className:"hidden"})]})})]}),y&&T.jsx("div",{className:"bg-green-50 text-green-600 px-4 py-3 rounded-lg text-sm",children:y}),T.jsx("button",{type:"submit",disabled:h,className:"flex items-center gap-2 px-6 py-3 bg-slate-800 text-white rounded-lg hover:bg-slate-700 transition-colors disabled:opacity-50",children:h?T.jsxs(T.Fragment,{children:[T.jsx(Jm,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):T.jsxs(T.Fragment,{children:[T.jsx(UL,{className:"w-4 h-4"}),"Save Settings"]})})]})}const fn=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),ew=[.001,0,0,.001,0,0],z0=1.35,ss={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},eo={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},qd="pdfjs_internal_editor_",ee={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},he={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_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},KL={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},tw={TRIANGLES:1,LATTICE:2,PATCH:3},Nt={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Wg={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},ut={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},fc={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Jy={ERRORS:0,WARNINGS:1,INFOS:5}
149,Xd={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},$h={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},YL={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Zy=Jy.WARNINGS;function QL(s){Number.isInteger(s)&&(Zy=s)}function JL(){return Zy}function e0(s){Zy>=Jy.INFOS&&console.info(`Info: ${s}`)}function J(s){Zy>=Jy.WARNINGS&&console.warn(`Warning: ${s}`)}function Ie(s){throw new Error(s)}function de(s,e){s||Ie(e)}function ZL(s){switch(s==null?void 0:s.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Rx(s,e=null,t=null){if(!s)return null;if(t&&typeof s=="string"){if(t.addDefaultProtocol&&s.startsWith("www.")){const i=s.match(/\./g);(i==null?void 0:i.length)>=2&&(s=`http://${s}`)}if(t.tryConvertEncoding)try{s=iI(s)}catch{}}const n=e?URL.parse(s,e):URL.parse(s);return ZL(n)?n:null}function Lx(s,e,t=!1){const n=URL.parse(s);return n?(n.hash=e,n.href):t&&Rx(s,"http://example.com")?s.split("#",1)[0]+`${e?`#${e}`:""}`:""}function se(s,e,t,n=!1){return Object.defineProperty(s,e,{value:t,enumerable:!n,configurable:!0,writable:!1}),t}const nc=function(){function e(t,n){this.message=t,this.name=n}return e.prototype=new Error,e.constructor=e,e}();class w1 extends nc{constructor(e,t){super(e,"PasswordException"),this.code=t}}class H0 extends nc{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class nw extends nc{constructor(e){super(e,"InvalidPDFException")}}class Zm extends nc{constructor(e,t,n){super(e,"ResponseException"),this.status=t,this.missing=n}}class eI extends nc{constructor(e){super(e,"FormatError")}}class ra extends nc{constructor(e){super(e,"AbortException")}}function Ix(s){(typeof s!="object"||(s==null?void 0:s.length)===void 0)&&Ie("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 r=Math.min(i+t,e),o=s.subarray(i,r);n.push(String.fromCharCode.apply(null,o))}return n.join("")}function Yp(s){typeof s!="string"&&Ie("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 tI(s){return String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255)}function nI(){const s=new Uint8Array(4);return s[0]=1,new Uint32Array(s.buffer,0,1)[0]===1}function sI(){try{return new Function(""),!0}catch{return!1}}class Gt{static get isLittleEndian(){return se(this,"isLittleEndian",nI())}static get isEvalSupported(){return se(this,"isEvalSupported",sI())}static get isOffscreenCanvasSupported(){return se(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return se(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return se(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return se(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){const{platform:e,userAgent:t}=navigator;return se(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(){var e,t;return se(this,"isCSSRoundSupported",(t=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:t.call(e,"width: round(1.5px, 1px)"))}}const V0=Array.from(Array(256).keys(),s=>s.toString(16).padStart(2,"0"));var Nr,Gg,sw;class U{static makeHexColor(e,t,n){return`#${V0[e]}${V0[t]}${V0[n]}`}static domMatrixToTransform(e){return[e.a,e.b,e.c,e.d,e.e,e.f]}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 multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,n=0){const i=e[n],r=e[n+1];e[n]=i*t[0]+r*t[2]+t[4],e[n+1]=i*t[1]+r*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){const i=t[0],r=t[1],o=t[2],l=t[3],c=t[4],u=t[5];for(let h=0;h<6;h+=2){const d=e[n+h],f=e[n+h+1];e[n+h]=d*i+f*o+c,e[n+h+1]=d*r+f*l+u}}static applyInverseTransform(e,t){const n=e[0],i=e[1],r=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-i*t[2]+t[2]*t[5]-t[4]*t[3])/r,e[1]=(-n*t[1]+i*t[0]+t[4]*t[1]-t[5]*t[0])/r}static axialAlignedBoundingBox(e,t,n){const i=t[0],r=t[1],o=t[2],l=t[3],c=t[4],u=t[5],h=e[0],d=e[1],f=e[2],p=e[3];let y=i*h+c,_=y,A=i*f+c,m=A,b=l*d+u,w=b,E=l*p+u,k=E;if(r!==0||o!==0){const x=r*h,C=r*f,P=o*d,R=o*p;y+=P,m+=P,A+=R,_+=R,b+=x,k+=x,E+=C,w+=C}n[0]=Math.min(n[0],y,A,_,m),n[1]=Math.min(n[1],b,E,w,k),n[2]=Math.max(n[2],y,A,_,m),n[3]=Math.max(n[3],b,E,w,k)}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],r=e[2],o=e[3],l=n**2+i**2,c=n*r+i*o,u=r**2+o**2,h=(l+u)/2,d=Math.sqrt(h**2-(l*u-c**2));t[0]=Math.sqrt(h+d||1),t[1]=Math.sqrt(h-d||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 r=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),o=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return r>o?null:[n,r,i,o]}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,r){r[0]=Math.min(r[0],e,n),r[1]=Math.min(r[1],t,i),r[2]=Math.max(r[2],e,
149n),r[3]=Math.max(r[3],t,i)}static bezierBoundingBox(e,t,n,i,r,o,l,c,u){u[0]=Math.min(u[0],e,l),u[1]=Math.min(u[1],t,c),u[2]=Math.max(u[2],e,l),u[3]=Math.max(u[3],t,c),S(this,Nr,sw).call(this,e,n,r,l,t,i,o,c,3*(-e+3*(n-r)+l),6*(e-2*n+r),3*(n-e),u),S(this,Nr,sw).call(this,e,n,r,l,t,i,o,c,3*(-t+3*(i-o)+c),6*(t-2*i+o),3*(i-t),u)}}Nr=new WeakSet,Gg=function(e,t,n,i,r,o,l,c,u,h){if(u<=0||u>=1)return;const d=1-u,f=u*u,p=f*u,y=d*(d*(d*e+3*u*t)+3*f*n)+p*i,_=d*(d*(d*r+3*u*o)+3*f*l)+p*c;h[0]=Math.min(h[0],y),h[1]=Math.min(h[1],_),h[2]=Math.max(h[2],y),h[3]=Math.max(h[3],_)},sw=function(e,t,n,i,r,o,l,c,u,h,d,f){if(Math.abs(u)<1e-12){Math.abs(h)>=1e-12&&S(this,Nr,Gg).call(this,e,t,n,i,r,o,l,c,-d/h,f);return}const p=h**2-4*d*u;if(p<0)return;const y=Math.sqrt(p),_=2*u;S(this,Nr,Gg).call(this,e,t,n,i,r,o,l,c,(-h+y)/_,f),S(this,Nr,Gg).call(this,e,t,n,i,r,o,l,c,(-h-y)/_,f)},v(U,Nr);function iI(s){return decodeURIComponent(escape(s))}let W0=null,_1=null;function rI(s){return W0||(W0=/([\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,_1=new Map([["ſt","ſt"]])),s.replaceAll(W0,(e,t,n)=>t?t.normalize("NFKC"):_1.get(n))}function Dx(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const s=new Uint8Array(32);return crypto.getRandomValues(s),Ix(s)}const Dc="pdfjs_internal_id_";function oI(s,e,t){if(!Array.isArray(t)||t.length<2)return!1;const[n,i,...r]=t;if(!s(n)&&!Number.isInteger(n)||!e(i))return!1;const o=r.length;let l=!0;switch(i.name){case"XYZ":if(o<2||o>3)return!1;break;case"Fit":case"FitB":return o===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(o>1)return!1;break;case"FitR":if(o!==4)return!1;l=!1;break;default:return!1}for(const c of r)if(!(typeof c=="number"||l&&c===null))return!1;return!0}function pn(s,e,t){return Math.min(Math.max(s,e),t)}function Mx(s){return Uint8Array.prototype.toBase64?s.toBase64():btoa(Ix(s))}function aI(s){return Uint8Array.fromBase64?Uint8Array.fromBase64(s):Yp(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)});class Kd{static textContent(e){const t=[],n={items:t,styles:Object.create(null)};function i(r){var c;if(!r)return;let o=null;const l=r.name;if(l==="#text")o=r.value;else if(Kd.shouldBuildText(l))(c=r==null?void 0:r.attributes)!=null&&c.textContent?o=r.attributes.textContent:r.value&&(o=r.value);else return;if(o!==null&&t.push({str:o}),!!r.children)for(const u of r.children)i(u)}return i(e),n}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}class Nx{static setupStorage(e,t,n,i,r){const o=i.getValue(t,{value:null});switch(n.name){case"textarea":if(o.value!==null&&(e.textContent=o.value),r==="print")break;e.addEventListener("input",l=>{i.setValue(t,{value:l.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(o.value===n.attributes.xfaOn?e.setAttribute("checked",!0):o.value===n.attributes.xfaOff&&e.removeAttribute("checked"),r==="print")break;e.addEventListener("change",l=>{i.setValue(t,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})})}else{if(o.value!==null&&e.setAttribute("value",o.value),r==="print")break;e.addEventListener("input",l=>{i.setValue(t,{value:l.target.value})})}break;case"select":if(o.value!==null){e.setAttribute("value",o.value);for(const l of n.children)l.attributes.value===o.value?l.attributes.selected=!0:l.attributes.hasOwnProperty("selected")&&delete l.attributes.selected}e.addEventListener("input",l=>{const c=l.target.options,u=c.selectedIndex===-1?"":c[c.selectedIndex].value;i.setValue(t,{value:u})});break}}static setAttributes({html:e,element:t,storage:n=null,intent:i,linkService:r}){const{attributes:o}=t,l=e instanceof HTMLAnchorElement;o.type==="radio"&&(o.name=`${o.name}-${i}`);for(const[c,u]of Object.entries(o))if(u!=null)switch(c){case"class":u.length&&e.setAttribute(c,u.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",u);break;case"style":Object.assign(e.style,u);break;case"textContent":e.textContent=u;break;default:(!l||c!=="href"&&c!=="newWindow")&&e.setAttribute(c,u)}l&&r.addLinkAttributes(e,o.href,o.newWindow),n&&o.dataId&&this.setupStorage(e,o.dataId,t,n)}static render(e){var d,f;const t=e.annotationStorage,n=e.linkService,i=e.xfaHtml,r=e.intent||"display",o=document.createElement(i.name);i.attributes&&this.setAttributes({html:o,element:i,intent:r,linkService:n});const l=r!=="richText",c=e.div;if(c.append(o),e.viewport){const p=`matrix(${e.viewport.transform.join(",")})`;c.style.transform=p}l&&c.setAttribute("class","xfaLayer xfaFont");const u=[];
149if(i.children.length===0){if(i.value){const p=document.createTextNode(i.value);o.append(p),l&&Kd.shouldBuildText(i.name)&&u.push(p)}return{textDivs:u}}const h=[[i,-1,o]];for(;h.length>0;){const[p,y,_]=h.at(-1);if(y+1===p.children.length){h.pop();continue}const A=p.children[++h.at(-1)[1]];if(A===null)continue;const{name:m}=A;if(m==="#text"){const w=document.createTextNode(A.value);u.push(w),_.append(w);continue}const b=(d=A==null?void 0:A.attributes)!=null&&d.xmlns?document.createElementNS(A.attributes.xmlns,m):document.createElement(m);if(_.append(b),A.attributes&&this.setAttributes({html:b,element:A,storage:t,intent:r,linkService:n}),((f=A.children)==null?void 0:f.length)>0)h.push([A,-1,b]);else if(A.value){const w=document.createTextNode(A.value);l&&Kd.shouldBuildText(m)&&u.push(w),b.append(w)}}for(const p of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))p.setAttribute("readOnly",!0);return{textDivs:u}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}const Hi="http://www.w3.org/2000/svg",Sa=class Sa{};I(Sa,"CSS",96),I(Sa,"PDF",72),I(Sa,"PDF_TO_CSS_UNITS",Sa.CSS/Sa.PDF);let oa=Sa;async function Qp(s,e="text"){if(Yh(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 Jp{constructor({viewBox:e,userUnit:t,scale:n,rotation:i,offsetX:r=0,offsetY:o=0,dontFlip:l=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=i,this.offsetX=r,this.offsetY=o,n*=t;const c=(e[2]+e[0])/2,u=(e[3]+e[1])/2;let h,d,f,p;switch(i%=360,i<0&&(i+=360),i){case 180:h=-1,d=0,f=0,p=1;break;case 90:h=0,d=1,f=1,p=0;break;case 270:h=0,d=-1,f=-1,p=0;break;case 0:h=1,d=0,f=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}l&&(f=-f,p=-p);let y,_,A,m;h===0?(y=Math.abs(u-e[1])*n+r,_=Math.abs(c-e[0])*n+o,A=(e[3]-e[1])*n,m=(e[2]-e[0])*n):(y=Math.abs(c-e[0])*n+r,_=Math.abs(u-e[1])*n+o,A=(e[2]-e[0])*n,m=(e[3]-e[1])*n),this.transform=[h*n,d*n,f*n,p*n,y-h*n*c-f*n*u,_-d*n*c-p*n*u],this.width=A,this.height=m}get rawDims(){const e=this.viewBox;return se(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:r=!1}={}){return new Jp({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:i,dontFlip:r})}convertToViewportPoint(e,t){const n=[e,t];return U.applyTransform(n,this.transform),n}convertToViewportRectangle(e){const t=[e[0],e[1]];U.applyTransform(t,this.transform);const n=[e[2],e[3]];return U.applyTransform(n,this.transform),[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){const n=[e,t];return U.applyInverseTransform(n,this.transform),n}}class Tb extends nc{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function t0(s){const e=s.length;let t=0;for(;t<e&&s[t].trim()==="";)t++;return s.substring(t,t+5).toLowerCase()==="data:"}function Pb(s){return typeof s=="string"&&/\.pdf$/i.test(s)}function lI(s){return[s]=s.split(/[#?]/,1),s.substring(s.lastIndexOf("/")+1)}function cI(s,e="document.pdf"){if(typeof s!="string")return e;if(t0(s))return J('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const n=(l=>{try{return new URL(l)}catch{try{return new URL(decodeURIComponent(l))}catch{try{return new URL(l,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(l),"https://foo.bar")}catch{return null}}}}})(s);if(!n)return e;const i=l=>{try{let c=decodeURIComponent(l);return c.includes("/")?(c=c.split("/").at(-1),c.test(/^\.pdf$/i)?c:l):c}catch{return l}}
149,r=/\.pdf$/i,o=n.pathname.split("/").at(-1);if(r.test(o))return i(o);if(n.searchParams.size>0){const l=Array.from(n.searchParams.values()).reverse();for(const u of l)if(r.test(u))return i(u);const c=Array.from(n.searchParams.keys()).reverse();for(const u of c)if(r.test(u))return i(u)}if(n.hash){const c=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(c)return i(c[0])}return e}class b1{constructor(){I(this,"started",Object.create(null));I(this,"times",[])}time(e){e in this.started&&J(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||J(`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:r}of this.times)e.push(`${n.padEnd(t)} ${r-i}ms
150`);return e.join("")}}function Yh(s,e){const t=e?URL.parse(s,e):URL.parse(s);return(t==null?void 0:t.protocol)==="http:"||(t==null?void 0:t.protocol)==="https:"}function Os(s){s.preventDefault()}function rt(s){s.preventDefault(),s.stopPropagation()}function uI(s){console.log("Deprecated API usage: "+s)}var Jd;class ey{static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!="string")return null;a(this,Jd)||g(this,Jd,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=a(this,Jd).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 r=parseInt(t[3],10);r=r>=1&&r<=31?r:1;let o=parseInt(t[4],10);o=o>=0&&o<=23?o:0;let l=parseInt(t[5],10);l=l>=0&&l<=59?l:0;let c=parseInt(t[6],10);c=c>=0&&c<=59?c:0;const u=t[7]||"Z";let h=parseInt(t[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(t[9],10)||0;return d=d>=0&&d<=59?d:0,u==="-"?(o+=h,l+=d):u==="+"&&(o-=h,l-=d),new Date(Date.UTC(n,i,r,o,l,c))}}Jd=new WeakMap,v(ey,Jd);function hI(s,{scale:e=1,rotation:t=0}){const{width:n,height:i}=s.attributes.style,r=[0,0,parseInt(n),parseInt(i)];return new Jp({viewBox:r,userUnit:1,scale:e,rotation:t})}function Zp(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):(J(`Not a valid color format: "${s}"`),[0,0,0])}function dI(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,Zp(n))}e.remove()}function Xe(s){const{a:e,b:t,c:n,d:i,e:r,f:o}=s.getTransform();return[e,t,n,i,r,o]}function ui(s){const{a:e,b:t,c:n,d:i,e:r,f:o}=s.getTransform().invertSelf();return[e,t,n,i,r,o]}function Yl(s,e,t=!1,n=!0){if(e instanceof Jp){const{pageWidth:i,pageHeight:r}=e.rawDims,{style:o}=s,l=Gt.isCSSRoundSupported,c=`var(--total-scale-factor) * ${i}px`,u=`var(--total-scale-factor) * ${r}px`,h=l?`round(down, ${c}, var(--scale-round-x))`:`calc(${c})`,d=l?`round(down, ${u}, var(--scale-round-y))`:`calc(${u})`;!t||e.rotation%180===0?(o.width=h,o.height=d):(o.width=d,o.height=h)}n&&s.setAttribute("data-main-rotation",e.rotation)}class $i{constructor(){const{pixelRatio:e}=$i;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,r=-1){let o=1/0,l=1/0,c=1/0;n=$i.capPixels(n,r),n>0&&(o=Math.sqrt(n/(e*t))),i!==-1&&(l=i/e,c=i/t);const u=Math.min(o,l,c);return this.sx>u||this.sy>u?(this.sx=u,this.sy=u,!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 iw=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class fI{static get isDarkMode(){var e;return se(this,"isDarkMode",!!((e=window==null?void 0:window.matchMedia)!=null&&e.call(window,"(prefers-color-scheme: dark)").matches))}}class pI{static get commentForegroundColor(){const e=document.createElement("span");e.classList.add("comment","sidebar");const{style:t}=e;t.width=t.height="0",t.display="none",t.color="var(--comment-fg-color)",document.body.append(e);const{color:n}=window.getComputedStyle(e);return e.remove(),se(this,"commentForegroundColor",Zp(n))}}
150function gI(s,e,t,n){n=Math.min(Math.max(n??1,0),1);const i=255*(1-n);return s=Math.round(s*n+i),e=Math.round(e*n+i),t=Math.round(t*n+i),[s,e,t]}function S1(s,e){const t=s[0]/255,n=s[1]/255,i=s[2]/255,r=Math.max(t,n,i),o=Math.min(t,n,i),l=(r+o)/2;if(r===o)e[0]=e[1]=0;else{const c=r-o;switch(e[1]=l<.5?c/(r+o):c/(2-r-o),r){case t:e[0]=((n-i)/c+(n<i?6:0))*60;break;case n:e[0]=((i-t)/c+2)*60;break;case i:e[0]=((t-n)/c+4)*60;break}}e[2]=l}function rw(s,e){const t=s[0],n=s[1],i=s[2],r=(1-Math.abs(2*i-1))*n,o=r*(1-Math.abs(t/60%2-1)),l=i-r/2;switch(Math.floor(t/60)){case 0:e[0]=r+l,e[1]=o+l,e[2]=l;break;case 1:e[0]=o+l,e[1]=r+l,e[2]=l;break;case 2:e[0]=l,e[1]=r+l,e[2]=o+l;break;case 3:e[0]=l,e[1]=o+l,e[2]=r+l;break;case 4:e[0]=o+l,e[1]=l,e[2]=r+l;break;case 5:case 6:e[0]=r+l,e[1]=l,e[2]=o+l;break}}function A1(s){return s<=.03928?s/12.92:((s+.055)/1.055)**2.4}function E1(s,e,t){rw(s,t),t.map(A1);const n=.2126*t[0]+.7152*t[1]+.0722*t[2];rw(e,t),t.map(A1);const i=.2126*t[0]+.7152*t[1]+.0722*t[2];return n>i?(n+.05)/(i+.05):(i+.05)/(n+.05)}const x1=new Map;function mI(s,e){const t=s[0]+s[1]*256+s[2]*65536+e[0]*16777216+e[1]*4294967296+e[2]*1099511627776;let n=x1.get(t);if(n)return n;const i=new Float32Array(9),r=i.subarray(0,3),o=i.subarray(3,6);S1(s,o);const l=i.subarray(6,9);S1(e,l);const c=l[2]<.5,u=c?12:4.5;if(o[2]=c?Math.sqrt(o[2]):1-Math.sqrt(1-o[2]),E1(o,l,r)<u){let h,d;c?(h=o[2],d=1):(h=0,d=o[2]);const f=.005;for(;d-h>f;){const p=o[2]=(h+d)/2;c===E1(o,l,r)<u?h=p:d=p}o[2]=c?d:h}return rw(o,r),n=U.makeHexColor(Math.round(r[0]*255),Math.round(r[1]*255),Math.round(r[2]*255)),x1.set(t,n),n}function Ox({html:s,dir:e,className:t},n){const i=document.createDocumentFragment();if(typeof s=="string"){const r=document.createElement("p");r.dir=e||"auto";const o=s.split(/(?:\r\n?|\n)/);for(let l=0,c=o.length;l<c;++l){const u=o[l];r.append(document.createTextNode(u)),l<c-1&&r.append(document.createElement("br"))}i.append(r)}else Nx.render({xfaHtml:s,div:i,intent:"richText"});i.firstChild.classList.add("richText",t),n.append(i)}function Fx(s){const e=new Path2D;if(!s)return e;for(let t=0,n=s.length;t<n;)switch(s[t++]){case $h.moveTo:e.moveTo(s[t++],s[t++]);break;case $h.lineTo:e.lineTo(s[t++],s[t++]);break;case $h.curveTo:e.bezierCurveTo(s[t++],s[t++],s[t++],s[t++],s[t++],s[t++]);break;case $h.quadraticCurveTo:e.quadraticCurveTo(s[t++],s[t++],s[t++],s[t++]);break;case $h.closePath:e.closePath();break;default:J(`Unrecognized drawing path operator: ${s[t-1]}`);break}return e}var to,no,gs,ms,Zd,so,Gc,qc,ef,dy,jx,Vt,Bx,$x,pc,Qh;const Xi=class Xi{constructor(e){v(this,Vt);v(this,to,null);v(this,no,null);v(this,gs);v(this,ms,null);v(this,Zd,null);v(this,so,null);v(this,Gc,null);v(this,qc,null);g(this,gs,e),a(Xi,ef)||g(Xi,ef,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=g(this,to,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=a(this,gs)._uiManager._signal;t instanceof AbortSignal&&!t.aborted&&(e.addEventListener("contextmenu",Os,{signal:t}),e.addEventListener("pointerdown",S(Xi,dy,jx),{signal:t}));const n=g(this,ms,document.createElement("div"));n.className="buttons",e.append(n);const i=a(this,gs).toolbarPosition;if(i){const{style:r}=e,o=a(this,gs)._uiManager.direction==="ltr"?1-i[0]:i[0];r.insetInlineEnd=`${100*o}%`,r.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return a(this,to)}hide(){var e;a(this,to).classList.add("hidden"),(e=a(this,no))==null||e.hideDropdown()}show(){var e,t;a(this,to).classList.remove("hidden"),(e=a(this,Zd))==null||e.shown(),(t=a(this,so))==null||t.shown()}addDeleteButton(){const{editorType:e,_uiManager:t}=a(this,gs),n=document.createElement("button");n.classList.add("basic","deleteButton"),n.tabIndex=0,n.setAttribute("data-l10n-id",a(Xi,ef)[e]),S(this,Vt,pc).call(this,n)&&n.addEventListener("click",i=>{t.delete()},{signal:t._signal}),a(this,ms).append(n)}async addAltText(e){const t=await e.render();S(this,Vt,pc).call(this,t),a(this,ms).append(t,a(this,Vt,Qh)),g(this,Zd,e)}
150addComment(e,t=null){if(a(this,so))return;const n=e.renderForToolbar();if(!n)return;S(this,Vt,pc).call(this,n);const i=g(this,Gc,a(this,Vt,Qh));t?(a(this,ms).insertBefore(n,t),a(this,ms).insertBefore(i,t)):a(this,ms).append(n,i),g(this,so,e),e.toolbar=this}addColorPicker(e){if(a(this,no))return;g(this,no,e);const t=e.renderButton();S(this,Vt,pc).call(this,t),a(this,ms).append(t,a(this,Vt,Qh))}async addEditSignatureButton(e){const t=g(this,qc,await e.renderEditButton(a(this,gs)));S(this,Vt,pc).call(this,t),a(this,ms).append(t,a(this,Vt,Qh))}removeButton(e){var t,n;switch(e){case"comment":(t=a(this,so))==null||t.removeToolbarCommentButton(),g(this,so,null),(n=a(this,Gc))==null||n.remove(),g(this,Gc,null);break}}async addButton(e,t){switch(e){case"colorPicker":t&&this.addColorPicker(t);break;case"altText":t&&await this.addAltText(t);break;case"editSignature":t&&await this.addEditSignatureButton(t);break;case"delete":this.addDeleteButton();break;case"comment":t&&this.addComment(t);break}}async addButtonBefore(e,t,n){if(!t&&e==="comment")return;const i=a(this,ms).querySelector(n);i&&e==="comment"&&this.addComment(t,i)}updateEditSignatureButton(e){a(this,qc)&&(a(this,qc).title=e)}remove(){var e;a(this,to).remove(),(e=a(this,no))==null||e.destroy(),g(this,no,null)}};to=new WeakMap,no=new WeakMap,gs=new WeakMap,ms=new WeakMap,Zd=new WeakMap,so=new WeakMap,Gc=new WeakMap,qc=new WeakMap,ef=new WeakMap,dy=new WeakSet,jx=function(e){e.stopPropagation()},Vt=new WeakSet,Bx=function(e){a(this,gs)._focusEventsAllowed=!1,rt(e)},$x=function(e){a(this,gs)._focusEventsAllowed=!0,rt(e)},pc=function(e){const t=a(this,gs)._uiManager._signal;return!(t instanceof AbortSignal)||t.aborted?!1:(e.addEventListener("focusin",S(this,Vt,Bx).bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",S(this,Vt,$x).bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",Os,{signal:t}),!0)},Qh=function(){const e=document.createElement("div");return e.className="divider",e},v(Xi,dy),v(Xi,ef,null);let ow=Xi;var tf,Ta,Qi,zr,Ux,zx,aw;class yI{constructor(e){v(this,zr);v(this,tf,null);v(this,Ta,null);v(this,Qi);g(this,Qi,e)}show(e,t,n){const[i,r]=S(this,zr,zx).call(this,t,n),{style:o}=a(this,Ta)||g(this,Ta,S(this,zr,Ux).call(this));e.append(a(this,Ta)),o.insetInlineEnd=`${100*i}%`,o.top=`calc(${100*r}% + var(--editor-toolbar-vert-offset))`}hide(){a(this,Ta).remove()}}tf=new WeakMap,Ta=new WeakMap,Qi=new WeakMap,zr=new WeakSet,Ux=function(){const e=g(this,Ta,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar");const t=a(this,Qi)._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener("contextmenu",Os,{signal:t});const n=g(this,tf,document.createElement("div"));return n.className="buttons",e.append(n),a(this,Qi).hasCommentManager()&&S(this,zr,aw).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{a(this,Qi).commentSelection("floating_button")}),S(this,zr,aw).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{a(this,Qi).highlightSelection("floating_button")}),e},zx=function(e,t){let n=0,i=0;for(const r of e){const o=r.y+r.height;if(o<n)continue;const l=r.x+(t?r.width:0);if(o>n){i=l,n=o;continue}t?l>i&&(i=l):l<i&&(i=l)}return[t?1-i:i,n]},aw=function(e,t,n,i){const r=document.createElement("button");r.classList.add("basic",e),r.tabIndex=0,r.setAttribute("data-l10n-id",t);const o=document.createElement("span");r.append(o),o.className="visuallyHidden",o.setAttribute("data-l10n-id",n);const l=a(this,Qi)._signal;l instanceof AbortSignal&&!l.aborted&&(r.addEventListener("contextmenu",Os,{signal:l}),r.addEventListener("click",i,{signal:l})),a(this,tf).append(r)};function Hx(s,e,t){for(const n of t)e.addEventListener(n,s[n].bind(s))}var Pa,Ra,Xc,La;const Ae=class Ae{static initializeAndAddPointerId(e){(a(Ae,Ra)||g(Ae,Ra,new Set)).add(e)}static setPointer(e,t){a(Ae,Pa)||g(Ae,Pa,t),a(Ae,La)??g(Ae,La,e)}static setTimeStamp(e){g(Ae,Xc,e)}static isSamePointerId(e){return a(Ae,Pa)===e}static isSamePointerIdOrRemove(e){var t;return a(Ae,Pa)===e?!0:((t=a(Ae,Ra))==null||t.delete(e),!1)}static isSamePointerType(e){return a(Ae,La)===e}static isInitializedAndDifferentPointerType(e){return a(Ae,La)!==null&&!Ae.isSamePointerType(e)}static isSameTimeStamp(e){return a(Ae,Xc)===e}static isUsingMultiplePointers(){var e;return((e=a(Ae,Ra))==null?void 0:e.size)>=1}static clearPointerType(){g(Ae,La,null)}static clearPointerIds(){g(Ae,Pa,NaN),g(Ae,Ra,null)}static clearTimeStamp(){g(Ae,Xc,NaN)}};Pa=new WeakMap,Ra=new WeakMap,Xc=new WeakMap,La=new WeakMap,v(Ae,Pa,NaN),v(Ae,Ra,null),v(Ae,Xc,NaN),v(Ae,La,null);let Qt=Ae;var fy;class vI{constructor(){v(this,fy,0)}get id(){return`${qd}${gt(this,fy)._++}`}}fy=new WeakMap;var Kc,nf,Jt,Yc,qg;const jb=class jb{constructor(){v(this,Yc);v(this,Kc,Dx());v(this,nf,0);v(this,Jt,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 r=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 se(this,"_isSVGFittingCanvas",r)}async getFromFile(e){const{lastModified:t,name:n,size:i,type:r}=e;return S(this,Yc,qg).call(this,`${t}_${n}_${i}_${r}`,e)}async getFromUrl(e){return S(this,Yc,qg).call(this,e,e)}async getFromBlob(e,t){const n=await t;return S(this,Yc,qg).call(this,e,n)}async getFromId(e){a(this,Jt)||g(this,Jt,new Map);const t=a(this,Jt).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){a(this,Jt)||g(this,Jt,new Map);let n=a(this,Jt).get(e);if(n!=null&&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_${a(this,Kc)}_${gt(this,nf)._++}`,refCounter:1,isSvg:!1},a(this,Jt).set(e,n),a(this,Jt).set(n.id,n),n}getSvgUrl(e){const t=a(this,Jt).get(e);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(e){var i;a(this,Jt)||g(this,Jt,new Map);const t=a(this,Jt).get(e);if(!t||(t.refCounter-=1,t.refCounter!==0))return;const{bitmap:n}=t;if(!t.url&&!t.file){const r=new OffscreenCanvas(n.width,n.height);r.getContext("bitmaprenderer").transferFromImageBitmap(n),t.blobPromise=r.convertToBlob()}(i=n.close)==null||i.call(n),t.bitmap=null}isValidId(e){return e.startsWith(`image_${a(this,Kc)}_`)}};Kc=new WeakMap,nf=new WeakMap,Jt=new WeakMap,Yc=new WeakSet,qg=async function(e,t){a(this,Jt)||g(this,Jt,new Map);let n=a(this,Jt).get(e);if(n===null)return null;if(n!=null&&n.bitmap)return n.refCounter+=1,n;try{n||(n={bitmap:null,id:`image_${a(this,Kc)}_${gt(this,nf)._++}`,refCounter:0,isSvg:!1});let i;if(typeof t=="string"?(n.url=t,i=await Qp(t,"blob")):t instanceof File?i=n.file=t:t instanceof Blob&&(i=t),i.type==="image/svg+xml"){const r=jb._isSVGFittingCanvas,o=new FileReader,l=new Image,c=new Promise((u,h)=>{l.onload=()=>{n.bitmap=l,n.isSvg=!0,u()},o.onload=async()=>{const d=n.svgUrl=o.result;l.src=await r?`${d}#svgView(preserveAspectRatio(none))`:d},l.onerror=o.onerror=h});o.readAsDataURL(i),await c}else n.bitmap=await createImageBitmap(i);n.refCounter=1}catch(i){J(i),n=null}return a(this,Jt).set(e,n),n&&a(this,Jt).set(n.id,n),n};let lw=jb;var ot,io,sf,qe;class wI{constructor(e=128){v(this,ot,[]);v(this,io,!1);v(this,sf);v(this,qe,-1);g(this,sf,e)}add({cmd:e,undo:t,post:n,mustExec:i,type:r=NaN,overwriteIfSameType:o=!1,keepUndo:l=!1}){if(i&&e(),a(this,io))return;const c={cmd:e,undo:t,post:n,type:r};if(a(this,qe)===-1){a(this,ot).length>0&&(a(this,ot).length=0),g(this,qe,0),a(this,ot).push(c);return}if(o&&a(this,ot)[a(this,qe)].type===r){l&&(c.undo=a(this,ot)[a(this,qe)].undo),a(this,ot)[a(this,qe)]=c;return}const u=a(this,qe)+1;u===a(this,sf)?a(this,ot).splice(0,1):(g(this,qe,u),u<a(this,ot).length&&a(this,ot).splice(u)),a(this,ot).push(c)}undo(){if(a(this,qe)===-1)return;g(this,io,!0);const{undo:e,post:t}=a(this,ot)[a(this,qe)];e(),t==null||t(),g(this,io,!1),g(this,qe,a(this,qe)-1)}redo(){if(a(this,qe)<a(this,ot).length-1){g(this,qe,a(this,qe)+1),g(this,io,!0);const{cmd:e,post:t}=a(this,ot)[a(this,qe)];e(),t==null||t(),g(this,io,!1)}}hasSomethingToUndo(){return a(this,qe)!==-1}hasSomethingToRedo(){return a(this,qe)<a(this,ot).length-1}cleanType(e){if(a(this,qe)!==-1){for(let t=a(this,qe);t>=0;t--)if(a(this,ot)[t].type!==e){a(this,ot).splice(t+1,a(this,qe)-t),g(this,qe,t);return}a(this,ot).length=0,g(this,qe,-1)}}destroy(){g(this,ot,null)}}ot=new WeakMap,io=new WeakMap,sf=new WeakMap,qe=new WeakMap;var py,Vx;class eg{constructor(e){v(this,py);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=Gt.platform;for(const[n,i,r={}]of e)for(const o of n){const l=o.startsWith("mac+");t&&l?(this.callbacks.set(o.slice(4),{callback:i,options:r}),this.allKeys.add(o.split("+").at(-1))):!t&&!l&&(this.callbacks.set(o,{callback:i,options:r}),this.allKeys.add(o.split("+").at(-1)))}}exec(e,t){if(!this.allKeys.has(t.key))return;const n=this.callbacks.get(S(this,py,Vx).call(this,t));if(!n)return;const{callback:i,options:{bubbles:r=!1,args:o=[],checker:l=null}}=n;l&&!l(e,t)||(i.bind(e,...o,t)(),r||rt(t))}}py=new WeakSet,Vx=function(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t};const gy=class gy{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return dI(e),se(this,"_colors",e)}convert(e){const t=Zp(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[n,i]of this._colors)if(i.every((r,o)=>r===t[o]))return gy._colorsMapping.get(n);return t}getHexCode(e){const t=this._colors.get(e);return t?U.makeHexColor(...t):e}};I(gy,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let cw=gy;var Qc,Bn,Jc,Ze,wt,Zc,ys,eu,vs,Zt,ro,oo,tu,ao,gi,ws,Ia,rf,of,nu,af,mi,lo,su,co,yi,my,uo,iu,lf,ho,Da,ru,fo,cf,ht,_e,Ji,po,go,uf,ou,hf,mo,vi,Zi,df,ff,_s,O,Xg,uw,Wx,Gx,Jh,qx,Xx,Kx,hw,Yx,Qx,Jx,Zx,ln,Vi,ek,tk,dw,nk,Zh,fw;const Nc=class Nc{constructor(e,t,n,i,r,o,l,c,u,h,d,f,p,y,_,A){v(this,O);v(this,Qc,new AbortController);v(this,Bn,null);v(this,Jc,null);v(this,Ze,new Map);v(this,wt,new Map);v(this,Zc,null);v(this,ys,null);v(this,eu,null);v(this,vs,new wI);v(this,Zt,null);v(this,ro,null);v(this,oo,null);v(this,tu,0);v(this,ao,new Set);v(this,gi,null);v(this,ws,null);v(this,Ia,new Set);I(this,"_editorUndoBar",null);v(this,rf,!1);v(this,of,!1);v(this,nu,!1);v(this,af,null);v(this,mi,null);v(this,lo,null);v(this,su,null);v(this,co,!1);v(this,yi,null);v(this,my,new vI);v(this,uo,!1);v(this,iu,!1);v(this,lf,!1);v(this,ho,null);v(this,Da,null);v(this,ru,null);v(this,fo,null);v(this,cf,null);v(this,ht,ee.NONE);v(this,_e,new Set);v(this,Ji,null);v(this,po,null);v(this,go,null);v(this,uf,null);v(this,ou,null);v(this,hf,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});v(this,mo,[0,0]);v(this,vi,null);v(this,Zi,null);v(this,df,null);v(this,ff,null);v(this,_s,null);const m=this._signal=a(this,Qc).signal;g(this,Zi,e),g(this,df,t),g(this,ff,n),g(this,Zc,i),g(this,Zt,r),g(this,po,o),g(this,ou,c),this._eventBus=l,l._on("editingaction",this.onEditingAction.bind(this),{signal:m}),l._on("pagechanging",this.onPageChanging.bind(this),{signal:m}),l._on("scalechanging",this.onScaleChanging.bind(this),{signal:m}),l._on("rotationchanging",this.onRotationChanging.bind(this),{signal:m}),l._on("setpreference",this.onSetPreference.bind(this),{signal:m}),l._on("switchannotationeditorparams",b=>this.updateParams(b.type,b.value),{signal:m}),window.addEventListener("pointerdown",()=>{g(this,iu,!0)},{capture:!0,signal:m}),window.addEventListener("pointerup",()=>{g(this,iu,!1)},{capture:!0,signal:m}),S(this,O,qx).call(this),S(this,O,Zx).call(this),S(this,O,hw).call(this),g(this,ys,c.annotationStorage),g(this,af,c.filterFactory),g(this,go,u),g(this,su,h||null),g(this,rf,d),g(this,of,f),g(this,nu,p),g(this,cf,y||null),this.viewParameters={realScale:oa.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=_||null,this._supportsPinchToZoom=A!==!1,r==null||r.setSidebarUiManager(this)}static get _keyboardManager(){const e=Nc.prototype,t=o=>a(o,Zi).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&o.hasSomethingToControl(),n=(o,{target:l})=>
150{if(l instanceof HTMLInputElement){const{type:c}=l;return c!=="text"&&c!=="number"}return!0},i=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return se(this,"_keyboardManager",new eg([[["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:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&a(o,Zi).contains(l)&&!o.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&a(o,Zi).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:[-r,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[r,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-r],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,r],checker:t}]]))}destroy(){var e,t,n,i,r,o,l,c,u;(e=a(this,_s))==null||e.resolve(),g(this,_s,null),(t=a(this,Qc))==null||t.abort(),g(this,Qc,null),this._signal=null;for(const h of a(this,wt).values())h.destroy();a(this,wt).clear(),a(this,Ze).clear(),a(this,Ia).clear(),(n=a(this,fo))==null||n.clear(),g(this,Bn,null),a(this,_e).clear(),a(this,vs).destroy(),(i=a(this,Zc))==null||i.destroy(),(r=a(this,Zt))==null||r.destroy(),(o=a(this,po))==null||o.destroy(),(l=a(this,yi))==null||l.hide(),g(this,yi,null),(c=a(this,ru))==null||c.destroy(),g(this,ru,null),g(this,Jc,null),a(this,mi)&&(clearTimeout(a(this,mi)),g(this,mi,null)),a(this,vi)&&(clearTimeout(a(this,vi)),g(this,vi,null)),(u=this._editorUndoBar)==null||u.destroy(),g(this,ou,null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return a(this,cf)}get useNewAltTextFlow(){return a(this,of)}get useNewAltTextWhenAddingImage(){return a(this,nu)}get hcmFilter(){return se(this,"hcmFilter",a(this,go)?a(this,af).addHCMFilter(a(this,go).foreground,a(this,go).background):"none")}get direction(){return se(this,"direction",getComputedStyle(a(this,Zi)).direction)}get _highlightColors(){return se(this,"_highlightColors",a(this,su)?new Map(a(this,su).split(",").map(e=>(e=e.split("=").map(t=>t.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return se(this,"highlightColors",null);const t=new Map,n=!!a(this,go);for(const[i,r]of e){const o=i.endsWith("_HCM");if(n&&o){t.set(i.replace("_HCM",""),r);continue}!n&&!o&&t.set(i,r)}return se(this,"highlightColors",t)}get highlightColorNames(){return se(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;const t=this.highlightColorNames.get(e);return this._highlightColors.get(t)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),g(this,oo,e)}setMainHighlightColorPicker(e){g(this,ru,e)}editAltText(e,t=!1){var n;(n=a(this,Zc))==null||n.editAltText(this,e,t)}hasCommentManager(){return!!a(this,Zt)}editComment(e,t,n,i){var r;(r=a(this,Zt))==null||r.showDialog(this,e,t,n,i)}selectComment(e,t){const n=a(this,wt).get(e),i=n==null?void 0:n.getEditorByUID(t);i==null||i.toggleComment(!0,!0)}updateComment(e){var t;(t=a(this,Zt))==null||t.updateComment(e.getData())}updatePopupColor(e){var t;(t=a(this,Zt))==null||t.updatePopupColor(e)}
150removeComment(e){var t;(t=a(this,Zt))==null||t.removeComments([e.uid])}toggleComment(e,t,n=void 0){var i;(i=a(this,Zt))==null||i.toggleCommentPopup(e,t,n)}makeCommentColor(e,t){var n;return e&&((n=a(this,Zt))==null?void 0:n.makeCommentColor(e,t))||null}getCommentDialogElement(){var e;return((e=a(this,Zt))==null?void 0:e.dialogElement)||null}async waitForEditorsRendered(e){if(a(this,wt).has(e-1))return;const{resolve:t,promise:n}=Promise.withResolvers(),i=r=>{r.pageNumber===e&&(this._eventBus._off("editorsrendered",i),t())};this._eventBus.on("editorsrendered",i),await n}getSignature(e){var t;(t=a(this,po))==null||t.getSignature({uiManager:this,editor:e})}get signatureManager(){return a(this,po)}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":g(this,nu,t);break}}onPageChanging({pageNumber:e}){g(this,tu,e-1)}focusMainContainer(){a(this,Zi).focus()}findParent(e,t){for(const n of a(this,wt).values()){const{x:i,y:r,width:o,height:l}=n.div.getBoundingClientRect();if(e>=i&&e<=i+o&&t>=r&&t<=r+l)return n}return null}disableUserSelect(e=!1){a(this,df).classList.toggle("noUserSelect",e)}addShouldRescale(e){a(this,Ia).add(e)}removeShouldRescale(e){a(this,Ia).delete(e)}onScaleChanging({scale:e}){var t;this.commitOrRemove(),this.viewParameters.realScale=e*oa.PDF_TO_CSS_UNITS;for(const n of a(this,Ia))n.onScaleChanging();(t=a(this,oo))==null||t.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e="",t=!1){const n=document.getSelection();if(!n||n.isCollapsed)return;const{anchorNode:i,anchorOffset:r,focusNode:o,focusOffset:l}=n,c=n.toString(),h=S(this,O,Xg).call(this,n).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;n.empty();const f=S(this,O,uw).call(this,h),p=a(this,ht)===ee.NONE,y=()=>{const _=f==null?void 0:f.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:d,anchorNode:i,anchorOffset:r,focusNode:o,focusOffset:l,text:c});p&&this.showAllEditors("highlight",!0,!0),t&&(_==null||_.editComment())};if(p){this.switchToMode(ee.HIGHLIGHT,y);return}y()}commentSelection(e=""){this.highlightSelection(e,!0)}getAndRemoveDataFromAnnotationStorage(e){if(!a(this,ys))return null;const t=`${qd}${e}`,n=a(this,ys).getRawValue(t);return n&&a(this,ys).remove(t),n}addToAnnotationStorage(e){!e.isEmpty()&&a(this,ys)&&!a(this,ys).has(e.id)&&a(this,ys).setValue(e.id,e)}a11yAlert(e,t=null){const n=a(this,ff);n&&(n.setAttribute("data-l10n-id",e),t?n.setAttribute("data-l10n-args",JSON.stringify(t)):n.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,a(this,co)&&(g(this,co,!1),S(this,O,Jh).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of a(this,_e))if(t.div.contains(e)){g(this,Da,[t,e]),t._focusEventsAllowed=!1;break}}focus(){if(!a(this,Da))return;const[e,t]=a(this,Da);g(this,Da,null),t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){S(this,O,hw).call(this),this.setEditingState(!0)}removeEditListeners(){S(this,O,Yx).call(this),this.setEditingState(!1)}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const n of a(this,ws))if(n.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const n of a(this,ws))if(n.isHandlingMimeForPasting(t.type)){n.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){var n;if(e.preventDefault(),(n=a(this,Bn))==null||n.commitOrRemove(),!this.hasSelection)return;const t=[];for(const i of a(this,_e)){const r=i.serialize(!0);r&&t.push(r)}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 r of t.items)for(const o of a(this,ws))if(o.isHandlingMimeForPasting(r.type)){o.paste(r,this.currentLayer);return}let n=t.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(r){J(`paste: "${r.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const i=this.currentLayer;try{const r=[];for(const c of n){const u=await i.deserialize(c);if(!u)return;r.push(u)}const o=()=>{for(const c of r)S(this,O,dw).call(this,c);S(this,O,fw).call(this,r)},l=()=>{for(const c of r)c.remove()};this.addCommands({cmd:o,undo:l,mustExec:!0})}catch(r){J(`paste: "${r.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),a(this,ht)!==ee.NONE&&!this.isEditorHandlingKeyboard&&Nc._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,a(this,co)&&(g(this,co,!1),S(this,O,Jh).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}
150setEditingState(e){e?(S(this,O,Xx).call(this),S(this,O,Qx).call(this),S(this,O,ln).call(this,{isEditing:a(this,ht)!==ee.NONE,isEmpty:S(this,O,Zh).call(this),hasSomethingToUndo:a(this,vs).hasSomethingToUndo(),hasSomethingToRedo:a(this,vs).hasSomethingToRedo(),hasSelectedEditor:!1})):(S(this,O,Kx).call(this),S(this,O,Jx).call(this),S(this,O,ln).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!a(this,ws)){g(this,ws,e);for(const t of a(this,ws))S(this,O,Vi).call(this,t.defaultPropertiesToUpdate)}}getId(){return a(this,my).id}get currentLayer(){return a(this,wt).get(a(this,tu))}getLayer(e){return a(this,wt).get(e)}get currentPageIndex(){return a(this,tu)}addLayer(e){a(this,wt).set(e.pageIndex,e),a(this,uo)?e.enable():e.disable()}removeLayer(e){a(this,wt).delete(e.pageIndex)}async updateMode(e,t=null,n=!1,i=!1,r=!1){var o,l,c,u,h,d;if(a(this,ht)!==e&&!(a(this,_s)&&(await a(this,_s).promise,!a(this,_s)))){if(g(this,_s,Promise.withResolvers()),(o=a(this,oo))==null||o.commitOrRemove(),a(this,ht)===ee.POPUP&&((l=a(this,Zt))==null||l.hideSidebar()),(c=a(this,Zt))==null||c.destroyPopup(),g(this,ht,e),e===ee.NONE){this.setEditingState(!1),S(this,O,tk).call(this);for(const f of a(this,Ze).values())f.hideStandaloneCommentButton();(u=this._editorUndoBar)==null||u.hide(),this.toggleComment(null),a(this,_s).resolve();return}for(const f of a(this,Ze).values())f.addStandaloneCommentButton();e===ee.SIGNATURE&&await((h=a(this,po))==null?void 0:h.loadSignatures()),this.setEditingState(!0),await S(this,O,ek).call(this),this.unselectAll();for(const f of a(this,wt).values())f.updateMode(e);if(e===ee.POPUP){a(this,Jc)||g(this,Jc,await a(this,ou).getAnnotationsByType(new Set(a(this,ws).map(y=>y._editorType))));const f=new Set,p=[];for(const y of a(this,Ze).values()){const{annotationElementId:_,hasComment:A,deleted:m}=y;_&&f.add(_),A&&!m&&p.push(y.getData())}for(const y of a(this,Jc)){const{id:_,popupRef:A,contentsObj:m}=y;A&&(m!=null&&m.str)&&!f.has(_)&&!a(this,ao).has(_)&&p.push(y)}(d=a(this,Zt))==null||d.showSidebar(p)}if(!t){n&&this.addNewEditorFromKeyboard(),a(this,_s).resolve();return}for(const f of a(this,Ze).values())f.uid===t?(this.setSelected(f),r?f.editComment():i?f.enterInEditMode():f.focus()):f.unselect();a(this,_s).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==a(this,ht)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,t){if(a(this,ws)){switch(e){case he.CREATE:this.currentLayer.addNewEditor(t);return;case he.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(a(this,uf)||g(this,uf,new Map)).set(e,t),this.showAllEditors("highlight",t);break}if(this.hasSelection)for(const n of a(this,_e))n.updateParams(e,t);else for(const n of a(this,ws))n.updateDefaultParams(e,t)}}showAllEditors(e,t,n=!1){var r;for(const o of a(this,Ze).values())o.editorType===e&&o.show(t);(((r=a(this,uf))==null?void 0:r.get(he.HIGHLIGHT_SHOW_ALL))??!0)!==t&&S(this,O,Vi).call(this,[[he.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(a(this,lf)!==e){g(this,lf,e);for(const t of a(this,wt).values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}*getEditors(e){for(const t of a(this,Ze).values())t.pageIndex===e&&(yield t)}getEditor(e){return a(this,Ze).get(e)}addEditor(e){a(this,Ze).set(e.id,e)}removeEditor(e){var t,n;e.div.contains(document.activeElement)&&(a(this,mi)&&clearTimeout(a(this,mi)),g(this,mi,setTimeout(()=>{this.focusMainContainer(),g(this,mi,null)},0))),a(this,Ze).delete(e.id),e.annotationElementId&&((t=a(this,fo))==null||t.delete(e.annotationElementId)),this.unselect(e),(!e.annotationElementId||!a(this,ao).has(e.annotationElementId))&&((n=a(this,ys))==null||n.remove(e.id))}addDeletedAnnotationElement(e){a(this,ao).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return a(this,ao).has(e)}removeDeletedAnnotationElement(e){a(this,ao).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){a(this,Bn)!==e&&(g(this,Bn,e),e&&S(this,O,Vi).call(this,e.propertiesToUpdate))}updateUI(e){a(this,O,nk)===e&&S(this,O,Vi).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){S(this,O,Vi).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(a(this,_e).has(e)){a(this,_e).delete(e),e.unselect(),S(this,O,ln).call(this,{hasSelectedEditor:this.hasSelection});return}a(this,_e).add(e),e.select(),S(this,O,Vi).call(this,e.propertiesToUpdate),S(this,O,ln).call(this,{hasSelectedEditor:!0})}setSelected(e){var t;this.updateToolbar({mode:e.mode,editId:e.uid}),(t=a(this,oo))==null||t.commitOrRemove();for(const n of a(this,_e))n!==e&&n.unselect();a(this,_e).clear(),a(this,_e).add(e),e.select(),S(this,O,Vi).call(this,e.propertiesToUpdate),S(this,O,ln).call(this,{hasSelectedEditor:!0})}isSelected(e){return a(this,_e).has(e)}get firstSelectedEditor(){return a(this,_e).values().next().value}unselect(e){e.unselect(),a(this,_e).delete(e),S(this,O,ln).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return a(this,_e).size!==0}get isEnterHandled(){return a(this,_e).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;a(this,vs).undo(),S(this,O,ln).call(this,{hasSomethingToUndo:a(this,vs).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:S(this,O,Zh).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){a(this,vs).redo(),S(this,O,ln).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:a(this,vs).hasSomethingToRedo(),isEmpty:S(this,O,Zh).call(this)})}addCommands(e){a(this,vs).add(e),S(this,O,ln).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:S(this,O,Zh).call(this)})}cleanUndoStack(e){a(this,vs).cleanType(e)}delete(){var r;this.commitOrRemove();const e=(r=this.currentLayer)==null?void 0:r.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const t=e?[e]:[...a(this,_e)],n=()=>{var o;(o=this._editorUndoBar)==null||o.show(i,t.length===1?t[0].editorType:t.length);for(const l of t)l.remove()},i=()=>{for(const o of t)S(this,O,dw).call(this,o)};this.addCommands({cmd:n,undo:i,mustExec:!0})}commitOrRemove(){var e;(e=a(this,Bn))==null||e.commitOrRemove()}hasSomethingToControl(){return a(this,Bn)||this.hasSelection}selectAll(){for(const e of a(this,_e))e.commit();S(this,O,fw).call(this,a(this,Ze).values())}unselectAll(){var e;if(!(a(this,Bn)&&(a(this,Bn).commitOrRemove(),a(this,ht)!==ee.NONE))&&!((e=a(this,oo))!=null&&e.commitOrRemove())&&this.hasSelection){for(const t of a(this,_e))t.unselect();a(this,_e).clear(),S(this,O,ln).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;a(this,mo)[0]+=e,a(this,mo)[1]+=t;const[i,r]=a(this,mo),o=[...a(this,_e)],l=1e3;a(this,vi)&&clearTimeout(a(this,vi)),g(this,vi,setTimeout(()=>{g(this,vi,null),a(this,mo)[0]=a(this,mo)[1]=0,this.addCommands({cmd:()=>{for(const c of o)a(this,Ze).has(c.id)&&(c.translateInPage(i,r),c.translationDone())},undo:()=>{for(const c of o)a(this,Ze).has(c.id)&&(c.translateInPage(-i,-r),c.translationDone())},mustExec:!1})},l));for(const c of o)c.translateInPage(e,t),c.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),g(this,gi,new Map);for(const e of a(this,_e))a(this,gi).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!a(this,gi))return!1;this.disableUserSelect(!1);const e=a(this,gi);g(this,gi,null);let t=!1;for(const[{x:i,y:r,pageIndex:o},l]of e)l.newX=i,l.newY=r,l.newPageIndex=o,t||(t=i!==l.savedX||r!==l.savedY||o!==l.savedPageIndex);if(!t)return!1;const n=(i,r,o,l)=>{if(a(this,Ze).has(i.id)){const c=a(this,wt).get(l);c?i._setParentAndPosition(c,r,o):(i.pageIndex=l,i.x=r,i.y=o)}};return this.addCommands({cmd:()=>{for(const[i,{newX:r,newY:o,newPageIndex:l}]of e)n(i,r,o,l)},undo:()=>{for(const[i,{savedX:r,savedY:o,savedPageIndex:l}]of e)n(i,r,o,l)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(a(this,gi))for(const n of a(this,gi).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(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||a(this,_e).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return a(this,Bn)===e}getActive(){return a(this,Bn)}getMode(){return a(this,ht)}isEditingMode(){return a(this,ht)!==ee.NONE}get imageManager(){return se(this,"imageManager",new lw)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let u=0,h=t.rangeCount;u<h;u++)if(!e.contains(t.getRangeAt(u).commonAncestorContainer))return null;const{x:n,y:i,width:r,height:o}=e.getBoundingClientRect();let l;switch(e.getAttribute("data-main-rotation")){case"90":l=(u,h,d,f)=>({x:(h-i)/o,y:1-(u+d-n)/r,width:f/o,height:d/r});break;case"180":l=(u,h,d,f)=>({x:1-(u+d-n)/r,y:1-(h+f-i)/o,width:d/r,height:f/o});break;case"270":l=(u,h,d,f)=>({x:1-(h+f-i)/o,y:(u-n)/r,width:f/o,height:d/r});break;default:l=(u,h,d,f)=>({x:(u-n)/r,y:(h-i)/o,width:d/r,height:f/o});break}const c=[];for(let u=0,h=t.rangeCount;u<h;u++){const d=t.getRangeAt(u);if(!d.collapsed)for(const{x:f,y:p,width:y,height:_}of d.getClientRects())y===0||_===0||c.push(l(f,p,y,_))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:e,id:t}){(a(this,eu)||g(this,eu,new Map)).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){var t;(t=a(this,eu))==null||t.delete(e)}renderAnnotationElement(e){var i;const t=(i=a(this,eu))==null?void 0:i.get(e.data.id);if(!t)return;const n=a(this,ys).getRawValue(t);n&&(a(this,ht)===ee.NONE&&!n.hasBeenModified||n.renderAnnotationElement(e))}setMissingCanvas(e,t,n){var r;const i=(r=a(this,fo))==null?void 0:r.get(e);i&&(i.setCanvas(t,n),a(this,fo).delete(e))}addMissingCanvas(e,t){(a(this,fo)||g(this,fo,new Map)).set(e,t)}};
150Qc=new WeakMap,Bn=new WeakMap,Jc=new WeakMap,Ze=new WeakMap,wt=new WeakMap,Zc=new WeakMap,ys=new WeakMap,eu=new WeakMap,vs=new WeakMap,Zt=new WeakMap,ro=new WeakMap,oo=new WeakMap,tu=new WeakMap,ao=new WeakMap,gi=new WeakMap,ws=new WeakMap,Ia=new WeakMap,rf=new WeakMap,of=new WeakMap,nu=new WeakMap,af=new WeakMap,mi=new WeakMap,lo=new WeakMap,su=new WeakMap,co=new WeakMap,yi=new WeakMap,my=new WeakMap,uo=new WeakMap,iu=new WeakMap,lf=new WeakMap,ho=new WeakMap,Da=new WeakMap,ru=new WeakMap,fo=new WeakMap,cf=new WeakMap,ht=new WeakMap,_e=new WeakMap,Ji=new WeakMap,po=new WeakMap,go=new WeakMap,uf=new WeakMap,ou=new WeakMap,hf=new WeakMap,mo=new WeakMap,vi=new WeakMap,Zi=new WeakMap,df=new WeakMap,ff=new WeakMap,_s=new WeakMap,O=new WeakSet,Xg=function({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},uw=function(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const n of a(this,wt).values())if(n.hasTextLayer(e))return n;return null},Wx=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const n=S(this,O,Xg).call(this,e).closest(".textLayer"),i=this.getSelectionBoxes(n);i&&(a(this,yi)||g(this,yi,new yI(this)),a(this,yi).show(n,i,this.direction==="ltr"))},Gx=function(){var r,o,l;const e=document.getSelection();if(!e||e.isCollapsed){a(this,Ji)&&((r=a(this,yi))==null||r.hide(),g(this,Ji,null),S(this,O,ln).call(this,{hasSelectedText:!1}));return}const{anchorNode:t}=e;if(t===a(this,Ji))return;const i=S(this,O,Xg).call(this,e).closest(".textLayer");if(!i){a(this,Ji)&&((o=a(this,yi))==null||o.hide(),g(this,Ji,null),S(this,O,ln).call(this,{hasSelectedText:!1}));return}if((l=a(this,yi))==null||l.hide(),g(this,Ji,t),S(this,O,ln).call(this,{hasSelectedText:!0}),!(a(this,ht)!==ee.HIGHLIGHT&&a(this,ht)!==ee.NONE)&&(a(this,ht)===ee.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),g(this,co,this.isShiftKeyDown),!this.isShiftKeyDown)){const c=a(this,ht)===ee.HIGHLIGHT?S(this,O,uw).call(this,i):null;if(c==null||c.toggleDrawing(),a(this,iu)){const u=new AbortController,h=this.combinedSignal(u),d=f=>{f.type==="pointerup"&&f.button!==0||(u.abort(),c==null||c.toggleDrawing(!0),f.type==="pointerup"&&S(this,O,Jh).call(this,"main_toolbar"))};window.addEventListener("pointerup",d,{signal:h}),window.addEventListener("blur",d,{signal:h})}else c==null||c.toggleDrawing(!0),S(this,O,Jh).call(this,"main_toolbar")}},Jh=function(e=""){a(this,ht)===ee.HIGHLIGHT?this.highlightSelection(e):a(this,rf)&&S(this,O,Wx).call(this)},qx=function(){document.addEventListener("selectionchange",S(this,O,Gx).bind(this),{signal:this._signal})},Xx=function(){if(a(this,lo))return;g(this,lo,new AbortController);const e=this.combinedSignal(a(this,lo));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},Kx=function(){var e;(e=a(this,lo))==null||e.abort(),g(this,lo,null)},hw=function(){if(a(this,ho))return;g(this,ho,new AbortController);const e=this.combinedSignal(a(this,ho));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},Yx=function(){var e;(e=a(this,ho))==null||e.abort(),g(this,ho,null)},Qx=function(){if(a(this,ro))return;g(this,ro,new AbortController);const e=this.combinedSignal(a(this,ro));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})},Jx=function(){var e;(e=a(this,ro))==null||e.abort(),g(this,ro,null)},Zx=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},ln=function(e){Object.entries(e).some(([n,i])=>a(this,hf)[n]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(a(this,hf),e)}),a(this,ht)===ee.HIGHLIGHT&&e.hasSelectedEditor===!1&&S(this,O,Vi).call(this,[[he.HIGHLIGHT_FREE,!0]]))},Vi=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},ek=async function(){if(!a(this,uo)){g(this,uo,!0);const e=[];for(const t of a(this,wt).values())e.push(t.enable());await Promise.all(e);for(const t of a(this,Ze).values())t.enable()}},tk=function(){if(this.unselectAll(),a(this,uo)){g(this,uo,!1);for(const e of a(this,wt).values())e.disable();for(const e of a(this,Ze).values())e.disable()}},dw=function(e){const t=a(this,wt).get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},nk=function(){let e=null;for(e of a(this,_e));return e},Zh=function(){if(a(this,Ze).size===0)return!0;
150if(a(this,Ze).size===1)for(const e of a(this,Ze).values())return e.isEmpty();return!1},fw=function(e){for(const t of a(this,_e))t.unselect();a(this,_e).clear();for(const t of e)t.isEmpty()||(a(this,_e).add(t),t.select());S(this,O,ln).call(this,{hasSelectedEditor:this.hasSelection})},I(Nc,"TRANSLATE_SMALL",1),I(Nc,"TRANSLATE_BIG",10);let Ql=Nc;var xt,wi,zs,au,_i,$n,lu,bi,En,er,Ma,Si,yo,ii,ed,Kg;const cn=class cn{constructor(e){v(this,ii);v(this,xt,null);v(this,wi,!1);v(this,zs,null);v(this,au,null);v(this,_i,null);v(this,$n,null);v(this,lu,!1);v(this,bi,null);v(this,En,null);v(this,er,null);v(this,Ma,null);v(this,Si,!1);g(this,En,e),g(this,Si,e._uiManager.useNewAltTextFlow),a(cn,yo)||g(cn,yo,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){cn._l10n??(cn._l10n=e)}async render(){const e=g(this,zs,document.createElement("button"));e.className="altText",e.tabIndex="0";const t=g(this,au,document.createElement("span"));e.append(t),a(this,Si)?(e.classList.add("new"),e.setAttribute("data-l10n-id",a(cn,yo).missing),t.setAttribute("data-l10n-id",a(cn,yo)["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=a(this,En)._uiManager._signal;e.addEventListener("contextmenu",Os,{signal:n}),e.addEventListener("pointerdown",r=>r.stopPropagation(),{signal:n});const i=r=>{r.preventDefault(),a(this,En)._uiManager.editAltText(a(this,En)),a(this,Si)&&a(this,En)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:a(this,ii,ed)}})};return e.addEventListener("click",i,{capture:!0,signal:n}),e.addEventListener("keydown",r=>{r.target===e&&r.key==="Enter"&&(g(this,lu,!0),i(r))},{signal:n}),await S(this,ii,Kg).call(this),e}finish(){a(this,zs)&&(a(this,zs).focus({focusVisible:a(this,lu)}),g(this,lu,!1))}isEmpty(){return a(this,Si)?a(this,xt)===null:!a(this,xt)&&!a(this,wi)}hasData(){return a(this,Si)?a(this,xt)!==null||!!a(this,er):this.isEmpty()}get guessedText(){return a(this,er)}async setGuessedText(e){a(this,xt)===null&&(g(this,er,e),g(this,Ma,await cn._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),S(this,ii,Kg).call(this))}toggleAltTextBadge(e=!1){var t;if(!a(this,Si)||a(this,xt)){(t=a(this,bi))==null||t.remove(),g(this,bi,null);return}if(!a(this,bi)){const n=g(this,bi,document.createElement("div"));n.className="noAltTextBadge",a(this,En).div.append(n)}a(this,bi).classList.toggle("hidden",!e)}serialize(e){let t=a(this,xt);return!e&&a(this,er)===t&&(t=a(this,Ma)),{altText:t,decorative:a(this,wi),guessedText:a(this,er),textWithDisclaimer:a(this,Ma)}}get data(){return{altText:a(this,xt),decorative:a(this,wi)}}set data({altText:e,decorative:t,guessedText:n,textWithDisclaimer:i,cancel:r=!1}){n&&(g(this,er,n),g(this,Ma,i)),!(a(this,xt)===e&&a(this,wi)===t)&&(r||(g(this,xt,e),g(this,wi,t)),S(this,ii,Kg).call(this))}toggle(e=!1){a(this,zs)&&(!e&&a(this,$n)&&(clearTimeout(a(this,$n)),g(this,$n,null)),a(this,zs).disabled=!e)}shown(){a(this,En)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:a(this,ii,ed)}})}destroy(){var e,t;(e=a(this,zs))==null||e.remove(),g(this,zs,null),g(this,au,null),g(this,_i,null),(t=a(this,bi))==null||t.remove(),g(this,bi,null)}};xt=new WeakMap,wi=new WeakMap,zs=new WeakMap,au=new WeakMap,_i=new WeakMap,$n=new WeakMap,lu=new WeakMap,bi=new WeakMap,En=new WeakMap,er=new WeakMap,Ma=new WeakMap,Si=new WeakMap,yo=new WeakMap,ii=new WeakSet,ed=function(){return a(this,xt)&&"added"||a(this,xt)===null&&this.guessedText&&"review"||"missing"},Kg=async function(){var i,r,o;const e=a(this,zs);if(!e)return;if(a(this,Si)){if(e.classList.toggle("done",!!a(this,xt)),e.setAttribute("data-l10n-id",a(cn,yo)[a(this,ii,ed)]),(i=a(this,au))==null||i.setAttribute("data-l10n-id",a(cn,yo)[`${a(this,ii,ed)}
150-label`]),!a(this,xt)){(r=a(this,_i))==null||r.remove();return}}else{if(!a(this,xt)&&!a(this,wi)){e.classList.remove("done"),(o=a(this,_i))==null||o.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=a(this,_i);if(!t){g(this,_i,t=document.createElement("span")),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${a(this,En).id}`;const l=100,c=a(this,En)._uiManager._signal;c.addEventListener("abort",()=>{clearTimeout(a(this,$n)),g(this,$n,null)},{once:!0}),e.addEventListener("mouseenter",()=>{g(this,$n,setTimeout(()=>{g(this,$n,null),a(this,_i).classList.add("show"),a(this,En)._reportTelemetry({action:"alt_text_tooltip"})},l))},{signal:c}),e.addEventListener("mouseleave",()=>{var u;a(this,$n)&&(clearTimeout(a(this,$n)),g(this,$n,null)),(u=a(this,_i))==null||u.classList.remove("show")},{signal:c})}a(this,wi)?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=a(this,xt)),t.parentNode||e.append(t);const n=a(this,En).getElementForAltText();n==null||n.setAttribute("aria-describedby",t.id)},v(cn,yo,null),I(cn,"_l10n",null);let ty=cn;var Ot,bs,Na,Ne,pf,Oa,Hs,Fa,ja,Ba,gf,pw;class Eg{constructor(e){v(this,gf);v(this,Ot,null);v(this,bs,null);v(this,Na,!1);v(this,Ne,null);v(this,pf,null);v(this,Oa,null);v(this,Hs,null);v(this,Fa,null);v(this,ja,!1);v(this,Ba,null);g(this,Ne,e)}renderForToolbar(){const e=g(this,bs,document.createElement("button"));return e.className="comment",S(this,gf,pw).call(this,e,!1)}renderForStandalone(){const e=g(this,Ot,document.createElement("button"));e.className="annotationCommentButton";const t=a(this,Ne).commentButtonPosition;if(t){const{style:n}=e;n.insetInlineEnd=`calc(${100*(a(this,Ne)._uiManager.direction==="ltr"?1-t[0]:t[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;const i=a(this,Ne).commentButtonColor;i&&(n.backgroundColor=i)}return S(this,gf,pw).call(this,e,!0)}focusButton(){setTimeout(()=>{var e;(e=a(this,Ot)??a(this,bs))==null||e.focus()},0)}onUpdatedColor(){if(!a(this,Ot))return;const e=a(this,Ne).commentButtonColor;e&&(a(this,Ot).style.backgroundColor=e),a(this,Ne)._uiManager.updatePopupColor(a(this,Ne))}get commentButtonWidth(){var e;return(((e=a(this,Ot))==null?void 0:e.getBoundingClientRect().width)??0)/a(this,Ne).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(a(this,Ba))return a(this,Ba);if(!a(this,Ot))return null;const{x:e,y:t,height:n}=a(this,Ot).getBoundingClientRect(),{x:i,y:r,width:o,height:l}=a(this,Ne).parent.boundingClientRect;return[(e-i)/o,(t+n-r)/l]}set commentPopupPositionInLayer(e){g(this,Ba,e)}hasDefaultPopupPosition(){return a(this,Ba)===null}removeStandaloneCommentButton(){var e;(e=a(this,Ot))==null||e.remove(),g(this,Ot,null)}removeToolbarCommentButton(){var e;(e=a(this,bs))==null||e.remove(),g(this,bs,null)}setCommentButtonStates({selected:e,hasPopup:t}){a(this,Ot)&&(a(this,Ot).classList.toggle("selected",e),a(this,Ot).ariaExpanded=t)}edit(e){const t=this.commentPopupPositionInLayer;let n,i;if(t)[n,i]=t;else{[n,i]=a(this,Ne).commentButtonPosition;const{width:h,height:d,x:f,y:p}=a(this,Ne);n=f+n*h,i=p+i*d}const r=a(this,Ne).parent.boundingClientRect,{x:o,y:l,width:c,height:u}=r;a(this,Ne)._uiManager.editComment(a(this,Ne),o+n*c,l+i*u,{...e,parentDimensions:r})}finish(){a(this,bs)&&(a(this,bs).focus({focusVisible:a(this,Na)}),g(this,Na,!1))}isDeleted(){return a(this,ja)||a(this,Hs)===""}isEmpty(){return a(this,Hs)===null}hasBeenEdited(){return this.isDeleted()||a(this,Hs)!==a(this,pf)}serialize(){return this.data}get data(){return{text:a(this,Hs),richText:a(this,Oa),date:a(this,Fa),deleted:this.isDeleted()}}set data(e){if(e!==a(this,Hs)&&g(this,Oa,null),e===null){g(this,Hs,""),g(this,ja,!0);return}g(this,Hs,e),g(this,Fa,new Date),g(this,ja,!1)}setInitialText(e,t=null){g(this,pf,e),this.data=e,g(this,Fa,null),g(this,Oa,t)}shown(){}destroy(){var e,t;(e=a(this,bs))==null||e.remove(),g(this,bs,null),(t=a(this,Ot))==null||t.remove(),g(this,Ot,null),g(this,Hs,""),g(this,Oa,null),g(this,Fa,null),g(this,Ne,null),g(this,Na,!1),g(this,ja,!1)}}Ot=new WeakMap,bs=new WeakMap,Na=new WeakMap,Ne=new WeakMap,pf=new WeakMap,Oa=new WeakMap,Hs=new WeakMap,Fa=new WeakMap,ja=new WeakMap,Ba=new WeakMap,gf=new WeakSet,pw=function(e,t){if(!a(this,Ne)._uiManager.hasCommentManager())return null;
150e.tabIndex="0",e.ariaHasPopup="dialog",t?(e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(e.ariaControlsElements=[a(this,Ne)._uiManager.getCommentDialogElement()],e.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));const n=a(this,Ne)._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return e;e.addEventListener("contextmenu",Os,{signal:n}),t&&(e.addEventListener("focusin",r=>{a(this,Ne)._focusEventsAllowed=!1,rt(r)},{capture:!0,signal:n}),e.addEventListener("focusout",r=>{a(this,Ne)._focusEventsAllowed=!0,rt(r)},{capture:!0,signal:n})),e.addEventListener("pointerdown",r=>r.stopPropagation(),{signal:n});const i=r=>{r.preventDefault(),e===a(this,bs)?this.edit():a(this,Ne).toggleComment(!0)};return e.addEventListener("click",i,{capture:!0,signal:n}),e.addEventListener("keydown",r=>{r.target===e&&r.key==="Enter"&&(g(this,Na,!0),i(r))},{signal:n}),e.addEventListener("pointerenter",()=>{a(this,Ne).toggleComment(!1,!0)},{signal:n}),e.addEventListener("pointerleave",()=>{a(this,Ne).toggleComment(!1,!1)},{signal:n}),e};var cu,$a,mf,yf,vf,wf,_f,tr,Ua,nr,za,sr,aa,sk,ik,rk;const Bb=class Bb{constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:n=null,onPinchStart:i=null,onPinching:r=null,onPinchEnd:o=null,signal:l}){v(this,aa);v(this,cu);v(this,$a,!1);v(this,mf,null);v(this,yf);v(this,vf);v(this,wf);v(this,_f);v(this,tr,null);v(this,Ua);v(this,nr,null);v(this,za);v(this,sr,null);g(this,cu,e),g(this,mf,n),g(this,yf,t),g(this,vf,i),g(this,wf,r),g(this,_f,o),g(this,za,new AbortController),g(this,Ua,AbortSignal.any([l,a(this,za).signal])),e.addEventListener("touchstart",S(this,aa,sk).bind(this),{passive:!1,signal:a(this,Ua)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/$i.pixelRatio}destroy(){var e,t;(e=a(this,za))==null||e.abort(),g(this,za,null),(t=a(this,tr))==null||t.abort(),g(this,tr,null)}};cu=new WeakMap,$a=new WeakMap,mf=new WeakMap,yf=new WeakMap,vf=new WeakMap,wf=new WeakMap,_f=new WeakMap,tr=new WeakMap,Ua=new WeakMap,nr=new WeakMap,za=new WeakMap,sr=new WeakMap,aa=new WeakSet,sk=function(e){var i,r,o;if((i=a(this,yf))!=null&&i.call(this))return;if(e.touches.length===1){if(a(this,tr))return;const l=g(this,tr,new AbortController),c=AbortSignal.any([a(this,Ua),l.signal]),u=a(this,cu),h={capture:!0,signal:c,passive:!1},d=f=>{var p;f.pointerType==="touch"&&((p=a(this,tr))==null||p.abort(),g(this,tr,null))};u.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(rt(f),d(f))},h),u.addEventListener("pointerup",d,h),u.addEventListener("pointercancel",d,h);return}if(!a(this,sr)){g(this,sr,new AbortController);const l=AbortSignal.any([a(this,Ua),a(this,sr).signal]),c=a(this,cu),u={signal:l,capture:!1,passive:!1};c.addEventListener("touchmove",S(this,aa,ik).bind(this),u);const h=S(this,aa,rk).bind(this);c.addEventListener("touchend",h,u),c.addEventListener("touchcancel",h,u),u.capture=!0,c.addEventListener("pointerdown",rt,u),c.addEventListener("pointermove",rt,u),c.addEventListener("pointercancel",rt,u),c.addEventListener("pointerup",rt,u),(r=a(this,vf))==null||r.call(this)}if(rt(e),e.touches.length!==2||(o=a(this,mf))!=null&&o.call(this)){g(this,nr,null);return}let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]),g(this,nr,{touch0X:t.screenX,touch0Y:t.screenY,touch1X:n.screenX,touch1Y:n.screenY})},ik=function(e){var E;if(!a(this,nr)||e.touches.length!==2)return;rt(e);let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]);const{screenX:i,screenY:r}=t,{screenX:o,screenY:l}=n,c=a(this,nr),{touch0X:u,touch0Y:h,touch1X:d,touch1Y:f}=c,p=d-u,y=f-h,_=o-i,A=l-r,m=Math.hypot(_,A)||1,b=Math.hypot(p,y)||1;if(!a(this,$a)&&Math.abs(b-m)<=Bb.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=i,c.touch0Y=r,c.touch1X=o,c.touch1Y=l,!a(this,$a)){g(this,$a,!0);return}const w=[(i+o)/2,(r+l)/2];(E=a(this,wf))==null||E.call(this,w,b,m)},rk=function(e){var t;e.touches.length>=2||(a(this,sr)&&(a(this,sr).abort(),g(this,sr,null),(t=a(this,_f))==null||t.call(this)),a(this,nr)&&(rt(e),g(this,nr,null),g(this,$a,!1)))};let ny=Bb;
150var Ha,Vs,Ve,Pe,ir,uu,vo,bf,Ft,Va,rr,Ss,wo,Sf,Wa,Un,Af,Ga,or,Ai,hu,du,As,qa,Ef,yy,K,gw,xf,mw,Yg,ok,ak,yw,Qg,vw,lk,ck,uk,ww,hk,_w,dk,fk,pk,bw,td;const Z=class Z{constructor(e){v(this,K);v(this,Ha,null);v(this,Vs,null);v(this,Ve,null);v(this,Pe,null);v(this,ir,null);v(this,uu,!1);v(this,vo,null);v(this,bf,"");v(this,Ft,null);v(this,Va,null);v(this,rr,null);v(this,Ss,null);v(this,wo,null);v(this,Sf,"");v(this,Wa,!1);v(this,Un,null);v(this,Af,!1);v(this,Ga,!1);v(this,or,!1);v(this,Ai,null);v(this,hu,0);v(this,du,0);v(this,As,null);v(this,qa,null);I(this,"isSelected",!1);I(this,"_isCopy",!1);I(this,"_editToolbar",null);I(this,"_initialOptions",Object.create(null));I(this,"_initialData",null);I(this,"_isVisible",!0);I(this,"_uiManager",null);I(this,"_focusEventsAllowed",!0);v(this,Ef,!1);v(this,yy,Z._zIndex++);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,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null,this.canAddComment=!0;const{rotation:t,rawDims:{pageWidth:n,pageHeight:i,pageX:r,pageY:o}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,i],this.pageTranslation=[r,o];const[l,c]=this.parentDimensions;this.x=e.x/l,this.y=e.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=Z.prototype._resizeWithKeyboard,t=Ql.TRANSLATE_SMALL,n=Ql.TRANSLATE_BIG;return se(this,"_resizerKeyboardManager",new eg([[["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"],Z.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return se(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new _I({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(Z._l10n??(Z._l10n=e),Z._l10nResizer||(Z._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"})),Z._borderLineWidth!==-1)return;const n=getComputedStyle(document.documentElement);Z._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){Ie("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return a(this,Ef)}set _isDraggable(e){var t;g(this,Ef,e),(t=this.div)==null||t.classList.toggle("draggable",e)}get uid(){return this.annotationElementId||this.id}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}
150setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=a(this,yy)}setParent(e){var t;e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):(S(this,K,td).call(this),(t=a(this,Ss))==null||t.remove(),g(this,Ss,null)),this.parent=e}focusin(e){this._focusEventsAllowed&&(a(this,Wa)?g(this,Wa,!1):this.parent.setSelected(this))}focusout(e){var n;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const t=e.relatedTarget;t!=null&&t.closest(`#${this.id}`)||(e.preventDefault(),(n=this.parent)!=null&&n.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,i){const[r,o]=this.parentDimensions;[n,i]=this.screenToPageTranslation(n,i),this.x=(e+n)/r,this.y=(t+i)/o,this.fixAndSetPosition()}_moveAfterPaste(e,t){const[n,i]=this.parentDimensions;this.setAt(e*n,t*i,this.width*n,this.height*i),this._onTranslated()}translate(e,t){S(this,K,gw).call(this,this.parentDimensions,e,t)}translateInPage(e,t){a(this,Un)||g(this,Un,[this.x,this.y,this.width,this.height]),S(this,K,gw).call(this,this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){a(this,Un)||g(this,Un,[this.x,this.y,this.width,this.height]);const{div:n,parentDimensions:[i,r]}=this;if(this.x+=e/i,this.y+=t/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:d,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,d,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:o,y:l}=this;const[c,u]=this.getBaseTranslation();o+=c,l+=u;const{style:h}=n;h.left=`${(100*o).toFixed(2)}%`,h.top=`${(100*l).toFixed(2)}%`,this._onTranslating(o,l),n.scrollIntoView({block:"nearest"})}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!a(this,Un)&&(a(this,Un)[0]!==this.x||a(this,Un)[1]!==this.y)}get _hasBeenResized(){return!!a(this,Un)&&(a(this,Un)[2]!==this.width||a(this,Un)[3]!==this.height)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:n}=Z,i=n/e,r=n/t;switch(this.rotation){case 90:return[-i,r];case 180:return[i,r];case 270:return[i,-r];default:return[-i,-r]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:t},pageDimensions:[n,i]}=this;let{x:r,y:o,width:l,height:c}=this;if(l*=n,c*=i,r*=n,o*=i,this._mustFixPosition)switch(e){case 0:r=pn(r,0,n-l),o=pn(o,0,i-c);break;case 90:r=pn(r,0,n-c),o=pn(o,l,i);break;case 180:r=pn(r,l,n),o=pn(o,c,i);break;case 270:r=pn(r,c,n),o=pn(o,0,i-l);break}this.x=r/=n,this.y=o/=i;const[u,h]=this.getBaseTranslation();r+=u,o+=h,t.left=`${(100*r).toFixed(2)}%`,t.top=`${(100*o).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,t){var n;return S(n=Z,xf,mw).call(n,e,t,this.parentRotation)}pageTranslationToScreen(e,t){var n;return S(n=Z,xf,mw).call(n,e,t,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(){const{div:{style:e},width:t,height:n}=this;e.width=`${(100*t).toFixed(2)}%`,e.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=a(this,Ve))==null||e.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||a(this,Ga))return this._editToolbar;this._editToolbar=new ow(this),this.div.append(this._editToolbar.render());const{toolbarButtons:e}=this;if(e)for(const[t,n]of e)await this._editToolbar.addButton(t,n);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){var e;(e=this._editToolbar)==null||e.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}
150removeCommentButtonFromToolbar(){var e;(e=this._editToolbar)==null||e.removeButton("comment")}removeEditToolbar(){var e,t;(e=this._editToolbar)==null||e.remove(),this._editToolbar=null,(t=a(this,Ve))==null||t.destroy()}addContainer(e){var n;const t=(n=this._editToolbar)==null?void 0:n.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return a(this,Ve)||(ty.initialize(Z._l10n),g(this,Ve,new ty(this)),a(this,Ha)&&(a(this,Ve).data=a(this,Ha),g(this,Ha,null))),a(this,Ve)}get altTextData(){var e;return(e=a(this,Ve))==null?void 0:e.data}set altTextData(e){a(this,Ve)&&(a(this,Ve).data=e)}get guessedAltText(){var e;return(e=a(this,Ve))==null?void 0:e.guessedText}async setGuessedAltText(e){var t;await((t=a(this,Ve))==null?void 0:t.setGuessedText(e))}serializeAltText(e){var t;return(t=a(this,Ve))==null?void 0:t.serialize(e)}hasAltText(){return!!a(this,Ve)&&!a(this,Ve).isEmpty()}hasAltTextData(){var e;return((e=a(this,Ve))==null?void 0:e.hasData())??!1}focusCommentButton(){var e;(e=a(this,Pe))==null||e.focusButton()}addCommentButton(){return this.canAddComment?a(this,Pe)||g(this,Pe,new Eg(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(a(this,ir)){this._uiManager.isEditingMode()&&a(this,ir).classList.remove("hidden");return}this.hasComment&&(g(this,ir,a(this,Pe).renderForStandalone()),this.div.append(a(this,ir)))}}removeStandaloneCommentButton(){a(this,Pe).removeStandaloneCommentButton(),g(this,ir,null)}hideStandaloneCommentButton(){var e;(e=a(this,ir))==null||e.classList.add("hidden")}get comment(){const{data:{richText:e,text:t,date:n,deleted:i}}=a(this,Pe);return{text:t,richText:e,date:n,deleted:i,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){a(this,Pe)||g(this,Pe,new Eg(this)),a(this,Pe).data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:t,richText:n}){if(!t||(a(this,Pe)||g(this,Pe,new Eg(this)),a(this,Pe).setInitialText(e,n),!this.annotationElementId))return;const i=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);i&&this.updateFromAnnotationLayer(i)}get hasEditedComment(){var e;return(e=a(this,Pe))==null?void 0:e.hasBeenEdited()}get hasDeletedComment(){var e;return(e=a(this,Pe))==null?void 0:e.isDeleted()}get hasComment(){return!!a(this,Pe)&&!a(this,Pe).isEmpty()&&!a(this,Pe).isDeleted()}async editComment(e){a(this,Pe)||g(this,Pe,new Eg(this)),a(this,Pe).edit(e)}
150toggleComment(e,t=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){a(this,Pe).setSelectedButton(e)}addComment(e){if(this.hasEditedComment){const[,,,i]=e.rect,[r]=this.pageDimensions,[o]=this.pageTranslation,l=o+r+1,c=i-100,u=l+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[l,c,u,i]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:t}}){a(this,Pe).data=t?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var o;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=a(this,uu)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),S(this,K,_w).call(this);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,r]=this.getInitialTranslation();return this.translate(i,r),Hx(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(a(this,qa)||g(this,qa,new ny({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:S(this,K,lk).bind(this),onPinching:S(this,K,ck).bind(this),onPinchEnd:S(this,K,uk).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),(o=this._uiManager._editorUndoBar)==null||o.hide(),e}pointerdown(e){const{isMac:t}=Gt.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(g(this,Wa,!0),this._isDraggable){S(this,K,hk).call(this,e);return}S(this,K,ww).call(this,e)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){a(this,Ai)&&clearTimeout(a(this,Ai)),g(this,Ai,setTimeout(()=>{var e;g(this,Ai,null),(e=this.parent)==null||e.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,[r,o]=this.pageDimensions,[l,c]=this.pageTranslation,u=e/i,h=t/i,d=this.x*r,f=this.y*o,p=this.width*r,y=this.height*o;switch(n){case 0:return[d+u+l,o-f-h-y+c,d+u+p+l,o-f-h+c];case 90:return[d+h+l,o-f+u+c,d+h+y+l,o-f+u+p+c];case 180:return[d-u-p+l,o-f+h+c,d-u+l,o-f+h+y+c];case 270:return[d-h-y+l,o-f-u-p+c,d-h+l,o-f-u+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[n,i,r,o]=e,l=r-n,c=o-i;switch(this.rotation){case 0:return[n,t-o,l,c];case 90:return[n,t-i,c,l];case 180:return[r,t-i,l,c];case 270:return[r,t-o,c,l];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&Z._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var e;(e=a(this,Pe))==null||e.onUpdatedColor()}getData(){const{comment:{text:e,color:t,date:n,opacity:i,deleted:r,richText:o},uid:l,pageIndex:c,creationDate:u,modificationDate:h}=this;return{id:l,pageIndex:c,rect:this.getPDFRect(),richText:o,contentsObj:{str:e},creationDate:u,modificationDate:n||h,popupRef:!r,color:t,opacity:i}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),g(this,Ga,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),g(this,Ga,!1),!0):!1}isInEditMode(){return a(this,Ga)}shouldGetKeyboardEvents(){return a(this,or)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:t,bottom:n,right:i}=this.getClientDimensions(),{innerHeight:r,innerWidth:o}=window;return t<o&&i>0&&e<r&&n>0}rebuild(){S(this,K,_w).call(this)}rotate(e){}resize(){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,t=null){var n;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:((n=this._initialData)==null?void 0:n.popupRef)||""}}static async deserialize(e,t,n){const i=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:n,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});i.rotation=e.rotation,g(i,Ha,e.accessibilityData),i._isCopy=e.isCopy||!1;const[r,o]=i.pageDimensions,[l,c,u,h]=i.getRectInCurrentCoords(e.rect,o);return i.x=l/r,i.y=c/o,i.width=u/r,i.height=h/o,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,t,n;if((e=a(this,wo))==null||e.abort(),g(this,wo,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),a(this,Ai)&&(clearTimeout(a(this,Ai)),g(this,Ai,null)),S(this,K,td).call(this),this.removeEditToolbar(),a(this,As)){for(const i of a(this,As).values())clearTimeout(i);g(this,As,null)}this.parent=null,(t=a(this,qa))==null||t.destroy(),g(this,qa,null),(n=a(this,Ss))==null||n.remove(),g(this,Ss,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(S(this,K,ok).call(this),a(this,Ft).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[e,t]}=this,[n,i,r,o]=this.getPDFRect();return[Z._round(n+(r-n)*e),Z._round(i+(o-i)*(1-t))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return a(this,Pe).commentPopupPositionInLayer}set commentPopupPosition(e){a(this,Pe).commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return a(this,Pe).hasDefaultPopupPosition()}get commentButtonWidth(){return a(this,Pe).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){var t;(t=a(this,Pe))==null||t.setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),g(this,rr,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=a(this,Ft).children;if(!a(this,Vs)){g(this,Vs,Array.from(t));const o=S(this,K,dk).bind(this),l=S(this,K,fk).bind(this),c=this._uiManager._signal;for(const u of a(this,Vs)){const h=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",o,{signal:c}),u.addEventListener("blur",l,{signal:c}),u.addEventListener("focus",S(this,K,pk).bind(this,h),{signal:c}),u.setAttribute("data-l10n-id",Z._l10nResizer[h])}}const n=a(this,Vs)[0];let i=0;for(const o of t){if(o===n)break;i++}const r=(360-this.rotation+this.parentRotation)%360/90*(a(this,Vs).length/4);if(r!==i){if(r<i)for(let l=0;l<i-r;l++)a(this,Ft).append(a(this,Ft).firstChild);else if(r>i)for(let l=0;l<r-i;l++)a(this,Ft).firstChild.before(a(this,Ft).lastChild);let o=0;for(const l of t){const u=a(this,Vs)[o++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",Z._l10nResizer[u])}}S(this,K,bw).call(this,0),g(this,or,!0),a(this,Ft).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,t){a(this,or)&&S(this,K,vw).call(this,a(this,Sf),{deltaX:e,deltaY:t,fromKeyboard:!0})}_stopResizingWithKeyboard(){S(this,K,td).call(this),this.div.focus()}select(){var e,t,n;if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var i,r;
150(i=this.div)!=null&&i.classList.contains("selectedEditor")&&((r=this._editToolbar)==null||r.show())});return}(t=this._editToolbar)==null||t.show(),(n=a(this,Ve))==null||n.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var e;return(e=this.div)==null?void 0:e.focus({preventScroll:!0})},0)}unselect(){var e,t,n,i,r;this.isSelected&&(this.isSelected=!1,(e=a(this,Ft))==null||e.classList.add("hidden"),(t=this.div)==null||t.classList.remove("selectedEditor"),(n=this.div)!=null&&n.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(i=this._editToolbar)==null||i.hide(),(r=a(this,Ve))==null||r.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return a(this,Af)}set isEditing(e){g(this,Af,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}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){a(this,As)||g(this,As,new Map);const{action:n}=e;let i=a(this,As).get(n);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(e),a(this,As).delete(n),a(this,As).size===0&&g(this,As,null)},Z._telemetryTimeout),a(this,As).set(n,i);return}e.type||(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),g(this,uu,!1)}disable(){this.div&&(this.div.tabIndex=-1),g(this,uu,!0)}updateFakeAnnotationElement(e){if(!a(this,Ss)&&!this.deleted){g(this,Ss,e.addFakeAnnotation(this));return}if(this.deleted){a(this,Ss).remove(),g(this,Ss,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&a(this,Ss).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;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==null?void 0:t.nodeName)==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}};Ha=new WeakMap,Vs=new WeakMap,Ve=new WeakMap,Pe=new WeakMap,ir=new WeakMap,uu=new WeakMap,vo=new WeakMap,bf=new WeakMap,Ft=new WeakMap,Va=new WeakMap,rr=new WeakMap,Ss=new WeakMap,wo=new WeakMap,Sf=new WeakMap,Wa=new WeakMap,Un=new WeakMap,Af=new WeakMap,Ga=new WeakMap,or=new WeakMap,Ai=new WeakMap,hu=new WeakMap,du=new WeakMap,As=new WeakMap,qa=new WeakMap,Ef=new WeakMap,yy=new WeakMap,K=new WeakSet,gw=function([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()},xf=new WeakSet,mw=function(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}},Yg=function(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]}},ok=function(){if(a(this,Ft))return;g(this,Ft,document.createElement("div")),a(this,Ft).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");a(this,Ft).append(i),i.classList.add("resizer",n),i.setAttribute("data-resizer-name",n),i.addEventListener("pointerdown",S(this,K,ak).bind(this,n),{signal:t}),i.addEventListener("contextmenu",Os,{signal:t}),i.tabIndex=-1}this.div.prepend(a(this,Ft))},ak=function(e,t){var h;t.preventDefault();const{isMac:n}=Gt.platform;if(t.button!==0||t.ctrlKey&&n)return;(h=a(this,Ve))==null||h.toggle(!1);const i=this._isDraggable;this._isDraggable=!1,g(this,Va,[t.screenX,t.screenY]);const r=new AbortController,o=this._uiManager.combinedSignal(r);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",S(this,K,vw).bind(this,e),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",rt,{passive:!1,signal:o}),window.addEventListener("contextmenu",Os,{signal:o}),g(this,rr,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const l=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const u=()=>{var d;r.abort(),this.parent.togglePointerEvents(!0),(d=a(this,Ve))==null||d.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=l,this.div.style.cursor=c,S(this,K,Qg).call(this)};window.addEventListener("pointerup",u,{signal:o}),window.addEventListener("blur",u,{signal:o})},yw=function(e,t,n,i){this.width=n,this.height=i,this.x=e,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()},Qg=function(){if(!a(this,rr))return;
vendor: 1,218 bytes, line 150
150const{savedX:e,savedY:t,savedWidth:n,savedHeight:i}=a(this,rr);g(this,rr,null);const r=this.x,o=this.y,l=this.width,c=this.height;r===e&&o===t&&l===n&&c===i||this.addCommands({cmd:S(this,K,yw).bind(this,r,o,l,c),undo:S(this,K,yw).bind(this,e,t,n,i),mustExec:!0})},vw=function(e,t){const[n,i]=this.parentDimensions,r=this.x,o=this.y,l=this.width,c=this.height,u=Z.MIN_SIZE/n,h=Z.MIN_SIZE/i,d=S(this,K,Yg).call(this,this.rotation),f=(z,H)=>[d[0]*z+d[2]*H,d[1]*z+d[3]*H],p=S(this,K,Yg).call(this,360-this.rotation),y=(z,H)=>[p[0]*z+p[2]*H,p[1]*z+p[3]*H];let _,A,m=!1,b=!1;switch(e){case"topLeft":m=!0,_=(z,H)=>[0,0],A=(z,H)=>[z,H];break;case"topMiddle":_=(z,H)=>[z/2,0],A=(z,H)=>[z/2,H];break;case"topRight":m=!0,_=(z,H)=>[z,0],A=(z,H)=>[0,H];break;case"middleRight":b=!0,_=(z,H)=>[z,H/2],A=(z,H)=>[0,H/2];break;case"bottomRight":m=!0,_=(z,H)=>[z,H],A=(z,H)=>[0,0];break;case"bottomMiddle":_=(z,H)=>[z/2,H],A=(z,H)=>[z/2,0];break;case"bottomLeft":m=!0,_=(z,H)=>[0,H],A=(z,H)=>[z,0];break;case"middleLeft":b=!0,_=(z,H)=>[0,H/2],A=(z,H)=>[z,H/2];break}const w=_(l,c),E=A(l,c);let k=f(...E);const x=Z._round(r+k[0]),C=Z._round(o+k[1]);let P=1,R=1,L,D;if(t.fromKeyboard)({deltaX:L,deltaY:D}=t);else{const{screenX:z,screenY:H}
150=t,[M,V]=a(this,Va);[L,D]=this.screenToPageTranslation(z-M,H-V),a(this,Va)[0]=z,a(this,Va)[1]=H}if([L,D]=y(L/n,D/i),m){const z=Math.hypot(l,c);P=R=Math.max(Math.min(Math.hypot(E[0]-w[0]-L,E[1]-w[1]-D)/z,1/l,1/c),u/l,h/c)}else b?P=pn(Math.abs(E[0]-w[0]-L),u,1)/l:R=pn(Math.abs(E[1]-w[1]-D),h,1)/c;const F=Z._round(l*P),Y=Z._round(c*R);k=f(...A(F,Y));const q=x-k[0],oe=C-k[1];a(this,Un)||g(this,Un,[this.x,this.y,this.width,this.height]),this.width=F,this.height=Y,this.x=q,this.y=oe,this.setDims(),this.fixAndSetPosition(),this._onResizing()},lk=function(){var e;g(this,rr,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=a(this,Ve))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)},ck=function(e,t,n){let r=.7*(n/t)+1-.7;if(r===1)return;const o=S(this,K,Yg).call(this,this.rotation),l=(x,C)=>[o[0]*x+o[2]*C,o[1]*x+o[3]*C],[c,u]=this.parentDimensions,h=this.x,d=this.y,f=this.width,p=this.height,y=Z.MIN_SIZE/c,_=Z.MIN_SIZE/u;r=Math.max(Math.min(r,1/f,1/p),y/f,_/p);const A=Z._round(f*r),m=Z._round(p*r);if(A===f&&m===p)return;a(this,Un)||g(this,Un,[h,d,f,p]);const b=l(f/2,p/2),w=Z._round(h+b[0]),E=Z._round(d+b[1]),k=l(A/2,m/2);this.x=w-k[0],this.y=E-k[1],this.width=A,this.height=m,this.setDims(),this.fixAndSetPosition(),this._onResizing()},uk=function(){var e;(e=a(this,Ve))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),S(this,K,Qg).call(this)},ww=function(e){const{isMac:t}=Gt.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)},hk=function(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();let n=!1;const i=new AbortController,r=this._uiManager.combinedSignal(i),o={capture:!0,passive:!1,signal:r},l=u=>{i.abort(),g(this,vo,null),g(this,Wa,!1),this._uiManager.endDragSession()||S(this,K,ww).call(this,u),n&&this._onStopDragging()};t&&(g(this,hu,e.clientX),g(this,du,e.clientY),g(this,vo,e.pointerId),g(this,bf,e.pointerType),window.addEventListener("pointermove",u=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:h,clientY:d,pointerId:f}=u;if(f!==a(this,vo)){rt(u);return}const[p,y]=this.screenToPageTranslation(h-a(this,hu),d-a(this,du));g(this,hu,h),g(this,du,d),this._uiManager.dragSelectedEditors(p,y)},o),window.addEventListener("touchmove",rt,o),window.addEventListener("pointerdown",u=>{u.pointerType===a(this,bf)&&(a(this,qa)||u.isPrimary)&&l(u),rt(u)},o));const c=u=>{if(!a(this,vo)||a(this,vo)===u.pointerId){l(u);return}rt(u)};window.addEventListener("pointerup",c,{signal:r}),window.addEventListener("blur",c,{signal:r})},_w=function(){if(a(this,wo)||!this.div)return;g(this,wo,new AbortController);const e=this._uiManager.combinedSignal(a(this,wo));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},dk=function(e){Z._resizerKeyboardManager.exec(this,e)},fk=function(e){var t;a(this,or)&&((t=e.relatedTarget)==null?void 0:t.parentNode)!==a(this,Ft)&&S(this,K,td).call(this)},pk=function(e){g(this,Sf,a(this,or)?e:"")},bw=function(e){if(a(this,Vs))for(const t of a(this,Vs))t.tabIndex=e},td=function(){g(this,or,!1),S(this,K,bw).call(this,-1),S(this,K,Qg).call(this)},v(Z,xf),I(Z,"_l10n",null),I(Z,"_l10nResizer",null),I(Z,"_borderLineWidth",-1),I(Z,"_colorManager",new cw),I(Z,"_zIndex",1),I(Z,"_telemetryTimeout",1e3);let je=Z;class _I extends je{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const k1=3285377520,fs=4294901760,hi=65535;class gk{constructor(e){this.h1=e?e&4294967295:k1,this.h2=e?e&4294967295:k1}update(e){let t,n;if(typeof e=="string"){t=new Uint8Array(e.length*2),n=0;for(let _=0,A=e.length;_<A;_++){const m=e.charCodeAt(_);m<=255?t[n++]=m:(t[n++]=m>>>8,t[n++]=m&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,r=n-i*4,o=new Uint32Array(t.buffer,0,i);let l=0,c=0,u=this.h1,h=this.h2;const d=3432918353,f=461845907,p=d&hi,y=f&hi;for(let _=0;_<i;_++)_&1?(l=o[_],l=l*d&fs|l*p&hi,l=l<<15|l>>>17,l=l*f&fs|l*y&hi,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=o[_],c=c*d&fs|c*p&hi,c=c<<15|c>>>17,c=c*f&fs|c*y&hi,h^=c,h=h<<13|h>>>19,h=h*5+3864292196);switch(l=0,r){case 3:l^=t[i*4+2]<<16;case 2:l^=t[i*4+1]<<8;case 1:l^=t[i*4],l=l*d&fs|l*p&hi,l=l<<15|l>>>17,l=l*f&fs|l*y&hi,i&1?u^=l:h^=l}this.h1=u,this.h2=h}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&fs|e*36045&hi,t=t*4283543511&fs|((t<<16|e>>>16)*2950163797&fs)>>>16,e^=t>>>1,e=e*444984403&fs|e*60499&hi,t=t*3301882366&fs|((t<<16|e>>>16)*3120437893&fs)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const Sw=Object.freeze({map:null,hash:"",transfer:void 0});var Xa,Ka,ar,jt,vy,mk;class Rb{constructor(){v(this,vy);v(this,Xa,!1);v(this,Ka,null);v(this,ar,null);v(this,jt,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const n=a(this,jt).get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return a(this,jt).get(e)}remove(e){const t=a(this,jt).get(e);if(t!==void 0&&(t instanceof je&&a(this,ar).delete(t.annotationElementId),a(this,jt).delete(e),a(this,jt).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function")){for(const n of a(this,jt).values())if(n instanceof je)return;this.onAnnotationEditor(null)}}setValue(e,t){const n=a(this,jt).get(e);let i=!1;if(n!==void 0)for(const[r,o]of Object.entries(t))n[r]!==o&&(i=!0,n[r]=o);else i=!0,a(this,jt).set(e,t);i&&S(this,vy,mk).call(this),t instanceof je&&((a(this,ar)||g(this,ar,new Map)).set(t.annotationElementId,t),typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(t.constructor._type))}has(e){return a(this,jt).has(e)}get size(){return a(this,jt).size}resetModified(){a(this,Xa)&&(g(this,Xa,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new yk(this)}get serializable(){if(a(this,jt).size===0)return Sw;const e=new Map,t=new gk,n=[],i=Object.create(null);let r=!1;for(const[o,l]of a(this,jt)){const c=l instanceof je?l.serialize(!1,i):l;c&&(e.set(o,c),t.update(`${o}:${JSON.stringify(c)}`),r||(r=!!c.bitmap))}if(r)for(const o of e.values())o.bitmap&&n.push(o.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:Sw}get editorStats(){let e=null;const t=new Map;let n=0,i=0;for(const r of a(this,jt).values()){if(!(r instanceof je)){r.popup&&(r.popup.deleted?i+=1:n+=1);continue}r.isCommentDeleted?i+=1:r.hasEditedComment&&(n+=1);const o=r.telemetryFinalData;if(!o)continue;const{type:l}=o;t.has(l)||t.set(l,Object.getPrototypeOf(r).constructor),e||(e=Object.create(null));const c=e[l]||(e[l]=new Map);for(const[u,h]of Object.entries(o)){if(u==="type")continue;let d=c.get(u);d||(d=new Map,c.set(u,d));const f=d.get(h)??0;d.set(h,f+1)}}if((i>0||n>0)&&(e||(e=Object.create(null)),e.comments={deleted:i,edited:n}),!e)return null;for(const[r,o]of t)e[r]=o.computeTelemetryFinalData(e[r]);return e}resetModifiedIds(){g(this,Ka,null)}updateEditor(e,t){var i;const n=(i=a(this,ar))==null?void 0:i.get(e);return n?(n.updateFromAnnotationLayer(t),!0):!1}getEditor(e){var t;return((t=a(this,ar))==null?void 0:t.get(e))||null}get modifiedIds(){if(a(this,Ka))return a(this,Ka);const e=[];
150if(a(this,ar))for(const t of a(this,ar).values())t.serialize()&&e.push(t.annotationElementId);return g(this,Ka,{ids:new Set(e),hash:e.join(",")})}[Symbol.iterator](){return a(this,jt).entries()}}Xa=new WeakMap,Ka=new WeakMap,ar=new WeakMap,jt=new WeakMap,vy=new WeakSet,mk=function(){a(this,Xa)||(g(this,Xa,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var kf;class yk extends Rb{constructor(t){super();v(this,kf);const{map:n,hash:i,transfer:r}=t.serializable,o=structuredClone(n,r?{transfer:r}:null);g(this,kf,{map:o,hash:i,transfer:r})}get print(){Ie("Should not call PrintAnnotationStorage.print")}get serializable(){return a(this,kf)}get modifiedIds(){return se(this,"modifiedIds",{ids:new Set,hash:""})}}kf=new WeakMap;var fu;class bI{constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){v(this,fu,new Set);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(),a(this,fu).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:n}){if(!(!e||a(this,fu).has(e.loadedName))){if(de(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:r,style:o}=e,l=new FontFace(i,r,o);this.addNativeFontFace(l);try{await l.load(),a(this,fu).add(i),n==null||n(e)}catch{J(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}Ie("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 J(`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(){var t;const e=!!((t=this._document)!=null&&t.fonts);return se(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return se(this,"isSyncFontLoadingSupported",fn||Gt.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(de(!i.done,"completeRequest() cannot be called twice."),i.done=!0;n.length>0&&n[0].done;){const r=n.shift();setTimeout(r.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 se(this,"_loadTestFont",e)}
150_prepareFontLoadEvent(e,t){function n(E,k){return E.charCodeAt(k)<<24|E.charCodeAt(k+1)<<16|E.charCodeAt(k+2)<<8|E.charCodeAt(k+3)&255}function i(E,k,x,C){const P=E.substring(0,k),R=E.substring(k+x);return P+C+R}let r,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d");let u=0;function h(E,k){if(++u>30){J("Load test font never loaded."),k();return}if(c.font="30px "+E,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){k();return}setTimeout(h.bind(null,E,k))}const d=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=i(f,976,d.length,d);const y=16,_=1482184792;let A=n(f,y);for(r=0,o=d.length-3;r<o;r+=4)A=A-_+n(d,r)|0;r<d.length&&(A=A-_+n(d+"XXX",r)|0),f=i(f,y,4,tI(A));const m=`url(data:font/opentype;base64,${btoa(f)});`,b=`@font-face {font-family:"${d}";src:${m}}`;this.insertRule(b);const w=this._document.createElement("div");w.style.visibility="hidden",w.style.width=w.style.height="10px",w.style.position="absolute",w.style.top=w.style.left="0px";for(const E of[e.loadedName,d]){const k=this._document.createElement("span");k.textContent="Hi",k.style.fontFamily=E,w.append(k)}this._document.body.append(w),h(d,()=>{w.remove(),t.complete()})}}fu=new WeakMap;var Ee;class SI{constructor(e,t=null,n,i){v(this,Ee);this.compiledGlyphs=Object.create(null),g(this,Ee,e),this._inspectFont=t,n&&Object.assign(this,n),i&&(this.charProcOperatorList=i)}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const n={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(n.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,n)}return(t=this._inspectFont)==null||t.call(this,this),e}createFontFaceRule(){var n;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${Mx(this.data)});`;let t;if(!this.cssFontInfo)t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${e}}`}return(n=this._inspectFont)==null||n.call(this,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(o){J(`getPathGenerator - ignoring character: "${o}".`)}const r=Fx(i);return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[t]=r}get black(){return a(this,Ee).black}get bold(){return a(this,Ee).bold}get disableFontFace(){return a(this,Ee).disableFontFace??!1}get fontExtraProperties(){return a(this,Ee).fontExtraProperties??!1}get isInvalidPDFjsFont(){return a(this,Ee).isInvalidPDFjsFont}get isType3Font(){return a(this,Ee).isType3Font}get italic(){return a(this,Ee).italic}get missingFile(){return a(this,Ee).missingFile}get remeasure(){return a(this,Ee).remeasure}get vertical(){return a(this,Ee).vertical}get ascent(){return a(this,Ee).ascent}get defaultWidth(){return a(this,Ee).defaultWidth}get descent(){return a(this,Ee).descent}get bbox(){return a(this,Ee).bbox}get fontMatrix(){return a(this,Ee).fontMatrix}get fallbackName(){return a(this,Ee).fallbackName}get loadedName(){return a(this,Ee).loadedName}get mimetype(){return a(this,Ee).mimetype}get name(){return a(this,Ee).name}get data(){return a(this,Ee).data}clearData(){a(this,Ee).clearData()}get cssFontInfo(){return a(this,Ee).cssFontInfo}get systemFontInfo(){return a(this,Ee).systemFontInfo}get defaultVMetrics(){return a(this,Ee).defaultVMetrics}}Ee=new WeakMap;var pu,gu,Cf,mu,Jg;const Oc=class Oc{constructor(e){v(this,mu);v(this,pu);v(this,gu);v(this,Cf);g(this,pu,e),g(this,gu,new DataView(a(this,pu))),g(this,Cf,new TextDecoder)}static write(e){const t=new TextEncoder,n={};let i=0;for(const u of Oc.strings){const h=t.encode(e[u]);n[u]=h,i+=4+h.length}const r=new ArrayBuffer(i),o=new Uint8Array(r),l=new DataView(r);let c=0;for(const u of Oc.strings){const h=n[u],d=h.length;l.setUint32(c,d),o.set(h,c+4),c+=4+d}return de(c===r.byteLength,"CssFontInfo.write: Buffer overflow"),r}get fontFamily(){return S(this,mu,Jg).call(this,0)}get fontWeight(){return S(this,mu,Jg).call(this,1)}get italicAngle(){return S(this,mu,Jg).call(this,2)}};pu=new WeakMap,gu=new WeakMap,Cf=new WeakMap,mu=new WeakSet,Jg=function(e){de(e<Oc.strings.length,"Invalid string index");let t=0;for(let i=0;i<e;i++)t+=a(this,gu).getUint32(t)+4;const n=a(this,gu).getUint32(t);return a(this,Cf).decode(new Uint8Array(a(this,pu),t+4,n))},I(Oc,"strings",["fontFamily","fontWeight","italicAngle"]);let sy=Oc;var _o,Ei,Ya,Qa,nd;const Fc=class Fc{constructor(e){v(this,Qa);v(this,_o);v(this,Ei);v(this,Ya);g(this,_o,e),g(this,Ei,new DataView(a(this,_o))),g(this,Ya,new TextDecoder)}static write(e){const t=new TextEncoder,n={};let i=0;for(const f of Fc.strings){const p=t.encode(e[f]);n[f]=p,i+=4+p.length}i+=4;let r,o,l=1+i;e.style&&(r=t.encode(e.style.style),o=t.encode(e.style.weight),l+=4+r.length+4+o.length);const c=new ArrayBuffer(l),u=new Uint8Array(c),h=new DataView(c);let d=0;h.setUint8(d++,e.guessFallback?1:0),h.setUint32(d,0),d+=4,i=0;for(const f of Fc.strings){const p=n[f],y=p.length;i+=4+y,h.setUint32(d,y),u.set(p,d+4),d+=4+y}return h.setUint32(d-i-4,i),e.style&&(h.setUint32(d,r.length),u.set(r,d+4),d+=4+r.length,h.setUint32(d,o.length),u.set(o,d+4),d+=4+o.length),de(d<=c.byteLength,"SubstitionInfo.write: Buffer overflow"),c.transferTo
150FixedLength(d)}get guessFallback(){return a(this,Ei).getUint8(0)!==0}get css(){return S(this,Qa,nd).call(this,0)}get loadedName(){return S(this,Qa,nd).call(this,1)}get baseFontName(){return S(this,Qa,nd).call(this,2)}get src(){return S(this,Qa,nd).call(this,3)}get style(){let e=1;e+=4+a(this,Ei).getUint32(e);const t=a(this,Ei).getUint32(e),n=a(this,Ya).decode(new Uint8Array(a(this,_o),e+4,t));e+=4+t;const i=a(this,Ei).getUint32(e),r=a(this,Ya).decode(new Uint8Array(a(this,_o),e+4,i));return{style:n,weight:r}}};_o=new WeakMap,Ei=new WeakMap,Ya=new WeakMap,Qa=new WeakSet,nd=function(e){de(e<Fc.strings.length,"Invalid string index");let t=5;for(let i=0;i<e;i++)t+=a(this,Ei).getUint32(t)+4;const n=a(this,Ei).getUint32(t);return a(this,Ya).decode(new Uint8Array(a(this,_o),t+4,n))},I(Fc,"strings",["css","loadedName","baseFontName","src"]);let iy=Fc;var yu,vu,wu,_u,zn,xi,Tf,xe,st,Bs,Zg,sd;const te=class te{constructor({data:e,extra:t}){v(this,st);v(this,xi);v(this,Tf);v(this,xe);g(this,xi,e),g(this,Tf,new TextDecoder),g(this,xe,new DataView(a(this,xi))),t&&Object.assign(this,t)}get black(){return S(this,st,Bs).call(this,0)}get bold(){return S(this,st,Bs).call(this,1)}get disableFontFace(){return S(this,st,Bs).call(this,2)}get fontExtraProperties(){return S(this,st,Bs).call(this,3)}get isInvalidPDFjsFont(){return S(this,st,Bs).call(this,4)}get isType3Font(){return S(this,st,Bs).call(this,5)}get italic(){return S(this,st,Bs).call(this,6)}get missingFile(){return S(this,st,Bs).call(this,7)}get remeasure(){return S(this,st,Bs).call(this,8)}get vertical(){return S(this,st,Bs).call(this,9)}get ascent(){return S(this,st,Zg).call(this,0)}get defaultWidth(){return S(this,st,Zg).call(this,1)}get descent(){return S(this,st,Zg).call(this,2)}get bbox(){let e=a(te,vu);if(a(this,xe).getUint8(e)===0)return;e+=1;const n=[];for(let i=0;i<4;i++)n.push(a(this,xe).getInt16(e,!0)),e+=2;return n}get fontMatrix(){let e=a(te,wu);if(a(this,xe).getUint8(e)===0)return;e+=1;const n=[];for(let i=0;i<6;i++)n.push(a(this,xe).getFloat64(e,!0)),e+=8;return n}get defaultVMetrics(){let e=a(te,_u);if(a(this,xe).getUint8(e)===0)return;e+=1;const n=[];for(let i=0;i<3;i++)n.push(a(this,xe).getInt16(e,!0)),e+=2;return n}get fallbackName(){return S(this,st,sd).call(this,0)}get loadedName(){return S(this,st,sd).call(this,1)}get mimetype(){return S(this,st,sd).call(this,2)}get name(){return S(this,st,sd).call(this,3)}get data(){let e=a(te,zn);const t=a(this,xe).getUint32(e);e+=4+t;const n=a(this,xe).getUint32(e);e+=4+n;const i=a(this,xe).getUint32(e);e+=4+i;const r=a(this,xe).getUint32(e);if(r!==0)return new Uint8Array(a(this,xi),e+4,r)}clearData(){let e=a(te,zn);const t=a(this,xe).getUint32(e);e+=4+t;const n=a(this,xe).getUint32(e);e+=4+n;const i=a(this,xe).getUint32(e);e+=4+i;const r=a(this,xe).getUint32(e);new Uint8Array(a(this,xi),e+4,r).fill(0),a(this,xe).setUint32(e,0)}get cssFontInfo(){let e=a(te,zn);const t=a(this,xe).getUint32(e);e+=4+t;const n=a(this,xe).getUint32(e);e+=4+n;const i=a(this,xe).getUint32(e);if(i===0)return null;const r=new Uint8Array(i);return r.set(new Uint8Array(a(this,xi),e+4,i)),new sy(r.buffer)}get systemFontInfo(){let e=a(te,zn);const t=a(this,xe).getUint32(e);e+=4+t;const n=a(this,xe).getUint32(e);if(n===0)return null;const i=new Uint8Array(n);return i.set(new Uint8Array(a(this,xi),e+4,n)),new iy(i.buffer)}static write(e){const t=e.systemFontInfo?iy.write(e.systemFontInfo):null,n=e.cssFontInfo?sy.write(e.cssFontInfo):null,i=new TextEncoder,r={};let o=0;for(const _ of te.strings)r[_]=i.encode(e[_]),o+=4+r[_].length;const l=a(te,zn)+4+o+4+(t?t.byteLength:0)+4+(n?n.byteLength:0)+4+(e.data?e.data.length:0),c=new ArrayBuffer(l),u=new Uint8Array(c),h=new DataView(c);let d=0;const f=te.bools.length;let p=0,y=0;for(let _=0;_<f;_++){const A=e[te.bools[_]];p|=(A===void 0?0:A?2:1)<<y,y+=2,(y===8||_===f-1)&&(h.setUint8(d++,p),p=0,y=0)}de(d===a(te,yu),"FontInfo.write: Boolean properties offset mismatch");for(const _ of te.numbers)h.setFloat64(d,e[_]),d+=8;if(de(d===a(te,vu),"FontInfo.write: Number properties offset mismatch"),e.bbox){h.setUint8(d++,4);for(const _ of e.bbox)h.setInt16(d,_,!0),d+=2}else h.setUint8(d++,0),d+=2*4;if(de(d===a(te,wu),"FontInfo.write: BBox properties offset mismatch"),e.fontMatrix){h.setUint8(d++,6);for(const _ of e.fontMatrix)h.setFloat64(d,_,!0),d+=8}else h.setUint8(d++,0),d+=8*6;if(de(d===a(te,_u),"FontInfo.write: FontMatrix properties offset mismatch"),e.defaultVMetrics){h.setUint8(d++,1);for(const _ of e.defaultVMetrics)h.setInt16(d,_,!0),d+=2}else h.setUint8(d++,0),d+=3*2;de(d===a(te,zn),"FontInfo.write: DefaultVMetrics properties offset mismatch"),h.setUint32(a(te,zn),0),d+=4;for(const _ of te.strings){const A=r[_],m=A.length;h.setUint32(d,m),u.set(A,d+4),d+=4+m}if(h.setUint32(a(te,zn),d-a(te,zn)-4),!t)h.setUint32(d,0),d+=4;else{const _=t.byteLength;h.setUint32(d,_),de(d+4+_<=c.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),u.set(new Uint8Array(t),d+4),d+=4+_}if(!n)h.setUint32(d,0),d+=4;else{const _=n.byteLength;h.setUint32(d,_),de(d+4+_<=c.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),u.set(new Uint8Array(n),d+4),d+=4+_}return e.data===void 0?(h.setUint32(d,0),d+=4):(h.setUint32(d,e.data.length),u.set(e.data,d+4),d+=4+e.data.length),de(d<=c.byteLength,"FontInfo.write: Buffer overflow"),c.transferTo
150FixedLength(d)}};yu=new WeakMap,vu=new WeakMap,wu=new WeakMap,_u=new WeakMap,zn=new WeakMap,xi=new WeakMap,Tf=new WeakMap,xe=new WeakMap,st=new WeakSet,Bs=function(e){de(e<te.bools.length,"Invalid boolean index");const t=Math.floor(e/4),n=e*2%8,i=a(this,xe).getUint8(t)>>n&3;return i===0?void 0:i===2},Zg=function(e){return de(e<te.numbers.length,"Invalid number index"),a(this,xe).getFloat64(a(te,yu)+e*8)},sd=function(e){de(e<te.strings.length,"Invalid string index");let t=a(te,zn)+4;for(let r=0;r<e;r++)t+=a(this,xe).getUint32(t)+4;const n=a(this,xe).getUint32(t),i=new Uint8Array(n);return i.set(new Uint8Array(a(this,xi),t+4,n)),a(this,Tf).decode(i)},I(te,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),I(te,"numbers",["ascent","defaultWidth","descent"]),I(te,"strings",["fallbackName","loadedName","mimetype","name"]),v(te,yu,Math.ceil(te.bools.length*2/8)),v(te,vu,a(te,yu)+te.numbers.length*8),v(te,wu,a(te,vu)+1+2*4),v(te,_u,a(te,wu)+1+8*6),v(te,zn,a(te,_u)+1+2*3);let Aw=te;var Pf,Rf,Lf,If,Df,Mf,Nf,Of;const Me=class Me{constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}static write(e){let t,n=null,i=[],r=[],o=[],l=[],c=null,u=null;switch(e[0]){case"RadialAxial":t=e[1]==="axial"?1:2,n=e[2],o=e[3],t===1?i.push(...e[4],...e[5]):i.push(e[4][0],e[4][1],e[6],e[5][0],e[5][1],e[7]);break;case"Mesh":t=3,c=e[1],i=e[2],r=e[3],l=e[4]||[],n=e[6],u=e[7];break;default:throw new Error(`Unsupported pattern type: ${e[0]}`)}const h=Math.floor(i.length/2),d=Math.floor(r.length/3),f=o.length,p=l.length;let y=0;for(const k of l)y+=1,y=Math.ceil(y/4)*4,y+=4+k.coords.length*4,y+=4+k.colors.length*4,k.verticesPerRow!==void 0&&(y+=4);const _=20+h*8+d*3+f*8+(n?16:0)+(u?3:0)+y,A=new ArrayBuffer(_),m=new DataView(A),b=new Uint8Array(A);m.setUint8(a(Me,Pf),t),m.setUint8(a(Me,Rf),n?1:0),m.setUint8(a(Me,Lf),u?1:0),m.setUint8(a(Me,If),c),m.setUint32(a(Me,Df),h,!0),m.setUint32(a(Me,Mf),d,!0),m.setUint32(a(Me,Nf),f,!0),m.setUint32(a(Me,Of),p,!0);let w=20;new Float32Array(A,w,h*2).set(i),w+=h*8,b.set(r,w),w+=d*3;for(const[k,x]of o)m.setFloat32(w,k,!0),w+=4,m.setUint32(w,parseInt(x.slice(1),16),!0),w+=4;if(n)for(const k of n)m.setFloat32(w,k,!0),w+=4;u&&(b.set(u,w),w+=3);for(let k=0;k<l.length;k++){const x=l[k];m.setUint8(w,x.type),w+=1,w=Math.ceil(w/4)*4,m.setUint32(w,x.coords.length,!0),w+=4,new Int32Array(A,w,x.coords.length).set(x.coords),w+=x.coords.length*4,m.setUint32(w,x.colors.length,!0),w+=4,new Int32Array(A,w,x.colors.length).set(x.colors),w+=x.colors.length*4,x.verticesPerRow!==void 0&&(m.setUint32(w,x.verticesPerRow,!0),w+=4)}return A}getIR(){const e=this.view,t=this.data[a(Me,Pf)],n=!!this.data[a(Me,Rf)],i=!!this.data[a(Me,Lf)],r=e.getUint32(a(Me,Df),!0),o=e.getUint32(a(Me,Mf),!0),l=e.getUint32(a(Me,Nf),!0),c=e.getUint32(a(Me,Of),!0);let u=20;const h=new Float32Array(this.buffer,u,r*2);u+=r*8;const d=new Uint8Array(this.buffer,u,o*3);u+=o*3;const f=[];for(let A=0;A<l;++A){const m=e.getFloat32(u,!0);u+=4;const b=e.getUint32(u,!0);u+=4,f.push([m,`#${b.toString(16).padStart(6,"0")}`])}let p=null;if(n){p=[];for(let A=0;A<4;++A)p.push(e.getFloat32(u,!0)),u+=4}let y=null;i&&(y=new Uint8Array(this.buffer,u,3),u+=3);const _=[];for(let A=0;A<c;++A){const m=e.getUint8(u);u+=1,u=Math.ceil(u/4)*4;const b=e.getUint32(u,!0);u+=4;const w=new Int32Array(this.buffer,u,b);u+=b*4;const E=e.getUint32(u,!0);u+=4;const k=new Int32Array(this.buffer,u,E);u+=E*4;const x={type:m,coords:w,colors:k};m===tw.LATTICE&&(x.verticesPerRow=e.getUint32(u,!0),u+=4),_.push(x)}if(t===1)return["RadialAxial","axial",p,f,Array.from(h.slice(0,2)),Array.from(h.slice(2,4)),null,null];if(t===2)return["RadialAxial","radial",p,f,[h[0],h[1]],[h[3],h[4]],h[2],h[5]];if(t===3){const A=this.data[a(Me,If)];let m=null;if(h.length>0){let b=h[0],w=h[0],E=h[1],k=h[1];for(let x=0;x<h.length;x+=2){const C=h[x],P=h[x+1];b=b>C?C:b,E=E>P?P:E,w=w<C?C:w,k=k<P?P:k}m=[b,E,w,k]}return["Mesh",A,h,d,_,m,p,y]}throw new Error(`Unsupported pattern kind: ${t}`)}};Pf=new WeakMap,Rf=new WeakMap,Lf=new WeakMap,If=new WeakMap,Df=new WeakMap,Mf=new WeakMap,Nf=new WeakMap,Of=new WeakMap,v(Me,Pf,0),v(Me,Rf,1),v(Me,Lf,2),v(Me,If,3),v(Me,Df,4),v(Me,Mf,8),v(Me,Nf,12),v(Me,Of,16);let Ew=Me;function AI(s){if(s instanceof URL)return s.href;if(typeof s=="string"){if(fn)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 EI(s){if(fn&&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 Yp(s);if(s instanceof ArrayBuffer||ArrayBuffer.isView(s)||typeof s=="object"&&!isNaN(s==null?void 0: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.")}
150function xg(s){if(typeof s!="string")return null;if(s.endsWith("/"))return s;throw new Error(`Invalid factory url: "${s}" must include trailing slash.`)}const xw=s=>typeof s=="object"&&Number.isInteger(s==null?void 0:s.num)&&s.num>=0&&Number.isInteger(s==null?void 0:s.gen)&&s.gen>=0,xI=s=>typeof s=="object"&&typeof(s==null?void 0:s.name)=="string",kI=oI.bind(null,xw,xI);var lr,wy;class CI{constructor(){v(this,lr,new Map);v(this,wy,Promise.resolve())}postMessage(e,t){const n={data:structuredClone(e,t?{transfer:t}:null)};a(this,wy).then(()=>{for(const[i]of a(this,lr))i.call(this,n)})}addEventListener(e,t,n=null){let i=null;if((n==null?void 0:n.signal)instanceof AbortSignal){const{signal:r}=n;if(r.aborted){J("LoopbackPort - cannot use an `aborted` signal.");return}const o=()=>this.removeEventListener(e,t);i=()=>r.removeEventListener("abort",o),r.addEventListener("abort",o)}a(this,lr).set(t,i)}removeEventListener(e,t){const n=a(this,lr).get(t);n==null||n(),a(this,lr).delete(t)}terminate(){for(const[,e]of a(this,lr))e==null||e();a(this,lr).clear()}}lr=new WeakMap,wy=new WeakMap;const kg={DATA:1,ERROR:2},ct={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function C1(){}function Sn(s){if(s instanceof ra||s instanceof nw||s instanceof w1||s instanceof Zm||s instanceof H0)return s;switch(s instanceof Error||typeof s=="object"&&s!==null||Ie('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),s.name){case"AbortException":return new ra(s.message);case"InvalidPDFException":return new nw(s.message);case"PasswordException":return new w1(s.message,s.code);case"ResponseException":return new Zm(s.message,s.status,s.missing);case"UnknownErrorException":return new H0(s.message,s.details)}return new H0(s.message,s.toString())}var bu,Is,vk,wk,_k,em;class id{constructor(e,t,n){v(this,Is);v(this,bu,new AbortController);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",S(this,Is,vk).bind(this),{signal:a(this,bu).signal})}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++,r=Promise.withResolvers();this.callbackCapabilities[i]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:i,data:t},n)}catch(o){r.reject(o)}return r.promise}sendWithStream(e,t,n,i){const r=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:u=>{const h=Promise.withResolvers();return this.streamControllers[r]={controller:u,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:o,targetName:l,action:e,streamId:r,data:t,desiredSize:u.desiredSize},i),h.promise},pull:u=>{const h=Promise.withResolvers();return this.streamControllers[r].pullCall=h,c.postMessage({sourceName:o,targetName:l,stream:ct.PULL,streamId:r,desiredSize:u.desiredSize}),h.promise},cancel:u=>{de(u instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[r].cancelCall=h,this.streamControllers[r].isClosed=!0,c.postMessage({sourceName:o,targetName:l,stream:ct.CANCEL,streamId:r,reason:Sn(u)}),h.promise}},n)}destroy(){var e;(e=a(this,bu))==null||e.abort(),g(this,bu,null)}}bu=new WeakMap,Is=new WeakSet,vk=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){S(this,Is,_k).call(this,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===kg.DATA)i.resolve(e.data);else if(e.callback===kg.ERROR)i.reject(Sn(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,r=this.comObj;Promise.try(t,e.data).then(function(o){r.postMessage({sourceName:n,targetName:i,callback:kg.DATA,callbackId:e.callbackId,data:o})},function(o){r.postMessage({sourceName:n,targetName:i,callback:kg.ERROR,callbackId:e.callbackId,reason:Sn(o)})});return}if(e.streamId){S(this,Is,wk).call(this,e);return}t(e.data)},wk=function(e){const t=e.streamId,n=this.sourceName,i=e.sourceName,r=this.comObj,o=this,l=this.actionHandler[e.action],c={enqueue(u,h=1,d){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=h,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),r.postMessage({sourceName:n,targetName:i,stream:ct.ENQUEUE,streamId:t,chunk:u},d)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:n,targetName:i,stream:ct.CLOSE,streamId:t}),delete o.streamSinks[t])},error(u){de(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,r.postMessage({sourceName:n,targetName:i,stream:ct.ERROR,streamId:t,reason:Sn(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[t]=c,Promise.try(l,e.data,c).then(function(){r.postMessage({sourceName:n,targetName:i,stream:ct.START_COMPLETE,streamId:t,success:!0})},function(u){r.postMessage({sourceName:n,targetName:i,stream:ct.START_COMPLETE,streamId:t,reason:Sn(u)})})},_k=function(e){const t=e.streamId,n=this.sourceName,i=e.sourceName,r=this.comObj,o=this.streamControllers[t],l=this.streamSinks[t];switch(e.stream){case ct.START_COMPLETE:e.success?o.startCall.resolve():o.startCall.reject(Sn(e.reason));break;case ct.PULL_COMPLETE:e.success?o.pullCall.resolve():o.pullCall.reject(Sn(e.reason));break;case ct.PULL:if(!l){r.postMessage({sourceName:n,targetName:i,stream:ct.PULL_COMPLETE,streamId:t,success:!0});break}l.desiredSize<=0&&e.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=e.desiredSize,Promise.try(l.onPull||C1).then(function(){r.postMessage({sourceName:n,targetName:i,stream:ct.PULL_COMPLETE,streamId:t,success:!0})},function(u){r.postMessage({sourceName:n,targetName:i,stream:ct.PULL_COMPLETE,streamId:t,reason:Sn(u)})});break;case ct.ENQUEUE:if(de(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(e.chunk);break;case ct.CLOSE:if(de(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),S(this,Is,em).call(this,o,t);break;case ct.ERROR:de(o,"error should have stream controller"),o.controller.error(Sn(e.reason)),S(this,Is,em).call(this,o,t);break;
150case ct.CANCEL_COMPLETE:e.success?o.cancelCall.resolve():o.cancelCall.reject(Sn(e.reason)),S(this,Is,em).call(this,o,t);break;case ct.CANCEL:if(!l)break;const c=Sn(e.reason);Promise.try(l.onCancel||C1,c).then(function(){r.postMessage({sourceName:n,targetName:i,stream:ct.CANCEL_COMPLETE,streamId:t,success:!0})},function(u){r.postMessage({sourceName:n,targetName:i,stream:ct.CANCEL_COMPLETE,streamId:t,reason:Sn(u)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}},em=async function(e,t){var n,i,r;await Promise.allSettled([(n=e.startCall)==null?void 0:n.promise,(i=e.pullCall)==null?void 0:i.promise,(r=e.cancelCall)==null?void 0:r.promise]),delete this.streamControllers[t]};var Ff;class bk{constructor({enableHWA:e=!1}){v(this,Ff,!1);g(this,Ff,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:!a(this,Ff)})}}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){Ie("Abstract method `_createCanvas` called.")}}Ff=new WeakMap;class TI extends bk{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 Sk{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){Ie("Abstract method `_fetch` called.")}}class T1 extends Sk{async _fetch(e){const t=await Qp(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):Yp(t)}}class Ak{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,n,i,r){return"none"}destroy(e=!1){}}var Ja,Su,cr,ur,en,Za,el,j,Yt,rd,gc,tm,mc,Ek,kw,yc,od,ad,Cw,ld;class PI extends Ak{constructor({docId:t,ownerDocument:n=globalThis.document}){super();v(this,j);v(this,Ja);v(this,Su);v(this,cr);v(this,ur);v(this,en);v(this,Za);v(this,el,0);g(this,ur,t),g(this,en,n)}addFilter(t){if(!t)return"none";let n=a(this,j,Yt).get(t);if(n)return n;const[i,r,o]=S(this,j,tm).call(this,t),l=t.length===1?i:`${i}${r}${o}`;if(n=a(this,j,Yt).get(l),n)return a(this,j,Yt).set(t,n),n;const c=`g_${a(this,ur)}_transfer_map_${gt(this,el)._++}`,u=S(this,j,mc).call(this,c);a(this,j,Yt).set(t,u),a(this,j,Yt).set(l,u);const h=S(this,j,yc).call(this,c);return S(this,j,ad).call(this,i,r,o,h),u}addHCMFilter(t,n){var y;const i=`${t}-${n}`,r="base";let o=a(this,j,rd).get(r);if((o==null?void 0:o.key)===i||(o?((y=o.filter)==null||y.remove(),o.key=i,o.url="none",o.filter=null):(o={key:i,url:"none",filter:null},a(this,j,rd).set(r,o)),!t||!n))return o.url;const l=S(this,j,ld).call(this,t);t=U.makeHexColor(...l);const c=S(this,j,ld).call(this,n);if(n=U.makeHexColor(...c),a(this,j,gc).style.color="",t==="#000000"&&n==="#ffffff"||t===n)return o.url;const u=new Array(256);for(let _=0;_<=255;_++){const A=_/255;u[_]=A<=.03928?A/12.92:((A+.055)/1.055)**2.4}const h=u.join(","),d=`g_${a(this,ur)}_hcm_filter`,f=o.filter=S(this,j,yc).call(this,d);S(this,j,ad).call(this,h,h,h,f),S(this,j,kw).call(this,f);const p=(_,A)=>{const m=l[_]/255,b=c[_]/255,w=new Array(A+1);for(let E=0;E<=A;E++)w[E]=m+E/A*(b-m);return w.join(",")};return S(this,j,ad).call(this,p(0,5),p(1,5),p(2,5),f),o.url=S(this,j,mc).call(this,d),o.url}addAlphaFilter(t){let n=a(this,j,Yt).get(t);if(n)return n;const[i]=S(this,j,tm).call(this,[t]),r=`alpha_${i}`;if(n=a(this,j,Yt).get(r),n)return a(this,j,Yt).set(t,n),n;const o=`g_${a(this,ur)}_alpha_map_${gt(this,el)._++}`,l=S(this,j,mc).call(this,o);a(this,j,Yt).set(t,l),a(this,j,Yt).set(r,l);const c=S(this,j,yc).call(this,o);return S(this,j,Cw).call(this,i,c),l}addLuminosityFilter(t){let n=a(this,j,Yt).get(t||"luminosity");if(n)return n;let i,r;if(t?([i]=S(this,j,tm).call(this,[t]),r=`luminosity_${i}`):r="luminosity",n=a(this,j,Yt).get(r),n)return a(this,j,Yt).set(t,n),n;const o=`g_${a(this,ur)}_luminosity_map_${gt(this,el)._++}`,l=S(this,j,mc).call(this,o);a(this,j,Yt).set(t,l),a(this,j,Yt).set(r,l);const c=S(this,j,yc).call(this,o);return S(this,j,Ek).call(this,c),t&&S(this,j,Cw).call(this,i,c),l}addHighlightHCMFilter(t,n,i,r,o){var b;const l=`${n}-${i}-${r}-${o}`;let c=a(this,j,rd).get(t);if((c==null?void 0:c.key)===l||(c?((b=c.filter)==null||b.remove(),c.key=l,c.url="none",c.filter=null):(c={key:l,url:"none",filter:null},a(this,j,rd).set(t,c)),!n||!i))return c.url;const[u,h]=[n,i].map(S(this,j,ld).bind(this));let d=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),f=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[p,y]=[r,o].map(S(this,j,ld).bind(this));f<d&&([d,f,p,y]=[f,d,y,p]),a(this,j,gc).style.color="";const _=(w,E,k)=>{const x=new Array(256),C=(f-d)/k,P=w/255,R=(E-w)/(255*k);let L=0;for(let D=0;D<=k;D++){const F=Math.round(d+D*C),Y=P+D*R;for(let q=L;q<=F;q++)x[q]=Y;L=F+1}for(let D=L;D<256;D++)x[D]=x[L-1];return x.join(",")},A=`g_${a(this,ur)}_hcm_${t}_filter`,m=c.filter=S(this,j,yc).call(this,A);return S(this,j,kw).call(this,m),S(this,j,ad).call(this,_(p[0],y[0],5),_(p[1],y[1],5),_(p[2],y[2],5),m),
150c.url=S(this,j,mc).call(this,A),c.url}destroy(t=!1){var n,i,r,o;t&&((n=a(this,Za))!=null&&n.size)||((i=a(this,cr))==null||i.parentNode.parentNode.remove(),g(this,cr,null),(r=a(this,Su))==null||r.clear(),g(this,Su,null),(o=a(this,Za))==null||o.clear(),g(this,Za,null),g(this,el,0))}}Ja=new WeakMap,Su=new WeakMap,cr=new WeakMap,ur=new WeakMap,en=new WeakMap,Za=new WeakMap,el=new WeakMap,j=new WeakSet,Yt=function(){return a(this,Su)||g(this,Su,new Map)},rd=function(){return a(this,Za)||g(this,Za,new Map)},gc=function(){if(!a(this,cr)){const t=a(this,en).createElement("div"),{style:n}=t;n.visibility="hidden",n.contain="strict",n.width=n.height=0,n.position="absolute",n.top=n.left=0,n.zIndex=-1;const i=a(this,en).createElementNS(Hi,"svg");i.setAttribute("width",0),i.setAttribute("height",0),g(this,cr,a(this,en).createElementNS(Hi,"defs")),t.append(i),i.append(a(this,cr)),a(this,en).body.append(t)}return a(this,cr)},tm=function(t){if(t.length===1){const u=t[0],h=new Array(256);for(let f=0;f<256;f++)h[f]=u[f]/255;const d=h.join(",");return[d,d,d]}const[n,i,r]=t,o=new Array(256),l=new Array(256),c=new Array(256);for(let u=0;u<256;u++)o[u]=n[u]/255,l[u]=i[u]/255,c[u]=r[u]/255;return[o.join(","),l.join(","),c.join(",")]},mc=function(t){if(a(this,Ja)===void 0){g(this,Ja,"");const n=a(this,en).URL;n!==a(this,en).baseURI&&(t0(n)?J('#createUrl: ignore "data:"-URL for performance reasons.'):g(this,Ja,Lx(n,"")))}return`url(${a(this,Ja)}#${t})`},Ek=function(t){const n=a(this,en).createElementNS(Hi,"feColorMatrix");n.setAttribute("type","matrix"),n.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"),t.append(n)},kw=function(t){const n=a(this,en).createElementNS(Hi,"feColorMatrix");n.setAttribute("type","matrix"),n.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"),t.append(n)},yc=function(t){const n=a(this,en).createElementNS(Hi,"filter");return n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("id",t),a(this,j,gc).append(n),n},od=function(t,n,i){const r=a(this,en).createElementNS(Hi,n);r.setAttribute("type","discrete"),r.setAttribute("tableValues",i),t.append(r)},ad=function(t,n,i,r){const o=a(this,en).createElementNS(Hi,"feComponentTransfer");r.append(o),S(this,j,od).call(this,o,"feFuncR",t),S(this,j,od).call(this,o,"feFuncG",n),S(this,j,od).call(this,o,"feFuncB",i)},Cw=function(t,n){const i=a(this,en).createElementNS(Hi,"feComponentTransfer");n.append(i),S(this,j,od).call(this,i,"feFuncA",t)},ld=function(t){return a(this,j,gc).style.color=t,Zp(getComputedStyle(a(this,j,gc)).getPropertyValue("color"))};class xk{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){Ie("Abstract method `_fetch` called.")}}class P1 extends xk{async _fetch(e){const t=await Qp(e,"arraybuffer");return new Uint8Array(t)}}class kk{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){Ie("Abstract method `_fetch` called.")}}class R1 extends kk{async _fetch(e){const t=await Qp(e,"arraybuffer");return new Uint8Array(t)}}fn&&J("Please use the `legacy` build in Node.js environments.");
150async function Lb(s){const t=await process.getBuiltinModule("fs").promises.readFile(s);return new Uint8Array(t)}class RI extends Ak{}class LI extends bk{_createCanvas(e,t){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,t)}}class II extends Sk{async _fetch(e){return Lb(e)}}class DI extends xk{async _fetch(e){return Lb(e)}}class MI extends kk{async _fetch(e){return Lb(e)}}const uc="__forcedDependency",{floor:L1,ceil:I1}=Math;function Cg(s,e,t,n,i,r){s[e*4+0]=Math.min(s[e*4+0],t),s[e*4+1]=Math.min(s[e*4+1],n),s[e*4+2]=Math.max(s[e*4+2],i),s[e*4+3]=Math.max(s[e*4+3],r)}const Tw=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var Au,bo;class NI{constructor(e,t){v(this,Au);v(this,bo);g(this,Au,e),g(this,bo,t)}get length(){return a(this,Au).length}isEmpty(e){return a(this,Au)[e]===Tw}minX(e){return a(this,bo)[e*4+0]/256}minY(e){return a(this,bo)[e*4+1]/256}maxX(e){return(a(this,bo)[e*4+2]+1)/256}maxY(e){return(a(this,bo)[e*4+3]+1)/256}}Au=new WeakMap,bo=new WeakMap;const Tg=(s,e)=>{if(!s)return;let t=s.get(e);return t||(t={dependencies:new Set,isRenderingOperation:!1},s.set(e,t)),t};var xn,kn,tl,Ws,nl,hr,be,ke,dr,Cn,jf,Eu,sl,il,fr,tn,ki,Bf,Pw;class OI{constructor(e,t,n=!1){v(this,Bf);v(this,xn,{__proto__:null});v(this,kn,{__proto__:null,transform:[],moveText:[],sameLineText:[],[uc]:[]});v(this,tl,new Map);v(this,Ws,[]);v(this,nl,[]);v(this,hr,[[1,0,0,1,0,0]]);v(this,be,[-1/0,-1/0,1/0,1/0]);v(this,ke,new Float64Array([1/0,1/0,-1/0,-1/0]));v(this,dr,-1);v(this,Cn,new Set);v(this,jf,new Map);v(this,Eu,new Map);v(this,sl);v(this,il);v(this,fr);v(this,tn);v(this,ki);g(this,sl,e.width),g(this,il,e.height),S(this,Bf,Pw).call(this,t),n&&g(this,ki,new Map)}growOperationsCount(e){e>=a(this,tn).length&&S(this,Bf,Pw).call(this,e,a(this,tn))}save(e){return g(this,xn,{__proto__:a(this,xn)}),g(this,kn,{__proto__:a(this,kn),transform:{__proto__:a(this,kn).transform},moveText:{__proto__:a(this,kn).moveText},sameLineText:{__proto__:a(this,kn).sameLineText},[uc]:{__proto__:a(this,kn)[uc]}}),g(this,be,{__proto__:a(this,be)}),a(this,Ws).push(e),this}restore(e){var i;const t=Object.getPrototypeOf(a(this,xn));if(t===null)return this;g(this,xn,t),g(this,kn,Object.getPrototypeOf(a(this,kn))),g(this,be,Object.getPrototypeOf(a(this,be)));const n=a(this,Ws).pop();return n!==void 0&&((i=Tg(a(this,ki),e))==null||i.dependencies.add(n),a(this,tn)[e]=a(this,tn)[n]),this}recordOpenMarker(e){return a(this,Ws).push(e),this}getOpenMarker(){return a(this,Ws).length===0?null:a(this,Ws).at(-1)}recordCloseMarker(e){var n;const t=a(this,Ws).pop();return t!==void 0&&((n=Tg(a(this,ki),e))==null||n.dependencies.add(t),a(this,tn)[e]=a(this,tn)[t]),this}beginMarkedContent(e){return a(this,nl).push(e),this}endMarkedContent(e){var n;const t=a(this,nl).pop();return t!==void 0&&((n=Tg(a(this,ki),e))==null||n.dependencies.add(t),a(this,tn)[e]=a(this,tn)[t]),this}pushBaseTransform(e){return a(this,hr).push(U.multiplyByDOMMatrix(a(this,hr).at(-1),e.getTransform())),this}popBaseTransform(){return a(this,hr).length>1&&a(this,hr).pop(),this}recordSimpleData(e,t){return a(this,xn)[e]=t,this}recordIncrementalData(e,t){return a(this,kn)[e].push(t),this}resetIncrementalData(e,t){return a(this,kn)[e].length=0,this}recordNamedData(e,t){return a(this,tl).set(e,t),this}recordSimpleDataFromNamed(e,t,n){a(this,xn)[e]=a(this,tl).get(t)??n}recordFutureForcedDependency(e,t){return this.recordIncrementalData(uc,t),this}inheritSimpleDataAsFutureForcedDependencies(e){for(const t of e)t in a(this,xn)&&this.recordFutureForcedDependency(t,a(this,xn)[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const e of a(this,Cn))this.recordFutureForcedDependency(uc,e);return this}resetBBox(e){return a(this,dr)!==e&&(g(this,dr,e),a(this,ke)[0]=1/0,a(this,ke)[1]=1/0,a(this,ke)[2]=-1/0,a(this,ke)[3]=-1/0),this}recordClipBox(e,t,n,i,r,o){const l=U.multiplyByDOMMatrix(a(this,hr).at(-1),t.getTransform()),c=[1/0,1/0,-1/0,-1/0];U.axialAlignedBoundingBox([n,r,i,o],l,c);const u=U.intersect(a(this,be),c);return u?(a(this,be)[0]=u[0],a(this,be)[1]=u[1],a(this,be)[2]=u[2],a(this,be)[3]=u[3]):(a(this,be)[0]=a(this,be)[1]=1/0,a(this,be)[2]=a(this,be)[3]=-1/0),this}recordBBox(e,t,n,i,r,o){const l=a(this,be);if(l[0]===1/0)return this;const c=U.multiplyByDOMMatrix(a(this,hr).at(-1),t.getTransform());if(l[0]===-1/0)return U.axialAlignedBoundingBox([n,r,i,o],c,a(this,ke)),this;const u=[1/0,1/0,-1/0,-1/0];return U.axialAlignedBoundingBox([n,r,i,o],c,u),a(this,ke)[0]=Math.min(a(this,ke)[0],Math.max(u[0],l[0])),a(this,ke)[1]=Math.min(a(this,ke)[1],Math.max(u[1],l[1])),a(this,ke)[2]=Math.max(a(this,ke)[2],Math.min(u[2],l[2])),a(this,ke)[3]=Math.max(a(this,ke)[3],Math.min(u[3],l[3])),this}recordCharacterBBox(e,t,n,i=1,r=0,o=0,l){const c=n.bbox;let u,h;if(c&&(u=c[2]!==c[0]&&c[3]!==c[1]&&a(this,Eu).get(n),u!==!1&&(h=[0,0,0,0],U.axialAlignedBoundingBox(c,n.fontMatrix,h),(i!==1||r!==0||o!==0)&&U.scaleMinMax([i,0,0,-i,r,o],h),u)))return this.recordBBox(e,t,h[0],h[2],h[1],h[3]);if(!l)return this.recordFullPageBBox(e);const d=l();return c&&h&&u===void 0&&(u=h[0]<=r-d.actualBoundingBoxLeft&&h[2]>=r+d.actualBoundingBoxRight&&h[1]<=o-d.actualBoundingBoxAscent&&h[3]>=o+d.actualBoundingBoxDescent,a(this,Eu).set(n,u),u)?this.recordBBox(e,t,h[0],h[2],h[1],h[3]):this.recordBBox(e,t,r-d.actualBoundingBoxLeft,r+d.actualBoundingBoxRight,o-d.actualBoundingBoxAscent,o+d.actualBoundingBoxDescent)}recordFullPageBBox(e){return a(this,ke)[0]=Math.max(0,a(this,be)[0]),a(this,ke)[1]=Math.max(0,a(this,be)[1]),a(this,ke)[2]=Math.min(a(this,sl),a(this,be)[2]),a(this,ke)[3]=Math.min(a(this,il),a(this,be)[3]),this}getSimpleIndex(e){return a(this,xn)[e]}recordDependencies(e,t){const n=a(this,Cn),i=a(this,xn),r=a(this,kn);for(const o of t)o in a(this,xn)?n.add(i[o]):o in r&&r[o].forEac
150h(n.add,n);return this}recordNamedDependency(e,t){return a(this,tl).has(t)&&a(this,Cn).add(a(this,tl).get(t)),this}recordOperation(e,t=!1){if(this.recordDependencies(e,[uc]),a(this,ki)){const n=Tg(a(this,ki),e),{dependencies:i}=n;a(this,Cn).forEach(i.add,i),a(this,Ws).forEach(i.add,i),a(this,nl).forEach(i.add,i),i.delete(e),n.isRenderingOperation=!0}if(a(this,dr)===e){const n=L1(a(this,ke)[0]*256/a(this,sl)),i=L1(a(this,ke)[1]*256/a(this,il)),r=I1(a(this,ke)[2]*256/a(this,sl)),o=I1(a(this,ke)[3]*256/a(this,il));Cg(a(this,fr),e,n,i,r,o);for(const l of a(this,Cn))l!==e&&Cg(a(this,fr),l,n,i,r,o);for(const l of a(this,Ws))l!==e&&Cg(a(this,fr),l,n,i,r,o);for(const l of a(this,nl))l!==e&&Cg(a(this,fr),l,n,i,r,o);t||(a(this,Cn).clear(),g(this,dr,-1))}return this}recordShowTextOperation(e,t=!1){const n=Array.from(a(this,Cn));this.recordOperation(e,t),this.recordIncrementalData("sameLineText",e);for(const i of n)this.recordIncrementalData("sameLineText",i);return this}bboxToClipBoxDropOperation(e,t=!1){return a(this,dr)===e&&(g(this,dr,-1),a(this,be)[0]=Math.max(a(this,be)[0],a(this,ke)[0]),a(this,be)[1]=Math.max(a(this,be)[1],a(this,ke)[1]),a(this,be)[2]=Math.min(a(this,be)[2],a(this,ke)[2]),a(this,be)[3]=Math.min(a(this,be)[3],a(this,ke)[3]),t||a(this,Cn).clear()),this}_takePendingDependencies(){const e=a(this,Cn);return g(this,Cn,new Set),e}_extractOperation(e){const t=a(this,jf).get(e);return a(this,jf).delete(e),t}_pushPendingDependencies(e){for(const t of e)a(this,Cn).add(t)}take(){return a(this,Eu).clear(),new NI(a(this,tn),a(this,fr))}takeDebugMetadata(){return a(this,ki)}}xn=new WeakMap,kn=new WeakMap,tl=new WeakMap,Ws=new WeakMap,nl=new WeakMap,hr=new WeakMap,be=new WeakMap,ke=new WeakMap,dr=new WeakMap,Cn=new WeakMap,jf=new WeakMap,Eu=new WeakMap,sl=new WeakMap,il=new WeakMap,fr=new WeakMap,tn=new WeakMap,ki=new WeakMap,Bf=new WeakSet,Pw=function(e,t){const n=new ArrayBuffer(e*4);g(this,fr,new Uint8ClampedArray(n)),g(this,tn,new Uint32Array(n)),t&&t.length>0?(a(this,tn).set(t),a(this,tn).fill(Tw,t.length)):a(this,tn).fill(Tw)};var Re,et,Gs,xu,ku;
150const $b=class $b{constructor(e,t,n){v(this,Re);v(this,et);v(this,Gs);v(this,xu,0);v(this,ku,0);if(e instanceof $b&&a(e,Gs)===!!n)return e;g(this,Re,e),g(this,et,t),g(this,Gs,!!n)}growOperationsCount(){throw new Error("Unreachable")}save(e){return gt(this,ku)._++,a(this,Re).save(a(this,et)),this}restore(e){return a(this,ku)>0&&(a(this,Re).restore(a(this,et)),gt(this,ku)._--),this}recordOpenMarker(e){return gt(this,xu)._++,this}getOpenMarker(){return a(this,xu)>0?a(this,et):a(this,Re).getOpenMarker()}recordCloseMarker(e){return gt(this,xu)._--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return a(this,Re).pushBaseTransform(e),this}popBaseTransform(){return a(this,Re).popBaseTransform(),this}recordSimpleData(e,t){return a(this,Re).recordSimpleData(e,a(this,et)),this}recordIncrementalData(e,t){return a(this,Re).recordIncrementalData(e,a(this,et)),this}resetIncrementalData(e,t){return a(this,Re).resetIncrementalData(e,a(this,et)),this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return a(this,Re).recordSimpleDataFromNamed(e,t,a(this,et)),this}recordFutureForcedDependency(e,t){return a(this,Re).recordFutureForcedDependency(e,a(this,et)),this}inheritSimpleDataAsFutureForcedDependencies(e){return a(this,Re).inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return a(this,Re).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return a(this,Gs)||a(this,Re).resetBBox(a(this,et)),this}recordClipBox(e,t,n,i,r,o){return a(this,Gs)||a(this,Re).recordClipBox(a(this,et),t,n,i,r,o),this}recordBBox(e,t,n,i,r,o){return a(this,Gs)||a(this,Re).recordBBox(a(this,et),t,n,i,r,o),this}recordCharacterBBox(e,t,n,i,r,o,l){return a(this,Gs)||a(this,Re).recordCharacterBBox(a(this,et),t,n,i,r,o,l),this}recordFullPageBBox(e){return a(this,Gs)||a(this,Re).recordFullPageBBox(a(this,et)),this}getSimpleIndex(e){return a(this,Re).getSimpleIndex(e)}recordDependencies(e,t){return a(this,Re).recordDependencies(a(this,et),t),this}recordNamedDependency(e,t){return a(this,Re).recordNamedDependency(a(this,et),t),this}recordOperation(e){return a(this,Re).recordOperation(a(this,et),!0),this}recordShowTextOperation(e){return a(this,Re).recordShowTextOperation(a(this,et),!0),this}bboxToClipBoxDropOperation(e){return a(this,Gs)||a(this,Re).bboxToClipBoxDropOperation(a(this,et),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};Re=new WeakMap,et=new WeakMap,Gs=new WeakMap,xu=new WeakMap,ku=new WeakMap;let ry=$b;const ps={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]},zt={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Rw(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 Ib{isModifyingCurrentTransform(){return!1}getPattern(){Ie("Abstract method `getPattern` called.")}}class FI extends Ib{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 r;if(i===zt.STROKE||i===zt.FILL){const o=t.current.getClippedPathBoundingBox(i,Xe(e))||[0,0,0,0],l=Math.ceil(o[2]-o[0])||1,c=Math.ceil(o[3]-o[1])||1,u=t.cachedCanvases.getCanvas("pattern",l,c),h=u.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-o[0],-o[1]),n=U.transform(n,[1,0,0,1,o[0],o[1]]),h.transform(...t.baseTransform),this.matrix&&h.transform(...this.matrix
150),Rw(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),r=e.createPattern(u.canvas,"no-repeat");const d=new DOMMatrix(n);r.setTransform(d)}else Rw(e,this._bbox),r=this._createGradient(e);return r}}function G0(s,e,t,n,i,r,o,l){const c=e.coords,u=e.colors,h=s.data,d=s.width*4;let f;c[t+1]>c[n+1]&&(f=t,t=n,n=f,f=r,r=o,o=f),c[n+1]>c[i+1]&&(f=n,n=i,i=f,f=o,o=l,l=f),c[t+1]>c[n+1]&&(f=t,t=n,n=f,f=r,r=o,o=f);const p=(c[t]+e.offsetX)*e.scaleX,y=(c[t+1]+e.offsetY)*e.scaleY,_=(c[n]+e.offsetX)*e.scaleX,A=(c[n+1]+e.offsetY)*e.scaleY,m=(c[i]+e.offsetX)*e.scaleX,b=(c[i+1]+e.offsetY)*e.scaleY;if(y>=b)return;const w=u[r],E=u[r+1],k=u[r+2],x=u[o],C=u[o+1],P=u[o+2],R=u[l],L=u[l+1],D=u[l+2],F=Math.round(y),Y=Math.round(b);let q,oe,z,H,M,V,X,ye;for(let Q=F;Q<=Y;Q++){if(Q<A){const Be=Q<y?0:(y-Q)/(y-A);q=p-(p-_)*Be,oe=w-(w-x)*Be,z=E-(E-C)*Be,H=k-(k-P)*Be}else{let Be;Q>b?Be=1:A===b?Be=0:Be=(A-Q)/(A-b),q=_-(_-m)*Be,oe=x-(x-R)*Be,z=C-(C-L)*Be,H=P-(P-D)*Be}let fe;Q<y?fe=0:Q>b?fe=1:fe=(y-Q)/(y-b),M=p-(p-m)*fe,V=w-(w-R)*fe,X=E-(E-L)*fe,ye=k-(k-D)*fe;const pt=Math.round(Math.min(q,M)),on=Math.round(Math.max(q,M));let Mt=d*Q+pt*4;for(let Be=pt;Be<=on;Be++)fe=(q-Be)/(q-M),fe<0?fe=0:fe>1&&(fe=1),h[Mt++]=oe-(oe-V)*fe|0,h[Mt++]=z-(z-X)*fe|0,h[Mt++]=H-(H-ye)*fe|0,h[Mt++]=255}}function jI(s,e,t){const n=e.coords,i=e.colors;let r,o;switch(e.type){case tw.LATTICE:const l=e.verticesPerRow,c=Math.floor(n.length/l)-1,u=l-1;for(r=0;r<c;r++){let h=r*l;for(let d=0;d<u;d++,h++)G0(s,t,n[h],n[h+1],n[h+l],i[h],i[h+1],i[h+l]),G0(s,t,n[h+l+1],n[h+1],n[h+l],i[h+l+1],i[h+1],i[h+l])}break;case tw.TRIANGLES:for(r=0,o=n.length;r<o;r+=3)G0(s,t,n[r],n[r+1],n[r+2],i[r],i[r+1],i[r+2]);break;default:throw new Error("illegal figure")}}class BI extends Ib{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 l=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-l,h=Math.ceil(this._bounds[3])-c,d=Math.min(Math.ceil(Math.abs(u*e[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(h*e[1]*1.1)),3e3),p=u/d,y=h/f,_={coords:this._coords,colors:this._colors,offsetX:-l,offsetY:-c,scaleX:1/p,scaleY:1/y},A=d+2*2,m=f+2*2,b=n.getCanvas("mesh",A,m),w=b.context,E=w.createImageData(d,f);if(t){const x=E.data;for(let C=0,P=x.length;C<P;C+=4)x[C]=t[0],x[C+1]=t[1],x[C+2]=t[2],x[C+3]=255}for(const x of this._figures)jI(E,x,_);return w.putImageData(E,2,2),{canvas:b.canvas,offsetX:l-2*p,offsetY:c-2*y,scaleX:p,scaleY:y}}isModifyingCurrentTransform(){return!0}getPattern(e,t,n,i){Rw(e,this._bbox);const r=new Float32Array(2);if(i===zt.SHADING)U.singularValueDecompose2dScale(Xe(e),r);else if(this.matrix){U.singularValueDecompose2dScale(this.matrix,r);const[l,c]=r;U.singularValueDecompose2dScale(t.baseTransform,r),r[0]*=l,r[1]*=c}else U.singularValueDecompose2dScale(t.baseTransform,r);const o=this._createMeshCanvas(r,i===zt.SHADING?null:this._background,t.cachedCanvases);return i!==zt.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(o.offsetX,o.offsetY),e.scale(o.scaleX,o.scaleY),e.createPattern(o.canvas,"no-repeat")}}class $I extends Ib{getPattern(){return"hotpink"}}function UI(s){switch(s[0]){case"RadialAxial":return new FI(s);case"Mesh":return new BI(s);case"Dummy":return new $I}throw new Error(`Unknown IR type: ${s[0]}`)}const D1={COLORED:1,UNCOLORED:2},_y=class _y{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,t){var V,X;const{bbox:n,operatorList:i,paintType:r,tilingType:o,color:l,canvasGraphicsFactory:c}=this;let{xstep:u,ystep:h}=this;u=Math.abs(u),h=Math.abs(h),e0("TilingType: "+o);const d=n[0],f=n[1],p=n[2],y=n[3],_=p-d,A=y-f,m=new Float32Array(2);U.singularValueDecompose2dScale(this.matrix,m);const[b,w]=m;U.singularValueDecompose2dScale(this.baseTransform,m);const E=b*m[0],k=w*m[1];let x=_,C=A,P=!1,R=!1;const L=Math.ceil(u*E),D=Math.ceil(h*k),F=Math.ceil(_*E),Y=Math.ceil(A*k);L>=F?x=u:P=!0,D>=Y?C=h:R=!0;const q=this.getSizeAndScale(x,this.ctx.canvas.width,E),oe=this.getSizeAndScale(C,this.ctx.canvas.height,k),z=e.cachedCanvases.getCanvas("pattern",q.size,oe.size),H=z.context,M=c.createCanvasGraphics(H,t);if(M.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(M,r,l),H.translate(-q.scale*d,-oe.scale*f),M.transform(0,q.scale,0,0,oe.scale,0,0),H.save(),(V=M.dependencyTracker)==null||V.save(),this.clipBbox(M,d,f,p,y),M.baseTransform=Xe(M.ctx),M.executeOperatorList(i),M.endDrawing(),(X=M.dependencyTracker)==null||X.restore(
150),H.restore(),P||R){const ye=z.canvas;P&&(x=u),R&&(C=h);const Q=this.getSizeAndScale(x,this.ctx.canvas.width,E),fe=this.getSizeAndScale(C,this.ctx.canvas.height,k),pt=Q.size,on=fe.size,Mt=e.cachedCanvases.getCanvas("pattern-workaround",pt,on),Be=Mt.context,i0=P?Math.floor(_/u):0,r0=R?Math.floor(A/h):0;for(let Rh=0;Rh<=i0;Rh++)for(let da=0;da<=r0;da++)Be.drawImage(ye,pt*Rh,on*da,pt,on,0,0,pt,on);return{canvas:Mt.canvas,scaleX:Q.scale,scaleY:fe.scale,offsetX:d,offsetY:f}}return{canvas:z.canvas,scaleX:q.scale,scaleY:oe.scale,offsetX:d,offsetY:f}}getSizeAndScale(e,t,n){const i=Math.max(_y.MAX_PATTERN_SIZE,t);let r=Math.ceil(e*n);return r>=i?r=i:n=r/e,{scale:n,size:r}}clipBbox(e,t,n,i,r){const o=i-t,l=r-n;e.ctx.rect(t,n,o,l),U.axialAlignedBoundingBox([t,n,i,r],Xe(e.ctx),e.current.minMax),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,n){const i=e.ctx,r=e.current;switch(t){case D1.COLORED:const{fillStyle:o,strokeStyle:l}=this.ctx;i.fillStyle=r.fillColor=o,i.strokeStyle=r.strokeColor=l;break;case D1.UNCOLORED:i.fillStyle=i.strokeStyle=n,r.fillColor=r.strokeColor=n;break;default:throw new eI(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,n,i,r){let o=n;i!==zt.SHADING&&(o=U.transform(o,t.baseTransform),this.matrix&&(o=U.transform(o,this.matrix)));const l=this.createPatternCanvas(t,r);let c=new DOMMatrix(o);c=c.translate(l.offsetX,l.offsetY),c=c.scale(1/l.scaleX,1/l.scaleY);const u=e.createPattern(l.canvas,"repeat");return u.setTransform(c),u}};I(_y,"MAX_PATTERN_SIZE",3e3);let Lw=_y;function zI({src:s,srcPos:e=0,dest:t,width:n,height:i,nonBlackColor:r=4294967295,inverseDecode:o=!1}){const l=Gt.isLittleEndian?4278190080:255,[c,u]=o?[r,l]:[l,r],h=n>>3,d=n&7,f=s.length;t=new Uint32Array(t.buffer);let p=0;for(let y=0;y<i;y++){for(const A=e+h;e<A;e++){const m=e<f?s[e]:255;t[p++]=m&128?u:c,t[p++]=m&64?u:c,t[p++]=m&32?u:c,t[p++]=m&16?u:c,t[p++]=m&8?u:c,t[p++]=m&4?u:c,t[p++]=m&2?u:c,t[p++]=m&1?u:c}if(d===0)continue;const _=e<f?s[e++]:255;for(let A=0;A<d;A++)t[p++]=_&1<<7-A?u:c}return{srcPos:e,destPos:p}}const M1=16,N1=100,HI=15,O1=10,Ln=16,q0=new DOMMatrix,rs=new Float32Array(2),Mc=new Float32Array([1/0,1/0,-1/0,-1/0]);function VI(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,r,o,l){e.transform(t,n,i,r,o,l),this.__originalTransform(t,n,i,r,o,l)},s.setTransform=function(t,n,i,r,o,l){e.setTransform(t,n,i,r,o,l),this.__originalSetTransform(t,n,i,r,o,l)},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,r,o,l){e.bezierCurveTo(t,n,i,r,o,l),this.__originalBezierCurveTo(t,n,i,r,o,l)},s.rect=function(t,n,i,r){e.rect(t,n,i,r),this.__originalRect(t,n,i,r)},s.closePath=function(){e.closePath(),this.__originalClosePath()},s.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class WI{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 Pg(s,e,t,n,i,r,o,l,c,u){const[h,d,f,p,y,_]=Xe(s);if(d===0&&f===0){const b=o*h+y,w=Math.round(b),E=l*p+_,k=Math.round(E),x=(o+c)*h+y,C=Math.abs(Math.round(x)-w)||1,P=(l+u)*p+_,R=Math.abs(Math.round(P)-k)||1;return s.setTransform(Math.sign(h),0,0,Math.sign(p),w,k),s.drawImage(e,t,n,i,r,0,0,C,R),s.setTransform(h,d,f,p,y,_),[C,R]}if(h===0&&p===0){const b=l*f+y,w=Math.round(b),E=o*d+_,k=Math.round(E),x=(l+u)*f+y,C=Math.abs(Math.round(x)-w)||1,P=(o+c)*d+_,R=Math.abs(Math.round(P)-k)||1;return s.setTransform(0,Math.sign(d),Math.sign(f),0,w,k),s.drawImage(e,t,n,i,r,0,0,R,C),s.setTransform(h,d,f,p,y,_),[R,C]}s.drawImage(e,t,n,i,r,o,l,c,u);const A=Math.hypot(h,d),m=Math.hypot(f,p);return[A*c,m*u]}class F1{constructor(e,t,n){I(this,"alphaIsShape",!1);I(this,"fontSize",0);I(this,"fontSizeScale",1);I(this,"textMatrix",null);I(this,"textMatrixScale",1);I(this,"fontMatrix",ew);I(this,"leading",0);I(this,"x",0);I(this,"y",0);I(this,"lineX",0);I(this,"lineY",0);I(this,"charSpacing",0);I(this,"wordSpacing",0);I(this,"textHScale",1);I(this,"textRenderingMode",Nt.FILL);I(this,"textRise",0);I(this,"fillColor","#000000");I(this,"strokeColor","#000000");I(this,"patternFill",!1);I(this,"patternStroke",!1);I(this,"fillAlpha",1);I(this,"strokeAlpha",1);I(this,"lineWidth",1);I(this,"activeSMask",null);I(this,"transferMaps","none");n==null||n(this),this.clipBox=new Float32Array([0,0,e,t]),this.minMax=Mc.slice()}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e}getPathBoundingBox(e=zt.FILL,t=null){const n=this.minMax.slice();if(e===zt.STROKE){t||Ie("Stroke bounding box must include transform."),U.singularValueDecompose2dScale(t,rs);const i=rs[0]*this.lineWidth/2,r=rs[1]*this.lineWidth/2;n[0]-=i,n[1]-=r,n[2]+=i,n[3]+=r}return n}updateClipFromPath(){const e=U.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(Mc,0)}getClippedPathBoundingBox(e=zt.FILL,t=null){return U.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function j1(s,e){if(e instanceof ImageData){s.putImageData(e,0,0);return}const t=e.height,n=e.width,i=t%Ln,r=(t-i)/Ln,o=i===0?r:r+1,l=s.createImageData(n,Ln);let c=0,u;const h=e.data,d=l.data;let f,p,y,_;if(e.kind===Wg.GRAYSCALE_1BPP){const A=h.byteLength,m=new Uint32Array(d.buffer,0,d.byteLength>>2),b=m.length,w=n+7>>3,E=4294967295,k=Gt.isLittleEndian?4278190080:255;for(f=0;f<o;f++){for(y=f<r?Ln:i,u=0,p=0;p<y;p++){const x=A-c;let C=0;const P=x>w?n:x*8-7,R=P&-8;let L=0,D=0;for(;C<R;C+=8)D=h[c++],m[u++]=D&128?E:k,m[u++]=D&64?E:k,m[u++]=D&32?E:k,m[u++]=D&16?E:k,m[u++]=D&8?E:k,m[u++]=D&4?E:k,m[u++]=D&2?E:k,m[u++]=D&1?E:k;for(;C<P;C++)L===0&&(D=h[c++],L=128),m[u++]=D&L?E:k,L>>=1}for(;u<b;)m[u++]=0;s.putImageData(l,0,f*Ln)}}else if(e.kind===Wg.RGBA_32BPP){for(p=0,_=n*Ln*4,f=0;f<r;f++)d.set(h.subarray(c,c+_)),c+=_,s.putImageData(l,0,p),p+=Ln;f<o&&(_=n*i*4,d.set(h.subarray(c,c+_)),s.putImageData(l,0,p))}else if(e.kind===Wg.RGB_24BPP)for(y=Ln,_=n*y,f=0;f<o;f++){for(f>=r&&(y=i,_=n*y),u=0,p=_;p--;)d[u++]=h[c++],d[u++]=h[c++],d[u++]=h[c++],d[u++]=255;s.putImageData(l,0,f*Ln)}else throw new Error(`bad image kind: ${e.kind}`)}function B1(s,e){if(e.bitmap){s.drawImage(e.bitmap,0,0);return}const t=e.height,n=e.width,i=t%Ln,r=(t-i)/Ln,o=i===0?r:r+1,l=s.createImageData(n,Ln);let c=0;const u=e.data,h=l.data;for(let d=0;d<o;d++){const f=d<r?Ln:i;({srcPos:c}=zI({src:u,srcPos:c,dest:h,width:n,height:f,nonBlackColor:0})),s.putImageData(l,0,d*Ln)}}function Uh(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 Rg(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.set
150LineDash!==void 0&&(s.setLineDash([]),s.lineDashOffset=0);const{filter:e}=s;e!=="none"&&e!==""&&(s.filter="none")}function $1(s,e){if(e)return!0;U.singularValueDecompose2dScale(s,rs);const t=Math.fround($i.pixelRatio*oa.PDF_TO_CSS_UNITS);return rs[0]<=t&&rs[1]<=t}const GI=["butt","round","square"],qI=["miter","round","bevel"],XI={},U1={};var li,Iw,Dw,Mw;const Ub=class Ub{constructor(e,t,n,i,r,{optionalContentConfig:o,markedContentStack:l=null},c,u,h){v(this,li);this.ctx=e,this.current=new F1(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=r,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=l||[],this.optionalContentConfig=o,this.cachedCanvases=new WI(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=h??null}getObject(e,t,n=null){var i;return typeof t=="string"?((i=this.dependencyTracker)==null||i.recordNamedDependency(e,t),t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t)):n}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:i=null}){const r=this.ctx.canvas.width,o=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,r,o),this.ctx.fillStyle=l,n){const c=this.cachedCanvases.getCanvas("transparent",r,o);this.compositeCtx=this.ctx,this.transparentCanvas=c.canvas,this.ctx=c.context,this.ctx.save(),this.ctx.transform(...Xe(this.compositeCtx))}this.ctx.save(),Rg(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=Xe(this.ctx)}executeOperatorList(e,t,n,i,r){var m;const o=e.argsArray,l=e.fnArray;let c=t||0;const u=o.length;if(u===c)return c;const h=u-c>O1&&typeof n=="function",d=h?Date.now()+HI:0;let f=0;const p=this.commonObjs,y=this.objs;let _,A;for(;;){if(i!==void 0&&c===i.nextBreakPoint)return i.breakIt(c,n),c;if(!r||r(c))if(_=l[c],A=o[c]??null,_!==Xd.dependency)A===null?this[_](c):this[_](c,...A);else for(const b of A){(m=this.dependencyTracker)==null||m.recordNamedData(b,c);const w=b.startsWith("g_")?p:y;if(!w.has(b))return w.get(b,n),c}if(c++,c===u)return c;if(h&&++f>O1){if(Date.now()>d)return n(),c;f=0}}}endDrawing(){S(this,li,Iw).call(this),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(),S(this,li,Dw).call(this)}_scaleImage(e,t){const n=e.width??e.displayWidth,i=e.height??e.displayHeight;let r=Math.max(Math.hypot(t[0],t[1]),1),o=Math.max(Math.hypot(t[2],t[3]),1),l=n,c=i,u="prescale1",h,d;for(;r>2&&l>1||o>2&&c>1;){let f=l,p=c;r>2&&l>1&&(f=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),r/=l/f),o>2&&c>1&&(p=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,o/=c/p),h=this.cachedCanvases.getCanvas(u,f,p),d=h.context,d.clearRect(0,0,f,p),d.drawImage(e,0,0,l,c,0,0,f,p),e=h.canvas,l=f,c=p,u=u==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:c}}_createMaskCanvas(e,t){var L,D;const n=this.ctx,{width:i,height:r}=t,o=this.current.fillColor,l=this.current.patternFill,c=Xe(n);let u,h,d,f;if((t.bitmap||t.data)&&t.count>1){const F=t.bitmap||t.data.buffer;h=JSON.stringify(l?c:[c.slice(0,4),o]),u=this._cachedBitmapsMap.get(F),u||(u=new Map,this._cachedBitmapsMap.set(F,u));const Y=u.get(h);if(Y&&!l){const q=Math.round(Math.min(c[0],c[2])+c[4]),oe=Math.round(Math.min(c[1],c[3])+c[5]);return(L=this.dependencyTracker)==null||L.recordDependencies(e,ps.transformAndFill),{canvas:Y,offsetX:q,offsetY:oe}}d=Y}d||(f=this.cachedCanvases.getCanvas("maskCanvas",i,r),B1(f.context,t));let p=U.transform(c,[1/i,0,0,-1/r,0,0]);p=U.transform(p,[1,0,0,1,0,-r]);const y=Mc.slice();U.axialAlignedBoundingBox([0,0,i,r],p,y);const[_,A,m,b]=y,w=Math.round(m-_)||1,E=Math.round(b-A)||1,k=this.cachedCanvases.getCanvas("fillCanvas",w,E),x=k.context,C=_,P=A;x.translate(-C,-P),x.transform(...p),d||(d=this._scaleImage(f.canvas,ui(x)),d=d.img,u&&l&&u.set(h,d)),x.imageSmoothingEnabled=$1(Xe(x),t.interpolate),Pg(x,d,0,0,d.width,d.height,0,0,i,r),x.globalCompositeOperation="source-in";const R=U.transform(ui(x),[1,0,0,1,-C,-P]);return x.fillStyle=l?o.getPattern(n,this,R,zt.FILL,e):o,x.fillRect(0,0,i,r),u&&!l&&(this.cachedCanvases.delete("fillCanvas"),u.set(h,k.canvas)),(D=this.dependencyTracker)==null||D.recordDependencies(e,ps.transformAndFill),{canvas:k.canvas,offsetX:Math.round(C),offsetY:Math.round(P)}}setLineWidth(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("lineWidth",e),t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("lineCap",e),this.ctx.lineCap=GI[t]}setLineJoin(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("lineJoin",e),this.ctx.lineJoin=qI[t]}setMiterLimit(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("miterLimit",e),this.ctx.miterLimit=t}setDash(e,t,n){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("dash",e);const i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=n)}
150setRenderingIntent(e,t){}setFlatness(e,t){}setGState(e,t){var n,i,r,o,l;for(const[c,u]of t)switch(c){case"LW":this.setLineWidth(e,u);break;case"LC":this.setLineCap(e,u);break;case"LJ":this.setLineJoin(e,u);break;case"ML":this.setMiterLimit(e,u);break;case"D":this.setDash(e,u[0],u[1]);break;case"RI":this.setRenderingIntent(e,u);break;case"FL":this.setFlatness(e,u);break;case"Font":this.setFont(e,u[0],u[1]);break;case"CA":(n=this.dependencyTracker)==null||n.recordSimpleData("strokeAlpha",e),this.current.strokeAlpha=u;break;case"ca":(i=this.dependencyTracker)==null||i.recordSimpleData("fillAlpha",e),this.ctx.globalAlpha=this.current.fillAlpha=u;break;case"BM":(r=this.dependencyTracker)==null||r.recordSimpleData("globalCompositeOperation",e),this.ctx.globalCompositeOperation=u;break;case"SMask":(o=this.dependencyTracker)==null||o.recordSimpleData("SMask",e),this.current.activeSMask=u?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":(l=this.dependencyTracker)==null||l.recordSimpleData("filter",e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(u);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(e){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,n=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,r=this.cachedCanvases.getCanvas(i,t,n);this.suspendedCtx=this.ctx;const o=this.ctx=r.context;o.setTransform(this.suspendedCtx.getTransform()),Uh(this.suspendedCtx,o),VI(o,this.suspendedCtx),this.setGState(e,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Uh(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 r=i[0],o=i[1],l=i[2]-r,c=i[3]-o;l===0||c===0||(this.genericComposeSMask(t.context,n,l,c,t.subtype,t.backdrop,t.transferMap,r,o,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,r,o,l,c,u,h,d){let f=e.canvas,p=c-h,y=u-d;if(o)if(p<0||y<0||p+n>f.width||y+i>f.height){const A=this.cachedCanvases.getCanvas("maskExtension",n,i),m=A.context;m.drawImage(f,-p,-y),m.globalCompositeOperation="destination-atop",m.fillStyle=o,m.fillRect(0,0,n,i),m.globalCompositeOperation="source-over",f=A.canvas,p=y=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const A=new Path2D;A.rect(p,y,n,i),e.clip(A),e.globalCompositeOperation="destination-atop",e.fillStyle=o,e.fillRect(p,y,n,i),e.restore()}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),r==="Alpha"&&l?t.filter=this.filterFactory.addAlphaFilter(l):r==="Luminosity"&&(t.filter=this.filterFactory.addLuminosityFilter(l));const _=new Path2D;_.rect(c,u,n,i),t.clip(_),t.globalCompositeOperation="destination-in",t.drawImage(f,p,y,n,i,c,u,n,i),t.restore()}save(e){var n;this.inSMaskMode&&Uh(this.ctx,this.suspendedCtx),this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone(),(n=this.dependencyTracker)==null||n.save(e)}restore(e){var t;if((t=this.dependencyTracker)==null||t.restore(e),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&Uh(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,t,n,i,r,o,l){var c;(c=this.dependencyTracker)==null||c.recordIncrementalData("transform",e),this.ctx.transform(t,n,i,r,o,l),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n,i){let[r]=n;if(!i){r||(r=n[0]=new Path2D),this[t](e,r);return}if(this.dependencyTracker!==null){const o=t===Xd.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,i[0]-o,i[2]+o,i[1]-o,i[3]+o).recordDependencies(e,["transform"])}r instanceof Path2D||(r=n[0]=Fx(r)),U.axialAlignedBoundingBox(i,Xe(this.ctx),this.current.minMax),this[t](e,r),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,t,n=!0){var o;const i=this.ctx,r=this.current.strokeColor;if(i.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof r=="object"&&(r!=null&&r.getPattern)){const l=r.isModifyingCurrentTransform()?i.getTransform():null;if(i.save(),i.strokeStyle=r.getPattern(i,this,ui(i),zt.STROKE,e),l){const c=new Path2D;c.addPath(t,i.getTransform().invertSelf().multiplySelf(l)),t=c}
150this.rescaleAndStroke(t,!1),i.restore()}else this.rescaleAndStroke(t,!0);(o=this.dependencyTracker)==null||o.recordDependencies(e,ps.stroke),n&&this.consumePath(e,t,this.current.getClippedPathBoundingBox(zt.STROKE,Xe(this.ctx))),i.globalAlpha=this.current.fillAlpha}closeStroke(e,t){this.stroke(e,t)}fill(e,t,n=!0){var u,h,d;const i=this.ctx,r=this.current.fillColor,o=this.current.patternFill;let l=!1;if(o){const f=r.isModifyingCurrentTransform()?i.getTransform():null;if((u=this.dependencyTracker)==null||u.save(e),i.save(),i.fillStyle=r.getPattern(i,this,ui(i),zt.FILL,e),f){const p=new Path2D;p.addPath(t,i.getTransform().invertSelf().multiplySelf(f)),t=p}l=!0}const c=this.current.getClippedPathBoundingBox();this.contentVisible&&c!==null&&(this.pendingEOFill?(i.fill(t,"evenodd"),this.pendingEOFill=!1):i.fill(t)),(h=this.dependencyTracker)==null||h.recordDependencies(e,ps.fill),l&&(i.restore(),(d=this.dependencyTracker)==null||d.restore(e)),n&&this.consumePath(e,t,c)}eoFill(e,t){this.pendingEOFill=!0,this.fill(e,t)}fillStroke(e,t){this.fill(e,t,!1),this.stroke(e,t,!1),this.consumePath(e,t)}eoFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}closeFillStroke(e,t){this.fillStroke(e,t)}closeEOFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}endPath(e,t){this.consumePath(e,t)}rawFillPath(e,t){var n;this.ctx.fill(t),(n=this.dependencyTracker)==null||n.recordDependencies(e,ps.rawFillPath).recordOperation(e)}clip(e){var t;(t=this.dependencyTracker)==null||t.recordFutureForcedDependency("clipMode",e),this.pendingClip=XI}eoClip(e){var t;(t=this.dependencyTracker)==null||t.recordFutureForcedDependency("clipMode",e),this.pendingClip=U1}beginText(e){var t;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,(t=this.dependencyTracker)==null||t.recordOpenMarker(e).resetIncrementalData("sameLineText").resetIncrementalData("moveText",e)}endText(e){const t=this.pendingTextPaths,n=this.ctx;if(this.dependencyTracker){const{dependencyTracker:i}=this;t!==void 0&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",e),i.recordCloseMarker(e)}if(t!==void 0){const i=new Path2D,r=n.getTransform().invertSelf();for(const{transform:o,x:l,y:c,fontSize:u,path:h}of t)h&&i.addPath(h,new DOMMatrix(o).preMultiplySelf(r).translate(l,c).scale(u,-u));n.clip(i)}delete this.pendingTextPaths}setCharSpacing(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("charSpacing",e),this.current.charSpacing=t}setWordSpacing(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("wordSpacing",e),this.current.wordSpacing=t}setHScale(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("hScale",e),this.current.textHScale=t/100}setLeading(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("leading",e),this.current.leading=-t}setFont(e,t,n){var d,f;(d=this.dependencyTracker)==null||d.recordSimpleData("font",e).recordSimpleDataFromNamed("fontObj",t,e);const i=this.commonObjs.get(t),r=this.current;if(!i)throw new Error(`Can't find font for ${t}`);if(r.fontMatrix=i.fontMatrix||ew,(r.fontMatrix[0]===0||r.fontMatrix[3]===0)&&J("Invalid font matrix for font "+t),n<0?(n=-n,r.fontDirection=-1):r.fontDirection=1,this.current.font=i,this.current.fontSize=n,i.isType3Font)return;const o=i.loadedName||"sans-serif",l=((f=i.systemFontInfo)==null?void 0:f.css)||`"${o}", ${i.fallbackName}`;let c="normal";i.black?c="900":i.bold&&(c="bold");const u=i.italic?"italic":"normal";let h=n;n<M1?h=M1:n>N1&&(h=N1),this.current.fontSizeScale=n/h,this.ctx.font=`${u} ${c} ${h}px ${l}`}setTextRenderingMode(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("textRenderingMode",e),this.current.textRenderingMode=t}setTextRise(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("textRise",e),this.current.textRise=t}moveText(e,t,n){var i;(i=this.dependencyTracker)==null||i.resetIncrementalData("sameLineText").recordIncrementalData("moveText",e),this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=n}setLeadingMoveText(e,t,n){this.setLeading(e,-n),this.moveText(e,t,n)}setTextMatrix(e,t){var i;(i=this.dependencyTracker)==null||i.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",e);const{current:n}=this;n.textMatrix=t,n.textMatrixScale=Math.hypot(t[0],t[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(e){var t;this.moveText(e,0,this.current.leading),(t=this.dependencyTracker)==null||t.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??e)}paintChar(e,t,n,i,r,o){var m,b,w,E;
150const l=this.ctx,c=this.current,u=c.font,h=c.textRenderingMode,d=c.fontSize/c.fontSizeScale,f=h&Nt.FILL_STROKE_MASK,p=!!(h&Nt.ADD_TO_PATH_FLAG),y=c.patternFill&&!u.missingFile,_=c.patternStroke&&!u.missingFile;let A;if((u.disableFontFace||p||y||_)&&!u.missingFile&&(A=u.getPathGenerator(this.commonObjs,t)),A&&(u.disableFontFace||y||_)){l.save(),l.translate(n,i),l.scale(d,-d),(m=this.dependencyTracker)==null||m.recordCharacterBBox(e,l,u);let k;if(f===Nt.FILL||f===Nt.FILL_STROKE)if(r){k=l.getTransform(),l.setTransform(...r);const x=S(this,li,Mw).call(this,A,k,r);l.fill(x)}else l.fill(A);if(f===Nt.STROKE||f===Nt.FILL_STROKE)if(o){k||(k=l.getTransform()),l.setTransform(...o);const{a:x,b:C,c:P,d:R}=k,L=U.inverseTransform(o),D=U.transform([x,C,P,R,0,0],L);U.singularValueDecompose2dScale(D,rs),l.lineWidth*=Math.max(rs[0],rs[1])/d,l.stroke(S(this,li,Mw).call(this,A,k,o))}else l.lineWidth/=d,l.stroke(A);l.restore()}else(f===Nt.FILL||f===Nt.FILL_STROKE)&&(l.fillText(t,n,i),(b=this.dependencyTracker)==null||b.recordCharacterBBox(e,l,u,d,n,i,()=>l.measureText(t))),(f===Nt.STROKE||f===Nt.FILL_STROKE)&&(this.dependencyTracker&&((w=this.dependencyTracker)==null||w.recordCharacterBBox(e,l,u,d,n,i,()=>l.measureText(t)).recordDependencies(e,ps.stroke)),l.strokeText(t,n,i));p&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Xe(l),x:n,y:i,fontSize:d,path:A}),(E=this.dependencyTracker)==null||E.recordCharacterBBox(e,l,u,d,n,i))}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 se(this,"isFontSubpixelAAEnabled",n)}showText(e,t){var P,R,L,D;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,ps.showText).resetBBox(e),this.current.textRenderingMode&Nt.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",e).inheritPendingDependenciesAsFutureForcedDependencies());const n=this.current,i=n.font;if(i.isType3Font){this.showType3Text(e,t),(P=this.dependencyTracker)==null||P.recordShowTextOperation(e);return}const r=n.fontSize;if(r===0){(R=this.dependencyTracker)==null||R.recordOperation(e);return}const o=this.ctx,l=n.fontSizeScale,c=n.charSpacing,u=n.wordSpacing,h=n.fontDirection,d=n.textHScale*h,f=t.length,p=i.vertical,y=p?1:-1,_=i.defaultVMetrics,A=r*n.fontMatrix[0],m=n.textRenderingMode===Nt.FILL&&!i.disableFontFace&&!n.patternFill;o.save(),n.textMatrix&&o.transform(...n.textMatrix),o.translate(n.x,n.y+n.textRise),h>0?o.scale(d,-1):o.scale(d,1);let b,w;if(n.patternFill){o.save();const F=n.fillColor.getPattern(o,this,ui(o),zt.FILL,e);b=Xe(o),o.restore(),o.fillStyle=F}if(n.patternStroke){o.save();const F=n.strokeColor.getPattern(o,this,ui(o),zt.STROKE,e);w=Xe(o),o.restore(),o.strokeStyle=F}let E=n.lineWidth;const k=n.textMatrixScale;if(k===0||E===0){const F=n.textRenderingMode&Nt.FILL_STROKE_MASK;(F===Nt.STROKE||F===Nt.FILL_STROKE)&&(E=this.getSinglePixelWidth())}else E/=k;if(l!==1&&(o.scale(l,l),E/=l),o.lineWidth=E,i.isInvalidPDFjsFont){const F=[];let Y=0;for(const oe of t)F.push(oe.unicode),Y+=oe.width;const q=F.join("");if(o.fillText(q,0,0),this.dependencyTracker!==null){const oe=o.measureText(q);this.dependencyTracker.recordBBox(e,this.ctx,-oe.actualBoundingBoxLeft,oe.actualBoundingBoxRight,-oe.actualBoundingBoxAscent,oe.actualBoundingBoxDescent).recordShowTextOperation(e)}n.x+=Y*A*d,o.restore(),this.compose();return}let x=0,C;for(C=0;C<f;++C){const F=t[C];if(typeof F=="number"){x+=y*F*r/1e3;continue}let Y=!1;const q=(F.isSpace?u:0)+c,oe=F.fontChar,z=F.accent;let H,M,V=F.width;if(p){const Q=F.vmetric||_,fe=-(F.vmetric?Q[1]:V*.5)*A,pt=Q[2]*A;V=Q?-Q[0]:V,H=fe/l,M=(x+pt)/l}else H=x/l,M=0;let X;if(i.remeasure&&V>0){X=o.measureText(oe);const Q=X.width*1e3/r*l;if(V<Q&&this.isFontSubpixelAAEnabled){const fe=V/Q;Y=!0,o.save(),o.scale(fe,1),H/=fe}else V!==Q&&(H+=(V-Q)/2e3*r/l)}if(this.contentVisible&&(F.isInFont||i.missingFile)){if(m&&!z)o.fillText(oe,H,M),(L=this.dependencyTracker)==null||L.recordCharacterBBox(e,o,X?{bbox:null}:i,r/l,H,M,()=>X??o.measureText(oe));else if(this.paintChar(e,oe,H,M,b,w),z){const Q=H+r*z.offset.x/l,fe=M-r*z.offset.y/l;this.paintChar(e,z.fontChar,Q,fe,b,w)}}const ye=p?V*A-q*h:V*A+q*h;
150x+=ye,Y&&o.restore()}p?n.y-=x:n.x+=x*d,o.restore(),this.compose(),(D=this.dependencyTracker)==null||D.recordShowTextOperation(e)}showType3Text(e,t){const n=this.ctx,i=this.current,r=i.font,o=i.fontSize,l=i.fontDirection,c=r.vertical?1:-1,u=i.charSpacing,h=i.wordSpacing,d=i.textHScale*l,f=i.fontMatrix||ew,p=t.length,y=i.textRenderingMode===Nt.INVISIBLE;let _,A,m,b;if(y||o===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),i.textMatrix&&n.transform(...i.textMatrix),n.translate(i.x,i.y+i.textRise),n.scale(d,l);const w=this.dependencyTracker;for(this.dependencyTracker=w?new ry(w,e):null,_=0;_<p;++_){if(A=t[_],typeof A=="number"){b=c*A*o/1e3,this.ctx.translate(b,0),i.x+=b*d;continue}const E=(A.isSpace?h:0)+u,k=r.charProcOperatorList[A.operatorListId];k?this.contentVisible&&(this.save(),n.scale(o,o),n.transform(...f),this.executeOperatorList(k),this.restore()):J(`Type3 character "${A.operatorListId}" is not available.`);const x=[A.width,0];U.applyTransform(x,f),m=x[0]*o+E,n.translate(m,0),i.x+=m*d}n.restore(),w&&(this.dependencyTracker=w)}setCharWidth(e,t,n){}setCharWidthAndBounds(e,t,n,i,r,o,l){var u;const c=new Path2D;c.rect(i,r,o-i,l-r),this.ctx.clip(c),(u=this.dependencyTracker)==null||u.recordBBox(e,this.ctx,i,o,r,l).recordClipBox(e,this.ctx,i,o,r,l),this.endPath(e)}getColorN_Pattern(e,t){let n;if(t[0]==="TilingPattern"){const i=this.baseTransform||Xe(this.ctx),r={createCanvasGraphics:(o,l)=>new Ub(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new ry(this.dependencyTracker,l,!0):null)};n=new Lw(t,this.ctx,r,i)}else n=this._getPattern(e,t[1],t[2]);return n}setStrokeColorN(e,...t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("strokeColor",e),this.current.strokeColor=this.getColorN_Pattern(e,t),this.current.patternStroke=!0}setFillColorN(e,...t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("fillColor",e),this.current.fillColor=this.getColorN_Pattern(e,t),this.current.patternFill=!0}setStrokeRGBColor(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor=t,this.current.patternStroke=!1}
150setStrokeTransparent(e){var t;(t=this.dependencyTracker)==null||t.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,t){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor=t,this.current.patternFill=!1}setFillTransparent(e){var t;(t=this.dependencyTracker)==null||t.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,t,n=null){let i;return this.cachedPatterns.has(t)?i=this.cachedPatterns.get(t):(i=UI(this.getObject(e,t)),this.cachedPatterns.set(t,i)),n&&(i.matrix=n),i}shadingFill(e,t){var o;if(!this.contentVisible)return;const n=this.ctx;this.save(e);const i=this._getPattern(e,t);n.fillStyle=i.getPattern(n,this,ui(n),zt.SHADING,e);const r=ui(n);if(r){const{width:l,height:c}=n.canvas,u=Mc.slice();U.axialAlignedBoundingBox([0,0,l,c],r,u);const[h,d,f,p]=u;this.ctx.fillRect(h,d,f-h,p-d)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);(o=this.dependencyTracker)==null||o.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,ps.transform).recordDependencies(e,ps.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e)}beginInlineImage(){Ie("Should not call beginInlineImage")}beginImageData(){Ie("Should not call beginImageData")}paintFormXObjectBegin(e,t,n){var i;if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),t&&this.transform(e,...t),this.baseTransform=Xe(this.ctx),n)){U.axialAlignedBoundingBox(n,this.baseTransform,this.current.minMax);const[r,o,l,c]=n,u=new Path2D;u.rect(r,o,l-r,c-o),this.ctx.clip(u),(i=this.dependencyTracker)==null||i.recordClipBox(e,this.ctx,r,l,o,c),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,t){var w;if(!this.contentVisible)return;this.save(e),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const n=this.ctx;t.isolated||e0("TODO: Support non-isolated groups."),t.knockout&&J("Knockout groups not supported.");const i=Xe(n);if(t.matrix&&n.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let r=Mc.slice();U.axialAlignedBoundingBox(t.bbox,Xe(n),r);const o=[0,0,n.canvas.width,n.canvas.height];r=U.intersect(r,o)||[0,0,0,0];const l=Math.floor(r[0]),c=Math.floor(r[1]),u=Math.max(Math.ceil(r[2])-l,1),h=Math.max(Math.ceil(r[3])-c,1);this.current.startNewPathAndClipBox([0,0,u,h]);let d="groupAt"+this.groupLevel;t.smask&&(d+="_smask_"+this.smaskCounter++%2);const f=this.cachedCanvases.getCanvas(d,u,h),p=f.context;p.translate(-l,-c),p.transform(...i);let y=new Path2D;const[_,A,m,b]=t.bbox;if(y.rect(_,A,m-_,b-A),t.matrix){const E=new Path2D;E.addPath(y,new DOMMatrix(t.matrix)),y=E}p.clip(y),t.smask&&this.smaskStack.push({canvas:f.canvas,context:p,offsetX:l,offsetY:c,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}),(!t.smask||this.dependencyTracker)&&(n.setTransform(1,0,0,1,0,0),n.translate(l,c),n.save()),Uh(n,p),this.ctx=p,(w=this.dependencyTracker)==null||w.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(n),this.setGState(e,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(n),this.groupLevel++}endGroup(e,t){var r;if(!this.contentVisible)return;this.groupLevel--;const n=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,(r=this.dependencyTracker)==null||r.popBaseTransform(),t.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();const o=Xe(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...o);const l=Mc.slice();U.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],o,l),this.ctx.drawImage(n.canvas,0,0),this.ctx.restore(),this.compose(l)}}beginAnnotation(e,t,n,i,r,o){if(S(this,li,Iw).call(this),Rg(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),n){const l=n[2]-n[0],c=n[3]-n[1];if(o&&this.annotationCanvasMap){i=i.slice(),i[4]-=n[0],i[5]-=n[1],n=n.slice(),n[0]=n[1]=0,n[2]=l,n[3]=c,U.singularValueDecompose2dScale(Xe(this.ctx),rs);const{viewportScale:u}=this,h=Math.ceil(l*this.outputScaleX*u),d=Math.ceil(c*this.outputScaleY*u);this.annotationCanvas=this.canvasFactory.create(h,d);const{canvas:f,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(t,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(rs[0],0,0,-rs[1],0,c*rs[1]),Rg(this.ctx)}else{Rg(this.ctx),this.endPath(e);const u=new Path2D;u.rect(n[0],n[1],l,c),this.ctx.clip(u)}}
150this.current=new F1(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(e,...i),this.transform(e,...r)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),S(this,li,Dw).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e,t){var l;if(!this.contentVisible)return;const n=t.count;t=this.getObject(e,t.data,t),t.count=n;const i=this.ctx,r=this._createMaskCanvas(e,t),o=r.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(o,r.offsetX,r.offsetY),(l=this.dependencyTracker)==null||l.resetBBox(e).recordBBox(e,this.ctx,r.offsetX,r.offsetX+o.width,r.offsetY,r.offsetY+o.height).recordOperation(e),i.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,n,i=0,r=0,o,l){var d,f,p;if(!this.contentVisible)return;t=this.getObject(e,t.data,t);const c=this.ctx;c.save();const u=Xe(c);c.transform(n,i,r,o,0,0);const h=this._createMaskCanvas(e,t);c.setTransform(1,0,0,1,h.offsetX-u[4],h.offsetY-u[5]),(d=this.dependencyTracker)==null||d.resetBBox(e);for(let y=0,_=l.length;y<_;y+=2){const A=U.transform(u,[n,i,r,o,l[y],l[y+1]]);c.drawImage(h.canvas,A[4],A[5]),(f=this.dependencyTracker)==null||f.recordBBox(e,this.ctx,A[4],A[4]+h.canvas.width,A[5],A[5]+h.canvas.height)}c.restore(),this.compose(),(p=this.dependencyTracker)==null||p.recordOperation(e)}paintImageMaskXObjectGroup(e,t){var o,l,c;if(!this.contentVisible)return;const n=this.ctx,i=this.current.fillColor,r=this.current.patternFill;(o=this.dependencyTracker)==null||o.resetBBox(e).recordDependencies(e,ps.transformAndFill);for(const u of t){const{data:h,width:d,height:f,transform:p}=u,y=this.cachedCanvases.getCanvas("maskCanvas",d,f),_=y.context;_.save();const A=this.getObject(e,h,u);B1(_,A),_.globalCompositeOperation="source-in",_.fillStyle=r?i.getPattern(_,this,ui(n),zt.FILL,e):i,_.fillRect(0,0,d,f),_.restore(),n.save(),n.transform(...p),n.scale(1,-1),Pg(n,y.canvas,0,0,d,f,0,-1,1,1),(l=this.dependencyTracker)==null||l.recordBBox(e,n,0,d,0,f),n.restore()}this.compose(),(c=this.dependencyTracker)==null||c.recordOperation(e)}paintImageXObject(e,t){if(!this.contentVisible)return;const n=this.getObject(e,t);if(!n){J("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e,n)}paintImageXObjectRepeat(e,t,n,i,r){if(!this.contentVisible)return;const o=this.getObject(e,t);if(!o){J("Dependent image isn't ready yet");return}const l=o.width,c=o.height,u=[];for(let h=0,d=r.length;h<d;h+=2)u.push({transform:[n,0,0,i,r[h],r[h+1]],x:0,y:0,w:l,h:c});this.paintInlineImageXObjectGroup(e,o,u)}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,r=this.cachedCanvases.getCanvas("inlineImage",n,i),o=r.context;return o.filter=this.current.transferMaps,o.drawImage(t,0,0),o.filter="none",r.canvas}paintInlineImageXObject(e,t){var u;if(!this.contentVisible)return;const n=t.width,i=t.height,r=this.ctx;this.save(e);const{filter:o}=r;o!=="none"&&o!==""&&(r.filter="none"),r.scale(1/n,-1/i);let l;if(t.bitmap)l=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)l=t;else{const d=this.cachedCanvases.getCanvas("inlineImage",n,i).context;j1(d,t),l=this.applyTransferMapsToCanvas(d)}const c=this._scaleImage(l,ui(r));r.imageSmoothingEnabled=$1(Xe(r),t.interpolate),(u=this.dependencyTracker)==null||u.resetBBox(e).recordBBox(e,r,0,n,-i,0).recordDependencies(e,ps.imageXObject).recordOperation(e),Pg(r,c.img,0,0,c.paintWidth,c.paintHeight,0,-i,n,i),this.compose(),this.restore(e)}paintInlineImageXObjectGroup(e,t,n){var o,l,c;if(!this.contentVisible)return;const i=this.ctx;let r;if(t.bitmap)r=t.bitmap;else{const u=t.width,h=t.height,f=this.cachedCanvases.getCanvas("inlineImage",u,h).context;j1(f,t),r=this.applyTransferMapsToCanvas(f)}(o=this.dependencyTracker)==null||o.resetBBox(e);for(const u of n)i.save(),i.transform(...u.transform),i.scale(1,-1),Pg(i,r,u.x,u.y,u.w,u.h,0,-1,1,1),(l=this.dependencyTracker)==null||l.recordBBox(e,i,0,1,-1,0),i.restore(
150);(c=this.dependencyTracker)==null||c.recordOperation(e),this.compose()}paintSolidColorImageMask(e){var t;this.contentVisible&&((t=this.dependencyTracker)==null||t.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,ps.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e,t){}markPointProps(e,t,n){}beginMarkedContent(e,t){var n;(n=this.dependencyTracker)==null||n.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t,n){var i;(i=this.dependencyTracker)==null||i.beginMarkedContent(e),t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(n)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(e){var t;(t=this.dependencyTracker)==null||t.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,t,n){var o,l;const i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(n);const r=this.ctx;this.pendingClip?(i||(this.pendingClip===U1?r.clip(t,"evenodd"):r.clip(t)),this.pendingClip=null,(o=this.dependencyTracker)==null||o.bboxToClipBoxDropOperation(e).recordFutureForcedDependency("clipPath",e)):(l=this.dependencyTracker)==null||l.recordOperation(e),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=Xe(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:r}=this.ctx.getTransform();let o,l;if(n===0&&i===0){const c=Math.abs(t),u=Math.abs(r);if(c===u)if(e===0)o=l=1/c;else{const h=c*e;o=l=h<1?1/h:1}else if(e===0)o=1/c,l=1/u;else{const h=c*e,d=u*e;o=h<1?1/h:1,l=d<1?1/d:1}}else{const c=Math.abs(t*r-n*i),u=Math.hypot(t,n),h=Math.hypot(i,r);if(e===0)o=h/c,l=u/c;else{const d=e*c;o=h>d?h/d:1,l=u>d?u/d:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(e,t){const{ctx:n,current:{lineWidth:i}}=this,[r,o]=this.getScaleForStroking();if(r===o){n.lineWidth=(i||1)*r,n.stroke(e);return}const l=n.getLineDash();t&&n.save(),n.scale(r,o),q0.a=1/r,q0.d=1/o;const c=new Path2D;if(c.addPath(e,q0),l.length>0){const u=Math.max(r,o);n.setLineDash(l.map(h=>h/u)),n.lineDashOffset/=u}n.lineWidth=i||1,n.stroke(c),t&&n.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};li=new WeakSet,Iw=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)},Dw=function(){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}}},Mw=function(e,t,n){const i=new Path2D;return i.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(t)),i};let Wc=Ub;for(const s in Xd)Wc.prototype[s]!==void 0&&(Wc.prototype[Xd[s]]=Wc.prototype[s]);var $f,Uf;class si{static get workerPort(){return a(this,$f)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");g(this,$f,e)}static get workerSrc(){return a(this,Uf)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");g(this,Uf,e)}}$f=new WeakMap,Uf=new WeakMap,v(si,$f,null),v(si,Uf,"");var Cu,zf;class KI{constructor({parsedData:e,rawData:t}){v(this,Cu);v(this,zf);g(this,Cu,e),g(this,zf,t)}getRaw(){return a(this,zf)}get(e){return a(this,Cu).get(e)??null}[Symbol.iterator](){return a(this,Cu).entries()}}Cu=new WeakMap,zf=new WeakMap;const vc=Symbol("INTERNAL");var Hf,Vf,Wf,Tu;class YI{constructor(e,{name:t,intent:n,usage:i,rbGroups:r}){v(this,Hf,!1);v(this,Vf,!1);v(this,Wf,!1);v(this,Tu,!0);g(this,Hf,!!(e&ss.DISPLAY)),g(this,Vf,!!(e&ss.PRINT)),this.name=t,this.intent=n,this.usage=i,this.rbGroups=r}get visible(){if(a(this,Wf))return a(this,Tu);if(!a(this,Tu))return!1;const{print:e,view:t}=this.usage;return a(this,Hf)?(t==null?void 0:t.viewState)!=="OFF":a(this,Vf)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,t,n=!1){e!==vc&&Ie("Internal method `_setVisible` called."),g(this,Wf,n),g(this,Tu,t)}}Hf=new WeakMap,Vf=new WeakMap,Wf=new WeakMap,Tu=new WeakMap;var So,Ce,Pu,Ru,Gf,Nw;class QI{constructor(e,t=ss.DISPLAY){v(this,Gf);v(this,So,null);v(this,Ce,new Map);v(this,Pu,null);v(this,Ru,null);if(this.renderingIntent=t,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,g(this,Ru,e.order);for(const n of e.groups)a(this,Ce).set(n.id,new YI(t,n));if(e.baseState==="OFF")for(const n of a(this,Ce).values())n._setVisible(vc,!1);for(const n of e.on)a(this,Ce).get(n)._setVisible(vc,!0);for(const n of e.off)a(this,Ce).get(n)._setVisible(vc,!1);g(this,Pu,this.getHash())}}isVisible(e){if(a(this,Ce).size===0)return!0;
150if(!e)return e0("Optional content group not defined."),!0;if(e.type==="OCG")return a(this,Ce).has(e.id)?a(this,Ce).get(e.id).visible:(J(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return S(this,Gf,Nw).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const t of e.ids){if(!a(this,Ce).has(t))return J(`Optional content group not found: ${t}`),!0;if(a(this,Ce).get(t).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const t of e.ids){if(!a(this,Ce).has(t))return J(`Optional content group not found: ${t}`),!0;if(!a(this,Ce).get(t).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const t of e.ids){if(!a(this,Ce).has(t))return J(`Optional content group not found: ${t}`),!0;if(!a(this,Ce).get(t).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const t of e.ids){if(!a(this,Ce).has(t))return J(`Optional content group not found: ${t}`),!0;if(a(this,Ce).get(t).visible)return!1}return!0}return J(`Unknown optional content policy ${e.policy}.`),!0}return J(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,n=!0){var r;const i=a(this,Ce).get(e);if(!i){J(`Optional content group not found: ${e}`);return}if(n&&t&&i.rbGroups.length)for(const o of i.rbGroups)for(const l of o)l!==e&&((r=a(this,Ce).get(l))==null||r._setVisible(vc,!1,!0));i._setVisible(vc,!!t,!0),g(this,So,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 r=a(this,Ce).get(i);if(r)switch(n){case"ON":this.setVisibility(i,!0,t);break;case"OFF":this.setVisibility(i,!1,t);break;case"Toggle":this.setVisibility(i,!r.visible,t);break}}g(this,So,null)}get hasInitialVisibility(){return a(this,Pu)===null||this.getHash()===a(this,Pu)}getOrder(){return a(this,Ce).size?a(this,Ru)?a(this,Ru).slice():[...a(this,Ce).keys()]:null}getGroup(e){return a(this,Ce).get(e)||null}getHash(){if(a(this,So)!==null)return a(this,So);const e=new gk;for(const[t,n]of a(this,Ce))e.update(`${t}:${n.visible}`);return g(this,So,e.hexdigest())}[Symbol.iterator](){return a(this,Ce).entries()}}So=new WeakMap,Ce=new WeakMap,Pu=new WeakMap,Ru=new WeakMap,Gf=new WeakSet,Nw=function(e){const t=e.length;if(t<2)return!0;const n=e[0];for(let i=1;i<t;i++){const r=e[i];let o;if(Array.isArray(r))o=S(this,Gf,Nw).call(this,r);else if(a(this,Ce).has(r))o=a(this,Ce).get(r).visible;else return J(`Optional content group not found: ${r}`),!0;switch(n){case"And":if(!o)return!1;break;case"Or":if(o)return!0;break;case"Not":return!o;default:return!0}}return n==="And"};class JI{constructor(e,{disableRange:t=!1,disableStream:n=!1}){de(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:r,progressiveDone:o,contentDispositionFilename:l}=e;if(this._queuedChunks=[],this._progressiveDone=o,this._contentDispositionFilename=l,(r==null?void 0:r.length)>0){const c=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!n,this._isRangeSupported=!t,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((c,u)=>{this._onReceiveData({begin:c,chunk:u})}),e.addProgressListener((c,u)=>{this._onProgress({loaded:c,total:u})}),e.addProgressiveReadListener(c=>{this._onReceiveData({chunk:c})}),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(r){return r._begin!==e?!1:(r._enqueue(n),!0)});de(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var t,n,i,r;e.total===void 0?(n=(t=this._rangeReaders[0])==null?void 0:t.onProgress)==null||n.call(t,{loaded:e.loaded}):(r=(i=this._fullRequestReader)==null?void 0:i.onProgress)==null||r.call(i,{loaded:e.loaded,total:e.total})}_onProgressiveDone(){var e;(e=this._fullRequestReader)==null||e.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){de(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new ZI(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new eD(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const n of this._rangeReaders.slice(0))n.cancel(e);this._pdfDataRangeTransport.abort()}}class ZI{constructor(e,t,n=!1,i=null){this._stream=e,this._done=n||!1,this._filename=Pb(i)?i:null,this._queuedChunks=t||[],this._loaded=0;for(const r of this._queuedChunks)this._loaded+=r.byteLength;
150this._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 eD{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 tD(s){let e=!0,t=n("filename\\*","i").exec(s);if(t){t=t[1];let h=l(t);return h=unescape(h),h=c(h),h=u(h),r(h)}if(t=o(s),t){const h=u(t);return r(h)}if(t=n("filename","i").exec(s),t){t=t[1];let h=l(t);return h=u(h),r(h)}function n(h,d){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',d)}function i(h,d){if(h){if(!/^[\x00-\xFF]+$/.test(d))return d;try{const f=new TextDecoder(h,{fatal:!0}),p=Yp(d);d=f.decode(p),e=!1}catch{}}return d}function r(h){return e&&/[\x80-\xff]/.test(h)&&(h=i("utf-8",h),e&&(h=i("iso-8859-1",h))),h}function o(h){const d=[];let f;const p=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(h))!==null;){let[,_,A,m]=f;if(_=parseInt(_,10),_ in d){if(_===0)break;continue}d[_]=[A,m]}const y=[];for(let _=0;_<d.length&&_ in d;++_){let[A,m]=d[_];m=l(m),A&&(m=unescape(m),_===0&&(m=c(m))),y.push(m)}return y.join("")}function l(h){if(h.startsWith('"')){const d=h.slice(1).split('\\"');for(let f=0;f<d.length;++f){const p=d[f].indexOf('"');p!==-1&&(d[f]=d[f].slice(0,p),d.length=f+1),d[f]=d[f].replaceAll(/\\(.)/g,"$1")}h=d.join('"')}return h}function c(h){const d=h.indexOf("'");if(d===-1)return h;const f=h.slice(0,d),y=h.slice(d+1).replace(/^[^']*'/,"");return i(f,y)}function u(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(d,f,p,y){if(p==="q"||p==="Q")return y=y.replaceAll("_"," "),y=y.replaceAll(/=([0-9a-fA-F]{2})/g,function(_,A){return String.fromCharCode(parseInt(A,16))}),i(f,y);try{y=atob(y)}catch{}return i(f,y)})}return""}function Ck(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 n0(s){var e;return((e=URL.parse(s))==null?void 0:e.origin)??null}function Tk({responseHeaders:s,isHttp:e,rangeChunkSize:t,disableRange:n}){const i={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(s.get("Content-Length"),10);return!Number.isInteger(r)||(i.suggestedLength=r,r<=2*t)||n||!e||s.get("Accept-Ranges")!=="bytes"||(s.get("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function Pk(s){const e=s.get("Content-Disposition");if(e){let t=tD(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(Pb(t))return t}return null}function tg(s,e){return new Zm(`Unexpected server response (${s}) while retrieving PDF "${e}".`,s,s===404||s===0&&e.startsWith("file:"))}function Rk(s){return s===200||s===206}function Lk(s,e,t){return{method:"GET",headers:s,signal:t.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function Ik(s){return s instanceof Uint8Array?s.buffer:s instanceof ArrayBuffer?s:(J(`getArrayBuffer - unexpected data format: ${s}`),new Uint8Array(s).buffer)}class nD{constructor(e){I(this,"_responseOrigin",null);this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=Ck(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return de(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new sD(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new iD(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class sD{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,Lk(n,this._withCredentials,this._abortController)).then(r=>{if(e._responseOrigin=n0(r.url),!Rk(r.status))throw tg(r.status,i);this._reader=r.body.getReader(),this._headersCapability.resolve();const o=r.headers,{allowRangeRequests:l,suggestedLength:c}=Tk({responseHeaders:o,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=l,this._contentLength=c||this._contentLength,this._filename=Pk(o),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ra("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded,total:this._contentLength}
150),{value:Ik(e),done:!1})}cancel(e){var t;(t=this._reader)==null||t.cancel(e),this._abortController.abort()}}class iD{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 r=new Headers(e.headers);r.append("Range",`bytes=${t}-${n-1}`);const o=i.url;fetch(o,Lk(r,this._withCredentials,this._abortController)).then(l=>{const c=n0(l.url);if(c!==e._responseOrigin)throw new Error(`Expected range response-origin "${c}" to match "${e._responseOrigin}".`);if(!Rk(l.status))throw tg(l.status,o);this._readCapability.resolve(),this._reader=l.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded}),{value:Ik(e),done:!1})}cancel(e){var t;(t=this._reader)==null||t.cancel(e),this._abortController.abort()}}const X0=200,K0=206;function rD(s){const e=s.response;return typeof e!="string"?e:Yp(e).buffer}class oD{constructor({url:e,httpHeaders:t,withCredentials:n}){I(this,"_responseOrigin",null);this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=Ck(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[r,o]of this.headers)t.setRequestHeader(r,o);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),i.expectedStatus=K0):i.expectedStatus=X0,t.responseType="arraybuffer",de(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){var i;const n=this.pendingRequests[e];n&&((i=n.onProgress)==null||i.call(n,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 r=i.status||X0;if(!(r===X0&&n.expectedStatus===K0)&&r!==n.expectedStatus){n.onError(i.status);return}const l=rD(i);if(r===K0){const c=i.getResponseHeader("Content-Range"),u=/bytes (\d+)-(\d+)\/(\d+)/.exec(c);u?n.onDone({begin:parseInt(u[1],10),chunk:l}):(J('Missing or invalid "Content-Range" header.'),n.onError(0))}else l?n.onDone({begin:0,chunk:l}):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 aD{constructor(e){this._source=e,this._manager=new oD(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 de(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new lD(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const n=new cD(this._manager,e,t);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class lD{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=n0(t.responseURL);const n=t.getAllResponseHeaders(),i=new Headers(n?n.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(l=>{const[c,...u]=l.split(": ");return[c,u.join(": ")]}):[]),{allowRangeRequests:r,suggestedLength:o}=Tk({responseHeaders:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});r&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=Pk(i),this._isRangeSupported&&this._manager.abortRequest
150(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=tg(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){var t;(t=this.onProgress)==null||t.call(this,{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 cD{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(){var t;const e=n0((t=this._manager.getRequestXhr(this._requestId))==null?void 0:t.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var e;(e=this.onClosed)==null||e.call(this,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??(this._storedError=tg(e,this._url));for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var t;this.isStreamingSupported||(t=this.onProgress)==null||t.call(this,{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 uD=/^[a-z][a-z0-9\-+.]+:/i;function hD(s){if(uD.test(s))return new URL(s);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(s))}class dD{constructor(e){this.source=e,this.url=hD(e.url),de(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return de(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new fD(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new pD(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const n of this._rangeRequestReaders.slice(0))n.cancel(e)}}class fD{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=tg(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(){var n;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,(n=this.onProgress)==null||n.call(this,{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 ra("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class pD{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 r=process.getBuiltinModule("fs");this._setReadableStream(r.createReadStream(this._url,{start:t,end:n-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;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,(n=this.onProgress)==null||n.call(this,{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 zh=Symbol("INITIAL_DATA");var Hn,qf,Ow;class Dk{constructor(){v(this,qf);v(this,Hn,Object.create(null))}get(e,t=null){if(t){const i=S(this,qf,Ow).call(this,e);return i.promise.then(()=>t(i.data)),null}const n=a(this,Hn)[e];if(!n||n.data===zh)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){const t=a(this,Hn)[e];return!!t&&t.data!==zh}delete(e){const t=a(this,Hn)[e];return!t||t.data===zh?!1:(delete a(this,Hn)[e],!0)}resolve(e,t=null){const n=S(this,qf,Ow).call(this,e);n.data=t,n.resolve()}clear(){var e;
150for(const t in a(this,Hn)){const{data:n}=a(this,Hn)[t];(e=n==null?void 0:n.bitmap)==null||e.close()}g(this,Hn,Object.create(null))}*[Symbol.iterator](){for(const e in a(this,Hn)){const{data:t}=a(this,Hn)[e];t!==zh&&(yield[e,t])}}}Hn=new WeakMap,qf=new WeakSet,Ow=function(e){var t;return(t=a(this,Hn))[e]||(t[e]={...Promise.withResolvers(),data:zh})};const gD=1e5,z1=30;var W1,Ao,Tn,Xf,Kf,rl,pr,Yf,Qf,ol,Lu,Iu,Eo,Du,Jf,Mu,al,Zf,ep,Nu,ll,tp,xo,Ou,Hr,Mk,Nk,Fw,cs,nm,jw,Ok,Fk;const yt=class yt{constructor({textContentSource:e,container:t,viewport:n}){v(this,Hr);v(this,Ao,Promise.withResolvers());v(this,Tn,null);v(this,Xf,!1);v(this,Kf,!!((W1=globalThis.FontInspector)!=null&&W1.enabled));v(this,rl,null);v(this,pr,null);v(this,Yf,0);v(this,Qf,0);v(this,ol,null);v(this,Lu,null);v(this,Iu,0);v(this,Eo,0);v(this,Du,Object.create(null));v(this,Jf,[]);v(this,Mu,null);v(this,al,[]);v(this,Zf,new WeakMap);v(this,ep,null);var c;if(e instanceof ReadableStream)g(this,Mu,e);else if(typeof e=="object")g(this,Mu,new ReadableStream({start(u){u.enqueue(e),u.close()}}));else throw new Error('No "textContentSource" parameter specified.');g(this,Tn,g(this,Lu,t)),g(this,Eo,n.scale*$i.pixelRatio),g(this,Iu,n.rotation),g(this,pr,{div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:r,pageX:o,pageY:l}=n.rawDims;g(this,ep,[1,0,0,-1,-o,l+r]),g(this,Qf,i),g(this,Yf,r),S(c=yt,cs,Ok).call(c),Yl(t,n),a(this,Ao).promise.finally(()=>{a(yt,Ou).delete(this),g(this,pr,null),g(this,Du,null)}
150).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=Gt.platform;return se(this,"fontFamilyMap",new Map([["sans-serif",`${e&&t?"Calibri, ":""}sans-serif`],["monospace",`${e&&t?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{a(this,ol).read().then(({value:t,done:n})=>{if(n){a(this,Ao).resolve();return}a(this,rl)??g(this,rl,t.lang),Object.assign(a(this,Du),t.styles),S(this,Hr,Mk).call(this,t.items),e()},a(this,Ao).reject)};return g(this,ol,a(this,Mu).getReader()),a(yt,Ou).add(this),e(),a(this,Ao).promise}update({viewport:e,onBefore:t=null}){var r;const n=e.scale*$i.pixelRatio,i=e.rotation;if(i!==a(this,Iu)&&(t==null||t(),g(this,Iu,i),Yl(a(this,Lu),{rotation:i})),n!==a(this,Eo)){t==null||t(),g(this,Eo,n);const o={div:null,properties:null,ctx:S(r=yt,cs,nm).call(r,a(this,rl))};for(const l of a(this,al))o.properties=a(this,Zf).get(l),o.div=l,S(this,Hr,Fw).call(this,o)}}cancel(){var t;const e=new ra("TextLayer task cancelled.");(t=a(this,ol))==null||t.cancel(e).catch(()=>{}),g(this,ol,null),a(this,Ao).reject(e)}get textDivs(){return a(this,al)}get textContentItemsStr(){return a(this,Jf)}static cleanup(){if(!(a(this,Ou).size>0)){a(this,Nu).clear();for(const{canvas:e}of a(this,ll).values())e.remove();a(this,ll).clear()}}};Ao=new WeakMap,Tn=new WeakMap,Xf=new WeakMap,Kf=new WeakMap,rl=new WeakMap,pr=new WeakMap,Yf=new WeakMap,Qf=new WeakMap,ol=new WeakMap,Lu=new WeakMap,Iu=new WeakMap,Eo=new WeakMap,Du=new WeakMap,Jf=new WeakMap,Mu=new WeakMap,al=new WeakMap,Zf=new WeakMap,ep=new WeakMap,Nu=new WeakMap,ll=new WeakMap,tp=new WeakMap,xo=new WeakMap,Ou=new WeakMap,Hr=new WeakSet,Mk=function(e){var i,r;if(a(this,Xf))return;(r=a(this,pr)).ctx??(r.ctx=S(i=yt,cs,nm).call(i,a(this,rl)));const t=a(this,al),n=a(this,Jf);for(const o of e){if(t.length>gD){J("Ignoring additional textDivs for performance reasons."),g(this,Xf,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){const l=a(this,Tn);g(this,Tn,document.createElement("span")),a(this,Tn).classList.add("markedContent"),o.id&&a(this,Tn).setAttribute("id",`${o.id}`),l.append(a(this,Tn))}else o.type==="endMarkedContent"&&g(this,Tn,a(this,Tn).parentNode);continue}n.push(o.str),S(this,Hr,Nk).call(this,o)}},Nk=function(e){var _;const t=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};a(this,al).push(t);const i=U.transform(a(this,ep),e.transform);let r=Math.atan2(i[1],i[0]);const o=a(this,Du)[e.fontName];o.vertical&&(r+=Math.PI/2);let l=a(this,Kf)&&o.fontSubstitution||o.fontFamily;l=yt.fontFamilyMap.get(l)||l;const c=Math.hypot(i[2],i[3]),u=c*S(_=yt,cs,Fk).call(_,l,o,a(this,rl));let h,d;r===0?(h=i[4],d=i[5]-u):(h=i[4]+u*Math.sin(r),d=i[5]-u*Math.cos(r));const f="calc(var(--total-scale-factor) *",p=t.style;a(this,Tn)===a(this,Lu)?(p.left=`${(100*h/a(this,Qf)).toFixed(2)}%`,p.top=`${(100*d/a(this,Yf)).toFixed(2)}%`):(p.left=`${f}${h.toFixed(2)}px)`,p.top=`${f}${d.toFixed(2)}px)`),p.fontSize=`${f}${(a(yt,xo)*c).toFixed(2)}px)`,p.fontFamily=l,n.fontSize=c,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,a(this,Kf)&&(t.dataset.fontName=o.fontSubstitutionLoadedName||e.fontName),r!==0&&(n.angle=r*(180/Math.PI));let y=!1;if(e.str.length>1)y=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const A=Math.abs(e.transform[0]),m=Math.abs(e.transform[3]);A!==m&&Math.max(A,m)/Math.min(A,m)>1.5&&(y=!0)}if(y&&(n.canvasWidth=o.vertical?e.height:e.width),a(this,Zf).set(t,n),a(this,pr).div=t,a(this,pr).properties=n,S(this,Hr,Fw).call(this,a(this,pr)),n.hasText&&a(this,Tn).append(t),n.hasEOL){const A=document.createElement("br");A.setAttribute("role","presentation"),a(this,Tn).append(A)}},Fw=function(e){var l;const{div:t,properties:n,ctx:i}=e,{style:r}=t;let o="";if(a(yt,xo)>1&&(o=`scale(${1/a(yt,xo)})`),n.canvasWidth!==0&&n.hasText){const{fontFamily:c}=r,{canvasWidth:u,fontSize:h}=n;S(l=yt,cs,jw).call(l,i,h*a(this,Eo),c);const{width:d}=i.measureText(t.textContent);d>0&&(o=`scaleX(${u*a(this,Eo)/d}) ${o}`)}n.angle!==0&&(o=`rotate(${n.angle}deg) ${o}`),o.length>0&&(r.transform=o)},cs=new WeakSet,nm=function(e=null){let t=a(this,ll).get(e||(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}),a(this,ll).set(e,t),a(this,tp).set(t,{size:0,family:""})}return t},jw=function(e,t,n){const i=a(this,tp).get(e);t===i.size&&n===i.family||(e.font=`${t}px ${n}`,i.size=t,i.family=n)},Ok=function(){if(a(this,xo)!==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),g(this,xo,e.getBoundingClientRect().height),e.remove()},Fk=function(e,t,n){const i=a(this,Nu).get(e);if(i)return i;const r=S(this,cs,nm).call(this,n);r.canvas.width=r.canvas.height=z1,S(this,cs,jw).call(this,r,z1,e);const o=r.measureText(""),l=o.fontBoundingBoxAscent,c=Math.abs(o.fontBoundingBoxDescent);r.canvas.width=r.canvas.height=0;let u=.8;return l?u=l/(l+c):(Gt.platform.isFirefox&&J("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?u=t.ascent:t.descent&&(u=1+t.descent)),a(this,Nu).set(e,u),u},v(yt,cs),v(yt,Nu,new Map),v(yt,ll,new Map),v(yt,tp,new WeakMap),v(yt,xo,null),v(yt,Ou,new Set);let Yd=yt;const mD=100;function Db(s={}){typeof s=="string"||s instanceof URL?s={url:s}:(s instanceof ArrayBuffer||ArrayBuffer.isView(s))&&(s={data:s});const e=new Bw,{docId:t}=e,n=s.url?AI(s.url):null,i=s.data?EI(s.data):null,r=s.httpHeaders||null,o=s.withCredentials===!0,l=s.password??null,c=s.range instanceof jk?s.range:null,u=Number.isInteger(s.rangeChunkSize)&&s.rangeChunkSize>0?s.rangeChunkSize:2**16;let h=s.worker instanceof Qd?s.worker:null;const d=s.verbosity,f=typeof s.docBaseUrl=="string"&&!t0(s.docBaseUrl)?s.docBaseUrl:null,p=xg(s.cMapUrl),y=s.cMapPacked!==!1,_=s.CMapReaderFactory||(fn?II:T1),A=xg(s.iccUrl),m=xg(s.standardFontDataUrl),b=s.StandardFontDataFactory||(fn?DI:P1),w=xg(s.wasmUrl),E=s.WasmFactory||(fn?MI:R1),k=s.stopAtErrors!==!0,x=Number.isInteger(s.maxImageSize)&&s.maxImageSize>-1?s.maxImageSize:-1,C=s.isEvalSupported!==!1,P=typeof s.isOffscreenCanvasSupported=="boolean"?s.isOffscreenCanvasSupported:!fn,R=typeof s.isImageDecoderSupported=="boolean"?s.isImageDecoderSupported:!fn&&(Gt.platform.isFirefox||!globalThis.chrome),L=Number.isInteger(s.canvasMaxAreaInBytes)?s.canvasMaxAreaInBytes:-1,D=typeof s.disableFontFace=="boolean"?s.disableFontFace:fn,F=s.fontExtraProperties===!0,Y=s.enableXfa===!0,q=s.ownerDocument||globalThis.document,oe=s.disableRange===!0,z=s.disableStream===!0,H=s.disableAutoFetch===!0,M=s.pdfBug===!0,V=s.CanvasFactory||(fn?LI:TI),X=s.FilterFactory||(fn?RI:PI),ye=s.enableHWA===!0,Q=s.useWasm!==!1,fe=c?c.length:s.length??NaN,pt=typeof s.useSystemFonts=="boolean"?s.useSystemFonts:!fn&&!D,on=typeof s.useWorkerFetch=="boolean"?s.useWorkerFetch:!!(_===T1&&b===P1&&E===R1&&p&&m&&w&&Yh(p,document.baseURI)&&Yh(m,document.baseURI)&&Yh(w,document.baseURI)),Mt=null;QL(d);const Be={canvasFactory:new V({ownerDocument:q,enableHWA:ye}),filterFactory:new X({docId:t,ownerDocument:q}),cMapReaderFactory:on?null:new _({baseUrl:p,isCompressed:y}),standardFontDataFactory:on?null:new b({baseUrl:m}),wasmFactory:on?null:new E({baseUrl:w})};h||(h=Qd.create({verbosity:d,port:si.workerPort}),e._worker=h);const i0={docId:t,apiVersion:"5.4.394",data:i,password:l,disableAutoFetch:H,rangeChunkSize:u,length:fe,docBaseUrl:f,enableXfa:Y,evaluatorOptions:{maxImageSize:x,disableFontFace:D,ignoreErrors:k,isEvalSupported:C,isOffscreenCanvasSupported:P,isImageDecoderSupported:R,canvasMaxAreaInBytes:L,fontExtraProperties:F,useSystemFonts:pt,useWasm:Q,useWorkerFetch:on,cMapUrl:p,iccUrl:A,standardFontDataUrl:m,wasmUrl:w}},r0={ownerDocument:q,pdfBug:M,styleElement:Mt,loadingParams:{disableAutoFetch:H,enableXfa:Y}};return h.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");
150const Rh=h.messageHandler.sendWithPromise("GetDocRequest",i0,i?[i.buffer]:null);let da;if(c)da=new JI(c,{disableRange:oe,disableStream:z});else if(!i){if(!n)throw new Error("getDocument - no `url` parameter provided.");const o0=Yh(n)?nD:fn?dD:aD;da=new o0({url:n,length:fe,httpHeaders:r,withCredentials:o,rangeChunkSize:u,disableRange:oe,disableStream:z})}return Rh.then(o0=>{if(e.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const Vb=new id(t,o0,h.port),$C=new wD(Vb,e,da,r0,Be,ye);e._transport=$C,Vb.send("Ready",null)})}).catch(e._capability.reject),e}var by;const Sy=class Sy{constructor(){I(this,"_capability",Promise.withResolvers());I(this,"_transport",null);I(this,"_worker",null);I(this,"docId",`d${gt(Sy,by)._++}`);I(this,"destroyed",!1);I(this,"onPassword",null);I(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var e,t,n,i;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((t=this._transport)==null?void 0:t.destroy())}catch(r){throw(n=this._worker)!=null&&n.port&&delete this._worker._pendingDestroy,r}this._transport=null,(i=this._worker)==null||i.destroy(),this._worker=null}async getData(){return this._transport.getData()}};by=new WeakMap,v(Sy,by,0);let Bw=Sy;var cl,np,sp,ip,rp;class jk{constructor(e,t,n=!1,i=null){v(this,cl,Promise.withResolvers());v(this,np,[]);v(this,sp,[]);v(this,ip,[]);v(this,rp,[]);this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=i}addRangeListener(e){a(this,rp).push(e)}addProgressListener(e){a(this,ip).push(e)}addProgressiveReadListener(e){a(this,sp).push(e)}addProgressiveDoneListener(e){a(this,np).push(e)}onDataRange(e,t){for(const n of a(this,rp))n(e,t)}onDataProgress(e,t){a(this,cl).promise.then(()=>{for(const n of a(this,ip))n(e,t)})}onDataProgressiveRead(e){a(this,cl).promise.then(()=>{for(const t of a(this,sp))t(e)})}onDataProgressiveDone(){a(this,cl).promise.then(()=>{for(const e of a(this,np))e()})}transportReady(){a(this,cl).resolve()}requestDataRange(e,t){Ie("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}cl=new WeakMap,np=new WeakMap,sp=new WeakMap,ip=new WeakMap,rp=new WeakMap;class yD{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 se(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)}
150getDestinations(){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()}getAnnotationsByType(e,t){return this._transport.getAnnotationsByType(e,t)}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()}}var gr,ul,cd;class vD{constructor(e,t,n,i=!1){v(this,ul);v(this,gr,!1);this._pageIndex=e,this._pageInfo=t,this._transport=n,this._stats=i?new b1:null,this._pdfBug=i,this.commonObjs=n.commonObjs,this.objs=new Dk,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}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:r=!1}={}){return new Jp({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:i,dontFlip:r})}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 se(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var e;return((e=this._transport._htmlForXfa)==null?void 0:e.children[this._pageIndex])||null}render({canvasContext:e,canvas:t=e.canvas,viewport:n,intent:i="display",annotationMode:r=eo.ENABLE,transform:o=null,background:l=null,optionalContentConfigPromise:c=null,annotationCanvasMap:u=null,pageColors:h=null,printAnnotationStorage:d=null,isEditing:f=!1,recordOperations:p=!1,operationsFilter:y=null}){var R,L,D;(R=this._stats)==null||R.time("Overall");const _=this._transport.getRenderingIntent(i,r,d,f),{renderingIntent:A,cacheKey:m}=_;g(this,gr,!1),c||(c=this._transport.getOptionalContentConfig(A));let b=this._intentStates.get(m);b||(b=Object.create(null),this._intentStates.set(m,b)),b.streamReaderCancelTimeout&&(clearTimeout(b.streamReaderCancelTimeout),b.streamReaderCancelTimeout=null);const w=!!(A&ss.PRINT);b.displayReadyCapability||(b.displayReadyCapability=Promise.withResolvers(),b.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(L=this._stats)==null||L.time("Page Request"),this._pumpOperatorList(_));const E=!!(this._pdfBug&&((D=globalThis.StepperManager)!=null&&D.enabled)),k=!this.recordedBBoxes&&(p||E),x=F=>{var Y,q;if(b.renderTasks.delete(C),k){const oe=(Y=C.gfx)==null?void 0:Y.dependencyTracker.take();oe&&(C.stepper&&C.stepper.setOperatorBBoxes(oe,C.gfx.dependencyTracker.takeDebugMetadata()),p&&(this.recordedBBoxes=oe))}w&&g(this,gr,!0),S(this,ul,cd).call(this),F?(C.capability.reject(F),this._abortOperatorList({intentState:b,reason:F instanceof Error?F:new Error(F)})):C.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(q=globalThis.Stats)!=null&&q.enabled&&globalThis.Stats.add(this.pageNumber,this._stats)
150)},C=new $w({callback:x,params:{canvas:t,canvasContext:e,dependencyTracker:k?new OI(t,b.operatorList.length,E):null,viewport:n,transform:o,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:b.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!w,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:y});(b.renderTasks||(b.renderTasks=new Set)).add(C);const P=C.task;return Promise.all([b.displayReadyCapability.promise,c]).then(([F,Y])=>{var q;if(this.destroyed){x();return}if((q=this._stats)==null||q.time("Rendering"),!(Y.renderingIntent&A))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");C.initializeGraphics({transparency:F,optionalContentConfig:Y}),C.operatorListChanged()}).catch(x),P}getOperatorList({intent:e="display",annotationMode:t=eo.ENABLE,printAnnotationStorage:n=null,isEditing:i=!1}={}){var u;function r(){l.operatorList.lastChunk&&(l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(c))}const o=this._transport.getRenderingIntent(e,t,n,i,!0);let l=this._intentStates.get(o.cacheKey);l||(l=Object.create(null),this._intentStates.set(o.cacheKey,l));let c;return l.opListReadCapability||(c=Object.create(null),c.operatorListChanged=r,l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||(l.renderTasks=new Set)).add(c),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(u=this._stats)==null||u.time("Page Request"),this._pumpOperatorList(o)),l.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=>Kd.textContent(n));const t=this.streamTextContent(e);return new Promise(function(n,i){function r(){o.read().then(function({value:c,done:u}){if(u){n(l);return}l.lang??(l.lang=c.lang),Object.assign(l.styles,c.styles),l.items.push(...c.items),r()},i)}const o=t.getReader(),l={items:[],styles:Object.create(null),lang:null};r()})}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(),g(this,gr,!1),Promise.all(e)}cleanup(e=!1){g(this,gr,!0);const t=S(this,ul,cd).call(this);return e&&t&&this._stats&&(this._stats=new b1),t}_startRenderPage(e,t){var i,r;const n=this._intentStates.get(t);n&&((i=this._stats)==null||i.timeEnd("Page Request"),(r=n.displayReadyCapability)==null||r.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&&S(this,ul,cd).call(this)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:n,modifiedIds:i}){const{map:r,transfer:o}=n,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:r,modifiedIds:i},o).getReader(),u=this._intentStates.get(t);u.streamReader=c;const h=()=>{c.read().then(({value:d,done:f})=>{if(f){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,u),h())},d=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(const f of u.renderTasks)f.operatorListChanged();S(this,ul,cd).call(this)}if(u.displayReadyCapability)u.displayReadyCapability.reject(d);else if(u.opListReadCapability)u.opListReadCapability.reject(d);else throw d}})};h()}_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 Tb){let i=mD;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 ra(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[i,r]of this._intentStates)if(r===e){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}}gr=new WeakMap,ul=new WeakSet,cd=function(){if(!a(this,gr)||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(),g(this,gr,!1),!0};var ko,qs,mr,hl,Ay,dl,fl,mn,sm,Bk,$k,ud,Fu,im;const He=class He{constructor({name:e=null,port:t=null,verbosity:n=JL()}={}){v(this,mn);v(this,ko,Promise.withResolvers());v(this,qs,null);v(this,mr,null);v(this,hl,null);if(this.name=e,this.destroyed=!1,this.verbosity=n,t){if(a(He,fl).has(t))throw new Error("Cannot use more than one PDFWorker per port.");a(He,fl).set(t,this),S(this,mn,Bk).call(this,t)}else S(this,mn,$k).call(this)}get promise(){return a(this,ko).promise}get port(){return a(this,mr)}get messageHandler(){return a(this,qs)}destroy(){var e,t;this.destroyed=!0,(e=a(this,hl))==null||e.terminate(),g(this,hl,null),a(He,fl).delete(a(this,mr)),g(this,mr,null),(t=a(this,qs))==null||t.destroy(),g(this,qs,null)}static create(e){const t=a(this,fl).get(e==null?void 0:e.port);
150if(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 He(e)}static get workerSrc(){if(si.workerSrc)return si.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return se(this,"_setupFakeWorkerGlobal",(async()=>a(this,Fu,im)?a(this,Fu,im):(await import(this.workerSrc)).WorkerMessageHandler)())}};ko=new WeakMap,qs=new WeakMap,mr=new WeakMap,hl=new WeakMap,Ay=new WeakMap,dl=new WeakMap,fl=new WeakMap,mn=new WeakSet,sm=function(){a(this,ko).resolve(),a(this,qs).send("configure",{verbosity:this.verbosity})},Bk=function(e){g(this,mr,e),g(this,qs,new id("main","worker",e)),a(this,qs).on("ready",()=>{}),S(this,mn,sm).call(this)},$k=function(){if(a(He,dl)||a(He,Fu,im)){S(this,mn,ud).call(this);return}let{workerSrc:e}=He;try{He._isSameOrigin(window.location,e)||(e=He._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),n=new id("main","worker",t),i=()=>{r.abort(),n.destroy(),t.terminate(),this.destroyed?a(this,ko).reject(new Error("Worker was destroyed")):S(this,mn,ud).call(this)},r=new AbortController;t.addEventListener("error",()=>{a(this,hl)||i()},{signal:r.signal}),n.on("test",l=>{if(r.abort(),this.destroyed||!l){i();return}g(this,qs,n),g(this,mr,t),g(this,hl,t),S(this,mn,sm).call(this)}),n.on("ready",l=>{if(r.abort(),this.destroyed){i();return}try{o()}catch{S(this,mn,ud).call(this)}});const o=()=>{const l=new Uint8Array;n.send("test",l,[l.buffer])};o();return}catch{e0("The worker has been disabled.")}S(this,mn,ud).call(this)},ud=function(){a(He,dl)||(J("Setting up fake worker."),g(He,dl,!0)),He._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){a(this,ko).reject(new Error("Worker was destroyed"));return}const t=new CI;g(this,mr,t);const n=`fake${gt(He,Ay)._++}`,i=new id(n+"_worker",n,t);e.setup(i,t),g(this,qs,new id(n,n+"_worker",t)),S(this,mn,sm).call(this)}).catch(e=>{a(this,ko).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})},Fu=new WeakSet,im=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},v(He,Fu),v(He,Ay,0),v(He,dl,!1),v(He,fl,new WeakMap),fn&&(g(He,dl,!0),si.workerSrc||(si.workerSrc="./pdf.worker.mjs")),He._isSameOrigin=(e,t)=>{const n=URL.parse(e);if(!(n!=null&&n.origin)||n.origin==="null")return!1;const i=new URL(t,n);return n.origin===i.origin},He._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))},He.fromPort=e=>{if(uI("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return He.create(e)};let Qd=He;var yr,Ci,ju,Bu,vr,pl,hd;class wD{constructor(e,t,n,i,r,o){v(this,pl);v(this,yr,new Map);v(this,Ci,new Map);v(this,ju,new Map);v(this,Bu,new Map);v(this,vr,null);this.messageHandler=e,this.loadingTask=t,this.commonObjs=new Dk,this.fontLoader=new bI({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=r.canvasFactory,this.filterFactory=r.filterFactory,this.cMapReaderFactory=r.cMapReaderFactory,this.standardFontDataFactory=r.standardFontDataFactory,this.wasmFactory=r.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=o,this.setupMessageHandler()}get annotationStorage(){return se(this,"annotationStorage",new Rb)}getRenderingIntent(e,t=eo.ENABLE,n=null,i=!1,r=!1){let o=ss.DISPLAY,l=Sw;switch(e){case"any":o=ss.ANY;break;case"display":break;case"print":o=ss.PRINT;break;default:J(`getRenderingIntent - invalid intent: ${e}`)}const c=o&ss.PRINT&&n instanceof yk?n:this.annotationStorage;switch(t){case eo.DISABLE:o+=ss.ANNOTATIONS_DISABLE;break;case eo.ENABLE:break;case eo.ENABLE_FORMS:o+=ss.ANNOTATIONS_FORMS;break;case eo.ENABLE_STORAGE:o+=ss.ANNOTATIONS_STORAGE,l=c.serializable;break;default:J(`getRenderingIntent - invalid annotationMode: ${t}`)}i&&(o+=ss.IS_EDITING),r&&(o+=ss.OPLIST);const{ids:u,hash:h}=c.modifiedIds,d=[o,l.hash,h];return{renderingIntent:o,cacheKey:d.join("_"),annotationStorageSerializable:l,modifiedIds:u}}destroy(){var n;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(n=a(this,vr))==null||n.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const i of a(this,Ci).values())e.push(i._destroy());a(this,Ci).clear(),a(this,ju).clear(),a(this,Bu).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();
150const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{var i,r;this.commonObjs.clear(),this.fontLoader.clear(),a(this,yr).clear(),this.filterFactory.destroy(),Yd.cleanup(),(i=this._networkStream)==null||i.cancelAllRequests(new ra("Worker was terminated.")),(r=this.messageHandler)==null||r.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)=>{de(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=r=>{this._lastProgress={loaded:r.loaded,total:r.total}},i.onPull=()=>{this._fullReader.read().then(function({value:r,done:o}){if(o){i.close();return}de(r instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{i.error(r)})},i.onCancel=r=>{this._fullReader.cancel(r),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("ReaderHeadersReady",async n=>{var l;await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:r,contentLength:o}=this._fullReader;return(!i||!r)&&(this._lastProgress&&((l=t.onProgress)==null||l.call(t,this._lastProgress)),this._fullReader.onProgress=c=>{var u;(u=t.onProgress)==null||u.call(t,{loaded:c.loaded,total:c.total})}),{isStreamingSupported:i,isRangeSupported:r,contentLength:o}}),e.on("GetRangeReader",(n,i)=>{de(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const r=this._networkStream.getRangeReader(n.begin,n.end);if(!r){i.close();return}i.onPull=()=>{r.read().then(function({value:o,done:l}){if(l){i.close();return}de(o instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{i.error(o)})},i.onCancel=o=>{r.cancel(o),i.ready.catch(l=>{if(!this.destroyed)throw l})}}),e.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,t._capability.resolve(new yD(n,this))}),e.on("DocException",n=>{t._capability.reject(Sn(n))}),e.on("PasswordRequest",n=>{g(this,vr,Promise.withResolvers());try{if(!t.onPassword)throw Sn(n);const i=r=>{r instanceof Error?a(this,vr).reject(r):a(this,vr).resolve({password:r})};t.onPassword(i,n.code)}catch(i){a(this,vr).reject(i)}return a(this,vr).promise}),e.on("DataLoaded",n=>{var i;(i=t.onProgress)==null||i.call(t,{loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),e.on("StartRenderPage",n=>{if(this.destroyed)return;a(this,Ci).get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),e.on("commonobj",([n,i,r])=>{var o;if(this.destroyed||this.commonObjs.has(n))return null;switch(i){case"Font":if("error"in r){const f=r.error;J(`Error during font loading: ${f}`),this.commonObjs.resolve(n,f);break}const l=new Aw(r),c=this._params.pdfBug&&((o=globalThis.FontInspector)!=null&&o.enabled)?(f,p)=>globalThis.FontInspector.fontAdded(f,p):null,u=new SI(l,c,r.extra,r.charProcOperatorList);this.fontLoader.bind(u).catch(()=>e.sendWithPromise("FontFallback",{id:n})).finally(()=>{!u.fontExtraProperties&&u.data&&u.clearData(),this.commonObjs.resolve(n,u)});break;case"CopyLocalImage":const{imageRef:h}=r;de(h,"The imageRef must be defined.");for(const f of a(this,Ci).values())for(const[,p]of f.objs)if((p==null?void 0:p.ref)===h)return p.dataLen?(this.commonObjs.resolve(n,structuredClone(p)),p.dataLen):null;break;case"FontPath":case"Image":this.commonObjs.resolve(n,r);break;case"Pattern":const d=new Ew(r);this.commonObjs.resolve(n,d.getIR());break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),e.on("obj",([n,i,r,o])=>{var c;if(this.destroyed)return;const l=a(this,Ci).get(i);if(!l.objs.has(n)){if(l._intentStates.size===0){(c=o==null?void 0:o.bitmap)==null||c.close();return}switch(r){case"Image":case"Pattern":l.objs.resolve(n,o);break;default:throw new Error(`Got unknown object type ${r}`)}}}),e.on("DocProgress",n=>{var i;this.destroyed||(i=t.onProgress)==null||i.call(t,{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)})}
150getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var n;this.annotationStorage.size<=0&&J("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:((n=this._fullReader)==null?void 0:n.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=a(this,ju).get(t);if(n)return n;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then(r=>{if(this.destroyed)throw new Error("Transport destroyed");r.refStr&&a(this,Bu).set(r.refStr,e);const o=new vD(t,r,this,this._params.pdfBug);return a(this,Ci).set(t,o),o});return a(this,ju).set(t,i),i}getPageIndex(e){return xw(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 S(this,pl,hd).call(this,"GetFieldObjects")}hasJSActions(){return S(this,pl,hd).call(this,"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)}getAnnotationsByType(e,t){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:e,pageIndexesToSkip:t})}getDocJSActions(){return S(this,pl,hd).call(this,"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 S(this,pl,hd).call(this,"GetOptionalContentConfig").then(t=>new QI(t,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=a(this,yr).get(e);if(t)return t;const n=this.messageHandler.sendWithPromise(e,null).then(i=>{var r,o;return{info:i[0],metadata:i[1]?new KI(i[1]):null,contentDispositionFilename:((r=this._fullReader)==null?void 0:r.filename)??null,contentLength:((o=this._fullReader)==null?void 0:o.contentLength)??null}});return a(this,yr).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 a(this,Ci).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),a(this,yr).clear(),this.filterFactory.destroy(!0),Yd.cleanup()}}cachedPageNumber(e){if(!xw(e))return null;const t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return a(this,Bu).get(t)??null}}yr=new WeakMap,Ci=new WeakMap,ju=new WeakMap,Bu=new WeakMap,vr=new WeakMap,pl=new WeakSet,hd=function(e,t=null){const n=a(this,yr).get(e);if(n)return n;const i=this.messageHandler.sendWithPromise(e,t);return a(this,yr).set(e,i),i};var Co;class _D{constructor(e){v(this,Co,null);I(this,"onContinue",null);I(this,"onError",null);g(this,Co,e)}get promise(){return a(this,Co).capability.promise}cancel(e=0){a(this,Co).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}
150=a(this,Co).operatorList;if(!e)return!1;const{annotationCanvasMap:t}=a(this,Co);return e.form||e.canvas&&(t==null?void 0:t.size)>0}}Co=new WeakMap;var To,gl;const Aa=class Aa{constructor({callback:e,params:t,objs:n,commonObjs:i,annotationCanvasMap:r,operatorList:o,pageIndex:l,canvasFactory:c,filterFactory:u,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:f=null,enableHWA:p=!1,operationsFilter:y=null}){v(this,To,null);this.callback=e,this.params=t,this.objs=n,this.commonObjs=i,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=o,this._pageIndex=l,this.canvasFactory=c,this.filterFactory=u,this._pdfBug=d,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new _D(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.canvas,this._canvasContext=t.canvas?null:t.canvasContext,this._enableHWA=p,this._dependencyTracker=t.dependencyTracker,this._operationsFilter=y}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){var c,u;if(this.cancelled)return;if(this._canvas){if(a(Aa,gl).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.");a(Aa,gl).add(this._canvas)}this._pdfBug&&((c=globalThis.StepperManager)!=null&&c.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:n,transform:i,background:r,dependencyTracker:o}=this.params,l=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new Wc(l,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors,o),this.gfx.beginDrawing({transform:i,viewport:n,transparency:e,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,(u=this.graphicsReadyCallback)==null||u.call(this)}cancel(e=null,t=0){var n,i,r;this.running=!1,this.cancelled=!0,(n=this.gfx)==null||n.endDrawing(),a(this,To)&&(window.cancelAnimationFrame(a(this,To)),g(this,To,null)),a(Aa,gl).delete(this._canvas),e||(e=new Tb(`Rendering cancelled, page ${this._pageIndex+1}`,t)),this.callback(e),(r=(i=this.task).onError)==null||r.call(i,e)}operatorListChanged(){var e,t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.gfx.dependencyTracker)==null||e.growOperationsCount(this.operatorList.fnArray.length),(t=this.stepper)==null||t.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?g(this,To,window.requestAnimationFrame(()=>{g(this,To,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._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),a(Aa,gl).delete(this._canvas),this.callback())))}};To=new WeakMap,gl=new WeakMap,v(Aa,gl,new WeakSet);let $w=Aa;const bD="5.4.394",SD="2cc809ade";var Vn,ml,$u,_t,op,Uu,wr,ap,Po,Xs,lp,Te,Uw,zw,Hw,va,Uk,Xr;const An=class An{constructor({editor:e=null,uiManager:t=null}){v(this,Te);v(this,Vn,null);v(this,ml,null);v(this,$u);v(this,_t,null);v(this,op,!1);v(this,Uu,!1);v(this,wr,null);v(this,ap);v(this,Po,null);v(this,Xs,null);var n,i;e?(g(this,Uu,!1),g(this,wr,e)):g(this,Uu,!0),g(this,Xs,(e==null?void 0:e._uiManager)||t),g(this,ap,a(this,Xs)._eventBus),g(this,$u,((n=e==null?void 0:e.color)==null?void 0:n.toUpperCase())||((i=a(this,Xs))==null?void 0:i.highlightColors.values().next().value)||"#FFFF98"),a(An,lp)||g(An,lp,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"}))}static get _keyboardManager(){return se(this,"_keyboardManager",new eg([[["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]]))}renderButton(){const e=g(this,Vn,document.createElement("button"));
150e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",a(this,wr)&&(e.ariaControls=`${a(this,wr).id}_colorpicker_dropdown`);const t=a(this,Xs)._signal;e.addEventListener("click",S(this,Te,va).bind(this),{signal:t}),e.addEventListener("keydown",S(this,Te,Hw).bind(this),{signal:t});const n=g(this,ml,document.createElement("span"));return n.className="swatch",n.ariaHidden="true",n.style.backgroundColor=a(this,$u),e.append(n),e}renderMainDropdown(){const e=g(this,_t,S(this,Te,Uw).call(this));return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}_colorSelectFromKeyboard(e){if(e.target===a(this,Vn)){S(this,Te,va).call(this,e);return}const t=e.target.getAttribute("data-color");t&&S(this,Te,zw).call(this,t,e)}_moveToNext(e){var t,n;if(!a(this,Te,Xr)){S(this,Te,va).call(this,e);return}if(e.target===a(this,Vn)){(t=a(this,_t).firstChild)==null||t.focus();return}(n=e.target.nextSibling)==null||n.focus()}_moveToPrevious(e){var t,n;if(e.target===((t=a(this,_t))==null?void 0:t.firstChild)||e.target===a(this,Vn)){a(this,Te,Xr)&&this._hideDropdownFromKeyboard();return}a(this,Te,Xr)||S(this,Te,va).call(this,e),(n=e.target.previousSibling)==null||n.focus()}_moveToBeginning(e){var t;if(!a(this,Te,Xr)){S(this,Te,va).call(this,e);return}(t=a(this,_t).firstChild)==null||t.focus()}_moveToEnd(e){var t;if(!a(this,Te,Xr)){S(this,Te,va).call(this,e);return}(t=a(this,_t).lastChild)==null||t.focus()}hideDropdown(){var e,t;(e=a(this,_t))==null||e.classList.add("hidden"),a(this,Vn).ariaExpanded="false",(t=a(this,Po))==null||t.abort(),g(this,Po,null)}_hideDropdownFromKeyboard(){var e;if(!a(this,Uu)){if(!a(this,Te,Xr)){(e=a(this,wr))==null||e.unselect();return}this.hideDropdown(),a(this,Vn).focus({preventScroll:!0,focusVisible:a(this,op)})}}updateColor(e){if(a(this,ml)&&(a(this,ml).style.backgroundColor=e),!a(this,_t))return;const t=a(this,Xs).highlightColors.values();for(const n of a(this,_t).children)n.ariaSelected=t.next().value===e.toUpperCase()}destroy(){var e,t;(e=a(this,Vn))==null||e.remove(),g(this,Vn,null),g(this,ml,null),(t=a(this,_t))==null||t.remove(),g(this,_t,null)}};Vn=new WeakMap,ml=new WeakMap,$u=new WeakMap,_t=new WeakMap,op=new WeakMap,Uu=new WeakMap,wr=new WeakMap,ap=new WeakMap,Po=new WeakMap,Xs=new WeakMap,lp=new WeakMap,Te=new WeakSet,Uw=function(){const e=document.createElement("div"),t=a(this,Xs)._signal;e.addEventListener("contextmenu",Os,{signal:t}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),a(this,wr)&&(e.id=`${a(this,wr).id}_colorpicker_dropdown`);for(const[n,i]of a(this,Xs).highlightColors){const r=document.createElement("button");r.tabIndex="0",r.role="option",r.setAttribute("data-color",i),r.title=n,r.setAttribute("data-l10n-id",a(An,lp)[n]);const o=document.createElement("span");r.append(o),o.className="swatch",o.style.backgroundColor=i,r.ariaSelected=i===a(this,$u),r.addEventListener("click",S(this,Te,zw).bind(this,i),{signal:t}),e.append(r)}return e.addEventListener("keydown",S(this,Te,Hw).bind(this),{signal:t}),e},zw=function(e,t){t.stopPropagation(),a(this,ap).dispatch("switchannotationeditorparams",{source:this,type:he.HIGHLIGHT_COLOR,value:e}),this.updateColor(e)},Hw=function(e){An._keyboardManager.exec(this,e)},va=function(e){if(a(this,Te,Xr)){this.hideDropdown();return}if(g(this,op,e.detail===0),a(this,Po)||(g(this,Po,new AbortController),window.addEventListener("pointerdown",S(this,Te,Uk).bind(this),{signal:a(this,Xs).combinedSignal(a(this,Po))})),a(this,Vn).ariaExpanded="true",a(this,_t)){a(this,_t).classList.remove("hidden");return}const t=g(this,_t,S(this,Te,Uw).call(this));a(this,Vn).append(t)},Uk=function(e){var t;(t=a(this,_t))!=null&&t.contains(e.target)||this.hideDropdown()},Xr=function(){return a(this,_t)&&!a(this,_t).classList.contains("hidden")},v(An,lp,null);let oy=An;var Ti,cp,zu,up;const Ea=class Ea{constructor(e){v(this,Ti,null);v(this,cp,null);v(this,zu,null);g(this,cp,e),g(this,zu,e._uiManager),a(Ea,up)||g(Ea,up,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(a(this,Ti))return a(this,Ti);const{editorType:e,colorType:t,color:n}=a(this,cp),i=g(this,Ti,document.createElement("input"));return i.type="color",i.value=n||"#000000",i.className="basicColorPicker",i.tabIndex=0,i.setAttribute("data-l10n-id",a(Ea,up)[e]),i.addEventListener("input",()=>{a(this,zu).updateParams(t,i.value)},{signal:a(this,zu)._signal}),i}update(e){a(this,Ti)&&(a(this,Ti).value=e)}destroy(){var e;(e=a(this,Ti))==null||e.remove(),g(this,Ti,null)}hideDropdown(){}};Ti=new WeakMap,cp=new WeakMap,zu=new WeakMap,up=new WeakMap,v(Ea,up,null);let ay=Ea;function H1(s){return Math.floor(Math.max(0,Math.min(1,s))*255).toString(16).padStart(2,"0")}function Hh(s){return Math.max(0,Math.min(255,255*s))}class V1{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=Hh(e),[e,e,e]}static G_HTML([e]){const t=H1(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(Hh)}static RGB_HTML(e){return`#${e.map(H1).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[Hh(1-Math.min(1,e+i)),Hh(1-Math.min(1,n+i)),Hh(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,r=1-t,o=1-n,l=Math.min(i,r,o);return["CMYK",i,r,o,l]}}class AD{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){Ie("Abstract method `_createSVG` called.")}}
150class ly extends AD{_createSVG(e){return document.createElementNS(Hi,e)}}const ED=9,Jl=new WeakSet,xD=new Date().getTimezoneOffset()*60*1e3;class Y0{static create(e){switch(e.data.annotationType){case ut.LINK:return new Mb(e);case ut.TEXT:return new CD(e);case ut.WIDGET:switch(e.data.fieldType){case"Tx":return new TD(e);case"Btn":return e.data.radioButton?new Vk(e):e.data.checkBox?new RD(e):new LD(e);case"Ch":return new ID(e);case"Sig":return new PD(e)}return new sc(e);case ut.POPUP:return new Ww(e);case ut.FREETEXT:return new Kk(e);case ut.LINE:return new MD(e);case ut.SQUARE:return new ND(e);case ut.CIRCLE:return new OD(e);case ut.POLYLINE:return new Yk(e);case ut.CARET:return new jD(e);case ut.INK:return new Nb(e);case ut.POLYGON:return new FD(e);case ut.HIGHLIGHT:return new Qk(e);case ut.UNDERLINE:return new BD(e);case ut.SQUIGGLY:return new $D(e);case ut.STRIKEOUT:return new UD(e);case ut.STAMP:return new Jk(e);case ut.FILEATTACHMENT:return new zD(e);default:return new Qe(e)}}}var yl,Hu,Es,hp,Vw;const zb=class zb{constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:i=!1}={}){v(this,hp);v(this,yl,null);v(this,Hu,!1);v(this,Es,null);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.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,this.hasOwnCommentButton=!1,t&&(this.contentElement=this.container=this._createContainer(n)),i&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:t}){return!!(e!=null&&e.str||t!=null&&t.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return zb._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var n;const{data:e}=this,t=(n=this.annotationStorage)==null?void 0:n.getEditor(e.id);return t?t.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}
150get commentButtonPosition(){var l;const e=(l=this.annotationStorage)==null?void 0:l.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:t,inkLists:n,rect:i}=this.data;let r=-1/0,o=-1/0;if((t==null?void 0:t.length)>=8){for(let c=0;c<t.length;c+=8)t[c+1]>o?(o=t[c+1],r=t[c+2]):t[c+1]===o&&(r=Math.max(r,t[c+2]));return[r,o]}if((n==null?void 0:n.length)>=1){for(const c of n)for(let u=0,h=c.length;u<h;u+=2)c[u+1]>o?(o=c[u+1],r=c[u]):c[u+1]===o&&(r=Math.max(r,c[u]));if(r!==1/0)return[r,o]}return i?[i[2],i[3]]:null}_normalizePoint(e){const{page:{view:t},viewport:{rawDims:{pageWidth:n,pageHeight:i,pageX:r,pageY:o}}}=this.parent;return e[1]=t[3]-e[1]+t[1],e[0]=100*(e[0]-r)/n,e[1]=100*(e[1]-o)/i,e}get commentText(){var t,n,i;const{data:e}=this;return((n=(t=this.annotationStorage.getRawValue(`${qd}${e.id}`))==null?void 0:t.popup)==null?void 0:n.contents)||((i=e.contentsObj)==null?void 0:i.str)||""}set commentText(e){const{data:t}=this,n={deleted:!e,contents:e||""};this.annotationStorage.updateEditor(t.id,{popup:n})||this.annotationStorage.setValue(`${qd}${t.id}`,{id:t.id,annotationType:t.annotationType,pageIndex:this.parent.page._pageIndex,popup:n,popupRef:t.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){var e,t;(t=((e=a(this,Es))==null?void 0:e.popup)||this.popup)==null||t.remove(),g(this,Es,this.popup=null)}updateEdited(e){var r;if(!this.container)return;e.rect&&(a(this,yl)||g(this,yl,{rect:this.data.rect.slice(0)}));const{rect:t,popup:n}=e;t&&S(this,hp,Vw).call(this,t);let i=((r=a(this,Es))==null?void 0:r.popup)||this.popup;!i&&(n!=null&&n.text)&&(this._createPopup(n),i=a(this,Es).popup),i&&(i.updateEdited(e),n!=null&&n.deleted&&(i.remove(),g(this,Es,null),this.popup=null))}resetEdited(){var e;a(this,yl)&&(S(this,hp,Vw).call(this,a(this,yl).rect),(e=a(this,Es))==null||e.popup.resetEdited(),g(this,yl,null))}_createContainer(e){const{data:t,parent:{page:n,viewport:i}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",t.id),!(this instanceof sc)&&!(this instanceof Mb)&&(r.tabIndex=0);const{style:o}=r;if(o.zIndex=this.parent.zIndex,this.parent.zIndex+=2,t.alternativeText&&(r.title=t.alternativeText),t.noRotate&&r.classList.add("norotate"),!t.rect||this instanceof Ww){const{rotation:_}=t;return!t.hasOwnCanvas&&_!==0&&this.setRotation(_,r),r}const{width:l,height:c}=this;if(!e&&t.borderStyle.width>0){o.borderWidth=`${t.borderStyle.width}px`;const _=t.borderStyle.horizontalCornerRadius,A=t.borderStyle.verticalCornerRadius;if(_>0||A>0){const b=`calc(${_}px * var(--total-scale-factor)) / calc(${A}px * var(--total-scale-factor))`;o.borderRadius=b}else if(this instanceof Vk){const b=`calc(${l}px * var(--total-scale-factor)) / calc(${c}px * var(--total-scale-factor))`;o.borderRadius=b}switch(t.borderStyle.style){case fc.SOLID:o.borderStyle="solid";break;case fc.DASHED:o.borderStyle="dashed";break;case fc.BEVELED:J("Unimplemented border style: beveled");break;case fc.INSET:J("Unimplemented border style: inset");break;case fc.UNDERLINE:o.borderBottomStyle="solid";break}const m=t.borderColor||null;m?(g(this,Hu,!0),o.borderColor=U.makeHexColor(m[0]|0,m[1]|0,m[2]|0)):o.borderWidth=0}const u=U.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:h,pageHeight:d,pageX:f,pageY:p}=i.rawDims;o.left=`${100*(u[0]-f)/h}%`,o.top=`${100*(u[1]-p)/d}%`;const{rotation:y}=t;return t.hasOwnCanvas||y===0?(o.width=`${100*l/h}%`,o.height=`${100*c/d}%`):this.setRotation(y,r),r}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:i}=this.parent.viewport.rawDims;let{width:r,height:o}=this;e%180!==0&&([r,o]=[o,r]),t.style.width=`${100*r/n}%`,t.style.height=`${100*o/i}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(t,n,i)=>{const r=i.detail[t],o=r[0],l=r.slice(1);i.target.style[n]=V1[`${o}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[n]:V1[`${o}_rgb`](l)})};return se(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(()=>
150t.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)){const r=e[i]||n[i];r==null||r(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,r]of Object.entries(t)){const o=n[i];if(o){const l={detail:{[i]:r},target:e};o(l),delete t[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,n,i,r]=this.data.rect.map(_=>Math.fround(_));if(e.length===8){const[_,A,m,b]=e.subarray(2,6);if(i===_&&r===A&&t===m&&n===b)return}const{style:o}=this.container;let l;if(a(this,Hu)){const{borderColor:_,borderWidth:A}=o;o.borderWidth=0,l=["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="${_}" stroke-width="${A}">`],this.container.classList.add("hasBorder")}const c=i-t,u=r-n,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0),d.role="none";const f=h.createElement("defs");d.append(f);const p=h.createElement("clipPath"),y=`clippath_${this.data.id}`;p.setAttribute("id",y),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let _=2,A=e.length;_<A;_+=8){const m=e[_],b=e[_+1],w=e[_+2],E=e[_+3],k=h.createElement("rect"),x=(w-t)/c,C=(r-b)/u,P=(m-w)/c,R=(b-E)/u;k.setAttribute("x",x),k.setAttribute("y",C),k.setAttribute("width",P),k.setAttribute("height",R),p.append(k),l==null||l.push(`<rect vector-effect="non-scaling-stroke" x="${x}" y="${C}" width="${P}" height="${R}"/>`)}a(this,Hu)&&(l.push("</g></svg>')"),o.backgroundImage=l.join("")),this.container.append(d),this.container.style.clipPath=`url(#${y})`}_createPopup(e=null){const{data:t}=this;let n,i;e?(n={str:e.text},i=e.date):(n=t.contentsObj,i=t.modificationDate),g(this,Es,new Ww({data:{color:t.color,titleObj:t.titleObj,modificationDate:i,contentsObj:n,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}))}get hasPopupElement(){return!!(a(this,Es)||this.popup||this.data.popupRef)}get extraPopupElement(){return a(this,Es)}render(){Ie("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const n=[];if(this._fieldObjects){const i=this._fieldObjects[e];if(i)for(const{page:r,id:o,exportValues:l}of i){if(r===-1||o===t)continue;const c=typeof l=="string"?l:null,u=document.querySelector(`[data-element-id="${o}"]`);if(u&&!Jl.has(u)){J(`_getElementsByName - element not allowed: ${o}`);continue}n.push({id:o,exportValue:c,domElement:u})}return n}for(const i of document.getElementsByName(e)){const{exportValue:r}=i,o=i.getAttribute("data-element-id");o!==t&&Jl.has(i)&&n.push({id:o,exportValue:r,domElement:i})}return n}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.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",()=>{var n;(n=this.linkService.eventBus)==null||n.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};yl=new WeakMap,Hu=new WeakMap,Es=new WeakMap,hp=new WeakSet,Vw=function(e){const{container:{style:t},data:{rect:n,rotation:i},parent:{viewport:{rawDims:{pageWidth:r,pageHeight:o,pageX:l,pageY:c}}}}=this;n==null||n.splice(0,4,...e),t.left=`${100*(e[0]-l)/r}%`,t.top=`${100*(o-e[3]+c)/o}%`,i===0?(t.width=`${100*(e[2]-e[0])/r}%`,t.height=`${100*(e[3]-e[1])/o}%`):this.setRotation(i)};let Qe=zb;class kD extends Qe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:e}=this;e.hasComment&&this._createPopup(e.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}
150get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){this.editor.comment=e,e||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}}var os,wa,zk,Hk;class Mb extends Qe{constructor(t,n=null){super(t,{isRenderable:!0,ignoreBorder:!!(n!=null&&n.ignoreBorder),createQuadrilaterals:!0});v(this,os);this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:n}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let r=!1;return t.url?(n.addLinkAttributes(i,t.url,t.newWindow),r=!0):t.action?(this._bindNamedAction(i,t.action,t.overlaidText),r=!0):t.attachment?(S(this,os,zk).call(this,i,t.attachment,t.overlaidText,t.attachmentDest),r=!0):t.setOCGState?(S(this,os,Hk).call(this,i,t.setOCGState,t.overlaidText),r=!0):t.dest?(this._bindLink(i,t.dest,t.overlaidText),r=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),r=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(i,""),r=!0)),this.container.classList.add("linkAnnotation"),r&&(this.contentElement=i,this.container.append(i)),this.container}_bindLink(t,n,i=""){t.href=this.linkService.getDestinationHash(n),t.onclick=()=>(n&&this.linkService.goToDestination(n),!1),(n||n==="")&&S(this,os,wa).call(this),i&&(t.title=i)}_bindNamedAction(t,n,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(n),!1),i&&(t.title=i),S(this,os,wa).call(this)}_bindJSAction(t,n){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const r of Object.keys(n.actions)){const o=i.get(r);o&&(t[o]=()=>{var l;return(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n.id,name:r}}),!1})}n.overlaidText&&(t.title=n.overlaidText),t.onclick||(t.onclick=()=>!1),S(this,os,wa).call(this)}_bindResetFormAction(t,n){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),S(this,os,wa).call(this),!this._fieldObjects){J('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{var d;i==null||i();const{fields:r,refs:o,include:l}=n,c=[];if(r.length!==0||o.length!==0){const f=new Set(o);for(const p of r){const y=this._fieldObjects[p]||[];for(const{id:_}of y)f.add(_)}for(const p of Object.values(this._fieldObjects))for(const y of p)f.has(y.id)===l&&c.push(y)}else for(const f of Object.values(this._fieldObjects))c.push(...f);const u=this.annotationStorage,h=[];for(const f of c){const{id:p}=f;switch(h.push(p),f.type){case"text":{const _=f.defaultValue||"";u.setValue(p,{value:_});break}case"checkbox":case"radiobutton":{const _=f.defaultValue===f.exportValues;u.setValue(p,{value:_});break}case"combobox":case"listbox":{const _=f.defaultValue||"";u.setValue(p,{value:_});break}default:continue}const y=document.querySelector(`[data-element-id="${p}"]`);if(y){if(!Jl.has(y)){J(`_bindResetFormAction - element not allowed: ${p}`);continue}}else continue;y.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((d=this.linkService.eventBus)==null||d.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}})),!1}}}os=new WeakSet,wa=function(){this.container.setAttribute("data-internal-link","")},zk=function(t,n,i="",r=null){t.href=this.linkService.getAnchorUrl(""),n.description?t.title=n.description:i&&(t.title=i),t.onclick=()=>{var o;return(o=this.downloadManager)==null||o.openOrDownloadData(n.content,n.filename,r),!1},S(this,os,wa).call(this)},Hk=function(t,n,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(n),!1),i&&(t.title=i),S(this,os,wa).call(this)};class CD extends Qe{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.hasOwnCommentButton=!0,this._createPopup()),this.container.append(e),this.container}}
150class sc extends Qe{render(){return this.container}showElementAndHideCanvas(e){var t;this.data.hasOwnCanvas&&(((t=e.previousSibling)==null?void 0:t.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return Gt.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,n,i,r){n.includes("mouse")?e.addEventListener(n,o=>{var l;(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:r(o),shift:o.shiftKey,modifier:this._getKeyModifier(o)}})}):e.addEventListener(n,o=>{var l;if(n==="blur"){if(!t.focused||!o.relatedTarget)return;t.focused=!1}else if(n==="focus"){if(t.focused)return;t.focused=!0}r&&((l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:r(o)}}))})}_setEventListeners(e,t,n,i){var r,o,l;for(const[c,u]of n)(u==="Action"||(r=this.data.actions)!=null&&r[u])&&((u==="Focus"||u==="Blur")&&(t||(t={focused:!1})),this._setEventListener(e,t,c,u,i),u==="Focus"&&!((o=this.data.actions)!=null&&o.Blur)?this._setEventListener(e,t,"blur","Blur",null):u==="Blur"&&!((l=this.data.actions)!=null&&l.Focus)&&this._setEventListener(e,t,"focus","Focus",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?"transparent":U.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||ED,r=e.style;let o;const l=2,c=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-l),h=Math.round(u/(z0*i))||1,d=u/h;o=Math.min(i,c(d/z0))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);o=Math.min(i,c(u/z0))}r.fontSize=`calc(${o}px * var(--total-scale-factor))`,r.color=U.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(r.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class TD extends sc{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 r=this.annotationStorage;
150for(const o of this._getElementsByName(e.name,e.id))o.domElement&&(o.domElement[t]=n),r.setValue(o.id,{[i]:n})}render(){var i,r;const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const o=e.getValue(t,{value:this.data.fieldValue});let l=o.value||"";const c=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;c&&l.length>c&&(l=l.slice(0,c));let u=o.formattedValue||((i=this.data.textContent)==null?void 0:i.join(`
151`))||null;u&&this.data.comb&&(u=u.replaceAll(/\s+/g,""));const h={userValue:l,formattedValue:u,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=u??l,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type=this.data.password?"password":"text",n.setAttribute("value",u??l),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),Jl.add(n),this.contentElement=n,n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;const{datetimeFormat:d,datetimeType:f,timeStep:p}=this.data,y=!!f&&this.enableScripting;d&&(n.title=d),this._setRequired(n,this.data.required),c&&(n.maxLength=c),n.addEventListener("input",A=>{e.setValue(t,{value:A.target.value}),this.setPropertyOnSiblings(n,"value",A.target.value,"value"),h.formattedValue=null}),n.addEventListener("resetform",A=>{const m=this.data.defaultFieldValue??"";n.value=h.userValue=m,h.formattedValue=null});let _=A=>{const{formattedValue:m}=h;m!=null&&(A.target.value=m),A.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",m=>{var w;if(h.focused)return;const{target:b}=m;if(y&&(b.type=f,p&&(b.step=p)),h.userValue){const E=h.userValue;if(y)if(f==="time"){const k=new Date(E),x=[k.getHours(),k.getMinutes(),k.getSeconds()];b.value=x.map(C=>C.toString().padStart(2,"0")).join(":")}else b.value=new Date(E-xD).toISOString().split(f==="date"?"T":".",1)[0];else b.value=E}h.lastCommittedValue=b.value,h.commitKey=1,(w=this.data.actions)!=null&&w.Focus||(h.focused=!0)}),n.addEventListener("updatefromsandbox",m=>{this.showElementAndHideCanvas(m.target);const b={value(w){h.userValue=w.detail.value??"",y||e.setValue(t,{value:h.userValue.toString()}),w.target.value=h.userValue},formattedValue(w){const{formattedValue:E}=w.detail;h.formattedValue=E,E!=null&&w.target!==document.activeElement&&(w.target.value=E);const k={formattedValue:E};y&&(k.value=E),e.setValue(t,k)},selRange(w){w.target.setSelectionRange(...w.detail.selRange)},charLimit:w=>{var C;const{charLimit:E}=w.detail,{target:k}=w;if(E===0){k.removeAttribute("maxLength");return}k.setAttribute("maxLength",E);let x=h.userValue;!x||x.length<=E||(x=x.slice(0,E),k.value=h.userValue=x,e.setValue(t,{value:x}),(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:x,willCommit:!0,commitKey:1,selStart:k.selectionStart,selEnd:k.selectionEnd}}))}};this._dispatchEventFromSandbox(b,m)}),n.addEventListener("keydown",m=>{var E;h.commitKey=1;let b=-1;if(m.key==="Escape"?b=0:m.key==="Enter"&&!this.data.multiLine?b=2:m.key==="Tab"&&(h.commitKey=3),b===-1)return;const{value:w}=m.target;h.lastCommittedValue!==w&&(h.lastCommittedValue=w,h.userValue=w,(E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:w,willCommit:!0,commitKey:b,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}}))});const A=_;_=null,n.addEventListener("blur",m=>{var E,k;if(!h.focused||!m.relatedTarget)return;(E=this.data.actions)!=null&&E.Blur||(h.focused=!1);const{target:b}=m;let{value:w}=b;if(y){if(w&&f==="time"){const x=w.split(":").map(C=>parseInt(C,10));w=new Date(2e3,0,1,x[0],x[1],x[2]||0).valueOf(),b.step=""}else w.includes("T")||(w=`${w}T00:00`),w=new Date(w).valueOf();b.type="text"}h.userValue=w,h.lastCommittedValue!==w&&((k=this.linkService.eventBus)==null||k.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:w,willCommit:!0,
vendor: 4,564 bytes, line 151
151commitKey:h.commitKey,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}})),A(m)}),(r=this.data.actions)!=null&&r.Keystroke&&n.addEventListener("beforeinput",m=>{var R;h.lastCommittedValue=null;const{data:b,target:w}=m,{value:E,selectionStart:k,selectionEnd:x}=w;let C=k,P=x;switch(m.inputType){case"deleteWordBackward":{const L=E.substring(0,k).match(/\w*[^\w]*$/);L&&(C-=L[0].length);break}case"deleteWordForward":{const L=E.substring(k).match(/^[^\w]*\w*/);L&&(P+=L[0].length);break}case"deleteContentBackward":k===x&&(C-=1);break;case"deleteContentForward":k===x&&(P+=1);break}m.preventDefault(),(R=this.linkService.eventBus)==null||R.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:E,change:b||"",willCommit:!1,selStart:C,selEnd:P}})}),this._setEventListeners(n,h,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],m=>m.target.value)}if(_&&n.addEventListener("blur",_),this.data.comb){const m=(this.data.rect[2]-this.data.rect[0])/c;n.classList.add("comb"),n.style.letterSpacing=`calc(${m}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 PD extends sc{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class RD extends sc{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 r=document.createElement("input");return Jl.add(r),r.setAttribute("data-element-id",n),r.disabled=t.readOnly,this._setRequired(r,this.data.required),r.type="checkbox",r.name=t.fieldName,i&&r.setAttribute("checked",!0),r.setAttribute("exportValue",t.exportValue),r.tabIndex=0,r.addEventListener("change",o=>{const{name:l,checked:c}=o.target;for(const u of this._getElementsByName(l,n)){const h=c&&u.exportValue===t.exportValue;u.domElement&&(u.domElement.checked=h),e.setValue(u.id,{value:h})}e.setValue(n,{value:c})}),r.addEventListener("resetform",o=>{const l=t.defaultFieldValue||"Off";o.target.checked=l===t.exportValue}),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",o=>{const l={value(c){c.target.checked=c.detail.value!=="Off",e.setValue(n,{value:c.target.checked})}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class Vk extends sc{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 o of this._getElementsByName(t.fieldName,n))e.setValue(o.id,{value:!1});const r=document.createElement("input");if(Jl.add(r),r.setAttribute("data-element-id",n),r.disabled=t.readOnly,this._setRequired(r,this.data.required),r.type="radio",r.name=t.fieldName,i&&r.setAttribute("checked",!0),r.tabIndex=0,r.addEventListener("change",o=>{const{name:l,checked:c}=o.target;for(const u of this._getElementsByName(l,n))e.setValue(u.id,{value:!1});e.setValue(n,{value:c})}),r.addEventListener("resetform",o=>{const l=t.defaultFieldValue;o.target.checked=l!=null&&l===t.buttonValue}),this.enableScripting&&this.hasJSActions){const o=t.buttonValue;r.addEventListener("updatefromsandbox",l=>{const c={value:u=>{const h=o===u.detail.value;for(const d of this._getElementsByName(u.target.name)){const f=h&&d.id===n;d.domElement&&(d.domElement.checked=f),e.setValue(d.id,{value:f})}}};this._dispatchEventFromSandbox(c,l)}),this._setEventListeners(r,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)}
151return this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class LD extends Mb{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 ID extends sc{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");Jl.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=0;let r=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",h=>{const d=this.data.defaultFieldValue;for(const f of i.options)f.selected=f.value===d});for(const h of this.data.options){const d=document.createElement("option");d.textContent=h.displayValue,d.value=h.exportValue,n.value.includes(h.exportValue)&&(d.setAttribute("selected",!0),r=!1),i.append(d)}let o=null;if(r){const h=document.createElement("option");h.value=" ",h.setAttribute("hidden",!0),h.setAttribute("selected",!0),i.prepend(h),o=()=>{h.remove(),i.removeEventListener("input",o),o=null},i.addEventListener("input",o)}const l=h=>{const d=h?"value":"textContent",{options:f,multiple:p}=i;return p?Array.prototype.filter.call(f,y=>y.selected).map(y=>y[d]):f.selectedIndex===-1?null:f[f.selectedIndex][d]};let c=l(!1);const u=h=>{const d=h.target.options;return Array.prototype.map.call(d,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",h=>{const d={value(f){o==null||o();const p=f.detail.value,y=new Set(Array.isArray(p)?p:[p]);for(const _ of i.options)_.selected=y.has(_.value);e.setValue(t,{value:l(!0)}),c=l(!1)},multipleSelection(f){i.multiple=!0},remove(f){const p=i.options,y=f.detail.remove;p[y].selected=!1,i.remove(y),p.length>0&&Array.prototype.findIndex.call(p,A=>A.selected)===-1&&(p[0].selected=!0),e.setValue(t,{value:l(!0),items:u(f)}),c=l(!1)},clear(f){for(;i.length!==0;)i.remove(0);e.setValue(t,{value:null,items:[]}),c=l(!1)},insert(f){const{index:p,displayValue:y,exportValue:_}=f.detail.insert,A=i.children[p],m=document.createElement("option");m.textContent=y,m.value=_,A?A.before(m):i.append(m),e.setValue(t,{value:l(!0),items:u(f)}),c=l(!1)},items(f){const{items:p}=f.detail;for(;i.length!==0;)i.remove(0);for(const y of p){const{displayValue:_,exportValue:A}=y,m=document.createElement("option");m.textContent=_,m.value=A,i.append(m)}i.options.length>0&&(i.options[0].selected=!0),e.setValue(t,{value:l(!0),items:u(f)}),c=l(!1)},indices(f){const p=new Set(f.detail.indices);for(const y of f.target.options)y.selected=p.has(y.index);e.setValue(t,{value:l(!0)}),c=l(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(d,h)}),i.addEventListener("input",h=>{var p;const d=l(!0),f=l(!1);e.setValue(t,{value:d}),h.preventDefault(),(p=this.linkService.eventBus)==null||p.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:c,change:f,changeEx:d,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"]],h=>h.target.value)):i.addEventListener("input",function(h){e.setValue(t,{value:l(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}var dp,Gw;class Ww extends Qe{constructor(t){const{data:n,elements:i,parent:r}=t,o=!!r._commentManager;super(t,{isRenderable:!o&&Qe._hasPopupData(n)});v(this,dp);if(this.elements=i,o&&Qe._hasPopupData(n)){const l=this.popup=S(this,dp,Gw).call(this);for(const c of i)c.popup=l}else this.popup=null}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";
151const n=this.popup=S(this,dp,Gw).call(this),i=[];for(const r of this.elements)r.popup=n,r.container.ariaHasPopup="dialog",i.push(r.data.id),r.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(r=>`${Dc}${r}`).join(",")),this.container}}dp=new WeakSet,Gw=function(){return new DD({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,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,commentManager:this.parent._commentManager})};var Wn,Ro,Ey,xy,Vu,Wu,tt,Pi,Lo,vl,Gu,qu,Ri,Gn,_r,br,nt,Sr,Io,fp,Ar,Xu,wl,Do,kt,Mo,re,rm,qw,Xw,Kw,om,Yw,Wk,Gk,qk,Xk,am,lm,Qw;class DD{constructor({container:e,color:t,elements:n,titleObj:i,modificationDate:r,contentsObj:o,richText:l,parent:c,rect:u,parentRect:h,open:d,commentManager:f=null}){v(this,re);v(this,Wn,null);v(this,Ro,S(this,re,qk).bind(this));v(this,Ey,S(this,re,Qw).bind(this));v(this,xy,S(this,re,lm).bind(this));v(this,Vu,S(this,re,am).bind(this));v(this,Wu,null);v(this,tt,null);v(this,Pi,null);v(this,Lo,null);v(this,vl,null);v(this,Gu,null);v(this,qu,null);v(this,Ri,!1);v(this,Gn,null);v(this,_r,null);v(this,br,null);v(this,nt,null);v(this,Sr,null);v(this,Io,null);v(this,fp,null);v(this,Ar,null);v(this,Xu,null);v(this,wl,null);v(this,Do,!1);v(this,kt,null);v(this,Mo,null);g(this,tt,e),g(this,Xu,i),g(this,Pi,o),g(this,Ar,l),g(this,Gu,c),g(this,Wu,t),g(this,fp,u),g(this,qu,h),g(this,vl,n),g(this,Wn,f),g(this,kt,n[0]),g(this,Lo,ey.toDateObject(r)),this.trigger=n.flatMap(p=>p.getElementsToTriggerPopup()),f||(S(this,re,rm).call(this),a(this,tt).hidden=!0,d&&S(this,re,am).call(this))}renderCommentButton(){if(a(this,nt)){a(this,nt).parentNode||a(this,kt).container.after(a(this,nt));return}if(a(this,Sr)||S(this,re,qw).call(this),!a(this,Sr))return;const{signal:e}=g(this,_r,new AbortController),t=a(this,kt).hasOwnCommentButton,n=()=>{a(this,Wn).toggleCommentPopup(this,!0,void 0,!t)},i=()=>{a(this,Wn).toggleCommentPopup(this,!1,!0,!t)},r=()=>{a(this,Wn).toggleCommentPopup(this,!1,!1)};if(t){g(this,nt,a(this,kt).container);for(const o of this.trigger)o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.addEventListener("keydown",a(this,Ro),{signal:e}),o.addEventListener("click",n,{signal:e}),o.addEventListener("pointerenter",i,{signal:e}),o.addEventListener("pointerleave",r,{signal:e}),o.classList.add("popupTriggerArea")}else{const o=g(this,nt,document.createElement("button"));o.className="annotationCommentButton";const l=a(this,kt).container;o.style.zIndex=l.style.zIndex+1,o.tabIndex=0,o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.setAttribute("data-l10n-id","pdfjs-show-comment-button"),S(this,re,Kw).call(this),S(this,re,Xw).call(this),o.addEventListener("keydown",a(this,Ro),{signal:e}),o.addEventListener("click",n,{signal:e}),o.addEventListener("pointerenter",i,{signal:e}),o.addEventListener("pointerleave",r,{signal:e}),l.after(o)}}get commentButtonColor(){const{color:e,opacity:t}=a(this,kt).commentData;return e?a(this,Gu)._commentManager.makeCommentColor(e,t):null}focusCommentButton(){setTimeout(()=>{var e;(e=a(this,nt))==null||e.focus()},0)}
151getData(){const{richText:e,color:t,opacity:n,creationDate:i,modificationDate:r}=a(this,kt).commentData;return{contentsObj:{str:this.comment},richText:e,color:t,opacity:n,creationDate:i,modificationDate:r}}get elementBeforePopup(){return a(this,nt)}get comment(){return a(this,Mo)||g(this,Mo,a(this,kt).commentText),a(this,Mo)}set comment(e){e!==this.comment&&(a(this,kt).commentText=g(this,Mo,e))}focus(){var e;(e=a(this,kt).container)==null||e.focus()}get parentBoundingClientRect(){return a(this,kt).layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:t}){a(this,nt)&&(a(this,nt).classList.toggle("selected",e),a(this,nt).ariaExpanded=t)}setSelectedCommentButton(e){a(this,nt).classList.toggle("selected",e)}get commentPopupPosition(){if(a(this,Io))return a(this,Io);const{x:e,y:t,height:n}=a(this,nt).getBoundingClientRect(),{x:i,y:r,width:o,height:l}=a(this,kt).layer.getBoundingClientRect();return[(e-i)/o,(t+n-r)/l]}set commentPopupPosition(e){g(this,Io,e)}hasDefaultPopupPosition(){return a(this,Io)===null}get commentButtonPosition(){return a(this,Sr)}get commentButtonWidth(){return a(this,nt).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){const[t,n]=a(this,Io)||this.commentButtonPosition.map(u=>u/100),i=this.parentBoundingClientRect,{x:r,y:o,width:l,height:c}=i;a(this,Wn).showDialog(null,this,r+t*l,o+n*c,{...e,parentDimensions:i})}render(){var n,i;if(a(this,Gn))return;const e=g(this,Gn,document.createElement("div"));if(e.className="popup",a(this,Wu)){const r=e.style.outlineColor=U.makeHexColor(...a(this,Wu));e.style.backgroundColor=`color-mix(in srgb, ${r} 30%, white)`}const t=document.createElement("span");if(t.className="header",(n=a(this,Xu))!=null&&n.str){const r=document.createElement("span");r.className="title",t.append(r),{dir:r.dir,str:r.textContent}=a(this,Xu)}if(e.append(t),a(this,Lo)){const r=document.createElement("time");r.className="popupDate",r.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),r.setAttribute("data-l10n-args",JSON.stringify({dateObj:a(this,Lo).valueOf()})),r.dateTime=a(this,Lo).toISOString(),t.append(r)}Ox({html:a(this,re,om)||a(this,Pi).str,dir:(i=a(this,Pi))==null?void 0:i.dir,className:"popupContent"},e),a(this,tt).append(e)}updateEdited({rect:e,popup:t,deleted:n}){var i;if(a(this,Wn)){n?(this.remove(),g(this,Mo,null)):t&&(t.deleted?this.remove():(S(this,re,Kw).call(this),g(this,Mo,t.text))),e&&(g(this,Sr,null),S(this,re,qw).call(this),S(this,re,Xw).call(this));return}if(n||t!=null&&t.deleted){this.remove();return}S(this,re,rm).call(this),a(this,wl)||g(this,wl,{contentsObj:a(this,Pi),richText:a(this,Ar)}),e&&g(this,br,null),t&&t.text&&(g(this,Ar,S(this,re,Gk).call(this,t.text)),g(this,Lo,ey.toDateObject(t.date)),g(this,Pi,null)),(i=a(this,Gn))==null||i.remove(),g(this,Gn,null)}resetEdited(){var e;a(this,wl)&&({contentsObj:gt(this,Pi)._,richText:gt(this,Ar)._}=a(this,wl),g(this,wl,null),(e=a(this,Gn))==null||e.remove(),g(this,Gn,null),g(this,br,null))}remove(){var e,t,n;if((e=a(this,_r))==null||e.abort(),g(this,_r,null),(t=a(this,Gn))==null||t.remove(),g(this,Gn,null),g(this,Do,!1),g(this,Ri,!1),(n=a(this,nt))==null||n.remove(),g(this,nt,null),this.trigger)for(const i of this.trigger)i.classList.remove("popupTriggerArea")}forceHide(){g(this,Do,this.isVisible),a(this,Do)&&(a(this,tt).hidden=!0)}maybeShow(){a(this,Wn)||(S(this,re,rm).call(this),a(this,Do)&&(a(this,Gn)||S(this,re,lm).call(this),g(this,Do,!1),a(this,tt).hidden=!1))}get isVisible(){return a(this,Wn)?!1:a(this,tt).hidden===!1}}Wn=new WeakMap,Ro=new WeakMap,Ey=new WeakMap,xy=new WeakMap,Vu=new WeakMap,Wu=new WeakMap,tt=new WeakMap,Pi=new WeakMap,Lo=new WeakMap,vl=new WeakMap,Gu=new WeakMap,qu=new WeakMap,Ri=new WeakMap,Gn=new WeakMap,_r=new WeakMap,br=new WeakMap,nt=new WeakMap,Sr=new WeakMap,Io=new WeakMap,fp=new WeakMap,Ar=new WeakMap,Xu=new WeakMap,wl=new WeakMap,Do=new WeakMap,kt=new WeakMap,Mo=new WeakMap,re=new WeakSet,rm=function(){var t;if(a(this,_r))return;g(this,_r,new AbortController);const{signal:e}=a(this,_r);for(const n of this.trigger)n.addEventListener("click",a(this,Vu),{signal:e}),n.addEventListener("pointerenter",a(this,xy),{signal:e}),n.addEventListener("pointerleave",a(this,Ey),{signal:e}),n.classList.add("popupTriggerArea");for(const n of a(this,vl))(t=n.container)==null||t.addEventListener("keydown",a(this,Ro),{signal:e})},qw=function(){const e=a(this,vl).find(t=>t.hasCommentButton);e&&g(this,Sr,e._normalizePoint(e.commentButtonPosition))},Xw=function(){if(a(this,kt).extraPopupElement&&!a(this,kt).editor)return;a(this,nt)||this.renderCommentButton();const[e,t]=a(this,Sr),{style:n}=a(this,nt);n.left=`calc(${e}%)`,n.top=`calc(${t}% - var(--comment-button-dim))`},Kw=function(){a(this,kt).extraPopupElement||(a(this,nt)||this.renderCommentButton(),a(this,nt).style.backgroundColor=this.commentButtonColor||"")},om=function(){const e=a(this,Ar),t=a(this,Pi);return e!=null&&e.str&&(!(t!=null&&t.str)||t.str===e.str)&&a(this,Ar).html||null},Yw=function(){var e,t,n;return((n=(t=(e=a(this,re,om))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:n.fontSize)||0},Wk=function(){var e,t,n;return((n=(t=(e=a(this,re,om))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:n.color)||null},Gk=function(e){const t=[],n={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},i={style:{color:a(this,re,Wk),fontSize:a(this,re,Yw)?`calc(${a(this,re,Yw)}px * var(--total-scale-factor))`:""}};for(const r of e.split(`
152`))t.push({name:"span",value:r,attributes:i});return n},qk=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&a(this,Ri))&&S(this,re,am).call(this)},Xk=function(){if(a(this,br)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:i,pageY:r}}}=a(this,Gu);let o=!!a(this,qu),l=o?a(this,qu):a(this,fp);for(const y of a(this,vl))if(!l||U.intersect(y.data.rect,l)!==null){l=y.data.rect,o=!0;break}const c=U.normalizeRect([l[0],e[3]-l[1]+e[1],l[2],e[3]-l[3]+e[1]]),h=o?l[2]-l[0]+5:0,d=c[0]+h,f=c[1];g(this,br,[100*(d-i)/t,100*(f-r)/n]);const{style:p}=a(this,tt);
152p.left=`${a(this,br)[0]}%`,p.top=`${a(this,br)[1]}%`},am=function(){if(a(this,Wn)){a(this,Wn).toggleCommentPopup(this,!1);return}g(this,Ri,!a(this,Ri)),a(this,Ri)?(S(this,re,lm).call(this),a(this,tt).addEventListener("click",a(this,Vu)),a(this,tt).addEventListener("keydown",a(this,Ro))):(S(this,re,Qw).call(this),a(this,tt).removeEventListener("click",a(this,Vu)),a(this,tt).removeEventListener("keydown",a(this,Ro)))},lm=function(){a(this,Gn)||this.render(),this.isVisible?a(this,Ri)&&a(this,tt).classList.add("focused"):(S(this,re,Xk).call(this),a(this,tt).hidden=!1,a(this,tt).style.zIndex=parseInt(a(this,tt).style.zIndex)+1e3)},Qw=function(){a(this,tt).classList.remove("focused"),!(a(this,Ri)||!this.isVisible)&&(a(this,tt).hidden=!0,a(this,tt).style.zIndex=parseInt(a(this,tt).style.zIndex)-1e3)};class Kk extends Qe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=ee.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=this.contentElement=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.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}var pp;class MD extends Qe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});v(this,pp,null)}render(){this.container.classList.add("lineAnnotation");const{data:t,width:n,height:i}=this,r=this.svgFactory.create(n,i,!0),o=g(this,pp,this.svgFactory.createElement("svg:line"));return o.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),o.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),o.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),o.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),o.setAttribute("stroke-width",t.borderStyle.width||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return a(this,pp)}addHighlightArea(){this.container.classList.add("highlightArea")}}pp=new WeakMap;var gp;class ND extends Qe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});v(this,gp,null)}render(){this.container.classList.add("squareAnnotation");const{data:t,width:n,height:i}=this,r=this.svgFactory.create(n,i,!0),o=t.borderStyle.width,l=g(this,gp,this.svgFactory.createElement("svg:rect"));return l.setAttribute("x",o/2),l.setAttribute("y",o/2),l.setAttribute("width",n-o),l.setAttribute("height",i-o),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),r.append(l),this.container.append(r),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return a(this,gp)}addHighlightArea(){this.container.classList.add("highlightArea")}}gp=new WeakMap;var mp;class OD extends Qe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});v(this,mp,null)}render(){this.container.classList.add("circleAnnotation");const{data:t,width:n,height:i}=this,r=this.svgFactory.create(n,i,!0),o=t.borderStyle.width,l=g(this,mp,this.svgFactory.createElement("svg:ellipse"));return l.setAttribute("cx",n/2),l.setAttribute("cy",i/2),l.setAttribute("rx",n/2-o/2),l.setAttribute("ry",i/2-o/2),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),r.append(l),this.container.append(r),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return a(this,mp)}addHighlightArea(){this.container.classList.add("highlightArea")}}mp=new WeakMap;var yp;class Yk extends Qe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});v(this,yp,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:n,borderStyle:i,popupRef:r},width:o,height:l}=this;if(!n)return this.container;const c=this.svgFactory.create(o,l,!0);let u=[];for(let d=0,f=n.length;d<f;d+=2){const p=n[d]-t[0],y=t[3]-n[d+1];u.push(`${p},${y}`)}u=u.join(" ");const h=g(this,yp,this.svgFactory.createElement(this.svgElementName));return h.setAttribute("points",u),h.setAttribute("stroke-width",i.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),c.append(h),this.container.append(c),!r&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return a(this,yp)}addHighlightArea(){this.container.classList.add("highlightArea")}}yp=new WeakMap;class FD extends Yk{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class jD extends Qe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}}
152var vp,_l,wp,Jw;class Nb extends Qe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});v(this,wp);v(this,vp,null);v(this,_l,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?ee.HIGHLIGHT:ee.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,rotation:n,inkLists:i,borderStyle:r,popupRef:o}}=this,{transform:l,width:c,height:u}=S(this,wp,Jw).call(this,n,t),h=this.svgFactory.create(c,u,!0),d=g(this,vp,this.svgFactory.createElement("svg:g"));h.append(d),d.setAttribute("stroke-width",r.width||1),d.setAttribute("stroke-linecap","round"),d.setAttribute("stroke-linejoin","round"),d.setAttribute("stroke-miterlimit",10),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),d.setAttribute("transform",l);for(let f=0,p=i.length;f<p;f++){const y=this.svgFactory.createElement(this.svgElementName);a(this,_l).push(y),y.setAttribute("points",i[f].join(",")),d.append(y)}return!o&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(h),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);const{thickness:n,points:i,rect:r}=t,o=a(this,vp);if(n>=0&&o.setAttribute("stroke-width",n||1),i)for(let l=0,c=a(this,_l).length;l<c;l++)a(this,_l)[l].setAttribute("points",i[l].join(","));if(r){const{transform:l,width:c,height:u}=S(this,wp,Jw).call(this,this.data.rotation,r);o.parentElement.setAttribute("viewBox",`0 0 ${c} ${u}`),o.setAttribute("transform",l)}}getElementsToTriggerPopup(){return a(this,_l)}addHighlightArea(){this.container.classList.add("highlightArea")}}vp=new WeakMap,_l=new WeakMap,wp=new WeakSet,Jw=function(t,n){switch(t){case 90:return{transform:`rotate(90) translate(${-n[0]},${n[1]}) scale(1,-1)`,width:n[3]-n[1],height:n[2]-n[0]};case 180:return{transform:`rotate(180) translate(${-n[2]},${n[1]}) scale(1,-1)`,width:n[2]-n[0],height:n[3]-n[1]};case 270:return{transform:`rotate(270) translate(${-n[2]},${n[3]}) scale(1,-1)`,width:n[3]-n[1],height:n[2]-n[0]};default:return{transform:`translate(${-n[0]},${n[3]}) scale(1,-1)`,width:n[2]-n[0],height:n[3]-n[1]}}};class Qk extends Qe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=ee.HIGHLIGHT}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),e){const n=document.createElement("mark");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}}class BD extends Qe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),e){const n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}}class $D extends Qe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),e){const n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}}class UD extends Qe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),e){const n=document.createElement("s");n.classList.add("overlaidText"),n.textContent=e,this.container.append(n)}return this.container}}class Jk extends Qe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=ee.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}
152var _p,bp,Zw;class zD extends Qe{constructor(t){var i;super(t,{isRenderable:!0});v(this,bp);v(this,_p,null);const{file:n}=this.data;this.filename=n.filename,this.content=n.content,(i=this.linkService.eventBus)==null||i.dispatch("fileattachmentannotation",{source:this,...n})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:n}=this;let i;n.hasAppearance||n.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(n.name)?"paperclip":"pushpin"}.svg`,n.fillAlpha&&n.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(n.fillAlpha*100)}%);`)),i.addEventListener("dblclick",S(this,bp,Zw).bind(this)),g(this,_p,i);const{isMac:r}=Gt.platform;return t.addEventListener("keydown",o=>{o.key==="Enter"&&(r?o.metaKey:o.ctrlKey)&&S(this,bp,Zw).call(this)}),!n.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return a(this,_p)}addHighlightArea(){this.container.classList.add("highlightArea")}}_p=new WeakMap,bp=new WeakSet,Zw=function(){var t;(t=this.downloadManager)==null||t.openOrDownloadData(this.content,this.filename)};var bl,Sl,Ku,No,Sp,Al,qn,Ap,Or,cm,t_;const Hb=class Hb{constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,annotationEditorUIManager:i,page:r,viewport:o,structTreeLayer:l,commentManager:c,linkService:u,annotationStorage:h}){v(this,Or);v(this,bl,null);v(this,Sl,null);v(this,Ku,null);v(this,No,new Map);v(this,Sp,null);v(this,Al,null);v(this,qn,[]);v(this,Ap,!1);this.div=e,g(this,bl,t),g(this,Sl,n),g(this,Sp,l||null),g(this,Al,u||null),g(this,Ku,h||new Rb),this.page=r,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=i,this._commentManager=c||null}hasEditableAnnotations(){return a(this,No).size>0}async render(e){var l;const{annotations:t}=e,n=this.div;Yl(n,this.viewport);const i=new Map,r=[],o={data:null,layer:n,linkService:a(this,Al),downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new ly,annotationStorage:a(this,Ku),enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const c of t){if(c.noHTML)continue;const u=c.annotationType===ut.POPUP;if(u){const f=i.get(c.id);if(!f)continue;if(!this._commentManager){r.push(c);continue}o.elements=f}else if(c.rect[2]===c.rect[0]||c.rect[3]===c.rect[1])continue;o.data=c;const h=Y0.create(o);if(!h.isRenderable)continue;if(!u&&(a(this,qn).push(h),c.popupRef)){const f=i.get(c.popupRef);f?f.push(h):i.set(c.popupRef,[h])}const d=h.render();c.hidden&&(d.style.visibility="hidden"),h._isEditable&&(a(this,No).set(h.data.id,h),(l=this._annotationEditorUIManager)==null||l.renderAnnotationElement(h))}await S(this,Or,cm).call(this);for(const c of r){const u=o.elements=i.get(c.id);o.data=c;const h=Y0.create(o);if(!h.isRenderable)continue;const d=h.render();h.contentElement.id=`${Dc}${c.id}`,c.hidden&&(d.style.visibility="hidden"),u.at(-1).container.after(d)}S(this,Or,t_).call(this)}async addLinkAnnotations(e){const t={data:null,layer:this.div,linkService:a(this,Al),svgFactory:new ly,parent:this};for(const n of e){n.borderStyle||(n.borderStyle=Hb._defaultBorderStyle),t.data=n;const i=Y0.create(t);i.isRenderable&&(i.render(),i.contentElement.id=`${Dc}${n.id}`,a(this,qn).push(i))}await S(this,Or,cm).call(this)}update({viewport:e}){const t=this.div;this.viewport=e,Yl(t,{rotation:e.rotation}),S(this,Or,t_).call(this),t.hidden=!1}getEditableAnnotations(){return Array.from(a(this,No).values())}getEditableAnnotation(e){return a(this,No).get(e)}addFakeAnnotation(e){const{div:t}=this,{id:n,rotation:i}=e,r=new kD({data:{id:n,rect:e.getPDFRect(),rotation:i},editor:e,layer:t,parent:this,enableComment:!!this._commentManager,linkService:a(this,Al),annotationStorage:a(this,Ku)});return r.render(),r.contentElement.id=`${Dc}${n}`,r.createOrUpdatePopup(),a(this,qn).push(r),r}removeAnnotation(e){var i;const t=a(this,qn).findIndex(r=>r.data.id===e);if(t<0)return;const[n]=a(this,qn).splice(t,1);(i=a(this,bl))==null||i.removePointerInTextLayer(n.contentElement)}updateFakeAnnotations(e){if(e.length!==0){for(const t of e)t.updateFakeAnnotationElement(this);S(this,Or,cm).call(this)}}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}static get _defaultBorderStyle(){return se(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:fc.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};bl=new WeakMap,Sl=new WeakMap,Ku=new WeakMap,No=new WeakMap,Sp=new WeakMap,Al=new WeakMap,qn=new WeakMap,Ap=new WeakMap,Or=new WeakSet,cm=async function(){var n,i,r;if(a(this,qn).length===0)return;this.div.replaceChildren();const e=[];
152if(!a(this,Ap)){g(this,Ap,!0);for(const{contentElement:o,data:{id:l}}of a(this,qn)){const c=o.id=`${Dc}${l}`;e.push((n=a(this,Sp))==null?void 0:n.getAriaAttributes(c).then(u=>{if(u)for(const[h,d]of u)o.setAttribute(h,d)}))}}a(this,qn).sort(({data:{rect:[o,l,c,u]}},{data:{rect:[h,d,f,p]}})=>{if(o===c&&l===u)return 1;if(h===f&&d===p)return-1;const y=u,_=l,A=(l+u)/2,m=p,b=d,w=(d+p)/2;if(A>=m&&w<=_)return-1;if(w>=y&&A<=b)return 1;const E=(o+c)/2,k=(h+f)/2;return E-k});const t=document.createDocumentFragment();for(const o of a(this,qn))t.append(o.container),this._commentManager?(r=((i=o.extraPopupElement)==null?void 0:i.popup)||o.popup)==null||r.renderCommentButton():o.extraPopupElement&&t.append(o.extraPopupElement.render());if(this.div.append(t),await Promise.all(e),a(this,bl))for(const o of a(this,qn))a(this,bl).addPointerInTextLayer(o.contentElement,!1)},t_=function(){var t;if(!a(this,Sl))return;const e=this.div;for(const[n,i]of a(this,Sl)){const r=e.querySelector(`[data-annotation-id="${n}"]`);if(!r)continue;i.className="annotationContent";const{firstChild:o}=r;o?o.nodeName==="CANVAS"?o.replaceWith(i):o.classList.contains("annotationContent")?o.after(i):o.before(i):r.append(i);const l=a(this,No).get(n);l&&(l._hasNoCanvas?((t=this._annotationEditorUIManager)==null||t.setMissingCanvas(n,r.id,i),l._hasNoCanvas=!1):l.canvas=i)}a(this,Sl).clear()};let e_=Hb;const Lg=/\r\n?|\n/g;var Xn,Ep,El,Kn,ft,Zk,eC,tC,um,Fr,hm,dm,nC,s_,sC;const Ue=class Ue extends je{constructor(t){super({...t,name:"freeTextEditor"});v(this,ft);v(this,Xn,"");v(this,Ep,`${this.id}-editor`);v(this,El,null);v(this,Kn);I(this,"_colorPicker",null);this.color=t.color||Ue._defaultColor||je._defaultLineColor,g(this,Kn,t.fontSize||Ue._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static get _keyboardManager(){const t=Ue.prototype,n=o=>o.isEmpty(),i=Ql.TRANSLATE_SMALL,r=Ql.TRANSLATE_BIG;return se(this,"_keyboardManager",new eg([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-r,0],checker:n}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[r,0],checker:n}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-r],checker:n}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,r],checker:n}]]))}static initialize(t,n){je.initialize(t,n);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,n){switch(t){case he.FREETEXT_SIZE:Ue._defaultFontSize=n;break;case he.FREETEXT_COLOR:Ue._defaultColor=n;break}}updateParams(t,n){switch(t){case he.FREETEXT_SIZE:S(this,ft,Zk).call(this,n);break;case he.FREETEXT_COLOR:S(this,ft,eC).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[he.FREETEXT_SIZE,Ue._defaultFontSize],[he.FREETEXT_COLOR,Ue._defaultColor||je._defaultLineColor]]}get propertiesToUpdate(){return[[he.FREETEXT_SIZE,a(this,Kn)],[he.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new ay(this)),[["colorPicker",this._colorPicker]]}get colorType(){return he.FREETEXT_COLOR}onUpdatedColor(){var t;this.editorDiv.style.color=this.color,(t=this._colorPicker)==null||t.update(this.color),super.onUpdatedColor()}_translateEmpty(t,n){this._uiManager.translateSelectedEditors(t,n,!0)}getInitialTranslation(){const t=this.parentScale;return[-Ue._internalPadding*t,-(Ue._internalPadding+a(this,Kn))*t]}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"),g(this,El,new AbortController);const t=this._uiManager.combinedSignal(a(this,El));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){var t;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",a(this,Ep)),this._isDraggable=!0,(t=a(this,El))==null||t.abort(),g(this,El,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){var n;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),(n=this._initialOptions)!=null&&n.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=a(this,Xn),n=g(this,Xn,S(this,ft,tC).call(this).trimEnd());if(t===n)return;const i=r=>
152{if(g(this,Xn,r),!r){this.remove();return}S(this,ft,dm).call(this),this._uiManager.rebuild(this),S(this,ft,um).call(this)};this.addCommands({cmd:()=>{i(n)},undo:()=>{i(t)},mustExec:!1}),S(this,ft,um).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){Ue._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){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 t,n;(this._isCopy||this.annotationElementId)&&(t=this.x,n=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",a(this,Ep)),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:i}=this.editorDiv;if(i.fontSize=`calc(${a(this,Kn)}px * var(--total-scale-factor))`,i.color=this.color,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[r,o]=this.parentDimensions;if(this.annotationElementId){const{position:l}=this._initialData;let[c,u]=this.getInitialTranslation();[c,u]=this.pageTranslationToScreen(c,u);const[h,d]=this.pageDimensions,[f,p]=this.pageTranslation;let y,_;switch(this.rotation){case 0:y=t+(l[0]-f)/h,_=n+this.height-(l[1]-p)/d;break;case 90:y=t+(l[0]-f)/h,_=n-(l[1]-p)/d,[c,u]=[u,-c];break;case 180:y=t-this.width+(l[0]-f)/h,_=n-(l[1]-p)/d,[c,u]=[-c,-u];break;case 270:y=t+(l[0]-f-this.height*d)/h,_=n+(l[1]-p-this.width*h)/d,[c,u]=[-u,c];break}this.setAt(y*r,_*o,c,u)}else this._moveAfterPaste(t,n);S(this,ft,dm).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){var y,_,A;const n=t.clipboardData||window.clipboardData,{types:i}=n;if(i.length===1&&i[0]==="text/plain")return;t.preventDefault();const r=S(y=Ue,Fr,s_).call(y,n.getData("text")||"").replaceAll(Lg,`
153`);if(!r)return;const o=window.getSelection();if(!o.rangeCount)return;this.editorDiv.normalize(),o.deleteFromDocument();const l=o.getRangeAt(0);if(!r.includes(`
154`)){l.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),o.collapseToStart();return}const{startContainer:c,startOffset:u}=l,h=[],d=[];if(c.nodeType===Node.TEXT_NODE){const m=c.parentElement;if(d.push(c.nodeValue.slice(u).replaceAll(Lg,"")),m!==this.editorDiv){let b=h;for(const w of this.editorDiv.childNodes){if(w===m){b=d;continue}b.push(S(_=Ue,Fr,hm).call(_,w))}}h.push(c.nodeValue.slice(0,u).replaceAll(Lg,""))}else if(c===this.editorDiv){let m=h,b=0;for(const w of this.editorDiv.childNodes)b++===u&&(m=d),m.push(S(A=Ue,Fr,hm).call(A,w))}g(this,Xn,`${h.join(`
155`)}${r}${d.join(`
156`)}`),S(this,ft,dm).call(this);const f=new Range;let p=Math.sumPrecise(h.map(m=>m.length));for(const{firstChild:m}of this.editorDiv.childNodes)if(m.nodeType===Node.TEXT_NODE){const b=m.nodeValue.length;if(p<=b){f.setStart(m,p),f.setEnd(m,p);break}p-=b}o.removeAllRanges(),o.addRange(f)}get contentDiv(){return this.editorDiv}getPDFRect(){const t=Ue._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,n,i){var l;let r=null;if(t instanceof Kk){const{data:{defaultAppearanceData:{fontSize:c,fontColor:u},rect:h,rotation:d,id:f,popupRef:p,richText:y,contentsObj:_,creationDate:A,modificationDate:m},textContent:b,textPosition:w,parent:{page:{pageNumber:E}}}=t;if(!b||b.length===0)return null;r=t={annotationType:ee.FREETEXT,color:Array.from(u),fontSize:c,value:b.join(`
157`),position:w,pageIndex:E-1,rect:h.slice(0),rotation:d,annotationElementId:f,id:f,deleted:!1,popupRef:p,comment:(_==null?void 0:_.str)||null,richText:y,creationDate:A,modificationDate:m}}const o=await super.deserialize(t,n,i);return g(o,Kn,t.fontSize),o.color=U.makeHexColor(...t.color),g(o,Xn,S(l=Ue,Fr,s_).call(l,t.value)),o._initialData=r,t.comment&&o.setCommentData(t),o}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n=je._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(t),{color:n,fontSize:a(this,Kn),value:S(this,ft,nC).call(this)});return this.addComment(i),t?(i.isCopy=!0,i):this.annotationElementId&&!S(this,ft,sC).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){const n=super.renderAnnotationElement(t);if(!n)return null;const{style:i}=n;i.fontSize=`calc(${a(this,Kn)}px * var(--total-scale-factor))`,i.color=this.color,n.replaceChildren();for(const r of a(this,Xn).split(`
158`)){const o=document.createElement("div");o.append(r?document.createTextNode(r):document.createElement("br")),n.append(o)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:a(this,Xn)}}),n}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}};Xn=new WeakMap,Ep=new WeakMap,El=new WeakMap,Kn=new WeakMap,ft=new WeakSet,Zk=function(t){const n=r=>{this.editorDiv.style.fontSize=`calc(${r}px * var(--total-scale-factor))`,this.translate(0,-(r-a(this,Kn))*this.parentScale),g(this,Kn,r),S(this,ft,um).call(this)},i=a(this,Kn);this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:he.FREETEXT_S
158IZE,overwriteIfSameType:!0,keepUndo:!0})},eC=function(t){const n=r=>{this.color=r,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:he.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},tC=function(){var i;const t=[];this.editorDiv.normalize();let n=null;for(const r of this.editorDiv.childNodes)(n==null?void 0:n.nodeType)===Node.TEXT_NODE&&r.nodeName==="BR"||(t.push(S(i=Ue,Fr,hm).call(i,r)),n=r);return t.join(`
159`)},um=function(){const[t,n]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:r,div:o}=this,l=o.style.display,c=o.classList.contains("hidden");o.classList.remove("hidden"),o.style.display="hidden",r.div.append(this.div),i=o.getBoundingClientRect(),o.remove(),o.style.display=l,o.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/n):(this.width=i.height/t,this.height=i.width/n),this.fixAndSetPosition()},Fr=new WeakSet,hm=function(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(Lg,"")},dm=function(){if(this.editorDiv.replaceChildren(),!!a(this,Xn))for(const t of a(this,Xn).split(`
160`)){const n=document.createElement("div");n.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(n)}},nC=function(){return a(this,Xn).replaceAll(" "," ")},s_=function(t){return t.replaceAll(" "," ")},sC=function(t){const{value:n,fontSize:i,color:r,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==n||t.fontSize!==i||t.color.some((l,c)=>l!==r[c])||t.pageIndex!==o},v(Ue,Fr),I(Ue,"_freeTextDefaultContent",""),I(Ue,"_internalPadding",0),I(Ue,"_defaultColor",null),I(Ue,"_defaultFontSize",10),I(Ue,"_type","freetext"),I(Ue,"_editorType",ee.FREETEXT);let n_=Ue;class B{toSVGPath(){Ie("Abstract method `toSVGPath` must be implemented.")}get box(){Ie("Abstract getter `box` must be implemented.")}serialize(e,t){Ie("Abstract method `serialize` must be implemented.")}static _rescale(e,t,n,i,r,o){o||(o=new Float32Array(e.length));for(let l=0,c=e.length;l<c;l+=2)o[l]=t+e[l]*i,o[l+1]=n+e[l+1]*r;return o}static _rescaleAndSwap(e,t,n,i,r,o){o||(o=new Float32Array(e.length));for(let l=0,c=e.length;l<c;l+=2)o[l]=t+e[l+1]*i,o[l+1]=n+e[l]*r;return o}static _translate(e,t,n,i){i||(i=new Float32Array(e.length));for(let r=0,o=e.length;r<o;r+=2)i[r]=t+e[r],i[r+1]=n+e[r+1];return i}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,n,i,r){switch(r){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,r,o){return[(e+5*n)/6,(t+5*i)/6,(5*n+r)/6,(5*i+o)/6,(n+r)/2,(i+o)/2]}}I(B,"PRECISION",1e-4);var Yn,Ks,Yu,Qu,Li,ae,xl,kl,xp,kp,Ju,Zu,Oo,Cp,ky,Cy,Et,dd,iC,rC,oC,aC,lC,cC;const Ki=class Ki{constructor({x:e,y:t},n,i,r,o,l=0){v(this,Et);v(this,Yn);v(this,Ks,[]);v(this,Yu);v(this,Qu);v(this,Li,[]);v(this,ae,new Float32Array(18));v(this,xl);v(this,kl);v(this,xp);v(this,kp);v(this,Ju);v(this,Zu);v(this,Oo,[]);g(this,Yn,n),g(this,Zu,r*i),g(this,Qu,o),a(this,ae).set([NaN,NaN,NaN,NaN,e,t],6),g(this,Yu,l),g(this,kp,a(Ki,Cp)*i),g(this,xp,a(Ki,Cy)*i),g(this,Ju,i),a(this,Oo).push(e,t)}isEmpty(){return isNaN(a(this,ae)[8])}add({x:e,y:t}){var R;g(this,xl,e),g(this,kl,t);const[n,i,r,o]=a(this,Yn);let[l,c,u,h]=a(this,ae).subarray(8,12);const d=e-u,f=t-h,p=Math.hypot(d,f);if(p<a(this,xp))return!1;const y=p-a(this,kp),_=y/p,A=_*d,m=_*f;let b=l,w=c;l=u,c=h,u+=A,h+=m,(R=a(this,Oo))==null||R.push(e,t);const E=-m/y,k=A/y,x=E*a(this,Zu),C=k*a(this,Zu);return a(this,ae).set(a(this,ae).subarray(2,8),0),a(this,ae).set([u+x,h+C],4),a(this,ae).set(a(this,ae).subarray(14,18),12),a(this,ae).set([u-x,h-C],16),isNaN(a(this,ae)[6])?(a(this,Li).length===0&&(a(this,ae).set([l+x,c+C],2),a(this,Li).push(NaN,NaN,NaN,NaN,(l+x-n)/r,(c+C-i)/o),a(this,ae).set([l-x,c-C],14),a(this,Ks).push(NaN,NaN,NaN,NaN,(l-x-n)/r,(c-C-i)/o)),a(this,ae).set([b,w,l,c,u,h],6),!this.isEmpty()):(a(this,ae).set([b,w,l,c,u,h],6),Math.abs(Math.atan2(w-c,b-l)-Math.atan2(m,A))<Math.PI/2?([l,c,u,h]=a(this,ae).subarray(2,6),a(this,Li).push(NaN,NaN,NaN,NaN,((l+u)/2-n)/r,((c+h)/2-i)/o),[l,c,b,w]=a(this,ae).subarray(14,18),a(this,Ks).push(NaN,NaN,NaN,NaN,((b+l)/2-n)/r,((w+c)/2-i)/o),!0):([b,w,l,c,u,h]=a(this,ae).subarray(0,6),a(this,Li).push(((b+5*l)/6-n)/r,((w+5*c)/6-i)/o,((5*l+u)/6-n)/r,((5*c+h)/6-i)/o,((l+u)/2-n)/r,((c+h)/2-i)/o),[u,h,l,c,b,w]=a(this,ae).subarray(12,18),a(this,Ks).push(((b+5*l)/6-n)/r,((w+5*c)/6-i)/o,((5*l+u)/6-n)/r,((5*c+h)/6-i)/o,((l+u)/2-n)/r,((c+h)/2-i)/o),!0))}toSVGPath(){if(this.isEmpty())return"";const e=a(this,Li),t=a(this,Ks);if(isNaN(a(this,ae)[6])&&!this.isEmpty())return S(this,Et,iC).call(this);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]}`);S(this,Et,oC).call(this,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 S(this,Et,rC).call(this,n),n.join(" ")}newFreeDrawOutline(e,t,n,i,r,o){return new uC(e,t,n,i,r,o)}getOutlines(){var d;const e=a(this,Li),t=a(this,Ks),n=a(this,ae),[i,r,o,l]=a(this,Yn),c=new Float32Array((((d=a(this,Oo))==null?void 0:d.length)??0)+2);for(let f=0,p=c.length-2;f<p;f+=2)c[f]=(a(this,Oo)[f]-i)/o,c[f+1]=(a(this,Oo)[f+1]-r)/l;if(c[c.length-2]=(a(this,xl)-i)/o,c[c.length-1]=(a(this,kl)-r)/l,isNaN(n[6])&&!this.isEmpty())return S(this,Et,aC).call(this,c);const u=new Float32Array(a(this,Li).length+24+a(this,Ks).length);let h=e.length;for(let f=0;f<h;f+=2){if(isNaN(e[f])){u[f]=u[f+1]=NaN;continue}u[f]=e[f],u[f+1]=e[f+1]}h=S(this,Et,cC).call(this,u,h);for(let f=t.length-6;f>=6;f-=6)for(let p=0;p<6;p+=2){if(isNaN(t[f+p])){u[h]=u[h+1]=NaN,h+=2;continue}u[h]=t[f+p],u[h+1]=t[f+p+1],h+=2}return S(this,Et,lC).call(this,u,h),this.newFreeDrawOutline(u,c,a(this,Yn),a(this,Ju),a(this,Yu),a(this,Qu))}};Yn=new WeakMap,Ks=new WeakMap,Yu=new WeakMap,Qu=new WeakMap,Li=new WeakMap,ae=new WeakMap,xl=new WeakMap,kl=new WeakMap,xp=new WeakMap,kp=new WeakMap,Ju=new WeakMap,Zu=new WeakMap,Oo=new WeakMap,Cp=new WeakMap,ky=new WeakMap,Cy=new WeakMap,Et=new WeakSet,dd=function(){const e=a(this,ae).subarray(4,6),t=
160a(this,ae).subarray(16,18),[n,i,r,o]=a(this,Yn);return[(a(this,xl)+(e[0]-t[0])/2-n)/r,(a(this,kl)+(e[1]-t[1])/2-i)/o,(a(this,xl)+(t[0]-e[0])/2-n)/r,(a(this,kl)+(t[1]-e[1])/2-i)/o]},iC=function(){const[e,t,n,i]=a(this,Yn),[r,o,l,c]=S(this,Et,dd).call(this);return`M${(a(this,ae)[2]-e)/n} ${(a(this,ae)[3]-t)/i} L${(a(this,ae)[4]-e)/n} ${(a(this,ae)[5]-t)/i} L${r} ${o} L${l} ${c} L${(a(this,ae)[16]-e)/n} ${(a(this,ae)[17]-t)/i} L${(a(this,ae)[14]-e)/n} ${(a(this,ae)[15]-t)/i} Z`},rC=function(e){const t=a(this,Ks);e.push(`L${t[4]} ${t[5]} Z`)},oC=function(e){const[t,n,i,r]=a(this,Yn),o=a(this,ae).subarray(4,6),l=a(this,ae).subarray(16,18),[c,u,h,d]=S(this,Et,dd).call(this);e.push(`L${(o[0]-t)/i} ${(o[1]-n)/r} L${c} ${u} L${h} ${d} L${(l[0]-t)/i} ${(l[1]-n)/r}`)},aC=function(e){const t=a(this,ae),[n,i,r,o]=a(this,Yn),[l,c,u,h]=S(this,Et,dd).call(this),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(t[2]-n)/r,(t[3]-i)/o,NaN,NaN,NaN,NaN,(t[4]-n)/r,(t[5]-i)/o,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,u,h,NaN,NaN,NaN,NaN,(t[16]-n)/r,(t[17]-i)/o,NaN,NaN,NaN,NaN,(t[14]-n)/r,(t[15]-i)/o],0),this.newFreeDrawOutline(d,e,a(this,Yn),a(this,Ju),a(this,Yu),a(this,Qu))},lC=function(e,t){const n=a(this,Ks);return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6},cC=function(e,t){const n=a(this,ae).subarray(4,6),i=a(this,ae).subarray(16,18),[r,o,l,c]=a(this,Yn),[u,h,d,f]=S(this,Et,dd).call(this);return e.set([NaN,NaN,NaN,NaN,(n[0]-r)/l,(n[1]-o)/c,NaN,NaN,NaN,NaN,u,h,NaN,NaN,NaN,NaN,d,f,NaN,NaN,NaN,NaN,(i[0]-r)/l,(i[1]-o)/c],t),t+=24},v(Ki,Cp,8),v(Ki,ky,2),v(Ki,Cy,a(Ki,Cp)+a(Ki,ky));let cy=Ki;var eh,Cl,Er,Tp,Qn,Pp,at,Ty,hC;class uC extends B{constructor(t,n,i,r,o,l){super();v(this,Ty);v(this,eh);v(this,Cl,new Float32Array(4));v(this,Er);v(this,Tp);v(this,Qn);v(this,Pp);v(this,at);g(this,at,t),g(this,Qn,n),g(this,eh,i),g(this,Pp,r),g(this,Er,o),g(this,Tp,l),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],S(this,Ty,hC).call(this,l);const[c,u,h,d]=a(this,Cl);for(let f=0,p=t.length;f<p;f+=2)t[f]=(t[f]-c)/h,t[f+1]=(t[f+1]-u)/d;for(let f=0,p=n.length;f<p;f+=2)n[f]=(n[f]-c)/h,n[f+1]=(n[f+1]-u)/d}toSVGPath(){const t=[`M${a(this,at)[4]} ${a(this,at)[5]}`];for(let n=6,i=a(this,at).length;n<i;n+=6){if(isNaN(a(this,at)[n])){t.push(`L${a(this,at)[n+4]} ${a(this,at)[n+5]}`);continue}t.push(`C${a(this,at)[n]} ${a(this,at)[n+1]} ${a(this,at)[n+2]} ${a(this,at)[n+3]} ${a(this,at)[n+4]} ${a(this,at)[n+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,n,i,r],o){const l=i-t,c=r-n;let u,h;switch(o){case 0:u=B._rescale(a(this,at),t,r,l,-c),h=B._rescale(a(this,Qn),t,r,l,-c);break;case 90:u=B._rescaleAndSwap(a(this,at),t,n,l,c),h=B._rescaleAndSwap(a(this,Qn),t,n,l,c);break;case 180:u=B._rescale(a(this,at),i,n,-l,c),h=B._rescale(a(this,Qn),i,n,-l,c);break;case 270:u=B._rescaleAndSwap(a(this,at),i,r,-l,-c),h=B._rescaleAndSwap(a(this,Qn),i,r,-l,-c);break}return{outline:Array.from(u),points:[Array.from(h)]}}get box(){return a(this,Cl)}newOutliner(t,n,i,r,o,l=0){return new cy(t,n,i,r,o,l)}getNewOutline(t,n){const[i,r,o,l]=a(this,Cl),[c,u,h,d]=a(this,eh),f=o*h,p=l*d,y=i*h+c,_=r*d+u,A=this.newOutliner({x:a(this,Qn)[0]*f+y,y:a(this,Qn)[1]*p+_},a(this,eh),a(this,Pp),t,a(this,Tp),n??a(this,Er));for(let m=2;m<a(this,Qn).length;m+=2)A.add({x:a(this,Qn)[m]*f+y,y:a(this,Qn)[m+1]*p+_});return A.getOutlines()}}eh=new WeakMap,Cl=new WeakMap,Er=new WeakMap,Tp=new WeakMap,Qn=new WeakMap,Pp=new WeakMap,at=new WeakMap,Ty=new WeakSet,hC=function(t){const n=a(this,at);let i=n[4],r=n[5];const o=[i,r,i,r];let l=i,c=r,u=i,h=r;const d=t?Math.max:Math.min,f=new Float32Array(4);for(let y=6,_=n.length;y<_;y+=6){const A=n[y+4],m=n[y+5];isNaN(n[y])?(U.pointBoundingBox(A,m,o),c>m?(l=A,c=m):c===m&&(l=d(l,A)),h<m?(u=A,h=m):h===m&&(u=d(u,A))):(f[0]=f[1]=1/0,f[2]=f[3]=-1/0,U.bezierBoundingBox(i,r,...n.slice(y,y+6),f),U.rectBoundingBox(f[0],f[1],f[2],f[3],o),c>f[1]?(l=f[0],c=f[1]):c===f[1]&&(l=d(l,f[0])),h<f[3]?(u=f[2],h=f[3]):h===f[3]&&(u=d(u,f[2]))),i=A,r=m}const p=a(this,Cl);p[0]=o[0]-a(this,Er),p[1]=o[1]-a(this,Er),p[2]=o[2]-o[0]+2*a(this,Er),p[3]=o[3]-o[1]+2*a(this,Er),this.firstPoint=[l,c],this.lastPoint=[u,h]};var Rp,Lp,Ip,Fo,Ys,vn,dC,fm,fC,pC,r_;class i_{constructor(e,t=0,n=0,i=!0){v(this,vn);v(this,Rp);v(this,Lp);v(this,Ip);v(this,Fo,[]);v(this,Ys,[]);const r=[1/0,1/0,-1/0,-1/0],l=10**-4;for(const{x:A,y:m,width:b,height:w}of e){const E=Math.floor((A-t)/l)*l,k=Math.ceil((A+b+t)/l)*l,x=Math.floor((m-t)/l)*l,C=Math.ceil((m+w+t)/l)*l,P=[E,x,C,!0],R=[k,x,C,!1];a(this,Fo).push(P,R),U.rectBoundingBox(E,x,k,C,r)}const c=r[2]-r[0]+2*n,u=r[3]-r[1]+2*n,h=r[0]-n,d=r[1]-n;let f=i?-1/0:1/0,p=1/0;const y=a(this,Fo).at(i?-1:-2),_=[y[0],y[2]];for(const A of a(this,Fo)){const[m,b,w,E]=A;!E&&i?b<p?(p=b,f=m):b===p&&(f=Math.max(f,m)):E&&!i&&(b<p?(p=b,f=m):b===p&&(f=Math.min(f,m))),A[0]=(m-h)/c,A[1]=(b-d)/u,A[2]=(w-d)/u}g(this,Rp,new Float32Array([h,d,c,u])),g(this,Lp,[f,p]),g(this,Ip,_)}getOutlines(){a(this,Fo).sort((t,n)=>t[0]-n[0]||t[1]-n[1]||t[2]-n[2]);const e=[];for(const t of a(this,Fo))t[3]?(e.push(...S(this,vn,r_).call(this,t)),S(this,vn,fC).call(this,t)):(S(this,vn,pC).call(this,t),e.push(...S(this,vn,r_).call(this,t)));return S(this,vn,dC).call(this,e)}}Rp=new WeakMap,Lp=new WeakMap,Ip=new WeakMap,Fo=new WeakMap,Ys=new WeakMap,vn=new WeakSet,dC=function(e){const t=[],n=new Set;for(const o of e){const[l,c,u]=o;t.push([l,c,o],[l,u,o])}t.sort((o,l)=>o[1]-l[1]||o[0]-l[0]);for(let o=0,l=t.length;o<l;
160o+=2){const c=t[o][2],u=t[o+1][2];c.push(u),u.push(c),n.add(c),n.add(u)}const i=[];let r;for(;n.size>0;){const o=n.values().next().value;let[l,c,u,h,d]=o;n.delete(o);let f=l,p=c;for(r=[l,u],i.push(r);;){let y;if(n.has(h))y=h;else if(n.has(d))y=d;else break;n.delete(y),[l,c,u,h,d]=y,f!==l&&(r.push(f,p,l,p===c?c:u),f=l),p=p===c?u:c}r.push(f,p)}return new HD(i,a(this,Rp),a(this,Lp),a(this,Ip))},fm=function(e){const t=a(this,Ys);let n=0,i=t.length-1;for(;n<=i;){const r=n+i>>1,o=t[r][0];if(o===e)return r;o<e?n=r+1:i=r-1}return i+1},fC=function([,e,t]){const n=S(this,vn,fm).call(this,e);a(this,Ys).splice(n,0,[e,t])},pC=function([,e,t]){const n=S(this,vn,fm).call(this,e);for(let i=n;i<a(this,Ys).length;i++){const[r,o]=a(this,Ys)[i];if(r!==e)break;if(r===e&&o===t){a(this,Ys).splice(i,1);return}}for(let i=n-1;i>=0;i--){const[r,o]=a(this,Ys)[i];if(r!==e)break;if(r===e&&o===t){a(this,Ys).splice(i,1);return}}},r_=function(e){const[t,n,i]=e,r=[[t,n,i]],o=S(this,vn,fm).call(this,i);for(let l=0;l<o;l++){const[c,u]=a(this,Ys)[l];for(let h=0,d=r.length;h<d;h++){const[,f,p]=r[h];if(!(u<=f||p<=c)){if(f>=c){if(p>u)r[h][1]=u;else{if(d===1)return[];r.splice(h,1),h--,d--}continue}r[h][2]=c,p>u&&r.push([t,u,p])}}}return r};var Dp,th;class HD extends B{constructor(t,n,i,r){super();v(this,Dp);v(this,th);g(this,th,t),g(this,Dp,n),this.firstPoint=i,this.lastPoint=r}toSVGPath(){const t=[];for(const n of a(this,th)){let[i,r]=n;t.push(`M${i} ${r}`);for(let o=2;o<n.length;o+=2){const l=n[o],c=n[o+1];l===i?(t.push(`V${c}`),r=c):c===r&&(t.push(`H${l}`),i=l)}t.push("Z")}return t.join(" ")}serialize([t,n,i,r],o){const l=[],c=i-t,u=r-n;for(const h of a(this,th)){const d=new Array(h.length);for(let f=0;f<h.length;f+=2)d[f]=t+h[f]*c,d[f+1]=r-h[f+1]*u;l.push(d)}return l}get box(){return a(this,Dp)}get classNamesForOutlining(){return["highlightOutline"]}}Dp=new WeakMap,th=new WeakMap;class o_ extends cy{newFreeDrawOutline(e,t,n,i,r,o){return new VD(e,t,n,i,r,o)}}class VD extends uC{newOutliner(e,t,n,i,r,o=0){return new o_(e,t,n,i,r,o)}}var nh,Mp,xr,Tl,Np,Pn,Op,Fp,Pl,Jn,Zn,Bt,sh,ih,nn,rh,xs,jp,ie,a_,pm,gC,mC,yC,l_,_a,Ps,wc,vC,gm,mm,wC,_C,bC,SC,AC;const ve=class ve extends je{constructor(t){super({...t,name:"highlightEditor"});v(this,ie);v(this,nh,null);v(this,Mp,0);v(this,xr);v(this,Tl,null);v(this,Np,null);v(this,Pn,null);v(this,Op,null);v(this,Fp,0);v(this,Pl,null);v(this,Jn,null);v(this,Zn,null);v(this,Bt,!1);v(this,sh,null);v(this,ih,null);v(this,nn,null);v(this,rh,"");v(this,xs);v(this,jp,"");this.color=t.color||ve._defaultColor,g(this,xs,t.thickness||ve._defaultThickness),this.opacity=t.opacity||ve._defaultOpacity,g(this,xr,t.boxes||null),g(this,jp,t.methodOfCreation||""),g(this,rh,t.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(g(this,Bt,!0),S(this,ie,pm).call(this,t),S(this,ie,_a).call(this)):a(this,xr)&&(g(this,nh,t.anchorNode),g(this,Mp,t.anchorOffset),g(this,Op,t.focu
160sNode),g(this,Fp,t.focusOffset),S(this,ie,a_).call(this),S(this,ie,_a).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const t=ve.prototype;return se(this,"_keyboardManager",new eg([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:a(this,Bt)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:a(this,xs),methodOfCreation:a(this,jp)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,n){var i;je.initialize(t,n),ve._defaultColor||(ve._defaultColor=((i=n.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,n){switch(t){case he.HIGHLIGHT_COLOR:ve._defaultColor=n;break;case he.HIGHLIGHT_THICKNESS:ve._defaultThickness=n;break}}translateInPage(t,n){}get toolbarPosition(){return a(this,ih)}get commentButtonPosition(){return a(this,sh)}updateParams(t,n){switch(t){case he.HIGHLIGHT_COLOR:S(this,ie,gC).call(this,n);break;case he.HIGHLIGHT_THICKNESS:S(this,ie,mC).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[he.HIGHLIGHT_COLOR,ve._defaultColor],[he.HIGHLIGHT_THICKNESS,ve._defaultThickness]]}get propertiesToUpdate(){return[[he.HIGHLIGHT_COLOR,this.color||ve._defaultColor],[he.HIGHLIGHT_THICKNESS,a(this,xs)||ve._defaultThickness],[he.HIGHLIGHT_FREE,a(this,Bt)]]}onUpdatedColor(){var t,n;(t=this.parent)==null||t.drawLayer.updateProperties(a(this,Zn),{root:{fill:this.color,"fill-opacity":this.opacity}}),(n=a(this,Np))==null||n.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",g(this,Np,new oy({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(S(this,ie,mm).call(this))}getBaseTranslation(){return[0,0]}getRect(t,n){return super.getRect(t,n,S(this,ie,mm).call(this))}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){S(this,ie,l_).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(S(this,ie,_a).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var i;let n=!1;this.parent&&!t?S(this,ie,l_).call(this):t&&(S(this,ie,_a).call(this,t),n=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(t),this.show(this._isVisible),n&&this.select()}rotate(t){var r,o,l;const{drawLayer:n}=this.parent;let i;a(this,Bt)?(t=(t-this.rotation+360)%360,i=S(r=ve,Ps,wc).call(r,a(this,Jn).box,t)):i=S(o=ve,Ps,wc).call(o,[this.x,this.y,this.width,this.height],t),n.updateProperties(a(this,Zn),{bbox:i,root:{"data-main-rotation":t}}),n.updateProperties(a(this,nn),{bbox:S(l=ve,Ps,wc).call(l,a(this,Pn).box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;const t=super.render();a(this,rh)&&(t.setAttribute("aria-label",a(this,rh)),t.setAttribute("role","mark")),a(this,Bt)?t.classList.add("free"):this.div.addEventListener("keydown",S(this,ie,vC).bind(this),{signal:this._uiManager._signal});const n=g(this,Pl,document.createElement("div"));return t.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",n.style.clipPath=a(this,Tl),this.setDims(),Hx(this,a(this,Pl),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){var t;this.isSelected||(t=this.parent)==null||t.drawLayer.updateProperties(a(this,nn),{rootClass:{hovered:!0}})}pointerleave(){var t;this.isSelected||(t=this.parent)==null||t.drawLayer.updateProperties(a(this,nn),{rootClass:{hovered:!1}})}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:S(this,ie,gm).call(this,!0);break;case 1:case 3:S(this,ie,gm).call(this,!1);break}}select(){var t;super.select(),a(this,nn)&&((t=this.parent)==null||t.drawLayer.updateProperties(a(this,nn),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var t;super.unselect(),a(this,nn)&&((t=this.parent)==null||t.drawLayer.updateProperties(a(this,nn),{rootClass:{selected:!1}}),a(this,Bt)||S(this,ie,gm).call(this,!1))}get _mustFixPosition(){return!a(this,Bt)}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(a(this,Zn),{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(a(this,nn),{rootClass:{hidden:!t}}))}static startHighlighting(t,n,{target:i,x:r,y:o}){const{x:l,y:c,width:u,height:h}=i.getBoundingClientRect(),d=new AbortController,f=t.combinedSignal(d),p=y=>{d.abort(),S(this,Ps,SC).call(this,t,y)};window.addEventListener("blur",p,{signal:f}),window.addEventListener("pointerup",p,{signal:f}),window.addEventListener("pointerdown",rt,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Os,{signal:f}),i.addEventListener("pointermove",S(this,Ps,bC).bind(this,t),{signal:f}),this._freeHighlight=new o_({x:r,y:o},[l,c,u,h],t.scale,this._defaultThickness/2,n,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.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 async deserialize(t,n,i){var _,A,m,b;let r=null;if(t instanceof Qk){const{data:{quadPoints:w,rect:E,rotation:k,id:x,color:C,opacity:P,popupRef:R,richText:L,contentsObj:D,creationDate:F,modificationDate:Y},parent:{page:{pageNumber:q}}}=t;r=t={annotationType:ee.HIGHLIGHT,color:Array.from(C),opacity:P,quadPoints:w,boxes:null,pageIndex:q-1,rect:E.slice(0),rotation:k,annotationElementId:x,id:x,deleted:!1,popupRef:R,richText:L,comment:(D==null?void 0:D.str)||null,creationDate:F,modificationDate:Y}}else if(t instanceof Nb){const{data:{inkLists:w,rect:E,rotation:k,id:x,color:C,borderStyle:{rawWidth:P},popupRef:R,richText:L,contentsObj:D,creationDate:F,modificationDate:Y},parent:{page:{pageNumber:q}}}=t;r=t={annotationType:ee.HIGHLIGHT,color:Array.from(C),thickness:P,inkLists:w,boxes:null,pageIndex:q-1,rect:E.slice(0),rotation:k,annotationElementId:x,id:x,deleted:!1,popupRef:R,richText:L,comment:(D==null?void 0:D.str)||null,creationDate:F,modificationDate:Y}}const{color:o,quadPoints:l,inkLists:c,opacity:u}=t,h=await super.deserialize(t,n,i);h.color=U.makeHexColor(...o),h.opacity=u||1,c&&g(h,xs,t.thickness),h._initialData=r,t.comment&&h.setCommentData(t);const[d,f]=h.pageDimensions,[p,y]=h.pageTranslation;if(l){const w=g(h,xr,[]);for(let E=0;E<l.length;E+=8)w.push({x:(l[E]-p)/d,y:1-(l[E+1]-y)/f,width:(l[E+2]-l[E])/d,height:(l[E+1]-l[E+5])/f});S(_=h,ie,a_).call(_),S(A=h,ie,_a).call(A),h.rotate(h.rotation)}else if(c){g(h,Bt,!0);const w=c[0],E={x:w[0]-p,y:f-(w[1]-y)},k=new o_(E,[0,0,d,f],1,a(h,xs)/2,!0,.001);for(let P=0,R=w.length;P<R;
160P+=2)E.x=w[P]-p,E.y=f-(w[P+1]-y),k.add(E);const{id:x,clipPathId:C}=n.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:k.toSVGPath()}},!0,!0);S(m=h,ie,pm).call(m,{highlightOutlines:k.getOutlines(),highlightId:x,clipPathId:C}),S(b=h,ie,_a).call(b),h.rotate(h.parentRotation)}return h}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const n=je._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i=super.serialize(t);return Object.assign(i,{color:n,opacity:this.opacity,thickness:a(this,xs),quadPoints:S(this,ie,wC).call(this),outlines:S(this,ie,_C).call(this,i.rect)}),this.addComment(i),this.annotationElementId&&!S(this,ie,AC).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}};nh=new WeakMap,Mp=new WeakMap,xr=new WeakMap,Tl=new WeakMap,Np=new WeakMap,Pn=new WeakMap,Op=new WeakMap,Fp=new WeakMap,Pl=new WeakMap,Jn=new WeakMap,Zn=new WeakMap,Bt=new WeakMap,sh=new WeakMap,ih=new WeakMap,nn=new WeakMap,rh=new WeakMap,xs=new WeakMap,jp=new WeakMap,ie=new WeakSet,a_=function(){const t=new i_(a(this,xr),.001);g(this,Jn,t.getOutlines()),[this.x,this.y,this.width,this.height]=a(this,Jn).box;const n=new i_(a(this,xr),.0025,.001,this._uiManager.direction==="ltr");g(this,Pn,n.getOutlines());const{firstPoint:i}=a(this,Jn);g(this,sh,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]);const{lastPoint:r}=a(this,Pn);g(this,ih,[(r[0]-this.x)/this.width,(r[1]-this.y)/this.height])},pm=function({highlightOutlines:t,highlightId:n,clipPathId:i}){var f,p;if(g(this,Jn,t),g(this,Pn,t.getNewOutline(a(this,xs)/2+1.5,.0025)),n>=0)g(this,Zn,n),g(this,Tl,i),this.parent.drawLayer.finalizeDraw(n,{bbox:t.box,path:{d:t.toSVGPath()}}),g(this,nn,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:a(this,Pn).box,path:{d:a(this,Pn).toSVGPath()}},!0));else if(this.parent){const y=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(a(this,Zn),{bbox:S(f=ve,Ps,wc).call(f,a(this,Jn).box,(y-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(a(this,nn),{bbox:S(p=ve,Ps,wc).call(p,a(this,Pn).box,y),path:{d:a(this,Pn).toSVGPath()}})}const[o,l,c,u]=t.box;switch(this.rotation){case 0:this.x=o,this.y=l,this.width=c,this.height=u;break;case 90:{const[y,_]=this.parentDimensions;this.x=l,this.y=1-o,this.width=c*_/y,this.height=u*y/_;break}case 180:this.x=1-o,this.y=1-l,this.width=c,this.height=u;break;case 270:{const[y,_]=this.parentDimensions;this.x=1-l,this.y=o,this.width=c*_/y,this.height=u*y/_;break}}const{firstPoint:h}=t;g(this,sh,[(h[0]-o)/c,(h[1]-l)/u]);const{lastPoint:d}=a(this,Pn);g(this,ih,[(d[0]-o)/c,(d[1]-l)/u])},gC=function(t){const n=(o,l)=>{this.color=o,this.opacity=l,this.onUpdatedColor()},i=this.color,r=this.opacity;this.addCommands({cmd:n.bind(this,t,ve._defaultOpacity),undo:n.bind(this,i,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:he.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)},mC=function(t){const n=a(this,xs),i=r=>{g(this,xs,r),S(this,ie,yC).call(this,r)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:he.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)},yC=function(t){a(this,Bt)&&(S(this,ie,pm).call(this,{highlightOutlines:a(this,Jn).getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims())},l_=function(){a(this,Zn)===null||!this.parent||(this.parent.drawLayer.remove(a(this,Zn)),g(this,Zn,null),this.parent.drawLayer.remove(a(this,nn)),g(this,nn,null))},_a=function(t=this.parent){a(this,Zn)===null&&({id:gt(this,Zn)._,clipPathId:gt(this,Tl)._}=t.drawLayer.draw({bbox:a(this,Jn).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:a(this,Bt)},path:{d:a(this,Jn).toSVGPath()}},!1,!0),g(this,nn,t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:a(this,Bt)},bbox:a(this,Pn).box,path:{d:a(this,Pn).toSVGPath()}},a(this,Bt))),a(this,Pl)&&(a(this,Pl).style.clipPath=a(this,Tl)))},Ps=new WeakSet,wc=function([t,n,i,r],o){switch(o){case 90:return[1-n-r,t,r,i];case 180:return[1-t-i,1-n-r,i,r];case 270:return[n,1-t-i,r,i]}return[t,n,i,r]},vC=function(t){ve._keyboardManager.exec(this,t)},gm=function(t){if(!a(this,nh))return;const n=window.getSelection();t?n.setPosition(a(this,nh),a(this,Mp)):n.setPosition(a(this,Op),a(this,Fp))},mm=function(){return a(this,Bt)?this.rotation:0},wC=function(){if(a(this,Bt))return null;const[t,n]=this.pageDimensions,[i,r]=this.pageTranslation,o=a(this,xr),l=new Float32Array(o.length*8);let c=0;for(const{x:u,y:h,width:d,height:f}of o){const p=u*t+i,y=(1-h)*n+r;l[c]=l[c+4]=p,l[c+1]=l[c+3]=y,l[c+2]=l[c+6]=p+d*t,l[c+5]=l[c+7]=y-f*n,c+=8}return l},_C=function(t){return a(this,Jn).serialize(t,S(this,ie,mm).call(this))},bC=function(t,n){this._freeHighlight.add(n)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},SC=function(t,n){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(n,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},AC=function(t){const{color:n}=this._initialData;return this.hasEditedComment||t.color.some((i,r)=>i!==n[r])},v(ve,Ps),I(ve,"_defaultColor",null),I(ve,"_defaultOpacity",1),I(ve,"_defaultThickness",12),I(ve,"_type","highlight"),I(ve,"_editorType",ee.HIGHLIGHT),I(ve,"_freeHighlightId",-1),I(ve,"_freeHighlight",null),I(ve,"_freeHighlightClipId","");let uy=ve;var Rl;class EC{constructor(){v(this,Rl,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){a(this,Rl)[e]=t}toSVGProperties(){const e=a(this,Rl);return g(this,Rl,Object.create(null)),{root:e}}reset(){g(this,Rl,Object.create(null))}updateAll(e=this){this.updateProperties(e)}clone(){Ie("Not implemented")}}Rl=new WeakMap;var es,oh,Ct,Ll,Il,ge,c_,u_,h_,fd,xC,ym,pd,_c;const ue=class ue extends je{constructor(t){super(t);v(this,ge);v(this,es,null);v(this,oh);I(this,"_colorPicker",null);I(this,"_drawId",null);g(this,oh,t.mustBeCommitted||!1),this._addOutlines(t)}onUpdatedColor(){var t;(t=this._colorPicker)==null||t.update(this.color),super.onUpdatedColor()}
160_addOutlines(t){t.drawOutlines&&(S(this,ge,c_).call(this,t),S(this,ge,fd).call(this))}static _mergeSVGProperties(t,n){const i=new Set(Object.keys(t));for(const[r,o]of Object.entries(n))i.has(r)?Object.assign(t[r],o):t[r]=o;return t}static getDefaultDrawingOptions(t){Ie("Not implemented")}static get typesMap(){Ie("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,n){const i=this.typesMap.get(t);i&&this._defaultDrawingOptions.updateProperty(i,n),this._currentParent&&(a(ue,Ct).updateProperty(i,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,n){const i=this.constructor.typesMap.get(t);i&&this._updateProperty(t,i,n)}static get defaultPropertiesToUpdate(){const t=[],n=this._defaultDrawingOptions;for(const[i,r]of this.typesMap)t.push([i,n[r]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:n}=this;for(const[i,r]of this.constructor.typesMap)t.push([i,n[r]]);return t}_updateProperty(t,n,i){const r=this._drawingOptions,o=r[n],l=c=>{var h;r.updateProperty(n,c);const u=a(this,es).updateProperty(n,c);u&&S(this,ge,pd).call(this,u),(h=this.parent)==null||h.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),t===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:l.bind(this,i),undo:l.bind(this,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,ue._mergeSVGProperties(a(this,es).getPathResizingSVGProperties(S(this,ge,ym).call(this)),{bbox:S(this,ge,_c).call(this)}))}_onResized(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,ue._mergeSVGProperties(a(this,es).getPathResizedSVGProperties(S(this,ge,ym).call(this)),{bbox:S(this,ge,_c).call(this)}))}_onTranslating(t,n){var i;(i=this.parent)==null||i.drawLayer.updateProperties(this._drawId,{bbox:S(this,ge,_c).call(this)})}_onTranslated(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,ue._mergeSVGProperties(a(this,es).getPathTranslatedSVGProperties(S(this,ge,ym).call(this),this.parentDimensions),{bbox:S(this,ge,_c).call(this)}))}_onStartDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;(t=this.parent)==null||t.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(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,a(this,oh)&&(g(this,oh,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){S(this,ge,h_).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(S(this,ge,fd).call(this),S(this,ge,pd).call(this,a(this,es).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var i;let n=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),S(this,ge,h_).call(this)):t&&(this._uiManager.addShouldRescale(this),S(this,ge,fd).call(this,t),n=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(t),n&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,ue._mergeSVGProperties({bbox:S(this,ge,_c).call(this)},a(this,es).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&S(this,ge,pd).call(this,a(this,es).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,n;this._isCopy&&(t=this.x,n=this.y);const i=super.render();i.classList.add("draw");const r=document.createElement("div");return i.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,n),i}static createDrawerInstance(t,n,i,r,o){Ie("Not implemented")}static startDrawing(t,n,i,r){var A;const{target:o,offsetX:l,offsetY:c,pointerId:u,pointerType:h}=r;if(Qt.isInitializedAndDifferentPointerType(h))return;const{viewport:{rotation:d}}=t,{width:f,height:p}=o.getBoundingClientRect(),y=g(ue,Ll,new AbortController),_=t.combinedSignal(y);if(Qt.setPointer(h,u),window.addEventListener("pointerup",m=>{Qt.isSamePointerIdOrRemove(m.pointerId)&&this._endDraw(m)},{signal:_}),window.addEventListener("pointercancel",m=>{Qt.isSamePointerIdOrRemove(m.pointerId)&&this._currentParent.endDrawingSession()},{signal:_}),window.addEventListener("pointerdown",m=>{Qt.isSamePointerType(m.pointerType)&&(Qt.initializeAndAddPointerId(m.pointerId),a(ue,Ct).isCancellable()&&(a(ue,Ct).removeLastElement(),a(ue,Ct).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:_}),window.addEventListener("contextmenu",Os,{signal:_}),o.addEventListener("pointermove",this._drawMove.bind(this),{signal:_}),o.addEventListener("touchmove",m=>{Qt.isSameTimeStamp(m.timeStamp)&&rt(m)},{signal:_}),t.toggleDrawing(),(A=n._editorUndoBar)==null||A.hide(),a(ue,Ct)){t.drawLayer.updateProperties(this._currentDrawId,a(ue,Ct).startNew(l,c,f,p,d));return}n.updateUIForDefaultProperties(this),g(ue,Ct,this.createDrawerInstance(l,c,f,p,d)),g(ue,Il,this.getDefaultDrawingOptions()),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(a(ue,Il).toSVGProperties(),a(ue,Ct).defaultSVGProperties),!0,!1)}static _drawMove(t){if(Qt.isSameTimeStamp(t.timeStamp),!a(ue,Ct))return;const{offsetX:n,offsetY:i,pointerId:r}=t;if(Qt.isSamePointerId(r)){if(Qt.isUsingMultiplePointers()){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,a(ue,Ct).add(n,i)),Qt.setTimeStamp(t.timeStamp),rt(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,g(ue,Ct,null),g(ue,Il,null),Qt.clearPointerType(),Qt.clearTimeStamp()),a(ue,Ll)&&(a(ue,Ll).abort(),g(ue,Ll,null),Qt.clearPointerIds())}static _endDraw(t){const n=this._currentParent;if(n){if(n.toggleDrawing(!0),this._cleanup(!1),(t==null?void 0:t.target)===n.div&&n.drawLayer.updateProperties(this._currentDrawId,a(ue,Ct).end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){const i=a(ue,Ct),r=this._currentDrawId,o=i.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(r,i.setLastElement(o))},undo:()=>{n.drawLayer.updateProperties(r,i.removeLastElement())},mustExec:!1,type:he.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){const n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(he.DRAW_STEP),!a(ue,Ct).isEmpty()){const{pageDimensions:[i,r],scale:o}=n,l=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:a(ue,Ct).getOutlines(i*o,r*o,o,this._INNER_MARGIN),drawingOptions:a(ue,Il),mustBeCommitted:!t});return this._cleanup(!0),l}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,n,i,r,o,l){Ie("Not implemented")}static async deserialize(t,n,i){var d,f;const{rawDims:{pageWidth:r,pageHeight:o,pageX:l,pageY:c}}=n.viewport,u=this.deserializeDraw(l,c,r,o,this._INNER_MARGIN,t),h=await super.deserialize(t,n,i);return h.createDrawingOptions(t),S(d=h,ge,c_).call(d,{drawOutlines:u}),S(f=h,ge,fd).call(f),h.onScaleChanging(),h.rotate(),h}serializeDraw(t){const[n,i]=this.pageTranslation,[r,o]=this.pageDimensions;
160return a(this,es).serialize([n,i,r,o],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};es=new WeakMap,oh=new WeakMap,Ct=new WeakMap,Ll=new WeakMap,Il=new WeakMap,ge=new WeakSet,c_=function({drawOutlines:t,drawId:n,drawingOptions:i}){g(this,es,t),this._drawingOptions||(this._drawingOptions=i),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),n>=0?(this._drawId=n,this.parent.drawLayer.finalizeDraw(n,t.defaultProperties)):this._drawId=S(this,ge,u_).call(this,t,this.parent),S(this,ge,pd).call(this,t.box)},u_=function(t,n){const{id:i}=n.drawLayer.draw(ue._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return i},h_=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},fd=function(t=this.parent){if(!(this._drawId!==null&&this.parent===t)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,t.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=S(this,ge,u_).call(this,a(this,es),t)}},xC=function([t,n,i,r]){const{parentDimensions:[o,l],rotation:c}=this;switch(c){case 90:return[n,1-t,i*(l/o),r*(o/l)];case 180:return[1-t,1-n,i,r];case 270:return[1-n,t,i*(l/o),r*(o/l)];default:return[t,n,i,r]}},ym=function(){const{x:t,y:n,width:i,height:r,parentDimensions:[o,l],rotation:c}=this;switch(c){case 90:return[1-n,t,i*(o/l),r*(l/o)];case 180:return[1-t,1-n,i,r];case 270:return[n,1-t,i*(o/l),r*(l/o)];default:return[t,n,i,r]}},pd=function(t){[this.x,this.y,this.width,this.height]=S(this,ge,xC).call(this,t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},_c=function(){const{x:t,y:n,width:i,height:r,rotation:o,parentRotation:l,parentDimensions:[c,u]}=this;switch((o*4+l)/90){case 1:return[1-n-r,t,r,i];case 2:return[1-t-i,1-n-r,i,r];case 3:return[n,1-t-i,r,i];case 4:return[t,n-i*(c/u),r*(u/c),i*(c/u)];case 5:return[1-n,t,i*(c/u),r*(u/c)];case 6:return[1-t-r*(u/c),1-n,r*(u/c),i*(c/u)];case 7:return[n-i*(c/u),1-t-r*(u/c),i*(c/u),r*(u/c)];case 8:return[t-i,n-r,i,r];case 9:return[1-n,t-i,r,i];case 10:return[1-t,1-n,i,r];case 11:return[n-r,1-t,r,i];case 12:return[t-r*(u/c),n,r*(u/c),i*(c/u)];case 13:return[1-n-i*(c/u),t-r*(u/c),i*(c/u),r*(u/c)];case 14:return[1-t,1-n-i*(c/u),r*(u/c),i*(c/u)];case 15:return[n,1-t,i*(c/u),r*(u/c)];default:return[t,n,i,r]}},I(ue,"_currentDrawId",-1),I(ue,"_currentParent",null),v(ue,Ct,null),v(ue,Ll,null),v(ue,Il,null),I(ue,"_INNER_MARGIN",3);let hy=ue;var Ii,Tt,Pt,Dl,ah,un,$t,ks,Ml,Nl,Ol,lh,vm;class WD{constructor(e,t,n,i,r,o){v(this,lh);v(this,Ii,new Float64Array(6));v(this,Tt);v(this,Pt);v(this,Dl);v(this,ah);v(this,un);v(this,$t,"");v(this,ks,0);v(this,Ml,new ng);v(this,Nl);v(this,Ol);g(this,Nl,n),g(this,Ol,i),g(this,Dl,r),g(this,ah,o),[e,t]=S(this,lh,vm).call(this,e,t);const l=g(this,Tt,[NaN,NaN,NaN,NaN,e,t]);g(this,un,[e,t]),g(this,Pt,[{line:l,points:a(this,un)}]),a(this,Ii).set(l,0)}updateProperty(e,t){e==="stroke-width"&&g(this,ah,t)}isEmpty(){return!a(this,Pt)||a(this,Pt).length===0}isCancellable(){return a(this,un).length<=10}add(e,t){[e,t]=S(this,lh,vm).call(this,e,t);const[n,i,r,o]=a(this,Ii).subarray(2,6),l=e-r,c=t-o;return Math.hypot(a(this,Nl)*l,a(this,Ol)*c)<=2?null:(a(this,un).push(e,t),isNaN(n)?(a(this,Ii).set([r,o,e,t],2),a(this,Tt).push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(a(this,Ii)[0])&&a(this,Tt).splice(6,6),a(this,Ii).set([n,i,r,o,e,t],0),a(this,Tt).push(...B.createBezierPoints(n,i,r,o,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){const n=this.add(e,t);return n||(a(this,un).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,n,i,r){g(this,Nl,n),g(this,Ol,i),g(this,Dl,r),[e,t]=S(this,lh,vm).call(this,e,t);const o=g(this,Tt,[NaN,NaN,NaN,NaN,e,t]);g(this,un,[e,t]);const l=a(this,Pt).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),a(this,Pt).push({line:o,points:a(this,un)}),a(this,Ii).set(o,0),g(this,ks,0),this.toSVGPath(),null}getLastElement(){return a(this,Pt).at(-1)}setLastElement(e){return a(this,Pt)?(a(this,Pt).push(e),g(this,Tt,e.line),g(this,un,e.points),g(this,ks,0),{path:{d:this.toSVGPath()}}):a(this,Ml).setLastElement(e)}removeLastElement(){if(!a(this,Pt))return a(this,Ml).removeLastElement();a(this,Pt).pop(),g(this,$t,"");for(let e=0,t=a(this,Pt).length;e<t;e++){const{line:n,points:i}=a(this,Pt)[e];g(this,Tt,n),g(this,un,i),g(this,ks,0),this.toSVGPath()}return{path:{d:a(this,$t)}}}toSVGPath(){const e=B.svgRound(a(this,Tt)[4]),t=B.svgRound(a(this,Tt)[5]);if(a(this,un).length===2)return g(this,$t,`${a(this,$t)} M ${e} ${t} Z`),a(this,$t);if(a(this,un).length<=6){const i=a(this,$t).lastIndexOf("M");g(this,$t,`${a(this,$t).slice(0,i)} M ${e} ${t}`),g(this,ks,6)}if(a(this,un).length===4){const i=B.svgRound(a(this,Tt)[10]),r=B.svgRound(a(this,Tt)[11]);return g(this,$t,`${a(this,$t)} L ${i} ${r}`),g(this,ks,12),a(this,$t)}const n=[];a(this,ks)===0&&(n.push(`M ${e} ${t}`),g(this,ks,6));for(let i=a(this,ks),r=a(this,Tt).length;i<r;i+=6){const[o,l,c,u,h,d]=a(this,Tt).slice(i,i+6).map(B.svgRound);n.push(`C${o} ${l} ${c} ${u} ${h} ${d}`)}return g(this,$t,a(this,$t)+n.join(" ")),g(this,ks,a(this,Tt).length),a(this,$t)}getOutlines(e,t,n,i){const r=a(this,Pt).at(-1);return r.line=new Float32Array(r.line),r.points=new Float32Array(r.points),a(this,Ml).build(a(this,Pt),e,t,n,a(this,Dl),a(this,ah),i),g(this,Ii,null),g(this,Tt,null),g(this,Pt,null),g(this,$t,null),a(this,Ml)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}Ii=new WeakMap,Tt=new WeakMap,Pt=new WeakMap,Dl=new WeakMap,ah=new WeakMap,un=new WeakMap,$t=new WeakMap,ks=new WeakMap,Ml=new WeakMap,Nl=new WeakMap,Ol=new WeakMap,lh=new WeakSet,vm=function(e,t){return B._normalizePoint(e,t,a(this,Nl),a(this,Ol),a(this,Dl))};var hn,Bp,$p,ts,Di,Mi,ch,uh,Fl,Ht,Wi,kC,CC,TC;
160class ng extends B{constructor(){super(...arguments);v(this,Ht);v(this,hn);v(this,Bp,0);v(this,$p);v(this,ts);v(this,Di);v(this,Mi);v(this,ch);v(this,uh);v(this,Fl)}build(t,n,i,r,o,l,c){g(this,Di,n),g(this,Mi,i),g(this,ch,r),g(this,uh,o),g(this,Fl,l),g(this,$p,c??0),g(this,ts,t),S(this,Ht,CC).call(this)}get thickness(){return a(this,Fl)}setLastElement(t){return a(this,ts).push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return a(this,ts).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const t=[];for(const{line:n}of a(this,ts)){if(t.push(`M${B.svgRound(n[4])} ${B.svgRound(n[5])}`),n.length===6){t.push("Z");continue}if(n.length===12&&isNaN(n[6])){t.push(`L${B.svgRound(n[10])} ${B.svgRound(n[11])}`);continue}for(let i=6,r=n.length;i<r;i+=6){const[o,l,c,u,h,d]=n.subarray(i,i+6).map(B.svgRound);t.push(`C${o} ${l} ${c} ${u} ${h} ${d}`)}}return t.join("")}serialize([t,n,i,r],o){const l=[],c=[],[u,h,d,f]=S(this,Ht,kC).call(this);let p,y,_,A,m,b,w,E,k;switch(a(this,uh)){case 0:k=B._rescale,p=t,y=n+r,_=i,A=-r,m=t+u*i,b=n+(1-h-f)*r,w=t+(u+d)*i,E=n+(1-h)*r;break;case 90:k=B._rescaleAndSwap,p=t,y=n,_=i,A=r,m=t+h*i,b=n+u*r,w=t+(h+f)*i,E=n+(u+d)*r;break;case 180:k=B._rescale,p=t+i,y=n,_=-i,A=r,m=t+(1-u-d)*i,b=n+h*r,w=t+(1-u)*i,E=n+(h+f)*r;break;case 270:k=B._rescaleAndSwap,p=t+i,y=n+r,_=-i,A=-r,m=t+(1-h-f)*i,b=n+(1-u-d)*r,w=t+(1-h)*i,E=n+(1-u)*r;break}for(const{line:x,points:C}of a(this,ts))l.push(k(x,p,y,_,A,o?new Array(x.length):null)),c.push(k(C,p,y,_,A,o?new Array(C.length):null));return{lines:l,points:c,rect:[m,b,w,E]}}static deserialize(t,n,i,r,o,{paths:{lines:l,points:c},rotation:u,thickness:h}){const d=[];let f,p,y,_,A;switch(u){case 0:A=B._rescale,f=-t/i,p=n/r+1,y=1/i,_=-1/r;break;case 90:A=B._rescaleAndSwap,f=-n/r,p=-t/i,y=1/r,_=1/i;break;case 180:A=B._rescale,f=t/i+1,p=-n/r,y=-1/i,_=1/r;break;case 270:A=B._rescaleAndSwap,f=n/r+1,p=t/i+1,y=-1/r,_=-1/i;break}if(!l){l=[];for(const b of c){const w=b.length;if(w===2){l.push(new Float32Array([NaN,NaN,NaN,NaN,b[0],b[1]]));continue}if(w===4){l.push(new Float32Array([NaN,NaN,NaN,NaN,b[0],b[1],NaN,NaN,NaN,NaN,b[2],b[3]]));continue}const E=new Float32Array(3*(w-2));l.push(E);let[k,x,C,P]=b.subarray(0,4);E.set([NaN,NaN,NaN,NaN,k,x],0);for(let R=4;R<w;R+=2){const L=b[R],D=b[R+1];E.set(B.createBezierPoints(k,x,C,P,L,D),(R-2)*3),[k,x,C,P]=[C,P,L,D]}}}for(let b=0,w=l.length;b<w;b++)d.push({line:A(l[b].map(E=>E??NaN),f,p,y,_),points:A(c[b].map(E=>E??NaN),f,p,y,_)});const m=new this.prototype.constructor;return m.build(d,i,r,1,u,h,o),m}get box(){return a(this,hn)}updateProperty(t,n){return t==="stroke-width"?S(this,Ht,TC).call(this,n):null}updateParentDimensions([t,n],i){const[r,o]=S(this,Ht,Wi).call(this);g(this,Di,t),g(this,Mi,n),g(this,ch,i);const[l,c]=S(this,Ht,Wi).call(this),u=l-r,h=c-o,d=a(this,hn);return d[0]-=u,d[1]-=h,d[2]+=2*u,d[3]+=2*h,d}updateRotation(t){return g(this,Bp,t),{path:{transform:this.rotationTransform}}}get viewBox(){return a(this,hn).map(B.svgRound).join(" ")}get defaultProperties(){const[t,n]=a(this,hn);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${B.svgRound(t)} ${B.svgRound(n)}`}}}get rotationTransform(){const[,,t,n]=a(this,hn);let i=0,r=0,o=0,l=0,c=0,u=0;switch(a(this,Bp)){case 90:r=n/t,o=-t/n,c=t;break;case 180:i=-1,l=-1,c=t,u=n;break;case 270:r=-n/t,o=t/n,u=n;break;default:return""}return`matrix(${i} ${r} ${o} ${l} ${B.svgRound(c)} ${B.svgRound(u)})`}getPathResizingSVGProperties([t,n,i,r]){const[o,l]=S(this,Ht,Wi).call(this),[c,u,h,d]=a(this,hn);if(Math.abs(h-o)<=B.PRECISION||Math.abs(d-l)<=B.PRECISION){const A=t+i/2-(c+h/2),m=n+r/2-(u+d/2);return{path:{"transform-origin":`${B.svgRound(t)} ${B.svgRound(n)}`,transform:`${this.rotationTransform} translate(${A} ${m})`}}}const f=(i-2*o)/(h-2*o),p=(r-2*l)/(d-2*l),y=h/i,_=d/r;return{path:{"transform-origin":`${B.svgRound(c)} ${B.svgRound(u)}`,transform:`${this.rotationTransform} scale(${y} ${_}) translate(${B.svgRound(o)} ${B.svgRound(l)}) scale(${f} ${p}) translate(${B.svgRound(-o)} ${B.svgRound(-l)})`}}}getPathResizedSVGProperties([t,n,i,r]){const[o,l]=S(this,Ht,Wi).call(this),c=a(this,hn),[u,h,d,f]=c;if(c[0]=t,c[1]=n,c[2]=i,c[3]=r,Math.abs(d-o)<=B.PRECISION||Math.abs(f-l)<=B.PRECISION){const m=t+i/2-(u+d/2),b=n+r/2-(h+f/2);for(const{line:w,points:E}of a(this,ts))B._translate(w,m,b,w),B._translate(E,m,b,E);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${B.svgRound(t)} ${B.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const p=(i-2*o)/(d-2*o),y=(r-2*l)/(f-2*l),_=-p*(u+o)+t+o,A=-y*(h+l)+n+l;if(p!==1||y!==1||_!==0||A!==0)for(const{line:m,points:b}of a(this,ts))B._rescale(m,_,A,p,y,m),B._rescale(b,_,A,p,y,b);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${B.svgRound(t)} ${B.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,n],i){const[r,o]=i,l=a(this,hn),c=t-l[0],u=n-l[1];if(a(this,Di)===r&&a(this,Mi)===o)for(const{line:h,points:d}of a(this,ts))B._translate(h,c,u,h),B._translate(d,c,u,d);else{const h=a(this,Di)/r,d=a(this,Mi)/o;g(this,Di,r),g(this,Mi,o);for(const{line:f,points:p}of a(this,ts))B._rescale(f,c,u,h,d,f),B._rescale(p,c,u,h,d,p);l[2]*=h,l[3]*=d}return l[0]=t,l[1]=n,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${B.svgRound(t)} ${B.svgRound(n)}`}}}get defaultSVGProperties(){const t=a(this,hn);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${B.svgRound(t[0])} ${B.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}hn=new WeakMap,Bp=new WeakMap,$p=new WeakMap,ts=new WeakMap,Di=new WeakMap,Mi=new WeakMap,ch=new WeakMap,uh=new WeakMap,Fl=new WeakMap,Ht=new WeakSet,Wi=function(t=a(this,Fl)){const n=a(this,$p)+t/2*a(this,ch);return a(this,uh)%180===0?[n/a(this,Di),n/a(this,Mi)]:[n/a(this,Mi),n/a(this,Di)]},kC=function(){const[t,n,i,r]=a(this,hn),[o,l]=S(this,Ht,Wi).call(this,0);return[t+o,n+l,i-2*o,r-2*l]},CC=function(){const t=g(this,hn,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:r}of a(this,ts)){if(r.length<=12){for(let c=4,u=r.length;c<u;c+=6)U.pointBoundingBox(r[c],r[c+1],t);continue}let o=r[4],l=r[5];for(let c=6,u=r.length;c<u;c+=6){const[h,d,f,p,y,_]=r.subarray(c,c+6);U.bezierBoundingBox(o,l,h,d,f,p,y,_,t),o=y,l=_}}const[n,i]=S(this,Ht,Wi).call(this);t[0]=pn(t[0]-n,0,1),t[1]=pn(t[1]-i,0,1),t[2]=pn(t[2]+n,0,1),t[3]=pn(t[3]+i,0,1),t[2]-=t[0],t[3]-=t[1]},TC=function(t){const[n,i]=S(this,Ht,Wi).call(this);g(this,Fl,t);const[r,o]=S(this,Ht,Wi).call(this),[l,c]=[r-n,o-i],u=a(this,hn);return u[0]-=l,u[1]-=c,u[2]+=2*l,u[3]+=2*c,u};
160class s0 extends EC{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:je._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){e==="stroke-width"&&(t??(t=this["stroke-width"]),t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){const e=new s0(this._viewParameters);return e.updateAll(this),e}}var Py,PC;const jc=class jc extends hy{constructor(t){super({...t,name:"inkEditor"});v(this,Py);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,n){je.initialize(t,n),this._defaultDrawingOptions=new s0(n.viewParameters)}static getDefaultDrawingOptions(t){const n=this._defaultDrawingOptions.clone();return n.updateProperties(t),n}static get supportMultipleDrawings(){return!0}static get typesMap(){return se(this,"typesMap",new Map([[he.INK_THICKNESS,"stroke-width"],[he.INK_COLOR,"stroke"],[he.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,n,i,r,o){return new WD(t,n,i,r,o,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,n,i,r,o,l){return ng.deserialize(t,n,i,r,o,l)}static async deserialize(t,n,i){let r=null;if(t instanceof Nb){const{data:{inkLists:l,rect:c,rotation:u,id:h,color:d,opacity:f,borderStyle:{rawWidth:p},popupRef:y,richText:_,contentsObj:A,creationDate:m,modificationDate:b},parent:{page:{pageNumber:w}}}=t;r=t={annotationType:ee.INK,color:Array.from(d),thickness:p,opacity:f,paths:{points:l},boxes:null,pageIndex:w-1,rect:c.slice(0),rotation:u,annotationElementId:h,id:h,deleted:!1,popupRef:y,richText:_,comment:(A==null?void 0:A.str)||null,creationDate:m,modificationDate:b}}const o=await super.deserialize(t,n,i);return o._initialData=r,t.comment&&o.setCommentData(t),o}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new ay(this)),[["colorPicker",this._colorPicker]]}get colorType(){return he.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:t,_drawingOptions:n,parent:i}=this;n.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(t,n.toSVGProperties())}static onScaleChangingWhenDrawing(){const t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:n,opacity:i}){this._drawingOptions=jc.getDefaultDrawingOptions({stroke:U.makeHexColor(...t),"stroke-width":n,"stroke-opacity":i})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:n,points:i}=this.serializeDraw(t),{_drawingOptions:{stroke:r,"stroke-opacity":o,"stroke-width":l}}=this,c=Object.assign(super.serialize(t),{color:je._colorManager.convert(r),opacity:o,thickness:l,paths:{lines:n,points:i}});return this.addComment(c),t?(c.isCopy=!0,c):this.annotationElementId&&!S(this,Py,PC).call(this,c)?null:(c.id=this.annotationElementId,c)}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;const{points:n,rect:i}=this.serializeDraw(!1);return t.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:n,popup:this.comment}),null}};Py=new WeakSet,PC=function(t){const{color:n,thickness:i,opacity:r,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((l,c)=>l!==n[c])||t.thickness!==i||t.opacity!==r||t.pageIndex!==o},I(jc,"_type","ink"),I(jc,"_editorType",ee.INK),I(jc,"_defaultDrawingOptions",null);let d_=jc;class f_ extends ng{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}const Ig=8,Vh=3;var jl,we,p_,Qs,RC,LC,g_,wm,IC,DC,MC,m_,y_,NC;class Lr{static extractContoursFromText(e,{fontFamily:t,fontStyle:n,fontWeight:i},r,o,l,c){let u=new OffscreenCanvas(1,1),h=u.getContext("2d",{alpha:!1});const d=200,f=h.font=`${n} ${i} ${d}px ${t}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:y,actualBoundingBoxAscent:_,actualBoundingBoxDescent:A,fontBoundingBoxAscent:m,fontBoundingBoxDescent:b,width:w}=h.measureText(e),E=1.5,k=Math.ceil(Math.max(Math.abs(p)+Math.abs(y)||0,w)*E),x=Math.ceil(Math.max(Math.abs(_)+Math.abs(A)||d,Math.abs(m)+Math.abs(b)||d)*E);u=new OffscreenCanvas(k,x),h=u.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=f,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,k,x),h.fillStyle="black",h.fillText(e,k*(E-1)/2,x*(3-E)/2);const C=S(this,we,m_).call(this,h.getImageData(0,0,k,x).data),P=S(this,we,MC).call(this,C),R=S(this,we,y_).call(this,P),L=S(this,we,g_).call(this,C,k,x,R);return this.processDrawnLines({lines:{curves:L,width:k,height:x},pageWidth:r,pageHeight:o,rotation:l,innerMargin:c,mustSmooth:!0,areContours:!0})}static process(e,t,n,i,r){const[o,l,c]=S(this,we,NC).call(this,e),[u,h]=S(this,we,DC).call(this,o,l,c,Math.hypot(l,c)*a(this,jl).sigmaSFactor,a(this,jl).sigmaR,a(this,jl).kernelSize),d=S(this,we,y_).call(this,h),f=S(this,we,g_).call(this,u,l,c,d);return this.processDrawnLines({lines:{curves:f,width:l,height:c},pageWidth:t,pageHeight:n,rotation:i,innerMargin:r,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:i,innerMargin:r,mustSmooth:o,areContours:l}){i%180!==0&&([t,n]=[n,t]);const{curves:c,width:u,height:h}=e,d=e.thickness??0,f=[],p=Math.min(t/u,n/h),y=p/t,_=p/n,A=[];for(const{points:b}of c){const w=o?S(this,we,IC).call(this,b):b;if(!w)continue;A.push(w);const E=w.length,k=new Float32Array(E),x=new Float32Array(3*(E===2?2:E-2));if(f.push({line:x,points:k}),E===2){k[0]=w[0]*y,k[1]=w[1]*_,x.set([NaN,NaN,NaN,NaN,k[0],k[1]],0);continue}let[C,P,R,L]=w;C*=y,P*=_,R*=y,L*=_,k.set([C,P,R,L],0),x.set([NaN,NaN,NaN,NaN,C,P],0);for(let D=4;D<E;D+=2){const F=k[D]=w[D]*y,Y=k[D+1]=w[D+1]*_;x.set(B.createBezierPoints(C,P,R,L,F,Y),(D-2)*3),[C,P,R,L]=[R,L,F,Y]}}if(f.length===0)return null;const m=l?new f_:new ng;return m.build(f,t,n,1,i,l?0:d,r),{outline:m,newCurves:A,areContours:l,thickness:d,width:u,height:h}}static async compressSignature({outlines:e,areContours:t,thickness:n,width:i,height:r}){let o=1/0,l=-1/0,c=0;for(const w of e){c+=w.length;for(let E=2,k=w.length;E<k;E++){const x=w[E]-w[E-2];o=Math.min(o,x),l=Math.max(l,x)}}let u;o>=-128&&l<=127?u=Int8Array:o>=-32768&&l<=32767?u=Int16Array:u=Int32Array;const h=e.length,d=Ig+Vh*h,f=new Uint32Array(d);let p=0;f[p++]=d*Uint32Array.BYTES_PER_ELEMENT+(c-2*h)*u.BYTES_PER_ELEMENT,f[p++]=0,f[p++]=i,f[p++]=r,f[p++]=t?0:1,f[p++]=Math.max(0,Math.floor(n??0)),f[p++]=h,f[p++]=u.BYTES_PER_ELEMENT;for(const w of e)f[p++]=w.length-2,f[p++]=w[0],f[p++]=w[1];const y=new CompressionStream("deflate-raw"),_=y.writable.getWriter();await _.ready,_.write(f);const A=u.prototype.constructor;for(const w of e){const E=new A(w.length-2);for(let k=2,x=w.length;k<x;k++)E[k-2]=w[k]-w[k-2];_.write(E)}_.close();const m=await new Response(y.readable).arrayBuffer(),b=new Uint8Array(m);return Mx(b)}static async decompressSignature(e){try{const t=aI(e),{readable:n,writable:i}=new DecompressionStream("deflate-raw"),r=i.getWriter();await r.ready,r.write(t).then(async()=>{await r.ready,await r.close()}).catch(()=>{});let o=null,l=0;for await(const w of n)o||(o=new Uint8Array(new Uint32Array(w.buffer,0,4)[0])),o.set(w,l),l+=w.length;const c=new Uint32Array(o.buffer,0,o.length>>2),u=c[1];if(u!==0)throw new Error(`Invalid version: ${u}`);const h=c[2],d=c[3],f=c[4]===0,p=c[5],y=c[6],_=c[7],A=[],m=(Ig+Vh*y)*Uint32Array.BYTES_PER_ELEMENT;let b;switch(_){case Int8Array.BYTES_PER_ELEMENT:b=new Int8Array(o.buffer,m);break;case Int16Array.BYTES_PER_ELEMENT:b=new Int16Array(o.buffer,m);break;case Int32Array.BYTES_PER_ELEMENT:b=new Int32Array(o.buffer,m);break}l=0;for(let w=0;w<y;w++){const E=c[Vh*w+Ig],k=new Float32Array(E+2);A.push(k);for(let x=0;x<Vh-1;x++)k[x]=c[Vh*w+Ig+x+1];for(let x=0;x<E;x++)k[x+2]=k[x]+b[l++]}return{areContours:f,thickness:p,outlines:A,width:h,height:d}}catch(t){return J(`decompressSignature: ${t}`),null}}}jl=new WeakMap,we=new WeakSet,p_=function(e,t,n,i){return n-=e,i-=t,n===0?i>0?0:4:n===1?i+6:2-i},Qs=new WeakMap,RC=function(e,t,n,i,r,o,l){const c=S(this,we,p_).call(this,n,i,r,o);for(let u=0;u<8;u++){const h=(-u+c-l+16)%8,d=a(this,Qs)[2*h],f=a(this,Qs)[2*h+1];if(e[(n+d)*t+(i+f)]!==0)return h}return-1},LC=function(e,t,n,i,r,o,l){const c=S(this,we,p_).call(this,n,i,r,o);for(let u=0;u<8;u++){const h=(u+c+l+16)%8,d=a(this,Qs)[2*h],f=a(this,Qs)[2*h+1];if(e[(n+d)*t+(i+f)]!==0)return h}return-1},g_=function(e,t,n,i){const r=e.length,o=new Int32Array(r);for(let h=0;h<r;h++)o[h]=e[h]<=i?1:0;for(let h=1;h<n-1;h++)o[h*t]=o[h*t+t-1]=0;for(let h=0;h<t;h++)o[h]=o[t*n-1-h]=0;let l=1,c;const u=[];for(let h=1;h<n-1;h++){c=1;for(let d=1;d<t-1;d++){const f=h*t+d,p=o[f];if(p===0)continue;let y=h,_=d;if(p===1&&o[f-1]===0)l+=1,_-=1;else if(p>=1&&o[f+1]===0)l+=1,_+=1,p>1&&(c=p);else{p!==1&&(c=Math.abs(p));continue}const A=[d,h],m=_===d+1,b={isHole:m,points:A,id:l,parent:0};u.push(b);let w;for(const D of u)if(D.id===c){w=D;break}w?w.isHole?b.parent=m?w.parent:c:b.parent=m?c:w.parent:b.parent=m?c:0;const E=S(this,we,RC).call(this,o,t,h,d,y,_,0);if(E===-1){o[f]=-l,o[f]!==1&&(c=Math.abs(o[f]));continue}let k=a(this,Qs)[2*E],x=a(this,Qs)[2*E+1];const C=h+k,P=d+x;y=C,_=P;let R=h,L=d;for(;;){const D=S(this,we,LC).call(this,o,t,R,L,y,_,1);k=a(this,Qs)[2*D],x=a(this,Qs)[2*D+1];const F=R+k,Y=L+x;A.push(Y,F);const q=R*t+L;if(o[q+1]===0?o[q]=-l:o[q]===1&&(o[q]=l),F===h&&Y===d&&R===C&&L===P){o[f]!==1&&(c=Math.abs(o[f]));break}else y=R,_=L,R=F,L=Y}}}return u},wm=function(e,t,n,i){if(n-t<=4){for(let C=t;C<n-2;C+=2)i.push(e[C],e[C+1]);return}const r=e[t],o=e[t+1],l=e[n-4]-r,c=e[n-3]-o,u=Math.hypot(l,c),h=l/u,d=c/u,f=h*o-d*r,p=c/l,y=1/u,_=Math.atan(p),A=Math.cos(_),m=Math.sin(_),b=y*(Math.abs(A)+Math.abs(m)),w=y*(1-b+b**2),E=Math.max(Math.atan(Math.abs(m+A)*w),Math.atan(Math.abs(m-A)*w));let k=0,x=t;for(let C=t+2;C<n-2;C+=2){const P=Math.abs(f-h*e[C+1]+d*e[C]);P>k&&(x=C,k=P)}k>
160(u*E)**2?(S(this,we,wm).call(this,e,t,x+2,i),S(this,we,wm).call(this,e,x,n,i)):i.push(r,o)},IC=function(e){const t=[],n=e.length;return S(this,we,wm).call(this,e,0,n,t),t.push(e[n-2],e[n-1]),t.length<=4?null:t},DC=function(e,t,n,i,r,o){const l=new Float32Array(o**2),c=-2*i**2,u=o>>1;for(let _=0;_<o;_++){const A=(_-u)**2;for(let m=0;m<o;m++)l[_*o+m]=Math.exp((A+(m-u)**2)/c)}const h=new Float32Array(256),d=-2*r**2;for(let _=0;_<256;_++)h[_]=Math.exp(_**2/d);const f=e.length,p=new Uint8Array(f),y=new Uint32Array(256);for(let _=0;_<n;_++)for(let A=0;A<t;A++){const m=_*t+A,b=e[m];let w=0,E=0;for(let x=0;x<o;x++){const C=_+x-u;if(!(C<0||C>=n))for(let P=0;P<o;P++){const R=A+P-u;if(R<0||R>=t)continue;const L=e[C*t+R],D=l[x*o+P]*h[Math.abs(L-b)];w+=L*D,E+=D}}const k=p[m]=Math.round(w/E);y[k]++}return[p,y]},MC=function(e){const t=new Uint32Array(256);for(const n of e)t[n]++;return t},m_=function(e){const t=e.length,n=new Uint8ClampedArray(t>>2);let i=-1/0,r=1/0;for(let l=0,c=n.length;l<c;l++){const u=n[l]=e[l<<2];i=Math.max(i,u),r=Math.min(r,u)}const o=255/(i-r);for(let l=0,c=n.length;l<c;l++)n[l]=(n[l]-r)*o;return n},y_=function(e){let t,n=-1/0,i=-1/0;const r=e.findIndex(c=>c!==0);let o=r,l=r;for(t=r;t<256;t++){const c=e[t];c>n&&(t-o>i&&(i=t-o,l=t-1),n=c,o=t)}for(t=l-1;t>=0&&!(e[t]>e[t+1]);t--);return t},NC=function(e){const t=e,{width:n,height:i}=e,{maxDim:r}=a(this,jl);let o=n,l=i;if(n>r||i>r){let f=n,p=i,y=Math.log2(Math.max(n,i)/r);const _=Math.floor(y);y=y===_?_-1:_;for(let m=0;m<y;m++){o=Math.ceil(f/2),l=Math.ceil(p/2);const b=new OffscreenCanvas(o,l);b.getContext("2d").drawImage(e,0,0,f,p,0,0,o,l),f=o,p=l,e!==t&&e.close(),e=b.transferToImageBitmap()}const A=Math.min(r/o,r/l);o=Math.round(o*A),l=Math.round(l*A)}const u=new OffscreenCanvas(o,l).getContext("2d",{willReadFrequently:!0});u.fillStyle="white",u.fillRect(0,0,o,l),u.filter="grayscale(1)",u.drawImage(e,0,0,e.width,e.height,0,0,o,l);const h=u.getImageData(0,0,o,l).data;return[S(this,we,m_).call(this,h),o,l]},v(Lr,we),v(Lr,jl,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),v(Lr,Qs,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class Ob extends EC{constructor(){super(),super.updateProperties({fill:je._defaultLineColor,"stroke-width":0})}clone(){const e=new Ob;return e.updateAll(this),e}}class Fb extends s0{constructor(e){super(e),super.updateProperties({stroke:je._defaultLineColor,"stroke-width":1})}clone(){const e=new Fb(this._viewParameters);return e.updateAll(this),e}}var jo,Ni,Bo,Bl;const jn=class jn extends hy{constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"});v(this,jo,!1);v(this,Ni,null);v(this,Bo,null);v(this,Bl,null);this._willKeepAspectRatio=!0,g(this,Bo,t.signatureData||null),g(this,Ni,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,n){je.initialize(t,n),this._defaultDrawingOptions=new Ob,this._defaultDrawnSignatureOptions=new Fb(n.viewParameters)}static getDefaultDrawingOptions(t){const n=this._defaultDrawingOptions.clone();return n.updateProperties(t),n}static get supportMultipleDrawings(){return!1}static get typesMap(){return se(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!a(this,Ni)}}static computeTelemetryFinalData(t){const n=t.get("hasDescription");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,n;const{_isCopy:i}=this;if(i&&(this._isCopy=!1,t=this.x,n=this.y),super.render(),this._drawId===null)if(a(this,Bo)){const{lines:r,mustSmooth:o,areContours:l,description:c,uuid:u,heightInPage:h}=a(this,Bo),{rawDims:{pageWidth:d,pageHeight:f},rotation:p}=this.parent.viewport,y=Lr.processDrawnLines({lines:r,pageWidth:d,pageHeight:f,rotation:p,innerMargin:jn._INNER_MARGIN,mustSmooth:o,areContours:l});this.addSignature(y,h,c,u)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:a(this,Ni)||""}));return i&&(this._isCopy=!0,this._moveAfterPaste(t,n)),this.div}setUuid(t){g(this,Bl,t),this.addEditToolbar()}getUuid(){return a(this,Bl)}get description(){return a(this,Ni)}set description(t){g(this,Ni,t),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(n=>
160{n==null||n.updateEditSignatureButton(t)}))}getSignaturePreview(){const{newCurves:t,areContours:n,thickness:i,width:r,height:o}=a(this,Bo),l=Math.max(r,o),c=Lr.processDrawnLines({lines:{curves:t.map(u=>({points:u})),thickness:i,width:r,height:o},pageWidth:l,pageHeight:l,rotation:0,innerMargin:0,mustSmooth:!1,areContours:n});return{areContours:n,outline:c.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,n,i,r){const{x:o,y:l}=this,{outline:c}=g(this,Bo,t);g(this,jo,c instanceof f_),this.description=i;let u;a(this,jo)?u=jn.getDefaultDrawingOptions():(u=jn._defaultDrawnSignatureOptions.clone(),u.updateProperties({"stroke-width":c.thickness})),this._addOutlines({drawOutlines:c,drawingOptions:u});const[,h]=this.pageDimensions;let d=n/h;d=d>=1?.5:d,this.width*=d/this.height,this.width>=1&&(d*=.9/this.width,this.width=.9),this.height=d,this.setDims(),this.x=o,this.y=l,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(r),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!r,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(t){const{rawDims:{pageWidth:n,pageHeight:i},rotation:r}=this.parent.viewport;return Lr.process(t,n,i,r,jn._INNER_MARGIN)}getFromText(t,n){const{rawDims:{pageWidth:i,pageHeight:r},rotation:o}=this.parent.viewport;return Lr.extractContoursFromText(t,n,i,r,o,jn._INNER_MARGIN)}getDrawnSignature(t){const{rawDims:{pageWidth:n,pageHeight:i},rotation:r}=this.parent.viewport;return Lr.processDrawnLines({lines:t,pageWidth:n,pageHeight:i,rotation:r,innerMargin:jn._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:n}){t?this._drawingOptions=jn.getDefaultDrawingOptions():(this._drawingOptions=jn._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(t=!1){if(this.isEmpty())return null;const{lines:n,points:i}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":r}}=this,o=Object.assign(super.serialize(t),{isSignature:!0,areContours:a(this,jo),color:[0,0,0],thickness:a(this,jo)?0:r});return this.addComment(o),t?(o.paths={lines:n,points:i},o.uuid=a(this,Bl),o.isCopy=!0):o.lines=n,a(this,Ni)&&(o.accessibilityData={type:"Figure",alt:a(this,Ni)}),o}static deserializeDraw(t,n,i,r,o,l){return l.areContours?f_.deserialize(t,n,i,r,o,l):ng.deserialize(t,n,i,r,o,l)}static async deserialize(t,n,i){var o;const r=await super.deserialize(t,n,i);return g(r,jo,t.areContours),r.description=((o=t.accessibilityData)==null?void 0:o.alt)||"",g(r,Bl,t.uuid),r}};jo=new WeakMap,Ni=new WeakMap,Bo=new WeakMap,Bl=new WeakMap,I(jn,"_type","signature"),I(jn,"_editorType",ee.SIGNATURE),I(jn,"_defaultDrawingOptions",null);let v_=jn;var We,Rt,$o,kr,Uo,hh,Cr,$l,Oi,ns,dh,me,gd,md,_m,bm,Sm,__,Am,OC;class w_ extends je{constructor(t){super({...t,name:"stampEditor"});v(this,me);v(this,We,null);v(this,Rt,null);v(this,$o,null);v(this,kr,null);v(this,Uo,null);v(this,hh,"");v(this,Cr,null);v(this,$l,!1);v(this,Oi,null);v(this,ns,!1);v(this,dh,!1);g(this,kr,t.bitmapUrl),g(this,Uo,t.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,n){je.initialize(t,n)}static isHandlingMimeForPasting(t){return iw.includes(t)}static paste(t,n){n.pasteEditor({mode:ee.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!((t=this.altTextData)!=null&&t.altText)}}static computeTelemetryFinalData(t){const n=t.get("hasAltText");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}async mlGuessAltText(t=null,n=!0){if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:r,width:o,height:l}=t||this.copyCanvas(null,null,!0).imageData,c=await i.guess({name:"altText",request:{data:r,width:o,height:l,channels:r.length/(o*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 u=c.output;return await this.setGuessedAltText(u),n&&!this.hasAltTextData()&&(this.altTextData={alt:u,decorative:!1}),u}remove(){var t;a(this,Rt)&&(g(this,We,null),this._uiManager.imageManager.deleteId(a(this,Rt)),(t=a(this,Cr))==null||t.remove(),g(this,Cr,null),a(this,Oi)&&(clearTimeout(a(this,Oi)),g(this,Oi,null))),super.remove()}rebuild(){if(!this.parent){a(this,Rt)&&S(this,me,_m).call(this);return}super.rebuild(),this.div!==null&&(a(this,Rt)&&a(this,Cr)===null&&S(this,me,_m).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(a(this,$o)||a(this,We)||a(this,kr)||a(this,Uo)||a(this,Rt)||a(this,$l))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}
160render(){if(this.div)return this.div;let t,n;return this._isCopy&&(t=this.x,n=this.y),super.render(),this.div.hidden=!0,this.createAltText(),a(this,$l)||(a(this,We)?S(this,me,bm).call(this):S(this,me,_m).call(this)),this._isCopy&&this._moveAfterPaste(t,n),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,n){const{id:i,bitmap:r}=this._uiManager.imageManager.getFromCanvas(t,n);n.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(g(this,Rt,i),r&&g(this,We,r),g(this,$l,!1),S(this,me,bm).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;a(this,Oi)!==null&&clearTimeout(a(this,Oi)),g(this,Oi,setTimeout(()=>{g(this,Oi,null),S(this,me,__).call(this)},200))}copyCanvas(t,n,i=!1){t||(t=224);const{width:r,height:o}=a(this,We),l=new $i;let c=a(this,We),u=r,h=o,d=null;if(n){if(r>n||o>n){const C=Math.min(n/r,n/o);u=Math.floor(r*C),h=Math.floor(o*C)}d=document.createElement("canvas");const p=d.width=Math.ceil(u*l.sx),y=d.height=Math.ceil(h*l.sy);a(this,ns)||(c=S(this,me,Sm).call(this,p,y));const _=d.getContext("2d");_.filter=this._uiManager.hcmFilter;let A="white",m="#cfcfd8";this._uiManager.hcmFilter!=="none"?m="black":fI.isDarkMode&&(A="#8f8f9d",m="#42414d");const b=15,w=b*l.sx,E=b*l.sy,k=new OffscreenCanvas(w*2,E*2),x=k.getContext("2d");x.fillStyle=A,x.fillRect(0,0,w*2,E*2),x.fillStyle=m,x.fillRect(0,0,w,E),x.fillRect(w,E,w,E),_.fillStyle=_.createPattern(k,"repeat"),_.fillRect(0,0,p,y),_.drawImage(c,0,0,c.width,c.height,0,0,p,y)}let f=null;if(i){let p,y;if(l.symmetric&&c.width<t&&c.height<t)p=c.width,y=c.height;else if(c=a(this,We),r>t||o>t){const m=Math.min(t/r,t/o);p=Math.floor(r*m),y=Math.floor(o*m),a(this,ns)||(c=S(this,me,Sm).call(this,p,y))}const A=new OffscreenCanvas(p,y).getContext("2d",{willReadFrequently:!0});A.drawImage(c,0,0,c.width,c.height,0,0,p,y),f={width:p,height:y,data:A.getImageData(0,0,p,y).data}}return{canvas:d,width:u,height:h,imageData:f}}static async deserialize(t,n,i){var A;let r=null,o=!1;if(t instanceof Jk){const{data:{rect:m,rotation:b,id:w,structParent:E,popupRef:k,richText:x,contentsObj:C,creationDate:P,modificationDate:R},container:L,parent:{page:{pageNumber:D}},canvas:F}=t;let Y,q;F?(delete t.canvas,{id:Y,bitmap:q}=i.imageManager.getFromCanvas(L.id,F),F.remove()):(o=!0,t._hasNoCanvas=!0);const oe=((A=await n._structTree.getAriaAttributes(`${Dc}${w}`))==null?void 0:A.get("aria-label"))||"";r=t={annotationType:ee.STAMP,bitmapId:Y,bitmap:q,pageIndex:D-1,rect:m.slice(0),rotation:b,annotationElementId:w,id:w,deleted:!1,accessibilityData:{decorative:!1,altText:oe},isSvg:!1,structParent:E,popupRef:k,richText:x,comment:(C==null?void 0:C.str)||null,creationDate:P,modificationDate:R}}const l=await super.deserialize(t,n,i),{rect:c,bitmap:u,bitmapUrl:h,bitmapId:d,isSvg:f,accessibilityData:p}=t;o?(i.addMissingCanvas(t.id,l),g(l,$l,!0)):d&&i.imageManager.isValidId(d)?(g(l,Rt,d),u&&g(l,We,u)):g(l,kr,h),g(l,ns,f);const[y,_]=l.pageDimensions;return l.width=(c[2]-c[0])/y,l.height=(c[3]-c[1])/_,p&&(l.altTextData=p),l._initialData=r,t.comment&&l.setCommentData(t),g(l,dh,!!r),l}serialize(t=!1,n=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i=Object.assign(super.serialize(t),{bitmapId:a(this,Rt),isSvg:a(this,ns)});if(this.addComment(i),t)return i.bitmapUrl=S(this,me,Am).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;const{decorative:r,altText:o}=this.serializeAltText(!1);if(!r&&o&&(i.accessibilityData={type:"Figure",alt:o}),this.annotationElementId){const c=S(this,me,OC).call(this,i);return c.isSame?null:(c.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1,i.id=this.annotationElementId,delete i.bitmapId,i)}if(n===null)return i;n.stamps||(n.stamps=new Map);const l=a(this,ns)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!n.stamps.has(a(this,Rt)))n.stamps.set(a(this,Rt),{area:l,serialized:i}),i.bitmap=S(this,me,Am).call(this,!1);else if(a(this,ns)){const c=n.stamps.get(a(this,Rt));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=S(this,me,Am).call(this,!1))}return i}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}We=new WeakMap,Rt=new WeakMap,$o=new WeakMap,kr=new WeakMap,Uo=new WeakMap,hh=new WeakMap,Cr=new WeakMap,$l=new WeakMap,Oi=new WeakMap,ns=new WeakMap,dh=new WeakMap,me=new WeakSet,gd=function(t,n=!1){if(!t){this.remove();return}
160g(this,We,t.bitmap),n||(g(this,Rt,t.id),g(this,ns,t.isSvg)),t.file&&g(this,hh,t.file.name),S(this,me,bm).call(this)},md=function(){if(g(this,$o,null),this._uiManager.enableWaiting(!1),!!a(this,Cr)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,We)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,We)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},_m=function(){if(a(this,Rt)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(a(this,Rt)).then(i=>S(this,me,gd).call(this,i,!0)).finally(()=>S(this,me,md).call(this));return}if(a(this,kr)){const i=a(this,kr);g(this,kr,null),this._uiManager.enableWaiting(!0),g(this,$o,this._uiManager.imageManager.getFromUrl(i).then(r=>S(this,me,gd).call(this,r)).finally(()=>S(this,me,md).call(this)));return}if(a(this,Uo)){const i=a(this,Uo);g(this,Uo,null),this._uiManager.enableWaiting(!0),g(this,$o,this._uiManager.imageManager.getFromFile(i).then(r=>S(this,me,gd).call(this,r)).finally(()=>S(this,me,md).call(this)));return}const t=document.createElement("input");t.type="file",t.accept=iw.join(",");const n=this._uiManager._signal;g(this,$o,new Promise(i=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const r=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),S(this,me,gd).call(this,r)}i()},{signal:n}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:n})}).finally(()=>S(this,me,md).call(this))),t.click()},bm=function(){var u;const{div:t}=this;let{width:n,height:i}=a(this,We);const[r,o]=this.pageDimensions,l=.75;if(this.width)n=this.width*r,i=this.height*o;else if(n>l*r||i>l*o){const h=Math.min(l*r/n,l*o/i);n*=h,i*=h}this._uiManager.enableWaiting(!1);const c=g(this,Cr,document.createElement("canvas"));c.setAttribute("role","img"),this.addContainer(c),this.width=n/r,this.height=i/o,this.setDims(),(u=this._initialOptions)!=null&&u.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),S(this,me,__).call(this),a(this,dh)||(this.parent.addUndoableEditor(this),g(this,dh,!0)),this._reportTelemetry({action:"inserted_image"}),a(this,hh)&&this.div.setAttribute("aria-description",a(this,hh)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},Sm=function(t,n){const{width:i,height:r}=a(this,We);let o=i,l=r,c=a(this,We);for(;o>2*t||l>2*n;){const u=o,h=l;o>2*t&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2)),l>2*n&&(l=l>=16384?Math.floor(l/2)-1:Math.ceil(l/2));const d=new OffscreenCanvas(o,l);d.getContext("2d").drawImage(c,0,0,u,h,0,0,o,l),c=d.transferToImageBitmap()}return c},__=function(){const[t,n]=this.parentDimensions,{width:i,height:r}=this,o=new $i,l=Math.ceil(i*t*o.sx),c=Math.ceil(r*n*o.sy),u=a(this,Cr);if(!u||u.width===l&&u.height===c)return;u.width=l,u.height=c;const h=a(this,ns)?a(this,We):S(this,me,Sm).call(this,l,c),d=u.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(h,0,0,h.width,h.height,0,0,l,c)},Am=function(t){if(t){if(a(this,ns)){const r=this._uiManager.imageManager.getSvgUrl(a(this,Rt));if(r)return r}const n=document.createElement("canvas");return{width:n.width,height:n.height}=a(this,We),n.getContext("2d").drawImage(a(this,We),0,0),n.toDataURL()}if(a(this,ns)){const[n,i]=this.pageDimensions,r=Math.round(this.width*n*oa.PDF_TO_CSS_UNITS),o=Math.round(this.height*i*oa.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(r,o);return l.getContext("2d").drawImage(a(this,We),0,0,a(this,We).width,a(this,We).height,0,0,r,o),l.transferToImageBitmap()}return structuredClone(a(this,We))},OC=function(t){var l;const{pageIndex:n,accessibilityData:{altText:i}}=this._initialData,r=t.pageIndex===n,o=(((l=t.accessibilityData)==null?void 0:l.alt)||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&r&&o,isSameAltText:o}},I(w_,"_type","stamp"),I(w_,"_editorType",ee.STAMP);var Ul,fh,zo,Ho,Tr,Rn,Vo,ph,gh,Js,Pr,Lt,Rr,Wo,mh,W,Go,Le,S_,FC,di,A_,E_,Em;const $s=class $s{constructor({uiManager:e,pageIndex:t,div:n,structTreeLayer:i,accessibilityManager:r,annotationLayer:o,drawLayer:l,textLayer:c,viewport:u,l10n:h}){v(this,Le);v(this,Ul);v(this,fh,!1);v(this,zo,null);v(this,Ho,null);v(this,Tr,null);v(this,Rn,new Map);v(this,Vo,!1);v(this,ph,!1);v(this,gh,!1);v(this,Js,null);v(this,Pr,null);v(this,Lt,null);v(this,Rr,null);v(this,Wo,null);v(this,mh,-1);v(this,W);const d=[...a($s,Go).values()];if(!$s._initialized){$s._initialized=!0;for(const f of d)f.initialize(h,e)}
160e.registerEditorTypes(d),g(this,W,e),this.pageIndex=t,this.div=n,g(this,Ul,r),g(this,zo,o),this.viewport=u,g(this,Lt,c),this.drawLayer=l,this._structTree=i,a(this,W).addLayer(this)}get isEmpty(){return a(this,Rn).size===0}get isInvisible(){return this.isEmpty&&a(this,W).getMode()===ee.NONE}updateToolbar(e){a(this,W).updateToolbar(e)}updateMode(e=a(this,W).getMode()){switch(S(this,Le,Em).call(this),e){case ee.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case ee.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case ee.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;if(t.toggle("nonEditing",!1),e===ee.POPUP)t.toggle("commentEditing",!0);else{t.toggle("commentEditing",!1);for(const n of a($s,Go).values())t.toggle(`${n._type}Editing`,e===n._editorType)}this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=a(this,Lt))==null?void 0:t.div)}setEditingState(e){a(this,W).setEditingState(e)}addCommands(e){a(this,W).addCommands(e)}cleanUndoStack(e){a(this,W).cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=a(this,zo))==null||t.togglePointerEvents(e)}async enable(){var n;g(this,gh,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),(n=a(this,Wo))==null||n.abort(),g(this,Wo,null);const e=new Set;for(const i of a(this,Le,S_))i.enableEditing(),i.show(!0),i.annotationElementId&&(a(this,W).removeChangedExistingAnnotation(i),e.add(i.annotationElementId));const t=a(this,zo);if(t)for(const i of t.getEditableAnnotations()){if(i.hide(),a(this,W).isDeletedAnnotationElement(i.data.id)||e.has(i.data.id))continue;const r=await this.deserialize(i);r&&(this.addOrRebuild(r),r.enableEditing())}g(this,gh,!1),a(this,W)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){var i;if(g(this,ph,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),a(this,Lt)&&!a(this,Wo)){g(this,Wo,new AbortController);const r=a(this,W).combinedSignal(a(this,Wo));a(this,Lt).div.addEventListener("pointerdown",o=>{const{clientX:c,clientY:u,timeStamp:h}=o,d=a(this,mh);if(h-d>500){g(this,mh,h);return}g(this,mh,-1);const{classList:f}=this.div;f.toggle("getElements",!0);const p=document.elementsFromPoint(c,u);if(f.toggle("getElements",!1),!this.div.contains(p[0]))return;let y;const _=new RegExp(`^${qd}[0-9]+$`);for(const m of p)if(_.test(m.id)){y=m.id;break}if(!y)return;const A=a(this,Rn).get(y);(A==null?void 0:A.annotationElementId)===null&&(o.stopPropagation(),o.preventDefault(),A.dblclick(o))},{signal:r,capture:!0})}const e=a(this,zo),t=[];if(e){const r=new Map,o=new Map;for(const c of a(this,Le,S_)){if(c.disableEditing(),!c.annotationElementId){t.push(c);continue}if(c.serialize()!==null){r.set(c.annotationElementId,c);continue}else o.set(c.annotationElementId,c);(i=this.getEditableAnnotation(c.annotationElementId))==null||i.show(),c.remove()}const l=e.getEditableAnnotations();for(const c of l){const{id:u}=c.data;if(a(this,W).isDeletedAnnotationElement(u)){c.updateEdited({deleted:!0});continue}let h=o.get(u);if(h){h.resetAnnotationElement(c),h.show(!1),c.show();continue}h=r.get(u),h&&(a(this,W).addChangedExistingAnnotation(h),h.renderAnnotationElement(c)&&h.show(!1)),c.show()}}S(this,Le,Em).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const r of a($s,Go).values())n.remove(`${r._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),e==null||e.updateFakeAnnotations(t),g(this,ph,!1)}getEditableAnnotation(e){var t;return((t=a(this,zo))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){a(this,W).getActive()!==e&&a(this,W).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=a(this,Lt))!=null&&e.div&&!a(this,Rr)){g(this,Rr,new AbortController);const t=a(this,W).combinedSignal(a(this,Rr));a(this,Lt).div.addEventListener("pointerdown",S(this,Le,FC).bind(this),{signal:t}),a(this,Lt).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=a(this,Lt))!=null&&e.div&&a(this,Rr)&&(a(this,Rr).abort(),g(this,Rr,null),a(this,Lt).div.classList.remove("highlighting"))}enableClick(){if(a(this,Ho))return;g(this,Ho,new AbortController);const e=a(this,W).combinedSignal(a(this,Ho));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(){var e;(e=a(this,Ho))==null||e.abort(),g(this,Ho,null)}attach(e){a(this,Rn).set(e.id,e);const{annotationElementId:t}=e;t&&a(this,W).isDeletedAnnotationElement(t)&&a(this,W).removeDeletedAnnotationElement(e)}detach(e){var t;a(this,Rn).delete(e.id),(t=a(this,Ul))==null||t.removePointerInTextLayer(e.contentDiv),!a(this,ph)&&e.annotationElementId&&a(this,W).addDeletedAnnotationElement(e)}remove(e){this.detach(e),a(this,W).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(a(this,W).addDeletedAnnotationElement(e.annotationElementId),je.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}
160add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),a(this,W).addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!a(this,gh)),a(this,W).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var n;if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!a(this,Tr)&&(e._focusEventsAllowed=!1,g(this,Tr,setTimeout(()=>{g(this,Tr,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:a(this,W)._signal}),t.focus())},0))),e._structTreeParentId=(n=a(this,Ul))==null?void 0:n.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(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})}getEditorByUID(e){for(const t of a(this,Rn).values())if(t.uid===e)return t;return null}getNextId(){return a(this,W).getId()}combinedSignal(e){return a(this,W).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=a(this,Le,di))==null?void 0:e.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await a(this,W).updateMode(e.mode);const{offsetX:n,offsetY:i}=S(this,Le,E_).call(this),r=this.getNextId(),o=S(this,Le,A_).call(this,{parent:this,id:r,x:n,y:i,uiManager:a(this,W),isCentered:!0,...t});o&&this.add(o)}async deserialize(e){var t;return await((t=a($s,Go).get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,a(this,W)))||null}createAndAddNewEditor(e,t,n={}){const i=this.getNextId(),r=S(this,Le,A_).call(this,{parent:this,id:i,x:e.offsetX,y:e.offsetY,uiManager:a(this,W),isCentered:t,...n});return r&&this.add(r),r}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(e={}){this.createAndAddNewEditor(S(this,Le,E_).call(this),!0,e)}setSelected(e){a(this,W).setSelected(e)}toggleSelected(e){a(this,W).toggleSelected(e)}unselect(e){a(this,W).unselect(e)}pointerup(e){var i;const{isMac:t}=Gt.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!a(this,Vo)||(g(this,Vo,!1),(i=a(this,Le,di))!=null&&i.isDrawer&&a(this,Le,di).supportMultipleDrawings))return;if(!a(this,fh)){g(this,fh,!0);return}const n=a(this,W).getMode();if(n===ee.STAMP||n===ee.SIGNATURE){a(this,W).unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){var i;if(a(this,W).getMode()===ee.HIGHLIGHT&&this.enableTextSelection(),a(this,Vo)){g(this,Vo,!1);return}const{isMac:t}=Gt.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(g(this,Vo,!0),(i=a(this,Le,di))!=null&&i.isDrawer){this.startDrawingSession(e);return}const n=a(this,W).getActive();g(this,fh,!n||n.isEmpty())}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),a(this,Js)){a(this,Le,di).startDrawing(this,a(this,W),!1,e);return}a(this,W).setCurrentDrawingSession(this),g(this,Js,new AbortController);const t=a(this,W).combinedSignal(a(this,Js));this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(g(this,Pr,null),this.commitOrRemove())},{signal:t}),a(this,Le,di).startDrawing(this,a(this,W),!1,e)}pause(e){if(e){const{activeElement:t}=document;this.div.contains(t)&&g(this,Pr,t);return}a(this,Pr)&&setTimeout(()=>{var t;(t=a(this,Pr))==null||t.focus(),g(this,Pr,null)},0)}endDrawingSession(e=!1){return a(this,Js)?(a(this,W).setCurrentDrawingSession(null),a(this,Js).abort(),g(this,Js,null),g(this,Pr,null),a(this,Le,di).endDrawing(e)):null}findNewParent(e,t,n){const i=a(this,W).findParent(t,n);return i===null||i===this?!1:(i.changeParent(e),!0)}commitOrRemove(){return a(this,Js)?(this.endDrawingSession(),!0):!1}onScaleChanging(){a(this,Js)&&a(this,Le,di).onScaleChangingWhenDrawing(this)}destroy(){var e,t;this.commitOrRemove(),((e=a(this,W).getActive())==null?void 0:e.parent)===this&&(a(this,W).commitOrRemove(),a(this,W).setActiveEditor(null)),a(this,Tr)&&(clearTimeout(a(this,Tr)),g(this,Tr,null));for(const n of a(this,Rn).values())(t=a(this,Ul))==null||t.removePointerInTextLayer(n.contentDiv),n.setParent(null),n.isAttachedToDOM=!1,n.div.remove();this.div=null,a(this,Rn).clear(),a(this,W).removeLayer(this)}render({viewport:e}){this.viewport=e,Yl(this.div,e);for(const t of a(this,W).getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){a(this,W).commitOrRemove(),S(this,Le,Em).call(this);const t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,Yl(this.div,{rotation:n}),t!==n)for(const i of a(this,Rn).values())i.rotate(n)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return a(this,W).viewParameters.realScale}};Ul=new WeakMap,fh=new WeakMap,zo=new WeakMap,Ho=new WeakMap,Tr=new WeakMap,Rn=new WeakMap,Vo=new WeakMap,ph=new WeakMap,gh=new WeakMap,Js=new WeakMap,Pr=new WeakMap,Lt=new WeakMap,Rr=new WeakMap,Wo=new WeakMap,mh=new WeakMap,W=new WeakMap,Go=new WeakMap,Le=new WeakSet,S_=function(){return a(this,Rn).size!==0?a(this,Rn).values():a(this,W).getEditors(this.pageIndex)},FC=function(e){a(this,W).unselectAll();const{target:t}=e;if(t===a(this,Lt).div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent"))&&a(this,Lt).div.contains(t)){const{isMac:n}=Gt.platform;if(e.button!==0||e.ctrlKey&&n)return;a(this,W).showAllEditors("highlight",!0,!0),a(this,Lt).div.classList.add("free"),this.toggleDrawing(),uy.startHighlighting(this,a(this,W).direction==="ltr",{target:a(this,Lt).div,x:e.x,y:e.y}),a(this,Lt).div.addEventListener("pointerup",()=>{a(this,Lt).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:a(this,W)._signal}),e.preventDefault()}},di=function(){return a($s,Go).get(a(this,W).getMode())},A_=function(e){const t=a(this,Le,di);return t?new t.prototype.constructor(e):null},E_=function(){const{x:e,y:t,width:n,height:i}
160=this.boundingClientRect,r=Math.max(0,e),o=Math.max(0,t),l=Math.min(window.innerWidth,e+n),c=Math.min(window.innerHeight,t+i),u=(r+l)/2-e,h=(o+c)/2-t,[d,f]=this.viewport.rotation%180===0?[u,h]:[h,u];return{offsetX:d,offsetY:f}},Em=function(){for(const e of a(this,Rn).values())e.isEmpty()&&e.remove()},I($s,"_initialized",!1),v($s,Go,new Map([n_,d_,w_,uy,v_].map(e=>[e._editorType,e])));let b_=$s;var Zs,dn,zl,Up,Ry,jC,Ui,k_,BC,C_;const vt=class vt{constructor({pageIndex:e}){v(this,Ui);v(this,Zs,null);v(this,dn,new Map);v(this,zl,new Map);this.pageIndex=e}setParent(e){if(!a(this,Zs)){g(this,Zs,e);return}if(a(this,Zs)!==e){if(a(this,dn).size>0)for(const t of a(this,dn).values())t.remove(),e.append(t);g(this,Zs,e)}}static get _svgFactory(){return se(this,"_svgFactory",new ly)}draw(e,t=!1,n=!1){const i=gt(vt,Up)._++,r=S(this,Ui,k_).call(this),o=vt._svgFactory.createElement("defs");r.append(o);const l=vt._svgFactory.createElement("path");o.append(l);const c=`path_p${this.pageIndex}_${i}`;l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),t&&a(this,zl).set(i,l);const u=n?S(this,Ui,BC).call(this,o,c):null,h=vt._svgFactory.createElement("use");return r.append(h),h.setAttribute("href",`#${c}`),this.updateProperties(r,e),a(this,dn).set(i,r),{id:i,clipPathId:`url(#${u})`}}drawOutline(e,t){const n=gt(vt,Up)._++,i=S(this,Ui,k_).call(this),r=vt._svgFactory.createElement("defs");i.append(r);const o=vt._svgFactory.createElement("path");r.append(o);const l=`path_p${this.pageIndex}_${n}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke");let c;if(t){const d=vt._svgFactory.createElement("mask");r.append(d),c=`mask_p${this.pageIndex}_${n}`,d.setAttribute("id",c),d.setAttribute("maskUnits","objectBoundingBox");const f=vt._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const p=vt._svgFactory.createElement("use");d.append(p),p.setAttribute("href",`#${l}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}const u=vt._svgFactory.createElement("use");i.append(u),u.setAttribute("href",`#${l}`),c&&u.setAttribute("mask",`url(#${c})`);const h=u.cloneNode();return i.append(h),u.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.updateProperties(i,e),a(this,dn).set(n,i),n}finalizeDraw(e,t){a(this,zl).delete(e),this.updateProperties(e,t)}updateProperties(e,t){var c;if(!t)return;const{root:n,bbox:i,rootClass:r,path:o}=t,l=typeof e=="number"?a(this,dn).get(e):e;if(l){if(n&&S(this,Ui,C_).call(this,l,n),i&&S(c=vt,Ry,jC).call(c,l,i),r){const{classList:u}=l;for(const[h,d]of Object.entries(r))u.toggle(h,d)}if(o){const h=l.firstChild.firstChild;S(this,Ui,C_).call(this,h,o)}}}updateParent(e,t){if(t===this)return;const n=a(this,dn).get(e);n&&(a(t,Zs).append(n),a(this,dn).delete(e),a(t,dn).set(e,n))}remove(e){a(this,zl).delete(e),a(this,Zs)!==null&&(a(this,dn).get(e).remove(),a(this,dn).delete(e))}destroy(){g(this,Zs,null);for(const e of a(this,dn).values())e.remove();a(this,dn).clear(),a(this,zl).clear()}};Zs=new WeakMap,dn=new WeakMap,zl=new WeakMap,Up=new WeakMap,Ry=new WeakSet,jC=function(e,[t,n,i,r]){const{style:o}=e;o.top=`${100*n}%`,o.left=`${100*t}%`,o.width=`${100*i}%`,o.height=`${100*r}%`},Ui=new WeakSet,k_=function(){const e=vt._svgFactory.create(1,1,!0);return a(this,Zs).append(e),e.setAttribute("aria-hidden",!0),e},BC=function(e,t){const n=vt._svgFactory.createElement("clipPath");e.append(n);const i=`clip_${t}`;n.setAttribute("id",i),n.setAttribute("clipPathUnits","objectBoundingBox");const r=vt._svgFactory.createElement("use");return n.append(r),r.setAttribute("href",`#${t}`),r.classList.add("clip"),i},C_=function(e,t){for(const[n,i]of Object.entries(t))i===null?e.removeAttribute(n):e.setAttribute(n,i)},v(vt,Ry),v(vt,Up,0);let x_=vt;globalThis._pdfjsTestingUtils={HighlightOutliner:i_};globalThis.pdfjsLib={AbortException:ra,AnnotationEditorLayer:b_,AnnotationEditorParamsType:he,AnnotationEditorType:ee,AnnotationEditorUIManager:Ql,AnnotationLayer:e_,AnnotationMode:eo,AnnotationType:ut,applyOpacity:gI,build:SD,ColorPicker:oy,createValidAbsoluteUrl:Rx,CSSConstants:pI,DOMSVGFactory:ly,DrawLayer:x_,FeatureTest:Gt,fetchData:Qp,findContrastColor:mI,getDocument:Db,getFilenameFromUrl:lI,getPdfFilenameFromUrl:cI,getRGB:Zp,getUuid:Dx,getXfaPageViewport:hI,GlobalWorkerOptions:si,ImageKind:Wg,InvalidPDFException:nw,isDataScheme:t0,isPdfFile:Pb,isValidExplicitDest:kI,MathClamp:pn,noContextMenu:Os,normalizeUnicode:rI,OPS:Xd,OutputScale:$i,PasswordResponses:YL,PDFDataRangeTransport:jk,PDFDateString:ey,PDFWorker:Qd,PermissionFlag:KL,PixelsPerInch:oa,RenderingCancelledException:Tb,renderRichText:Ox,ResponseException:Zm,setLayerDimensions:Yl,shadow:se,SignatureExtractor:Lr,stopEvent:rt,SupportedImageMimeTypes:iw,TextLayer:Yd,TouchManager:ny,updateUrlHash:Lx,Util:U,VerbosityLevel:Jy,version:bD,XfaLayer:Nx};si.workerSrc=new URL("/assets/pdf.worker.min-Cpi8b8z3.mjs",import.meta.url).toString();function GD({url:s,alt:e,className:t="",width:n,height:i,onContextMenu:r,draggable:o=!1}){const l=G.useRef(null),[c,u]=G.useState(!0),[h,d]=G.useState(!1);G.useEffect(()=>{s.toLowerCase().endsWith(".pdf")?f():(d(!1),u(!1))},[s]);const f=async()=>
160{if(l.current)try{u(!0);const _=await(await Db({url:s,withCredentials:!1}).promise).getPage(1),A=l.current,m=A.getContext("2d");if(!m)return;const b=_.getViewport({scale:2});A.width=b.width,A.height=b.height,await _.render({canvasContext:m,viewport:b}).promise,u(!1)}catch(p){console.error("Error rendering PDF:",p),d(!0),u(!1)}};return s.toLowerCase().endsWith(".pdf")?T.jsxs("div",{className:t,style:{width:n,height:i},children:[c&&T.jsx("div",{className:"flex items-center justify-center w-full h-full bg-slate-100",children:T.jsx("div",{className:"text-slate-500",children:"Loading PDF..."})}),h&&T.jsx("div",{className:"flex items-center justify-center w-full h-full bg-slate-100",children:T.jsx("div",{className:"text-red-500",children:"Error loading PDF"})}),T.jsx("canvas",{ref:l,className:`w-full h-full ${c?"hidden":""}`,onContextMenu:r})]}):T.jsx("img",{src:s,alt:e,className:t,draggable:o,onContextMenu:r})}si.workerSrc=new URL("/assets/pdf.worker.min-Cpi8b8z3.mjs",import.meta.url).toString();function qD(){const[s,e]=G.useState([]),[t,n]=G.useState(!0),[i,r]=G.useState(!1),[o,l]=G.useState("");G.useEffect(()=>{c()},[]);const c=async()=>{const{data:f}=await Oe.from("pages").select("*").order("page_number",{ascending:!0});f&&e(f),n(!1)},u=async f=>{var y,_,A;const p=(y=f.target.files)==null?void 0:y[0];if(p){if(p.type!=="application/pdf"){alert("Please upload a PDF file");return}r(!0),l("Loading PDF...");try{const m=await p.arrayBuffer(),w=await Db({data:m}).promise,E=w.numPages;let x=((A=(_=(await Oe.from("pages").select("page_number").order("page_number",{ascending:!1}).limit(1)).data)==null?void 0:_[0])==null?void 0:A.page_number)??0;for(let C=1;C<=E;C++){l(`Processing page ${C} of ${E}...`);const P=await w.getPage(C),R=P.getViewport({scale:2}),L=document.createElement("canvas"),D=L.getContext("2d");if(!D)continue;L.width=R.width,L.height=R.height,await P.render({canvasContext:D,viewport:R}).promise;const F=await new Promise(H=>{L.toBlob(M=>{H(M)},"image/png",.95)});x+=1;const Y=`pages/${Date.now()}-${x}.png`,{error:q}=await Oe.storage.from("graphic-novel-pages").upload(Y,F);if(q){console.error("Upload error:",q),alert(`Failed to upload page ${x}: ${q.message}`);continue}const{data:{publicUrl:oe}}=Oe.storage.from("graphic-novel-pages").getPublicUrl(Y),{error:z}=await Oe.from("pages").insert({page_number:x,image_url:oe,page_type:"single"});z&&(console.error("Insert error:",z),alert(`Failed to save page ${x}: ${z.message}`))}l("Upload complete!"),setTimeout(()=>l(""),2e3)}catch(m){console.error("PDF processing error:",m);const b=m instanceof Error?m.message:"Unknown error";alert(`Error processing PDF: ${b}`)}r(!1),c(),f.target.value=""}},h=async(f,p)=>{await Oe.from("pages").update({page_type:p}).eq("id",f),c()},d=async f=>{if(!confirm("Delete this page?"))return;const p=f.image_url.split("/"),y=p.slice(p.indexOf("graphic-novel-pages")+1).join("/");await Oe.storage.from("graphic-novel-pages").remove([y]),await Oe.from("pages").delete().eq("id",f.id),c()};return t?T.jsx("div",{className:"flex justify-center py-8",children:T.jsx(Jm,{className:"w-6 h-6 animate-spin text-slate-400"})}):T.jsxs("div",{className:"space-y-6",children:[T.jsxs("div",{className:"space-y-4",children:[T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("h3",{className:"text-xl font-semibold text-slate-900",children:["Pages (",s.length,")"]}),T.jsxs("label",{className:"flex items-center gap-2 px-4 py-2 bg-slate-700 text-white rounded-lg hover:bg-slate-600 transition-colors cursor-pointer",children:[i?T.jsxs(T.Fragment,{children:[T.jsx(Jm,{className:"w-4 h-4 animate-spin"}),o||"Uploading..."]}):T.jsxs(T.Fragment,{children:[T.jsx(BL,{className:"w-4 h-4"}),"Upload PDF"]}),T.jsx("input",{type:"file",onChange:u,accept:"application/pdf",className:"hidden",disabled:i})]})]}),o&&T.jsx("div",{className:"text-sm text-slate-600 text-center",children:o})]}),s.length===0?T.jsx("div",{className:"text-center py-12 text-slate-500",children:"No pages yet. Upload a PDF to get started."}):T.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 ga
160p-4",children:s.map(f=>T.jsxs("div",{className:"relative group",children:[T.jsx("div",{className:"aspect-[3/4] bg-slate-200 rounded-lg overflow-hidden",children:T.jsx(GD,{url:f.image_url,alt:`Page ${f.page_number}`,className:"w-full h-full object-cover"})}),T.jsxs("div",{className:"mt-2 space-y-1",children:[T.jsxs("div",{className:"text-xs font-medium text-slate-700",children:["Page ",f.page_number]}),T.jsxs("select",{value:f.page_type,onChange:p=>h(f.id,p.target.value),className:"w-full text-xs px-2 py-1 border border-slate-300 rounded",children:[T.jsx("option",{value:"single",children:"Single Page"}),T.jsx("option",{value:"left",children:"Left Spread"}),T.jsx("option",{value:"right",children:"Right Spread"})]})]}),T.jsx("button",{onClick:()=>d(f),className:"absolute top-2 right-2 p-1.5 bg-red-500 text-white rounded-lg opacity-0 group-hover:opacity-100 transition-opacity",children:T.jsx(HL,{className:"w-3 h-3"})})]},f.id))})]})}function XD(){const{signOut:s}=Cb(),[e,t]=G.useState("pages");return T.jsxs("div",{className:"min-h-screen bg-slate-50",children:[T.jsx("header",{className:"bg-white border-b border-slate-200 sticky top-0 z-10",children:T.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:T.jsxs("div",{className:"flex justify-between items-center h-16",children:[T.jsxs("div",{className:"flex items-center gap-3",children:[T.jsx(Qm,{className:"w-8 h-8 text-slate-800"}),T.jsx("h1",{className:"text-xl font-bold text-slate-900",children:"Admin Dashboard"})]}),T.jsxs("button",{onClick:()=>s(),className:"flex items-center gap-2 px-4 py-2 text-slate-600 hover:text-slate-900 hover:bg-slate-100 rounded-lg transition-colors",children:[T.jsx($L,{className:"w-4 h-4"}),T.jsx("span",{children:"Sign Out"})]})]})})}),T.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:T.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-slate-200 overflow-hidden",children:[T.jsx("div",{className:"border-b border-slate-200",children:T.jsxs("nav",{className:"flex",children:[T.jsxs("button",{onClick:()=>t("pages"),className:`flex items-center gap-2 px-6 py-4 font-medium transition-colors ${e==="pages"?"text-slate-900 border-b-2 border-slate-900":"text-slate-600 hover:text-slate-900"}`,children:[T.jsx(Qm,{className:"w-4 h-4"}),"Pages"]}),T.jsxs("button",{onClick:()=>t("metadata"),className:`flex items-center gap-2 px-6 py-4 font-medium transition-colors ${e==="metadata"?"text-slate-900 border-b-2 border-slate-900":"text-slate-600 hover:text-slate-900"}`,children:[T.jsx(zL,{className:"w-4 h-4"}),"Novel Settings"]})]})}),T.jsxs("div",{className:"p-6",children:[e==="pages"&&T.jsx(qD,{}),e==="metadata"&&T.jsx(XL,{})]})]})})]})}function KD({currentPage:s,nextPage:e,isFlipping:t,direction:n,zoom:i,onNextPage:r,onPrevPage:o}){const[l,c]=G.useState("");G.useEffect(()=>{c("")},[t,n]);const u=d=>{if(t)return;const f=d.clientX,p=window.innerWidth;f<p/3?o():r()};if(!s)return T.jsx("div",{className:"flex items-center justify-center h-full",children:T.jsx("div",{className:"text-white text-xl",children:"No pages available"})});const h=!!e;return T.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",children:[T.jsx("style",{children:`
161          @keyframes fade-in {
162            0% {
163              opacity: 0;
164            }
165            100% {
166              opacity: 1;
167            }
168          }
169
170          .flip-forward,
171          .flip-backward {
172            animation: fade-in 0.3s ease-in-out;
173          }
174
175          .page-shadow {
176            box-shadow:
177              0 10px 40px rgba(0, 0, 0, 0.4),
178              0 2px 8px rgba(0, 0, 0, 0.3),
179              inset -2px 0 4px rgba(0, 0, 0, 0.1);
180          }
181
182          .page-edge {
183            box-shadow: inset -3px 0 10px rgba(0, 0, 0, 0.2);
184          }
185
186          .no-select {
187            user-select: none;
188            -webkit-user-select: none;
189            -moz-user-select: none;
190            -ms-user-select: none;
191          }
192        `}),T.jsx("div",{className:`relative no-select ${l} w-full h-full flex items-center justify-center px-2 sm:px-4`,style:{transform:`scale(${i})`,transition:"transform 0.3s ease"},onClick:u,children:h?T.jsxs("div",{className:"flex gap-1 max-w-full max-h-full",children:[T.jsx("div",{className:"relative page-shadow page-edge flex-1 max-h-[95vh]",children:T.jsx("img",{src:s.image_url,alt:"Left page",className:"w-full h-full object-contain bg-white",draggable:!1,onContextMenu:d=>d.preventDefault()})}),T.jsx("div",{className:"relative page-shadow page-edge flex-1 max-h-[95vh]",children:T.jsx("img",{src:e.image_url,alt:"Right page",className:"w-full h-full object-contain bg-white",draggable:!1,onContextMenu:d=>d.preventDefault()})})]}):T.jsx("div",{className:"relative page-shadow w-full max-w-full h-full max-h-[95vh]",children:T.jsx("img",{src:s.image_url,alt:"Current page",className:"w-full h-full object-contain bg-white",draggable:!1,onContextMenu:d=>d.preventDefault()})})})]})}function YD(){let s=localStorage.getItem("reader_session_id");return s||(s=`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,localStorage.setItem("reader_session_id",s)),s}async function QD(s){const e=YD(),{data:t}=await Oe.from("reading_sessions").select("id").eq("session_id",e).maybeSingle();t?await Oe.from("reading_sessions").update({last_page_id:s,updated_at:new Date().toISOString()}).eq("id",t.id):await Oe.from("reading_sessions").insert({session_id:e,last_page_id:s})}function JD({onClose:s,startPage:e=0}){const[t,n]=G.useState([]),[i,r]=G.useState(e),[o,l]=G.useState(!1),[c,u]=G.useState("forward"),[h,d]=G.useState(!0),[f,p]=G.useState(1),[y,_]=G.useState(!0);G.useEffect(()=>{A()},[]),G.useEffect(()=>{const R=setTimeout(()=>{d(!1)},3e3);return()=>clearTimeout(R)},[h]),G.useEffect(()=>{const R=L=>{L.key==="ArrowRight"||L.key===" "?(L.preventDefault(),m()):L.key==="ArrowLeft"?(L.preventDefault(),b()):L.key==="Escape"&&s()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[i,t]);const A=async()=>{const{data:R}=await Oe.from("pages").select("*").order("page_number",{ascending:!0});R&&n(R),_(!1)},m=G.useCallback(()=>{i>=t.length-1||r(R=>R+1)},[i,t.length]),b=G.useCallback(()=>{i<=0||r(R=>R-1)},[i]);G.useEffect(()=>{if(t.length>0&&t[i]){const R=t[i];QD(R.id)}},[i,t]);const w=()=>{d(!0)},E=()=>{p(R=>Math.min(R+.25,2))},k=()=>{p(R=>Math.max(R-.25,.5))};if(y)return T.jsx("div",{className:"fixed inset-0 bg-slate-900 flex items-center justify-center",children:T.jsx("div",{className:"text-white text-xl",children:"Loading..."})});const x=t[i],C=i<t.length-1?t[i+1]:null,P=(x==null?void 0:x.page_type)==="left"&&(C==null?void 0:C.page_type)==="right";return T.jsxs("div",{className:"fixed inset-0 bg-slate-900 overflow-hidden",onMouseMove:w,children:[h&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"absolute top-0 left-0 right-0 bg-gradient-to-b from-black/50 to-transparent p-4 z-10 transition-opacity",children:T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{className:"text-white text-sm",children:["Page ",i+1," of ",t.length]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{onClick:k,className:"p-2 text-white hover:bg-white/10 rounded-lg transition-colors",disabled:f<=.5,children:T.jsx(GL,{className:"w-5 h-5"})}),T.jsx("button",{onClick:E,className:"p-2 text-white hover:bg-white/10 rounded-lg transition-colors",disabled:f>=2,children:T.jsx(WL,{className:"w-5 h-5"})}),T.jsx("button",{onClick:s,className:"p-2 text-white hover:bg-white/10 rounded-lg transition-colors",children:T.jsx(Px,{className:"w-6 h-6"})})]})]})}),T.jsx("button",{onClick:b,disabled:i===0,className:"absolute left-4 top-1/2 -translate-y-1/2 p-3 bg-black/30 text-white rounded-full hover:bg-black/50 transition-all disabled:opacity-30 z-10",children:T.jsx(FL,{className:"w-6 h-6"})}),T.jsx("button",{onClick:m,disabled:i>=t.length-1,className:"absolute right-4 top-1/2 -translate-y-1/2 p-3 bg-black/30 text-white rounded-full hover:bg-black/50 transition-all disabled:opacity-30 z-10",children:T.jsx(jL,{className:"w-6 h-6"})})]}),T.jsx(KD,{currentPage:x,nextPage:P?C:null,isFlipping:o,direction:c,zoom:f,onNextPage:m,onPrevPage:b})]})}function ZD(){const[s,e]=G.useState(null),[t,n]=G.useState(!0),[i,r]=G.useState(!1),[o,l]=G.useState(0),[c,u]=G.useState(!1);G.useEffect(()=>{h(),d()},[]);const h=async()=>{const{data:_}=await Oe.from("novel_metadata").select("*").maybeSingle();_&&e(_),n(!1)},d=async()=>{const _=f(),{data:A}=await Oe.from("reading_sessions").select("*, pages(*)").eq("session_id",_).maybeSingle();if(A!=null&&A.pages){const{data:m}=await Oe.from("pages").select("id, global_page_number").order("global_page_number",{ascending:!0});if(m){const b=m.findIndex(w=>w.id===A.last_page_id);b!==-1&&(l(b),u(!0))}}},f=()=>{let _=localStorage.getItem("reader_session_id");return _||(_=`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,localStorage.setItem("reader_session_id",_)),_},p=()=>{r(!0)},y=()=>{r(!0)};return t?T.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center",children:T.jsx("div",{className:"text-white text-xl",children:"Loading..."})}):i?T.jsx(JD,{onClose:()=>r(!1),startPage:c?o:0}):T.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900",children:T.jsx("div",{className:"container mx-auto px-4 py-12 sm:py-20",children:T.jsx("div",{className:"max-w-6xl mx-auto",children:T.jsxs("div",{className:"grid md:grid-cols-2 gap-12 items-start",children:[T.jsxs("div",{className:"order-2 md:order-1",children:[T.jsx("h1",{className:"text-5xl sm:text-6xl font-bold text-white mb-6 leading-tight",children:(s==null?void 0:s.title)||"Untitled Novel"}),(s==null?void 0:s.author)&&T.jsxs("div",{className:"text-xl text-slate-300 mb-6",children:["by ",s.author]}),(s==null?void 0:s.description)&&T.jsx("p",{className:"text-lg text-slate-300 mb-10 leading-relaxed",children:s.description}),T.jsx("div",{className:"flex flex-col sm:flex-row gap-4 mb-12",children:c?T.jsxs(T.Fragment,{children:[T.jsxs("button",{onClick:y,className:"flex items-center justify-center gap-3 px-8 py-4 bg-amber-500 text-slate-900 rounded-xl font-bold text-lg hover:bg-amber-400 transform hover:scale-105 transition-all shadow-xl hover:shadow-2xl",children:[T.jsx(OL,{className:"w-5 h-5"}),"Continue Reading"]}),T.jsxs("button",{onClick:p,className:"flex items-center justify-center gap-3 px-8 py-4 bg-slate-700 text-white rounded-xl font-bold text-lg hover:bg-slate-600 transform hover:scale-105 transition-all",children:[T.jsx(v1,{className:"w-5 h-5"}),"Start Over"]})]}):T.jsxs("button",{onClick:p,className:"flex items-center justify-center gap-3 px-8 py-4 bg-amber-500 text-slate-900 rounded-xl font-bold text-lg hover:bg-amber-400 transform hover:scale-105 transition-all shadow-xl hover:shadow-2xl",children:[T.jsx(v1,{className:"w-5 h-5"}),"Start Reading"]})}),T.jsxs("div",{className:"prose prose-invert prose-lg max-w-none",children:[T.jsxs("p",{className:"text-slate-300 leading-relaxed mb-4",children:["Hi, I'm ",T.jsx("a",{href:"https://www.linkedin.com/in/joefloyd/",target:"_blank",rel:"noopener noreferrer",className:"text-slate-300 hover:text-slate-100 transition-colors underline",children:"Joe Floyd"})," and I work with superheroes every day. Not the masks and spandex type—real life superheroes who risk everything to use their passion to change the world: Entrepreneurs."]}),T.jsxs("p",{className:"text-slate-300 leading-relaxed mb-4",children:["Through my experience as a General Partner at ",T.jsx("a",{href:"https://www.emcap.com",target:"_blank",rel:"noopener noreferrer",className:"text-slate-300 hover:text-slate-100 transition-colors underline",children:"Emergence Capital"}),", I've had the opportunity to work with some of the world's most incredible entrepreneurs and investors. People involved in amazing companies like Google, Meta, OpenAI and Zoom! Now, I have turned those insights into Silicon Heroes."]}),T.jsx("p",{className:"text-slate-300 leading-relaxed mb-4",children:"Silicon Heroes is a 96 page, full color graphic novel. The story follows five young tech workers who embark on a quest to discover their inner entrepreneurial superpowers. The goal is to inspire the next generation of entrepreneurs of all kinds with the characteristics and skills that power startup success."})]})]}),T.jsx("div",{className:"order-1 md:order-2",children:s!=null&&s.cover_url?T.jsxs("div",{className:"relative cursor-pointer",onClick:c?y:p,children:[T.jsx("div",{className:"absolute inset-0 bg-amber-500 rounded-2xl blur-3xl op
192acity-20"}),T.jsx("img",{src:s.cover_url,alt:s.title,className:"relative w-full max-w-md mx-auto rounded-2xl shadow-2xl transform hover:scale-105 transition-transform duration-300"})]}):T.jsx("div",{className:"relative bg-slate-700 rounded-2xl aspect-[3/4] max-w-md mx-auto flex items-center justify-center cursor-pointer hover:bg-slate-600 transition-colors",onClick:c?y:p,children:T.jsx(Qm,{className:"w-24 h-24 text-slate-500"})})})]})})})})}function eM(){const{user:s,isAdmin:e,loading:t}=Cb(),[n,i]=G.useState(!1);return G.useEffect(()=>{window.location.pathname==="/admin"&&i(!0)},[]),t?T.jsx("div",{className:"min-h-screen bg-slate-900 flex items-center justify-center",children:T.jsx("div",{className:"text-white text-xl",children:"Loading..."})}):n?s?e?T.jsx(XD,{}):T.jsx("div",{className:"min-h-screen bg-slate-900 flex items-center justify-center",children:T.jsx("div",{className:"text-white text-xl",children:"Access Denied"})}):T.jsx(qL,{}):T.jsx(ZD,{})}function tM(){return T.jsx(DL,{children:T.jsx(eM,{})})}ix(document.getElementById("root")).render(T.jsx(G.StrictMode,{children:T.jsx(tM,{})}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.